:root {
    /* BüroPro Theme - Modern Dark/Glass Overhaul */

    /* Brand Colors */
    --primary: #1a365d;
    /* Deep Navy Blue */
    --primary-light: #3b82f6;
    /* Brighter Blue for Dark Mode accents */
    --secondary: #65a30d;
    /* Vibrant Green (BüroPro Green) */

    /* Layout Colors */
    --bg-body: #f7f7f7;
    /* Soft Grey/Beige (Reference Image) */
    --bg-sidebar: #1c1c1c;
    /* Deep Dark / Black (Reference Image) */
    --bg-card: #eeeeee;
    /* White Cards */

    /* Text Colors */
    --text-main: #1f2937;
    /* Dark Grey */
    --text-muted: #6b7280;
    /* Medium Grey */
    --text-sidebar: #9ca3af;
    /* Light Grey for Sidebar */
    --text-sidebar-active: #ffffff;

    /* UI Properties */
    --radius-card: 24px;
    /* Large "Bento" Radius */
    --radius-sm: 12px;
    /* Smaller elements */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* Soft diffused shadow */
    --border-light: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    height: 100vh;
    overflow: hidden;
    /* Prevent body scroll, use content-area */
}

/* App Layout */
.app-container {
    display: flex;
    height: 100%;
}

/* --- Dark Sidebar --- */
.sidebar {
    width: 280px;
    /* Slightly wider */
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.logo {
    display: flex;
    justify-content: center;
    /* Center logo image */
    margin-bottom: 3rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    margin-bottom: 0.5rem;
    border-radius: 99px;
    /* Pill shape */
    color: var(--text-sidebar);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
    border: none;
    /* Reset border */
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    /* Subtle hover */
    color: var(--text-sidebar-active);
}

.nav-link.active {
    background-color: var(--secondary);
    /* Green Active State */
    color: white;
    box-shadow: 0 4px 12px rgba(101, 163, 13, 0.4);
    /* Green Glow */
    font-weight: 600;
}

/* --- Main Content Area --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-body);
    /* Ensure bg color covers area */
    border-top-left-radius: 30px;
    /* Round the corner meeting sidebar */
    border-bottom-left-radius: 30px;
    margin: 10px 10px 10px 0;
    /* Gap from sidebar */
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
}

/* --- Gradients & Glass Effects --- */
body {
    background: linear-gradient(135deg, #eef0f2 0%, #e2e5ea 100%);
    /* Depth for main bg */
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    margin: 0;
    height: 100vh;
    overflow: hidden;
    /* Prevent body scroll, use content-area */
}

.sidebar {
    width: 280px;
    /* Slightly wider */
    background: linear-gradient(180deg, #0f1115 0%, #1a1d26 100%);
    /* Stronger dark gradient */
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.nav-link:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.08) 100%);
    color: var(--text-sidebar-active);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(101, 163, 13, 0.2) 0%, rgba(101, 163, 13, 0.05) 100%);
    color: #84cc16;
    border: 1px solid rgba(101, 163, 13, 0.2);
    box-shadow: 0 0 15px rgba(101, 163, 13, 0.15);
    font-weight: 600;
}

.top-bar {
    background-color: transparent;
    /* Transparent Header */
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    /* Remove harsh line */
}

.top-bar h1 {
    font-size: 1.75rem;
    /* Larger Title */
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.content-area {
    padding: 0 2.5rem 2.5rem;
    overflow-y: auto;
    flex: 1;
}

/* --- Bento Cards --- */
.card {
    /* Use dynamic mix of --link-color from layout (95% white for desired tint) fading to white. */
    background: linear-gradient(180deg, color-mix(in srgb, var(--link-color, #4f46e5), white 95%) 0%, #ffffff 100%);
    /* Subtle card surface */
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: none;
    transition: transform 0.2s;
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    /* Highlight for 3D feel */
}

.card:hover {
    /* transform removed as requested */
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    /* Deeper shadow */
}

/* --- Rounded UI Elements --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    /* Pill Buttons */
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--text-main);
    /* Black/Dark Button like reference */
    color: white;
}

.btn-primary:hover {
    background-color: black;
    transform: scale(1.02);
}

.btn-secondary {
    background-color: white;
    border: 1px solid var(--border-light);
    color: var(--text-main);
}

.btn-danger {
    background-color: #fee2e2;
    color: var(--danger);
}

/* Input Fields */
.form-input,
textarea,
input[type="text"],
input[type="number"],
input[type="email"],
select {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border: 1px solid var(--border-light);
    /* Subtle border for structure */
    background-color: white;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    /* Tailwind shadow */
    font-family: inherit;
    transition: all 0.2s;
}

textarea {
    resize: vertical;
    /* Allow vertical resizing only */
    min-height: 100px;
}

.form-input:focus {
    outline: none;
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--secondary);
    /* Green focus border */
}

/* Tables */
.table-container {
    /* Use dynamic mix of --link-color from layout (95% white for desired tint) fading to white. */
    background: linear-gradient(180deg, color-mix(in srgb, var(--link-color, #4f46e5), white 95%) 0%, #ffffff 100%);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    padding: 0;
    /* Tables often need 0 padding container */
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.8);
}


.table th {
    background-color: rgba(255, 255, 255, 0.5);
    /* Semi-transparent white to blend with container gradient */
    border-bottom: 2px solid var(--border-light);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 1rem;
    letter-spacing: 0.05em;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: color-mix(in srgb, var(--link-color, #4f46e5), white 92%);
    cursor: pointer;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

/* Badges */
.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-blue {
    background-color: #e0f2fe;
    color: var(--primary);
}

.badge-primary {
    background-color: var(--text-main);
    color: white;
}


/* Document Editor Items */
.item-type-title {
    background: linear-gradient(90deg, rgba(26, 54, 93, 0.1) 0%, rgba(26, 54, 93, 0.02) 100%);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    padding: 1rem;
    position: relative;
    /* For absolute positioned children */
}

.item-type-subtitle {
    background: linear-gradient(90deg, rgba(101, 163, 13, 0.1) 0%, rgba(101, 163, 13, 0.02) 100%);
    border-left: 4px solid var(--secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    padding: 1rem;
    margin-left: 2rem;
    position: relative;
}

.item-type-position {
    background-color: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    padding: 1rem;
    margin-left: 4rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
}

/* --- Collapsible Sidebar --- */
.sidebar {
    transition: width 0.3s ease, padding 0.3s ease;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.sidebar.collapsed {
    width: 80px;
    padding: 2rem 0.5rem;
    /* Slightly less padding to fit large icons */
}

.sidebar.collapsed .logo {
    margin-bottom: 2rem;
}

.sidebar.collapsed .logo img {
    height: 38px;
    /* ~20% larger than 32px */
    width: 38px;
    object-fit: contain;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.85rem;
    font-size: 1.6rem;
    /* 10% smaller than 1.8rem */
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar-toggle-btn {
    margin-top: auto;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-sidebar);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    align-self: flex-end;
    /* Align right initially */
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.sidebar.collapsed .sidebar-toggle-btn {
    align-self: center;
    /* Center in collapsed mode */
    margin-right: 0;
    transform: rotate(180deg);
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* --- Roman Sections (New Style) --- */
.item-type-section {
    background: linear_gradient(90deg, rgba(229, 231, 235, 0.5) 0%, rgba(243, 244, 246, 0.3) 100%);
    /* Very light grey */
    border-left: 4px solid #9ca3af;
    /* Light Grey border */
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    padding: 1rem;
    position: relative;
    /* Removed white text, now inherits dark text */
}

.item-type-section .section-number {
    color: #6b7280;
    /* Muted Grey */
    font-weight: 800;
    font-size: 2rem;
    min-width: 60px;
    text-align: center;
}

.item-type-section .section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    /* Muted Grey */
    margin-bottom: 0.25rem;
}

.item-type-section .section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}


/* --- Settings Grid --- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    /* Responsive columns */
    gap: 1.5rem;
}

/* Utilities */
.grid-cols-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: 1fr 1fr;
    }
}