:root {
    --bg: #f4f1ea;
    --surface: rgba(255, 255, 255, 0.76);
    --line: rgba(145, 123, 91, 0.18);
    --text: #2d261f;
    --muted: #786a5d;
    --accent: #b18857;
    --accent-deep: #8d6941;
    --danger: #b34d45;
    --shadow: 0 18px 60px rgba(122, 92, 54, 0.12);
    --radius: 24px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(194, 161, 120, 0.28), transparent 28%),
        radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.9), transparent 24%),
        linear-gradient(135deg, #f6f1e8 0%, #efe7dc 45%, #f9f5ee 100%);
    min-height: 100vh;
}

@media (min-width: 1081px) {
    body {
        font-size: 12px;
    }

    .main {
        padding: 16px;
    }

    .topbar h1 {
        font-size: 25px;
    }

    .topbar p,
    .refresh-badge small,
    .brand small,
    label span,
    .flash,
    .text-list,
    .prose p {
        font-size: 11px;
    }

    .card,
    .login-card,
    .login-hero {
        padding: 15px;
        border-radius: 17px;
    }

    .nav-link {
        gap: 9px;
        padding: 6px 9px;
        border-radius: 12px;
        font-size: 11px;
    }

    .icon {
        width: 27px;
        height: 27px;
        border-radius: 8px;
        flex-basis: 27px;
    }

    .icon svg {
        width: 15px;
        height: 15px;
    }

    .data-table th,
    .data-table td {
        padding: 7px 7px;
        font-size: 11px;
    }

    .data-table th {
        font-size: 10px;
    }

    input,
    select,
    textarea {
        padding: 8px 9px;
        font-size: 12px;
        border-radius: 11px;
    }

    textarea {
        min-height: 36px;
    }

    .primary-btn,
    .secondary-btn,
    .danger-btn {
        padding: 8px 11px;
        border-radius: 11px;
        font-size: 11px;
    }

    .tab {
        padding: 7px 10px;
        font-size: 11px;
    }

    .stat-card {
        padding: 11px 13px;
        border-radius: 14px;
    }

    .stat-card strong {
        font-size: 12px;
    }

    .stat-card span {
        font-size: 19px;
    }

    .refresh-badge {
        min-width: 160px;
        padding: 9px 11px;
        border-radius: 12px;
    }

    .login-page {
        padding: 24px;
        gap: 20px;
    }

    .login-hero {
        min-height: 360px;
    }

    .login-hero h1 {
        font-size: 38px;
    }
}

.tl-exclusion-hint { margin: -4px 4px 14px; color: var(--muted, #82786d); font-size: 12px; }
.data-table tr.tl-excluded-row { color: #8b8b8b; background: #efefef; }
.data-table tr.tl-excluded-row td { color: #8b8b8b; }
.data-table tr.tl-exclusion-saving { opacity: .55; pointer-events: none; }
.tl-row-context-menu { position: fixed; z-index: 1100; min-width: 220px; padding: 5px; border: 1px solid #e7dfd3; border-radius: 10px; background: #fffdfa; box-shadow: 0 10px 28px #30271926; }
.tl-row-context-menu[hidden] { display: none; }
.tl-row-context-menu button { width: 100%; padding: 9px 12px; border: 0; border-radius: 7px; background: transparent; color: #433b32; text-align: left; font: inherit; cursor: pointer; }
.tl-row-context-menu button:hover { background: #f3ece1; }
.tl-comment-modal[hidden] { display: none; }
.tl-comment-modal { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 20px; }
.tl-comment-backdrop { position: absolute; inset: 0; background: #211a1280; backdrop-filter: blur(5px); animation: tl-comment-fade .18s ease-out; }
.tl-comment-dialog { position: relative; width: min(100%, 520px); padding: 30px; border: 1px solid #ffffffc9; border-radius: 22px; background: linear-gradient(145deg, #fffdfa, #f8f2e8); box-shadow: 0 24px 80px #211a1240; animation: tl-comment-rise .22s ease-out; }
.tl-comment-close { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f1e9dd; color: #6e5b45; font-size: 23px; line-height: 1; cursor: pointer; }
.tl-comment-eyebrow { color: #a67b48; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.tl-comment-dialog h2 { margin: 9px 0 5px; color: #302820; font-size: 22px; }
.tl-comment-description { margin: 0 0 24px; color: #85796c; font-size: 13px; }
.tl-comment-label { display: block; margin-bottom: 8px; color: #554a3e; font-size: 12px; font-weight: 600; }
.tl-comment-dialog textarea { display: block; width: 100%; min-height: 130px; resize: vertical; padding: 13px 14px; border: 1px solid #e4dbce; border-radius: 12px; outline: none; background: #fff; color: #302820; font: inherit; font-size: 14px; line-height: 1.5; transition: border-color .15s, box-shadow .15s; }
.tl-comment-dialog textarea:focus { border-color: #bc8d55; box-shadow: 0 0 0 3px #bc8d5526; }
.tl-comment-dialog textarea::placeholder { color: #aaa095; }
.tl-comment-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; }
.tl-comment-counter { color: #968b7e; font-size: 11px; }
.tl-comment-footer > div { display: flex; gap: 8px; }
.tl-comment-footer button { min-height: 38px; padding: 0 15px; border: 0; border-radius: 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.tl-comment-cancel { background: #f1e9dd; color: #705b43; }
.tl-comment-save { background: #b88950; color: #fff; }
.tl-comment-save:hover { background: #a77840; }
.tl-comment-save:disabled { opacity: .55; cursor: wait; }
.tl-comment-error { margin: 12px 0 0; color: #a13e43; font-size: 12px; }
body.tl-comment-open { overflow: hidden; }
@keyframes tl-comment-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tl-comment-rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 540px) { .tl-comment-dialog { padding: 25px 20px 20px; border-radius: 18px; } .tl-comment-dialog h2 { font-size: 19px; } }

.social-vrn-toolbar { display: grid; grid-template-columns: minmax(240px, 1.6fr) repeat(5, minmax(130px, 1fr)) auto; align-items: end; gap: 12px; }
.social-vrn-toolbar label { min-width: 0; }
.social-vrn-toolbar input, .social-vrn-toolbar select { min-width: 0; padding: 10px 12px; border-radius: 12px; font-size: 12px; }
.social-vrn-search { min-width: 240px; }
.social-vrn-count { color: var(--muted); font-size: 12px; white-space: nowrap; padding-bottom: 10px; }
.social-columns-toggle { white-space: nowrap; }
.social-columns-panel { padding: 16px 20px; }
.social-column-options { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 12px; }
.social-column-options label { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.social-column-options input, .social-vrn-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: #a97942; }
.social-vrn-table-card { padding: 16px; }
.social-vrn-table-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.social-vrn-scroll-hint { color: var(--muted); font-size: 11px; padding: 0 3px; }
.social-vrn-scroll-hint[hidden] { display: none; }
.social-vrn-table-scroll { overflow: auto; overflow-x: scroll; max-height: calc(100vh - 310px); border: 1px solid var(--line); border-radius: 14px; scrollbar-color: #b58c5a #f1e8dc; scrollbar-width: auto; scrollbar-gutter: stable; }
.social-vrn-table { width: max-content; min-width: 100%; margin: 0; }
.social-vrn-table th { position: sticky; top: 0; z-index: 2; background: #fbf8f3; white-space: nowrap; }
.social-vrn-table td { max-width: 280px; min-width: 110px; }
.social-vrn-table td:first-child, .social-vrn-table th:first-child { min-width: 190px; }
.social-vrn-table td.social-truncated-cell { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-vrn-table tbody tr { cursor: pointer; transition: background .12s ease; }
.social-vrn-table tbody tr:hover { background: #fbf5eb; }
.social-vrn-table tbody tr.is-selected { background: #f2e4d0; box-shadow: inset 3px 0 #b58c5a; }
.social-checkbox-cell { text-align: center; }
.social-vrn-empty { min-height: 250px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.social-vrn-empty h3 { color: var(--text); }
.social-vrn-empty p { max-width: 450px; }
.social-row-menu { position: fixed; z-index: 90; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: #fffdf9; box-shadow: 0 12px 32px rgba(48, 40, 32, .2); }
.social-row-menu button { border: 0; border-radius: 7px; padding: 9px 13px; background: transparent; color: var(--text); cursor: pointer; font-size: 12px; }
.social-row-menu button:hover { background: #f2e8d9; }
.social-modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(35, 29, 23, .46); backdrop-filter: blur(5px); }
.social-modal-backdrop[hidden], .social-columns-panel[hidden], .social-row-menu[hidden] { display: none; }
.social-modal { width: min(1040px, 100%); max-height: min(90vh, 920px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(255,255,255,.75); border-radius: 22px; background: #fffdf9; box-shadow: 0 30px 90px rgba(35, 29, 23, .32); }
.social-modal-header { display: flex; justify-content: space-between; gap: 16px; padding: 22px 26px 17px; border-bottom: 1px solid var(--line); background: linear-gradient(110deg, #fffdf9, #f4eadb); }
.social-modal-header h2 { margin: 5px 0 3px; font-size: 22px; }
.social-modal-header p { margin: 0; color: var(--muted); font-size: 12px; }
.social-modal-header .eyebrow { color: #a67b48; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.social-modal-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 25px; line-height: 1; cursor: pointer; }
.social-modal-body { overflow: auto; padding: 20px 26px 24px; }
.social-record-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.social-record-field { min-width: 0; align-content: start; gap: 6px; padding: 11px 12px; border: 1px solid rgba(120,104,83,.13); border-radius: 12px; background: #fff; }
.social-record-field > span, .social-comment-field > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.social-record-field input[type="text"], .social-record-field textarea, .social-comment-field textarea { padding: 9px 10px; border-radius: 9px; font-size: 12px; line-height: 1.5; }
.social-record-field input[type="checkbox"] { width: 17px; height: 17px; accent-color: #a97942; }
.social-record-boolean { display: flex; align-items: center; gap: 9px; }
.social-record-readonly { overflow-wrap: anywhere; white-space: pre-wrap; font-size: 12px; line-height: 1.5; color: var(--text); }
.social-comment-field { margin-top: 16px; padding: 14px; border: 1px solid rgba(120,104,83,.16); border-radius: 14px; background: #fcfaf6; }
.social-comment-field textarea { margin-top: 8px; width: 100%; resize: vertical; }
.social-hidden-comment { border-color: #d7c3a8; background: #f7f0e6; }
.social-modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 26px; border-top: 1px solid var(--line); }
.social-modal-footer #socialSaveStatus { margin-right: auto; color: var(--muted); font-size: 12px; }
.social-modal-footer button:disabled { opacity: .6; cursor: wait; }
.social-access-list { display: grid; gap: 14px; }
.social-access-card { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 2fr) auto; align-items: center; gap: 16px; }
.social-access-user { display: grid; gap: 5px; }
.social-access-user span { color: var(--muted); font-size: 11px; }
.social-access-districts { display: flex; flex-wrap: wrap; gap: 8px; }
.social-access-districts label { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: #f5eee4; font-size: 11px; }
.social-access-districts input { width: 15px; height: 15px; accent-color: #a97942; }
body.social-modal-open { overflow: hidden; }
@media (max-width: 1280px) { .social-vrn-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); } .social-vrn-search { grid-column: span 2; } }
@media (max-width: 760px) { .social-vrn-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); } .social-vrn-search { grid-column: span 2; } .social-record-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .social-access-card { grid-template-columns: 1fr; } .social-modal-backdrop { padding: 8px; } .social-modal { max-height: 95vh; border-radius: 16px; } .social-modal-header, .social-modal-body { padding-inline: 16px; } .social-modal-footer { flex-wrap: wrap; padding-inline: 16px; } }
@media (max-width: 480px) { .social-record-fields { grid-template-columns: 1fr; } .social-vrn-toolbar { grid-template-columns: 1fr 1fr; } }

a { color: inherit; text-decoration: none; }

.shell {
    display: grid;
    grid-template-columns: 258px 1fr;
    min-height: 100vh;
    transition: grid-template-columns .25s ease;
}
.shell.collapsed { grid-template-columns: 83px 1fr; }

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 17px 14px;
    background: rgba(255, 253, 249, 0.72);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--line);
    transition: width .25s ease, padding .25s ease;
}

.sidebar.collapsed { width: 83px; padding-inline: 10px; }
.sidebar.collapsed .label,
.sidebar.collapsed .brand-copy,
.sidebar.collapsed .sidebar-branch-switch,
.sidebar.collapsed .user-card { display: none; }

.sidebar-head { display: grid; gap: 9px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand strong { font-size: 15px; letter-spacing: -.035em; white-space: nowrap; }
.sidebar-brand-bird { width: 31px; height: 31px; flex: 0 0 31px; color: var(--accent); overflow: visible; }
.sidebar-brand-bird .bird-outline { stroke-width: 6.2; }
.sidebar-brand-bird .bird-wing { stroke-width: 5.2; }
.sidebar-brand-bird .bird-eye, .sidebar-brand-bird .bird-beak { stroke-width: 5; }
.brand-copy small { white-space: nowrap; }
.brand small, .topbar p, .user-card small, .flash, label span, .text-list, .prose p { color: var(--muted); }
.distribution-frame-card { min-width: 0; overflow: hidden; padding: 0; border-radius: 18px; background: #f1e9dc; }
.distribution-frame { display: block; width: 100%; min-height: 920px; border: 0; background: #f1e9dc; }

.ghost-btn {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: grid;
    place-content: center;
    gap: 4px;
}

.ghost-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
}

.nav { display: grid; flex: 1 1 auto; align-content: start; gap: 5px; min-height: 0; margin-top: 16px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-group { display: grid; gap: 3px; }
.nav-heading {
    padding: 6px 10px 2px;
    color: var(--muted, #8a8277);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.management-group { margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(120, 104, 83, .14); }
.sidebar.collapsed .nav-heading { display: none; }
.nav-subgroup { display: grid; gap: 2px; }
.nav-subgroup-toggle { list-style: none; cursor: pointer; }
.nav-subgroup-toggle::-webkit-details-marker { display: none; }
.nav-caret { margin-left: auto; font-size: 13px; transition: transform .18s ease; }
.nav-subgroup[open] .nav-caret { transform: rotate(180deg); }
.nav-subgroup-items { display: grid; gap: 2px; margin-left: 40px; padding-left: 8px; border-left: 1px solid rgba(120, 104, 83, .2); }
.nav-subgroup-items .nav-link { min-height: 30px; padding: 5px 9px; font-size: 11px; }
.sidebar.collapsed .nav-subgroup-items { margin-left: 0; padding-left: 0; border-left: 0; }
.sidebar.collapsed .nav-caret { display: none; }
.department-unmatched-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.department-unmatched-list li { padding: 7px 11px; border-radius: 999px; background: rgba(181, 140, 90, .12); color: var(--muted); font-size: 12px; }
.card-heading-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.role-list { display: grid; gap: 8px; max-height: 65vh; overflow: auto; }
.role-item { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid rgba(120, 104, 83, .16); border-radius: 14px; color: inherit; text-decoration: none; }
.role-item.active { border-color: #b58c5a; background: rgba(181, 140, 90, .1); }
.role-item small, .muted { color: var(--muted, #8a8277); }
.access-admin-layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); align-items: start; gap: 18px; }
.access-role-panel, .access-permission-panel { min-width: 0; }
.access-permission-panel > h3 { margin-top: 0; }
.access-role-name { max-width: 520px; }
.access-preserve-note { margin-top: 12px; }
.permission-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.permission-group { min-width: 0; display: grid; gap: 10px; border: 1px solid rgba(120, 104, 83, .16); border-radius: 14px; padding: 14px; }
.permission-group legend { padding: 0 6px; font-weight: 800; }
.permission-option { display: flex; align-items: flex-start; gap: 10px; }
.permission-option-locked { opacity: .68; }
.permission-option small { margin-left: auto; color: var(--muted, #8a8277); font-size: 11px; text-align: right; }
.module-placeholder { min-height: 250px; display: flex; flex-direction: column; justify-content: center; }
.module-placeholder h2 { margin: 10px 0; }
.module-placeholder p { color: var(--muted, #8a8277); }

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 13px;
    color: var(--muted);
    transition: .2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(243,233,220,.92));
    box-shadow: var(--shadow);
}

.nav-link[data-tooltip]::after,
#sidebarToggle[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    z-index: 30;
    width: max-content;
    max-width: 260px;
    padding: 8px 11px;
    border: 1px solid rgba(145, 123, 91, 0.2);
    border-radius: 10px;
    background: #fffdf9;
    box-shadow: 0 8px 24px rgba(72, 54, 31, 0.18);
    color: var(--text);
    font: 600 11px/1.4 "Manrope", sans-serif;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translate(0, -50%);
    transition: opacity .14s ease, visibility .14s ease;
}

.sidebar.collapsed .nav-link[data-tooltip]:hover::after,
.sidebar.collapsed .nav-link[data-tooltip]:focus-visible::after,
.sidebar.collapsed #sidebarToggle[data-tooltip]:hover::after,
.sidebar.collapsed #sidebarToggle[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

#sidebarToggle { position: relative; }

.icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #e9dcc9, #fff);
    color: var(--accent-deep);
    font-weight: 800;
    flex: 0 0 30px;
}
.icon svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-footer { display: grid; gap: 14px; }

.user-card, .card, .login-card, .login-hero {
    background: var(--surface);
    border: 1px solid var(--line);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.user-card { padding: 16px; }
.logout-link { color: var(--accent-deep); font-weight: 700; padding-left: 6px; }

.main { padding: 28px; overflow: hidden; }
.topbar {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.topbar h1 { margin: 0 0 6px; font-size: 34px; }
.refresh-badge {
    min-width: 210px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,.76);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    text-align: right;
}
.refresh-badge strong {
    display: block;
    font-size: 14px;
}
.refresh-badge small {
    color: var(--muted);
}
.card { padding: 22px; margin-bottom: 18px; }
.accent-card { background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(244,233,213,.88)); }
.credentials-block {
    display: grid;
    gap: 4px;
    line-height: 1.35;
}
.grid.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.inline-form, .toolbar, .filter-card form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form.align-bottom { align-items: flex-end; }

label { display: grid; gap: 8px; font-size: 14px; }

input, select, textarea, button { font: inherit; }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 13px 14px;
    background: rgba(255,255,255,.92);
    color: var(--text);
}

textarea { min-height: 52px; resize: vertical; }

.primary-btn, .secondary-btn, .danger-btn {
    border: 0;
    border-radius: 16px;
    padding: 13px 18px;
    font-weight: 700;
    cursor: pointer;
}

.primary-btn { background: linear-gradient(135deg, #c79d66, #a87a44); color: #fff; }
.secondary-btn { background: #f2eadf; color: var(--accent-deep); }
.danger-btn { background: #f8e2de; color: var(--danger); }
.tl-export-btn { margin-left: auto; text-decoration: none; white-space: nowrap; }
.tl-personal-toolbar { width: 100%; }

.flash-stack { display: grid; gap: 10px; margin-bottom: 16px; }
.flash { padding: 14px 16px; border-radius: 16px; background: rgba(255,255,255,.82); border: 1px solid var(--line); }
.flash.success { border-color: rgba(70, 144, 93, 0.25); }
.flash.error { border-color: rgba(179, 77, 69, 0.25); }

.table-shell { overflow: auto; border-radius: 22px; border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; min-width: 1200px; background: rgba(255,255,255,.78); }
.data-table.compact { min-width: 1700px; }
.data-table.settings-table { min-width: 820px; }
.data-table.tl-report-table { min-width: 980px; }

.data-table th, .data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(145,123,91,.1);
    vertical-align: top;
    text-align: left;
}

.data-table th {
    position: sticky;
    top: 0;
    background: rgba(252, 249, 245, 0.96);
    z-index: 2;
    font-size: 13px;
    color: var(--muted);
}
.data-table .bonus-col {
    background: linear-gradient(180deg, rgba(199, 157, 102, 0.13), rgba(255,255,255,0.9));
}
.data-table th.bonus-col {
    color: var(--accent-deep);
}
.data-table .total-bonus-head,
.data-table .total-bonus-cell {
    background: linear-gradient(180deg, rgba(177, 136, 87, 0.22), rgba(255,255,255,0.96));
    font-weight: 800;
}

.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.stats-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stats-strip.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card {
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    border-radius: 20px;
    background: rgba(255,255,255,.78);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.stat-card strong {
    font-size: 14px;
    color: var(--muted);
}
.stat-card span {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
}
.stat-card.active {
    background: linear-gradient(135deg, rgba(199,157,102,.16), rgba(255,255,255,.94));
    border-color: rgba(177, 136, 87, 0.34);
}
.tab {
    padding: 11px 16px;
    border-radius: 999px;
    background: #f5ede2;
    color: var(--muted);
    font-weight: 700;
}

.tab.active { background: linear-gradient(135deg, #c79d66, #a87a44); color: #fff; }

.branch-switch {
    display: inline-flex;
    gap: 6px;
    margin-top: 12px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.64);
}
.sidebar-branch-switch {
    width: 100%;
    display: flex;
}
.sidebar-branch-switch a {
    flex: 1;
    text-align: center;
    padding-inline: 10px;
}
.branch-switch a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 800;
}
.branch-switch a.active {
    color: #fff;
    background: linear-gradient(135deg, #c79d66, #a87a44);
}

.text-list { margin: 0; padding-left: 18px; line-height: 1.8; }
.prose h3 { margin-top: 0; }
.inner-table { width: 100%; border-collapse: collapse; }
.inner-table th, .inner-table td { padding: 10px 0; border-bottom: 1px solid var(--line); text-align: left; }
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.72);
}
.setting-row strong {
    display: block;
    margin-bottom: 4px;
}
.setting-row p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.settings-table td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}
.switch {
    position: relative;
    display: inline-flex;
    width: 58px;
    height: 32px;
    flex: 0 0 auto;
    cursor: pointer;
}
.switch input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
}
.switch-slider {
    width: 100%;
    border-radius: 999px;
    background: rgba(173, 160, 140, .35);
    transition: background .2s ease;
    position: relative;
}
.switch-slider::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 18px rgba(99, 76, 47, .18);
    transition: transform .2s ease;
}
.switch input:checked + .switch-slider {
    background: linear-gradient(135deg, #c79d66, #a87a44);
}
.switch input:checked + .switch-slider::after {
    transform: translateX(26px);
}

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(390px, .88fr); gap: clamp(18px, 3vw, 44px); padding: clamp(16px, 3vw, 42px); background: radial-gradient(ellipse at 78% 12%, #fffdf7 0, #f8f2e8 46%, #eee6dc 100%); }
.login-story { position: relative; isolation: isolate; min-height: min(820px, calc(100vh - 2 * clamp(16px, 3vw, 42px))); display: flex; flex-direction: column; overflow: hidden; padding: clamp(28px, 5vw, 68px); border: 1px solid rgba(255,255,255,.16); border-radius: 30px; color: #fffaf0; background: radial-gradient(ellipse at 78% 36%, rgba(157, 145, 126, .22), transparent 36%), linear-gradient(145deg, #3c3b39 0%, #302f2e 56%, #262625 100%); box-shadow: 0 30px 90px rgba(57, 48, 38, .2); animation: login-panel-in .7s cubic-bezier(.2,.7,.2,1) both; }
.login-story::before, .login-story::after { position: absolute; z-index: -1; content: ""; border: 1px solid rgba(248, 242, 229, .08); border-radius: 50%; pointer-events: none; }
.login-story::before { width: 610px; height: 610px; right: -230px; top: 70px; }
.login-story::after { width: 470px; height: 470px; right: -160px; top: 140px; }
.login-story-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.login-brand-lockup { display: inline-flex; align-items: center; gap: 11px; color: #fffaf0; }
.login-brand-bird { width: 49px; height: 49px; overflow: visible; }
.login-brand-name { font-size: 16px; font-weight: 700; line-height: .98; letter-spacing: -.06em; text-transform: uppercase; }
.login-center-label { color: rgba(255,250,240,.58); font-size: 10px; letter-spacing: .13em; text-align: right; text-transform: uppercase; }
.bird-outline, .bird-wing, .bird-eye, .bird-beak { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.bird-outline { stroke-width: 5.2; }
.bird-wing { stroke-width: 4.4; }
.bird-eye { stroke-width: 4.2; }
.bird-beak { stroke-width: 4.2; }
.login-art { position: absolute; z-index: -1; top: 17%; right: -2%; width: min(82%, 760px); height: 48%; color: #f8f2e5; }
.login-art-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; stroke: rgba(232, 220, 198, .23); stroke-width: 1.5; }
.login-art-lines circle { fill: #d9bc8c; stroke: none; }
.login-art-lines path:last-of-type { fill: #d9bc8c; stroke: none; }
.login-bird { position: absolute; top: 4%; right: 15%; width: clamp(145px, 19vw, 225px); height: auto; overflow: visible; filter: drop-shadow(0 12px 28px rgba(0,0,0,.14)); animation: login-bird-hop 5.8s ease-in-out infinite; transform-origin: 50% 88%; }
.login-bird .bird-outline { stroke-width: 2.6; }
.login-bird .bird-wing { stroke-width: 2.3; }
.login-bird .bird-eye, .login-bird .bird-beak { stroke-width: 2.4; }
.login-art-orbit { position: absolute; width: 11px; height: 11px; border: 1px solid rgba(237, 220, 190, .68); border-radius: 50%; }
.login-art-orbit-one { top: 5%; left: 20%; }
.login-art-orbit-two { right: 4%; bottom: 13%; width: 6px; height: 6px; background: #d8b77f; }
.login-story-copy { position: relative; z-index: 1; max-width: 600px; margin-top: auto; padding-top: 250px; }
.login-overline, .login-panel-kicker { color: #d4b989; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.login-story-copy h1 { margin: 13px 0 10px; color: #fffaf0; font-family: "Bebas Neue", "Manrope", sans-serif; font-size: clamp(54px, 6.6vw, 86px); font-weight: 400; letter-spacing: .015em; line-height: .92; }
.login-story-copy p { margin: 16px 0 0; color: rgba(255,250,240,.68); font-size: 14px; letter-spacing: .01em; }
.login-story-foot { display: flex; align-items: center; gap: 9px; margin-top: 32px; color: rgba(255,250,240,.52); font-size: 10px; letter-spacing: .06em; }
.login-foot-dot { width: 6px; height: 6px; border-radius: 50%; background: #dfc18f; box-shadow: 0 0 14px rgba(223,193,143,.65); }
.login-panel { display: grid; place-items: center; min-width: 0; padding: clamp(20px, 4vw, 56px); }
.login-panel-inner { width: min(100%, 430px); animation: login-panel-in .7s .12s cubic-bezier(.2,.7,.2,1) both; }
.login-panel-heading { margin-bottom: 34px; }
.login-panel-kicker { color: #aa8252; }
.login-panel-heading h2 { margin: 12px 0 5px; color: #302d2a; font-family: "Bebas Neue", "Manrope", sans-serif; font-size: 42px; font-weight: 400; letter-spacing: .025em; line-height: 1; }
.login-panel-heading p { margin: 0; color: #82776a; font-size: 13px; }
.login-card { display: grid; gap: 20px; width: 100%; padding: 28px; border: 1px solid rgba(119, 101, 76, .12); border-radius: 20px; background: rgba(255, 254, 251, .72); box-shadow: 0 18px 54px rgba(80, 62, 40, .08); backdrop-filter: blur(14px); }
.login-card label { display: grid; gap: 8px; }
.login-card label span { color: #5e554b; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.login-card input { width: 100%; min-height: 50px; padding: 0 15px; border: 1px solid #e4dbce; border-radius: 12px; outline: none; background: #fffefa; color: #302d2a; font: inherit; font-size: 13px; transition: border-color .2s ease, box-shadow .2s ease, background .2s ease; }
.login-card input::placeholder { color: #aaa093; }
.login-card input:focus { border-color: #ae895c; background: #fff; box-shadow: 0 0 0 4px rgba(174,137,92,.12); }
.login-card .primary-btn { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 17px; border: 0; border-radius: 12px; color: #fffaf1; background: linear-gradient(115deg, #92714d, #b38e60 55%, #9c784f); box-shadow: 0 9px 22px rgba(139,104,62,.22); font: 700 13px "Manrope", sans-serif; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, filter .2s ease; }
.login-card .primary-btn:hover { transform: translateY(-2px); box-shadow: 0 13px 27px rgba(139,104,62,.27); filter: saturate(1.08); }
.login-card .primary-btn:focus-visible { outline: 3px solid rgba(174,137,92,.35); outline-offset: 3px; }
.login-card .primary-btn span:last-child { font-size: 20px; font-weight: 400; transition: transform .2s ease; }
.login-card .primary-btn:hover span:last-child { transform: translateX(3px); }
.login-card > small { color: #9b9185; font-size: 10px; text-align: center; }
.login-panel-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; color: #a1978a; font-size: 9px; letter-spacing: .08em; }
.login-panel-footer span:first-child { color: #887763; font-weight: 800; }
@keyframes login-bird-hop { 0%, 15%, 25%, 100% { transform: translateY(0) rotate(0); } 19% { transform: translateY(-11px) rotate(-2deg); } 22% { transform: translateY(0) rotate(1deg); } 62% { transform: translateY(0) rotate(0); } 66% { transform: translateY(-5px) rotate(1deg); } 70% { transform: translateY(0) rotate(0); } }
@keyframes login-panel-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .login-bird, .login-story, .login-panel-inner { animation: none; } .login-card .primary-btn, .login-card .primary-btn span:last-child { transition: none; } }

.autosave-field[data-saving="true"] { outline: 2px solid rgba(177, 136, 87, 0.32); }
.autosave-field[data-saved="true"] { outline: 2px solid rgba(70, 144, 93, 0.22); }

.login-page .login-card { padding: 28px; border-radius: 20px; }
@media (max-width: 1080px) {
    .login-page { grid-template-columns: 1fr; gap: 8px; }
    .login-story { min-height: 540px; }
    .login-panel { padding-block: 34px; }
}
@media (max-width: 600px) {
    .login-page { padding: 12px; }
    .login-story { min-height: 440px; padding: 25px 23px; border-radius: 23px; }
    .login-story-top { align-items: flex-start; }
    .login-center-label { max-width: 125px; padding-top: 8px; font-size: 8px; line-height: 1.6; }
    .login-brand-bird { width: 42px; height: 42px; }
    .login-brand-name { font-size: 14px; }
    .login-art { top: 20%; right: -17%; width: 110%; height: 41%; }
    .login-bird { right: 17%; width: 155px; }
    .login-story-copy { padding-top: 190px; }
    .login-story-copy h1 { font-size: clamp(51px, 15vw, 68px); }
    .login-story-copy p { max-width: 250px; font-size: 12px; }
    .login-panel { padding: 28px 8px 20px; }
    .login-panel-heading { margin-bottom: 24px; }
    .login-panel-heading h2 { font-size: 37px; }
    .login-page .login-card { gap: 17px; padding: 22px 18px; }
}

@media (max-width: 1080px) {
    .shell { grid-template-columns: 83px 1fr; }
    .sidebar .label, .sidebar .brand-copy, .sidebar .user-card { display: none; }
    .sidebar .nav-link[data-tooltip]:hover::after,
    .sidebar .nav-link[data-tooltip]:focus-visible::after,
    .sidebar #sidebarToggle[data-tooltip]:hover::after,
    .sidebar #sidebarToggle[data-tooltip]:focus-visible::after {
        opacity: 1;
        visibility: visible;
    }
    .grid.two-col, .login-page { grid-template-columns: 1fr; }
    .login-card { justify-self: stretch; max-width: none; }
    .topbar { flex-direction: column; }
    .refresh-badge { text-align: left; min-width: 0; }
    .stats-strip, .stats-strip.three { grid-template-columns: 1fr; }
    .permission-groups { grid-template-columns: 1fr; }
    .access-admin-layout { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
}

@media (min-width: 1081px) {
    body { font-size: 12px; }
    .main { padding: 16px; }
    .topbar { margin-bottom: 14px; }
    .topbar h1 { font-size: 26px; }
    .topbar p, .refresh-badge small, .brand small, label span,
    .flash, .text-list, .prose p { font-size: 11px; }
    .card, .login-card, .login-hero { padding: 16px; border-radius: 17px; }
    .card { margin-bottom: 12px; }
    .grid.two-col { gap: 12px; }
    .sidebar { padding: 16px 13px; }
    .brand { gap: 9px; }
    .brand strong { font-size: 18px; }
    .ghost-btn { width: 38px; height: 38px; border-radius: 11px; }
    .nav { gap: 4px; margin-top: 14px; }
    .nav-group { gap: 2px; }
    .nav-heading { padding: 5px 9px 2px; font-size: 9px; }
    .management-group { margin-top: 7px; padding-top: 5px; }
    .nav-link { gap: 8px; padding: 6px 9px; border-radius: 11px; font-size: 11px; }
    .icon { width: 27px; height: 27px; flex-basis: 27px; border-radius: 8px; }
    .icon svg { width: 15px; height: 15px; }
    input, select, textarea { padding: 8px 10px; border-radius: 11px; font-size: 12px; }
    label { gap: 5px; font-size: 12px; }
    .primary-btn, .secondary-btn, .danger-btn { padding: 8px 11px; border-radius: 11px; font-size: 11px; }
    .data-table th, .data-table td { padding: 7px 7px; font-size: 11px; }
    .data-table th { font-size: 10px; }
    .table-shell { border-radius: 16px; }
    .stats-strip { gap: 10px; margin-bottom: 12px; }
    .stat-card { gap: 5px; padding: 12px 13px; border-radius: 15px; }
    .stat-card strong { font-size: 11px; }
    .stat-card span { font-size: 19px; }
    .refresh-badge { min-width: 155px; padding: 9px 11px; border-radius: 12px; }
    .refresh-badge strong { font-size: 12px; }
}
