:root {
    --navy-950: #071727; --navy-900: #0b2239; --navy-800: #12395d;
    --blue-700: #17639a; --blue-600: #1f78b4; --blue-500: #3192d0;
    --blue-200: #cfe9fa; --blue-100: #eaf6fd; --blue-050: #f4faff;
    /* Shared informational status palette for cards, pills, and legends. */
    --document-status-blue-accent: var(--blue-500); --document-status-blue-background: var(--blue-100); --document-status-blue-text: var(--blue-700);
    --accent: #f59e0b; --accent-hover: #d98906;
    --success: #15803d; --success-light: #e8f7ee;
    --danger: #dc2626; --danger-light: #fdecec;
    --surface: #ffffff; --background: #f3f7fb;
    --text: #17324a; --muted: #6d8193;
    --border: rgba(18, 57, 93, 0.12); --border-strong: rgba(18, 57, 93, 0.22);
    --shadow-small: 0 2px 8px rgba(7, 23, 39, 0.05); --shadow: 0 10px 28px rgba(7, 23, 39, 0.08);
    --radius-small: 7px; --radius: 10px; --radius-large: 13px;
    /* Shared brandbook contract for application cards, controls, and copy. */
    --interface-content-width: 1400px; --interface-card-padding: 20px;
    --interface-card-radius: 12px; --interface-tile-radius: 9px;
    --interface-control-height: 40px; --interface-control-padding: 8px 10px;
    --interface-heading-size: 16px; --interface-tile-heading-size: 14px;
    --interface-label-size: 11px; --interface-value-size: 12px;
    --interface-helper-size: 9.5px; --interface-placeholder: #8798a7;
    --interface-border: #dfe4e8; --interface-divider: #e7ebee;
    --interface-edit-surface: #fbfcfd;
    /* Standard read-only records keep white cards around softly tinted fields. */
    --interface-view-card-surface: #ffffff; --interface-view-field-surface: #f8fafb;
    --interface-view-field-text: #17324a;
    --interface-view-surface: var(--interface-view-field-surface);
    /* Disabled editor controls are a shared interaction state, independent of record type. */
    --interface-disabled-field-surface: #eef2f5; --interface-disabled-field-text: #637789;
    --interface-locked-surface: var(--interface-disabled-field-surface);
    --interface-locked-text: var(--interface-disabled-field-text);
    /* Commercial documents deliberately retain their denser locked-field variant. */
    --interface-commercial-tile-heading-size: 12px; --interface-commercial-view-card-surface: #f8fafb;
    --interface-commercial-field-surface: #eef2f5; --interface-commercial-field-text: #637789;
    --sidebar-width: 255px;
}

/* =========================
   USER MANAGEMENT
   ========================= */

.user-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.user-summary { display: flex; flex-direction: column; gap: 2px; }
.user-summary strong { color: var(--navy-800); font-size: 22px; }
.user-summary span, .muted { color: var(--muted); }
.user-search { display: flex; gap: 10px; margin-bottom: 18px; }
.user-search input { flex: 1; }
.user-table { width: 100%; border-collapse: collapse; }
.user-table th, .user-table td { padding: 13px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.user-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.user-table td small { display: block; color: var(--muted); }
.user-list-shell .article-list-card { overflow: hidden; }
.user-list-shell .user-table-card { overflow: auto; border-top: 1px solid var(--border); }
.user-list-shell .user-table { min-width: 850px; }
.user-list-shell .user-table tbody tr { cursor: pointer; }
.user-list-shell .user-table tbody tr:hover { background: var(--blue-050); }
.user-list-shell .user-table tbody tr:last-child td { border-bottom: 0; }
.user-identity { color: var(--navy-900); text-decoration: none; }
.user-row-arrow { color: var(--blue-700); font-size: 23px; text-decoration: none; }
.user-list-empty { display: flex; align-items: center; flex-direction: column; gap: 4px; padding: 40px; color: var(--muted); text-align: center; }
.user-list-empty strong { color: var(--navy-900); }

.status-pill.active { color: var(--success); background: var(--success-light); }
.status-pill.inactive { color: var(--danger); background: var(--danger-light); }
.state-toggle-button{display:inline-flex!important;align-items:center;justify-content:center;width:112px!important;min-width:112px!important;box-sizing:border-box;text-align:center;white-space:nowrap}
.account-switches { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.account-switches label { display: flex; align-items: center; gap: 9px; font-weight: 650; }
.employee-link-state { display: flex; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 14px 16px; border-radius: var(--radius-small); background: var(--blue-050); }
.employee-link-state span { color: var(--muted); }
.permission-legend { display: flex; gap: 15px; color: var(--muted); font-size: 12px; }
.permission-search { margin-bottom: 14px; }
.permission-search input { width: 100%; }
.permission-branch[hidden], .permission-child[hidden], [data-permission-children][hidden] { display: none !important; }
.permission-tree { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); }
.permission-branch + .permission-branch { border-top: 1px solid var(--border-strong); }
.permission-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; align-items: center; min-height: 48px; padding: 7px 12px; border-bottom: 1px solid var(--border); }
.permission-row:last-child { border-bottom: 0; }
.permission-row > div { display: flex; align-items: center; gap: 9px; }
.permission-row select { min-height: 36px; padding: 6px 30px 6px 10px; }
.permission-parent { background: var(--blue-050); }
.permission-child { padding-left: 40px; background: var(--surface); }
.permission-parent .permission-toggle { width: 34px; min-width: 34px; height: 34px; min-height: 34px; border: 1px solid var(--border); border-radius: var(--radius-small); background: #fff; color: var(--muted); box-shadow: var(--shadow-small); }
.permission-parent .permission-toggle:hover { border-color: var(--blue-300); background: var(--blue-050); color: var(--blue-700); box-shadow: var(--shadow-small); }
.permission-parent .permission-toggle svg { width: 18px; height: 18px; }
.tree-bullet { width: 34px; color: var(--blue-600); text-align: center; }
.tree-line { color: var(--border-strong); font-size: 18px; }
.permission-empty { margin: 0; padding: 24px; color: var(--muted); text-align: center; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Keep document preview actions visually quiet while retaining an accessible label. */
.preview-icon-button{position:relative!important;display:grid!important;width:40px!important;min-width:40px!important;height:40px!important;min-height:40px!important;padding:0!important;border:1px solid var(--blue-600)!important;background:#fff!important;color:var(--blue-700)!important;box-shadow:none!important;place-items:center!important}.document-topbar-icon-action[data-compact-tooltip],.compact-tooltip[data-compact-tooltip]{position:relative!important}
.preview-icon-button svg{display:block;width:20px;height:20px}.preview-icon-button svg path,.preview-icon-button svg circle{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.preview-icon-button:hover,.preview-icon-button:focus-visible{border-color:var(--blue-700)!important;background:var(--blue-050)!important;color:var(--blue-700)!important;box-shadow:none!important}.preview-icon-button::after,.document-topbar-icon-action[data-compact-tooltip]::after,.compact-tooltip[data-compact-tooltip]::after{position:absolute;z-index:240;top:calc(100% + 7px);right:0;padding:6px 9px;border-radius:999px;background:var(--navy-900);color:#fff;font-size:10px;font-weight:700;line-height:1.2;opacity:0;visibility:hidden;pointer-events:none;transform:translateY(-3px);transition:opacity .06s ease,transform .06s ease,visibility 0s!important;white-space:nowrap}.preview-icon-button::after{content:attr(aria-label)}.document-topbar-icon-action[data-compact-tooltip]::after,.compact-tooltip[data-compact-tooltip]::after{content:attr(data-compact-tooltip)}.preview-icon-button:hover::after,.preview-icon-button:focus-visible::after,.document-topbar-icon-action[data-compact-tooltip]:hover::after,.document-topbar-icon-action[data-compact-tooltip]:focus-visible::after,.compact-tooltip[data-compact-tooltip]:hover::after,.compact-tooltip[data-compact-tooltip]:focus-visible::after{opacity:1;visibility:visible;transform:translateY(0)}details[open]>.document-topbar-icon-action[data-compact-tooltip]::after{opacity:0!important;visibility:hidden}
/* Disabled text actions reuse the icon tooltip, with readable bounded explanations. */
.compact-tooltip[data-compact-tooltip]::after{width:max-content;max-width:min(320px,calc(100vw - 32px));border-radius:var(--radius-small);white-space:normal;text-align:left}
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.user-editor .errorlist { margin: 5px 0 0; padding: 0; color: var(--danger); list-style: none; font-size: 11px; }
.user-editor small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--interface-helper-size); line-height: 1.5; }

@media (max-width: 760px) {
    .user-summary-grid { grid-template-columns: 1fr; }
    .permission-legend { display: none; }
    .permission-row { grid-template-columns: 1fr; gap: 6px; }
    .permission-child { padding-left: 24px; }
    .employee-link-state { flex-direction: column; gap: 4px; }
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;

    background: var(--background);
    color: var(--text);

    font-family: Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;

    line-height: 1.5;
}

a {
    color: var(--blue-700);
}

a:hover {
    color: var(--navy-800);
}

/* =========================
   APPLICATION LAYOUT
   ========================= */

.app-layout {
    display: grid;
    grid-template-columns:
                var(--sidebar-width)
                minmax(0, 1fr);

    min-height: 100vh;
}

.app-main {
    grid-column: 2;
    min-width: 0;
}

/* =========================
   SIDEBAR
   ========================= */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;

    display: flex;
    flex-direction: column;

    width: var(--sidebar-width);
    height: 100vh;

    padding: 0 14px 18px;

    overflow: hidden;

    color: white;

    background: linear-gradient(
            180deg,
            var(--navy-950) 0%,
            var(--navy-900) 55%,
            var(--navy-800) 100%
    );

    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

/* =========================
   LOGO
   ========================= */

.sidebar-brand-zone {
    position: relative;
    flex: 0 0 126px;
    min-height: 126px;
    background: var(--navy-950);
}

.sidebar-brand {
    display: block;
    height: 82px;

    color: white;
    text-decoration: none;
}

.sidebar-brand:hover {
    color: white;
}

.brand-logo {
    position: absolute;
    top: -20px;
    left: 8px;
    display: block;
    width: 190px;
    max-width: 100%;
    height: auto;

    object-fit: contain;
}

.brand-logo-small {
    display: none;
}

/* =========================
   SVG ICONS
   ========================= */

.menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 21px;

    width: 21px;
    height: 21px;

    color: currentColor;
}

.menu-icon svg {
    display: block;

    width: 19px;
    height: 19px;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* =========================
   SIDEBAR NAV
   ========================= */

.sidebar-nav {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;

    flex: 1 1 auto;
    min-height: 0;

    gap: 3px;
    padding-top: 18px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

/* =========================
   DASHBOARD
   ========================= */

.sidebar-dashboard {
    margin-bottom: 13px;
}

.sidebar-link {
    display: flex;
    align-items: center;

    gap: 11px;

    min-height: 42px;

    padding: 9px 11px;

    border-radius: var(--radius-small);

    color: rgba(255, 255, 255, 0.78);

    font-size: 13.5px;
    font-weight: 650;

    text-decoration: none;

    transition: background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;

    transform: translateX(2px);
}

.sidebar-link.active {
    position: relative;
    margin-left: 5px;
    padding-left: 14px;
    background: transparent;
    color: white;
    box-shadow: inset 2px 0 0 white;
    text-decoration: none;
}

/* =========================
   MENU GROUP
   ========================= */

.sidebar-group {
    margin-bottom: 5px;
}

.sidebar-group-button {
    display: flex;
    align-items: center;

    width: 100%;
    min-height: 40px;

    gap: 10px;

    padding: 8px 10px;

    border: 0;
    border-radius: var(--radius-small);

    background: transparent;
    color: rgba(255, 255, 255, 0.88);

    box-shadow: none;

    font: inherit;
    font-size: 13px;
    font-weight: 700;

    text-align: left;
    text-decoration: none;

    cursor: pointer;

    transition: background 0.15s ease,
    color 0.15s ease;
}

.sidebar-group-button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;

    box-shadow: none;
    transform: none;
}

.sidebar-group-button.open {
    color: white;
}

.sidebar-group-button.active {
    margin-left: 5px;
    width: calc(100% - 5px);
    padding-left: 13px;
    background: transparent;
    color: white;
    box-shadow: inset 2px 0 0 white;
    text-decoration: none;
}

.sidebar-group-button.active .sidebar-chevron {
    color: white;
}

.sidebar-group-name {
    flex: 1;
}

/* =========================
   CHEVRON
   ========================= */

.sidebar-chevron {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 42px;
    width: 42px;
    height: 40px;
    margin: -8px -10px -8px 0;
    border-radius: 6px;

    color: rgba(255, 255, 255, 0.42);

    transition: color 0.15s ease,
    background 0.15s ease;
}

.sidebar-chevron:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.sidebar-chevron svg {
    width: 14px;
    height: 14px;

    fill: none;
    stroke: currentColor;

    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;

    transition: transform 0.20s ease;
}

.sidebar-group-button.open
.sidebar-chevron {
    color: rgba(255, 255, 255, 0.78);
}

.sidebar-group-button.open
.sidebar-chevron svg {
    transform: rotate(90deg);
}

/* =========================
   SUBMENU
   ========================= */

.sidebar-submenu {
    display: grid;

    grid-template-rows: 0fr;

    opacity: 0;

    transition: grid-template-rows 0.20s ease,
    opacity 0.16s ease;
}

.sidebar-submenu.open {
    grid-template-rows: 1fr;
    opacity: 1;
}

.sidebar-submenu-inner {
    min-height: 0;
    overflow: hidden;

    display: flex;
    flex-direction: column;

    gap: 1px;

    padding-left: 41px;
}

.sidebar-submenu.open
.sidebar-submenu-inner {
    padding-bottom: 6px;
}

.sidebar-submenu-link {
    position: relative;

    display: flex;
    align-items: center;

    min-height: 30px;

    padding: 5px 10px;

    border-radius: 6px;

    color: rgba(255, 255, 255, 0.53);

    font-size: 12.5px;
    font-weight: 500;

    text-decoration: none;

    transition: background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.sidebar-submenu-link:hover {
    background: rgba(255, 255, 255, 0.055);
    color: white;

    transform: translateX(2px);
}

.sidebar-submenu-link.active {
    background: transparent;
    color: white;

    font-weight: 700;
}

.sidebar-submenu-link.active::before {
    content: none;
}

/* =========================
RELATION TYPE & STATUS
========================= */

.relation-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
}

.relation-meta-column {
    min-width: 0;
}

.relation-meta-title {
    margin: 0 0 14px;
    color: var(--navy-900);
    font-size: 14px;
    font-weight: 750;
}

.relation-option-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.relation-option {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

.relation-option input[type="checkbox"],
.relation-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.relation-option-box {
    position: relative;
    display: block;
    min-height: 54px;
    padding: 15px 16px 15px 48px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: white;
    transition: border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.relation-option-box::before {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 18px;
    height: 18px;
    border: 2px solid #aebcca;
    background: white;
    content: "";
    transition: border-color 0.15s ease,
    background 0.15s ease;
}

.relation-option:not(.relation-option-radio)
.relation-option-box::before {
    border-radius: 5px;
}

.relation-option-radio
.relation-option-box::before {
    border-radius: 50%;
}

.relation-option-box::after {
    position: absolute;
    content: "";
    opacity: 0;
    transition: opacity 0.15s ease;
}

.relation-option:not(.relation-option-radio)
.relation-option-box::after {
    top: 18px;
    left: 22px;
    width: 5px;
    height: 10px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(45deg);
}

.relation-option-radio
.relation-option-box::after {
    top: 21px;
    left: 21px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.relation-option:hover .relation-option-box {
    border-color: var(--blue-500);
    background: var(--blue-050);
}

.relation-option input:checked + .relation-option-box {
    border-color: var(--blue-500);
    background: var(--blue-050);
    box-shadow: 0 0 0 3px rgba(49, 146, 208, 0.10);
}

.relation-option input:checked + .relation-option-box::before {
    border-color: var(--blue-600);
    background: var(--blue-600);
}

.relation-option input:checked + .relation-option-box::after {
    opacity: 1;
}

.relation-option-box strong {
    display: block;
    color: var(--navy-900);
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 900px) {
    .relation-meta-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   REPORTS
   ========================= */

.sidebar-single-link {
    display: flex;
    align-items: center;

    gap: 10px;

    min-height: 40px;

    padding: 8px 10px;

    border-radius: var(--radius-small);

    color: rgba(255, 255, 255, 0.88);

    font-size: 13px;
    font-weight: 700;

    text-decoration: none;

    transition: background 0.15s ease,
    color 0.15s ease;
}

.sidebar-single-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

.sidebar-single-link.active {
    margin-left: 5px;
    padding-left: 13px;
    background: transparent;
    color: white;
    box-shadow: inset 2px 0 0 white;
    text-decoration: none;
}

/* =========================
   SECTION LANDING PAGE
   ========================= */

.section-landing {
    max-width: 1120px;
    margin: 0 auto;
}

.section-landing-header {
    max-width: 680px;
    margin-bottom: 34px;
}

.section-landing-header h2 {
    margin: 0 0 8px;
    color: var(--navy-900);
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.2;
}

.section-landing-header > p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.section-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.section-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    align-items: start;
    gap: 22px 16px;
    min-height: 190px;
    padding: 28px;
    border: 1px solid rgba(18, 57, 93, .1);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 8px 24px rgba(7, 23, 39, .06);
    text-decoration: none;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

a.section-card:hover {
    border-color: rgba(49, 146, 208, .45);
    color: var(--text);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.section-card-icon {
    display: grid;
    place-items: center;
    grid-column: 1;
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: linear-gradient(145deg, var(--blue-100), #d9f0ff);
    color: var(--blue-700);
}

.section-card-icon svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.section-card-copy,
.section-card-copy strong,
.section-card-copy span {
    display: block;
}

.section-card-copy {
    grid-column: 1 / -1;
    align-self: end;
}

.section-card-copy strong {
    margin-bottom: 7px;
    color: var(--navy-900);
    font-size: 18px;
}

.section-card-copy span {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.section-card-arrow {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--blue-050);
    color: var(--blue-600);
    font-size: 22px;
}

.section-card-muted {
    background: rgba(255, 255, 255, .72);
}

.section-card-muted .section-card-icon {
    background: #edf1f4;
    color: var(--muted);
}

.section-card-status {
    grid-column: 2;
    grid-row: 1;
    padding: 4px 8px;
    border-radius: 999px;
    background: #edf1f4;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.section-card-muted {
    grid-template-columns: 44px minmax(0, 1fr) auto;
}

.section-card:nth-child(4n + 2) .section-card-icon {
    background: linear-gradient(145deg, #fff4d9, #ffe9b5);
    color: #a96800;
}

.section-card:nth-child(4n + 3) .section-card-icon {
    background: linear-gradient(145deg, #e6f5ee, #d2ecdf);
    color: var(--success);
}

.section-card:nth-child(4n + 4) .section-card-icon {
    background: linear-gradient(145deg, #f0eaff, #e4d8ff);
    color: #6d4bb0;
}

.section-card:target {
    border-color: rgba(49, 146, 208, .55);
    box-shadow: 0 0 0 4px rgba(49, 146, 208, .1), var(--shadow);
}

@media (max-width: 760px) {
    .section-card-grid { grid-template-columns: 1fr; }
    .section-card { padding: 18px; }
}

/* Compact shared navigation for main sections and settings. */
.section-card {
    grid-template-columns: 44px minmax(0, 1fr) 28px;
    grid-template-rows: auto;
    align-items: center;
    gap: 16px;
    min-height: 104px;
    padding: 18px;
    border-radius: 11px;
    box-shadow: 0 3px 10px rgba(7, 23, 39, .035);
}

a.section-card:hover {
    border-color: rgba(49, 146, 208, .38);
    box-shadow: 0 7px 18px rgba(7, 23, 39, .07);
    transform: translateY(-1px);
}

.section-card-icon {
    grid-column: 1;
    grid-row: 1;
    width: 42px;
    height: 42px;
    border-radius: 9px;
}

.section-card-icon svg {
    width: 20px;
    height: 20px;
}

.section-card-copy {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
}

.section-card-copy strong {
    margin-bottom: 4px;
    font-size: 15px;
}

.section-card-copy span {
    font-size: 12px;
    line-height: 1.45;
}

.section-card-arrow {
    grid-column: 3;
    grid-row: 1;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    font-size: 19px;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

a.section-card:hover .section-card-arrow {
    background: var(--blue-050);
    color: var(--blue-700);
    transform: translateX(2px);
}

.section-card-status {
    grid-column: 3;
    grid-row: 1;
    white-space: nowrap;
}

.section-card.section-card-muted {
    grid-template-columns: 44px minmax(0, 1fr) max-content;
}

.section-settings-page {
    max-width: 920px;
}

.section-settings-page .section-landing-header {
    margin-bottom: 24px;
}

.section-settings-page .section-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: 0 4px 14px rgba(7, 23, 39, .04);
}

.section-settings-page .section-card {
    grid-template-columns: minmax(0, 1fr) 28px;
    min-height: 78px;
    padding: 15px 18px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.section-settings-page .section-card:last-child {
    border-bottom: 0;
}

.section-settings-page .section-card-copy {
    grid-column: 1;
}

.section-settings-page .section-card-muted {
    grid-template-columns: minmax(0, 1fr) auto;
}

.section-settings-page .section-card-arrow,
.section-settings-page .section-card-status {
    grid-column: 2;
}

.section-settings-page a.section-card:hover {
    border-color: var(--border);
    background: var(--blue-050);
    box-shadow: inset 3px 0 0 var(--blue-600);
    transform: none;
}

@media (max-width: 760px) {
    .section-card { min-height: 92px; padding: 15px; }
    .section-settings-page .section-card { min-height: 74px; padding: 14px 15px; }
}

/* Main-menu links never use underlines, including after browser or cache overrides. */
.sidebar .sidebar-link,
.sidebar .sidebar-link:hover,
.sidebar .sidebar-link:focus,
.sidebar .sidebar-link:active,
.sidebar .sidebar-group-button,
.sidebar .sidebar-group-button:hover,
.sidebar .sidebar-group-button:focus,
.sidebar .sidebar-group-button:active,
.sidebar .sidebar-group-name,
.sidebar .sidebar-single-link,
.sidebar .sidebar-single-link:hover,
.sidebar .sidebar-single-link:focus,
.sidebar .sidebar-single-link:active {
    text-decoration: none !important;
}

.sidebar .sidebar-link.active,
.sidebar .sidebar-group-button.active,
.sidebar .sidebar-single-link.active {
    position: relative;
    box-shadow: none;
}

.sidebar .sidebar-link.active::before,
.sidebar .sidebar-group-button.active::before,
.sidebar .sidebar-single-link.active::before {
    position: absolute;
    top: 50%;
    left: 0;
    width: 2px;
    height: 23px;
    border-radius: 999px;
    background: #fff;
    content: "";
    transform: translateY(-50%);
}

/* =========================
   DIVIDER
   ========================= */

.sidebar-divider {
    height: 1px;

    margin: 10px 10px 14px;

    background: rgba(255, 255, 255, 0.10);
}

/* =========================
   RIA AI ASSISTANT
   ========================= */

.sidebar-ria {
    position: absolute;
    right: 8px;
    bottom: 2px;
    left: 8px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 9px;
    height: 34px;
    padding: 0 11px 0 9px;
    border: 1px solid rgba(137, 181, 255, .38);
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(82, 139, 239, .22), rgba(82, 139, 239, .10));
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .16);
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.sidebar-ria:hover {
    border-color: rgba(164, 199, 255, .7);
    background: linear-gradient(135deg, rgba(82, 139, 239, .32), rgba(82, 139, 239, .15));
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, .24);
}

.sidebar-ria.active {
    border-color: #9bc0ff;
    background: rgba(82, 139, 239, .3);
}

.sidebar-ria-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
}

.sidebar-ria-icon svg {
    width: 20px;
    height: 20px;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-ria-icon .sidebar-ria-spark {
    stroke: #83b8ff;
    stroke-width: 1.9;
}

.sidebar-ria-label {
    flex: 1;
    font-size: 12.5px;
    font-weight: 750;
    letter-spacing: .01em;
}

.sidebar-ria-status {
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #62d6ac;
    box-shadow: 0 0 0 3px rgba(98, 214, 172, .12);
}

.sidebar-ria-status.offline {
    background: #9aa8bc;
    box-shadow: 0 0 0 3px rgba(154, 168, 188, .13);
}

/* =========================
   USER
   ========================= */

.sidebar-user {
    flex: 0 0 auto;

    margin-top: 14px;
    padding-top: 16px;

    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.user-card {
    display: flex;
    align-items: center;

    gap: 11px;

    margin-bottom: 10px;

    padding: 9px;

    border-radius: var(--radius);

    background: rgba(255, 255, 255, 0.06);
}

.user-avatar {
    display: grid;
    place-items: center;

    flex: 0 0 34px;

    width: 34px;
    height: 34px;

    border-radius: 50%;

    background: var(--blue-500);
    color: white;

    font-size: 13px;
    font-weight: 800;

    text-transform: uppercase;
}

.user-details {
    min-width: 0;
}

.user-name {
    overflow: hidden;

    color: white;

    font-size: 13px;
    font-weight: 700;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    margin-top: 2px;

    color: rgba(255, 255, 255, 0.55);

    font-size: 11px;
}

.logout-form {
    margin: 0;
}

.logout-button {
    width: 100%;

    padding: 9px 11px;

    border: 1px solid rgba(255, 255, 255, 0.12);

    border-radius: var(--radius-small);

    background: transparent;

    color: rgba(255, 255, 255, 0.72);

    text-align: left;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    box-shadow: none;
}

.logout-button:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;

    transform: none;
    box-shadow: none;
}

/* =========================
   TOPBAR
   ========================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 80;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;

    min-height: 60px;

    padding: 10px 30px;

    border-bottom: 1px solid var(--border);

    background: rgba(255, 255, 255, 0.94);

    backdrop-filter: blur(12px);
}

.topbar-left {
    display: flex; flex: 1 1 auto;
    align-items: center;
    min-width: 0;
    gap: 14px;
}
.topbar-left > div {min-width: 0}
.page-title {
    margin: 0;

    overflow: hidden;

    color: var(--navy-950);

    font-size: 23px;
    font-weight: 750;

    letter-spacing: -0.02em;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;

    gap: 10px;
}

/* Shared contextual navigation stays left of the heading on every Ratio page. */
.topbar-back-action{flex:0 0 41px;width:41px;height:41px;min-height:41px;padding:0;border-radius:9px}
.topbar-back-icon{display:block;flex:0 0 20px;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.35;stroke-linecap:round;stroke-linejoin:round}
.topbar:has(.topbar-back-action) .topbar-actions{flex:none}
@media(max-width:620px){.topbar:has(.topbar-back-action) .topbar-left{flex:1}.topbar:has(.topbar-back-action) .topbar-left>div{min-width:0;flex:1}.topbar:has(.topbar-back-action) .page-title{max-width:100%}}

/* Editor pages keep the top bar visible at native browser zoom levels. */
body:has([data-tabs]) .topbar {
    position: fixed;
    right: 0;
    left: var(--sidebar-width);
}

body:has([data-tabs]) .content {
    padding-top: calc(var(--tabs-topbar-height, 65px) + 28px);
}

/* Shared detail heading: labels and identifiers always start on the same edge. */
.page-title .editor-page-heading{display:flex;min-width:0;align-items:flex-start;flex-direction:column;gap:2px;overflow:hidden;line-height:1.1;white-space:normal}.page-title .editor-page-heading small{display:block;max-width:min(55vw,620px);margin:0;overflow:hidden;color:var(--muted);font-size:12px;font-weight:600;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.page-title .editor-page-heading small::before{content:none}.editor-topbar-action{position:relative;justify-content:center;width:112px}.editor-action-icon{display:none;flex:0 0 24px;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
/* Ratio article numbers use one consistent emphasis in every interface context. */
.article-number-text{font-weight:700}
@media(max-width:760px){.page-title .editor-page-heading small{max-width:min(48vw,300px)}.editor-topbar-action{display:grid;place-items:center;width:44px;min-width:44px;height:44px;padding:0}.editor-action-icon{display:block}.editor-action-label{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.editor-topbar-action::after{position:absolute;top:calc(100% + 7px);right:0;z-index:120;padding:5px 9px;border-radius:999px;background:var(--navy-900);color:#fff;content:attr(aria-label);font-size:11px;font-weight:650;line-height:1.2;opacity:0;pointer-events:none;transform:translateY(-3px);transition:opacity .14s ease,transform .14s ease;white-space:nowrap}.editor-topbar-action:hover::after,.editor-topbar-action:focus-visible::after{opacity:1;transform:translateY(0)}}
@media(max-width:480px){.page-title .editor-page-heading small{max-width:35vw}.topbar-actions{gap:7px}}

/* =========================
   CONTENT
   ========================= */

.content {
    width: 100%;
    max-width: var(--interface-content-width);

    margin: 0 auto;

    padding: 28px 30px 42px;
}
.app-messages{display:grid;gap:8px;margin:0 0 18px}.app-messages[hidden]{display:none}.app-message{padding:12px 15px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;color:#334155;font-size:14px;opacity:1;transform:translateY(0);transition:opacity .28s ease,transform .28s ease}.app-message.is-leaving{opacity:0;transform:translateY(-10px)}.app-message.error{border-color:#f0b4b0;background:#fff1f0;color:#9f2d26}.app-message.success{border-color:#acd7bb;background:#effaf3;color:#1d6b39}

/* =========================
   BUTTONS
   ========================= */

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    min-height: var(--interface-control-height);

    padding: 8px 12px;

    border: 0;
    border-radius: var(--radius-small);

    background: var(--blue-700);
    color: white;

    font: inherit;

    font-size: var(--interface-value-size);
    font-weight: 700;

    line-height: 1.2;
    text-decoration: none;

    cursor: pointer;

    box-shadow: 0 3px 8px rgba(23, 99, 154, 0.16);

    transition: transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.button:hover,
button:hover {
    color: white;
    background: var(--blue-600);

    transform: translateY(-1px);

    box-shadow: 0 6px 14px rgba(23, 99, 154, 0.20);
}

.button:active,
button:active {
    transform: translateY(0);
}

/* A timeline report opens as a text link. The shared button chrome stays off. */
button.personnel-report-button,
a.personnel-report-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 0;
    margin-top: 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--blue-700);
    font-size: var(--interface-value-size);
    font-weight: 750;
    line-height: 1.4;
    text-decoration: none;
    transform: none;
    cursor: pointer;
}

button.personnel-report-button:is(:hover, :focus-visible, :active),
a.personnel-report-button:is(:hover, :focus-visible) {
    background: none;
    color: var(--navy-900);
    box-shadow: none;
    transform: none;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.personnel-report-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button-accent {
    background: var(--accent);
    color: var(--navy-950);

    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.22);
}

.button-accent:hover {
    background: var(--accent-hover);
    color: var(--navy-950);

    box-shadow: 0 7px 16px rgba(245, 158, 11, 0.28);
}

.button-secondary {
    border: 1px solid var(--border-strong);

    background: white;
    color: var(--navy-800);

    box-shadow: none;
}

.button-secondary:hover {
    border-color: var(--blue-600);

    background: var(--blue-050);
    color: var(--navy-950);

    box-shadow: none;
}

.button-danger {
    background: var(--danger);
}

.button-danger:hover {
    background: #ad3535;
}

/* Keep permission-blocked actions visible without making them interactive. */
.permission-action-disabled {
    display: inline-flex;
    border-radius: var(--radius-small);
    cursor: not-allowed;
}

.permission-action-disabled > button:disabled,
.permission-action-disabled > button:disabled:hover {
    border-color: #d6dce1;
    background: #e9edf0;
    color: #87939c;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
    transform: none;
}

.icon-button-danger {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #e3b6b6;
    border-radius: 7px;
    background: #fff5f5;
    color: #b63838;
    cursor: pointer;
}

.icon-button-danger:hover {
    border-color: #c94a4a;
    background: #fde8e8;
    color: #992c2c;
}

.icon-button-danger svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
/* Dialog visibility must override the generic inline-flex button presentation. */
.unsaved-modal[hidden], .unsaved-modal-actions .button[hidden] { display: none; }
.unsaved-modal { position: fixed; z-index: 1200; inset: 0; display: grid; place-items: center; padding: 20px; }
.unsaved-modal-backdrop { position: absolute; inset: 0; background: rgba(7,23,39,.58); backdrop-filter: blur(3px); }
.unsaved-modal-panel { position: relative; width: min(450px,100%); padding: 26px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 24px 70px rgba(7,23,39,.3); }
.unsaved-modal-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 15px; border-radius: 50%; background: #fff3dc; color: #a96100; font-size: 23px; font-weight: 850; }
.unsaved-modal-panel h2 { margin: 0 0 8px; color: var(--navy-950); font-size: 19px; text-align: center; }
.unsaved-modal-panel p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; text-align: center; }
.unsaved-modal-panel .confirm-modal-warning { margin: 0 0 8px; color: var(--danger); font-weight: 800; }
.unsaved-modal-panel [data-confirm-details] { display:grid; gap:8px; margin:14px 0 0; padding:10px 12px; border:1px solid var(--interface-border); border-radius:10px; background:var(--interface-view-field-surface); text-align:left; }
.unsaved-modal-panel [data-confirm-details][hidden] { display:none; }
.unsaved-modal-panel [data-confirm-details-title] { margin:0; color:var(--muted); font-size:var(--interface-label-size); font-weight:750; text-align:left; }
.unsaved-modal-panel [data-confirm-details-list] { display:grid; gap:8px; margin:0; padding:0; list-style:none; }
.unsaved-modal-panel [data-confirm-details-list] li { display:flex; justify-content:space-between; align-items:baseline; gap:12px; color:var(--navy-800); font-size:13px; line-height:1.35; }
.unsaved-modal-panel [data-confirm-details-list] strong { font-weight:750; }
.unsaved-modal-panel [data-confirm-details-list] span { color:var(--navy-700); font-weight:650; white-space:nowrap; }
.unsaved-modal-actions { display: flex; justify-content: center; gap: 10px; margin-top: 23px; }
.unsaved-modal-actions .button { min-width: 100px; justify-content: center; }
@media(max-width:480px){.unsaved-modal-actions{align-items:stretch;flex-direction:column}.unsaved-modal-actions .button{width:100%}}

.actions {
    display: flex;
    flex-wrap: wrap;

    gap: 10px;

    margin-bottom: 20px;
}

/* =========================
   CARDS
   ========================= */

.card {
    margin-bottom: 20px;

    padding: var(--interface-card-padding);

    border: 1px solid var(--interface-border);
    border-radius: var(--interface-card-radius);

    background: var(--surface);

    box-shadow: var(--shadow-small);
}

.card:last-child {
    margin-bottom: 0;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 14px;

    margin-bottom: 18px;
    padding-bottom: 14px;

    border-bottom: 1px solid var(--interface-divider);
}

.card-title {
    margin: 0;

    color: var(--navy-950);

    font-size: var(--interface-heading-size);
    font-weight: 700;
    line-height: 1.25;
}

.card-subtitle {
    margin: 2px 0 0;

    color: var(--muted);

    font-size: var(--interface-helper-size);
    font-weight: 500;
    line-height: 1.5;
}

/* =========================
   HERO
   ========================= */

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 28px;

    padding: 27px;

    border-color: rgba(49, 146, 208, 0.14);

    background: linear-gradient(
            135deg,
            var(--blue-100) 0%,
            white 68%
    );
}

.hero h1,
.hero h2 {
    margin: 0 0 7px;

    color: var(--navy-950);

    font-size: 27px;

    letter-spacing: -0.025em;
}

.hero p {
    max-width: 680px;

    margin: 0;

    color: var(--muted);
}

/* =========================
   STATISTICS
   ========================= */

.stats-grid {
    display: grid;

    grid-template-columns:
                repeat(4, minmax(0, 1fr));

    gap: 16px;

    margin-bottom: 20px;
}

.stat-card {
    position: relative;

    overflow: hidden;

    min-height: 138px;

    padding: 20px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: white;

    box-shadow: var(--shadow-small);
}

.stat-card::after {
    position: absolute;
    inset: 0 0 auto;

    height: 3px;

    background: var(--blue-500);

    content: "";
}

.stat-label {
    margin-bottom: 11px;

    color: var(--muted);

    font-size: 13px;
    font-weight: 650;
}

.stat-value {
    color: var(--navy-900);

    font-size: 31px;
    font-weight: 800;

    letter-spacing: -0.03em;
}

.stat-note {
    margin-top: 7px;

    color: var(--muted);

    font-size: 12px;
}

.grid-2 {
    display: grid;

    grid-template-columns:
                minmax(0, 2fr)
                minmax(280px, 1fr);

    gap: 20px;
}

.grid-equal {
    display: grid;

    grid-template-columns:
                repeat(2, minmax(0, 1fr));

    gap: 20px;
}

/* =========================
   TABLES
   ========================= */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 12px;

    border-bottom: 1px solid #e9eff4;

    text-align: left;
    vertical-align: middle;

    font-size: var(--interface-value-size);
}

th {
    color: var(--muted);
    background: var(--blue-050);

    font-size: var(--interface-label-size);
    font-weight: 750;

    letter-spacing: 0.03em;
    text-transform: uppercase;
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: #f8fbfd;
}

tbody tr:last-child td {
    border-bottom: 0;
}

td a {
    font-weight: 700;
    text-decoration: none;
}

/* =========================
   STATUS
   ========================= */

.status {background: var(--blue-100);color: var(--blue-700);}

.status-success {
    background: var(--success-light);
    color: var(--success);
}

.status-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.status-neutral {
    background: #eef1f3;
    color: var(--muted);
}

/* =========================
   FORMS
   ========================= */

form p {
    margin: 0 0 18px;
}

label {
    display: block;

    margin-bottom: 5px;

    color: var(--navy-900);

    font-size: var(--interface-label-size);
    font-weight: 750;
    line-height: 1.5;
}

input,
select,
textarea {
    width: 100%;
    min-height: var(--interface-control-height);

    padding: var(--interface-control-padding);

    border: 1px solid var(--border-strong);
    border-radius: var(--radius-small);

    outline: none;

    background: white;
    color: var(--text);

    font-family: inherit;
    font-size: var(--interface-value-size);
    font-weight: 450;
    line-height: 1.5;

    transition: border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

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

select:not([multiple]) {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 48px;
    background-color: white;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%23586f82' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
        linear-gradient(var(--border), var(--border));
    background-repeat: no-repeat, no-repeat;
    background-position: right 13px center, right 39px center;
    background-size: 12px 8px, 1px 56%;
    cursor: pointer;
}

select:not([multiple]):disabled {
    cursor: not-allowed;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue-500);

    box-shadow: 0 0 0 3px rgba(49, 146, 208, 0.14);
}

ul.errorlist {
    margin: 0 0 7px;
    padding: 0;

    list-style: none;
}

ul.errorlist li {
    color: var(--danger);

    font-size: 12px;
    font-weight: 650;
}

.helptext {
    display: block;

    margin-top: 2px;

    color: var(--muted);

    font-size: var(--interface-helper-size);
    font-weight: 500;
    line-height: 1.5;
}

/* =========================
   DETAILS
   ========================= */

.details {
    display: grid;

    grid-template-columns:
                190px minmax(0, 1fr);

    margin: 0;
}

.details dt,
.details dd {
    padding: 13px 0;

    border-bottom: 1px solid #edf1f5;
}

.details dt {
    color: var(--muted);

    font-size: 13px;
    font-weight: 700;
}

.details dd {
    margin: 0;

    color: var(--text);

    white-space: pre-wrap;
}

/* =========================
   LOGIN
   ========================= */

.login-page {
    display: grid;
    place-items: center;

    min-height: 100vh;

    padding: 24px;

    background: radial-gradient(
            circle at 18% 18%,
            rgba(49, 146, 208, 0.24),
            transparent 32%
    ),
    linear-gradient(
            145deg,
            var(--navy-950),
            var(--navy-800)
    );
}

.login-wrapper {
    width: min(430px, 100%);
}

.login-logo {
    display: flex;
    justify-content: center;

    margin-bottom: 20px;
}

.login-brand-logo {
    display: block;

    width: 210px;
    max-width: 80%;

    height: auto;
}

.login-card {
    padding: 28px;

    border: 1px solid rgba(255, 255, 255, 0.20);

    border-radius: var(--radius-large);

    background: white;

    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.22);
}

.login-card h1 {
    margin: 0 0 7px;

    color: var(--navy-950);

    font-size: 25px;
}

.login-intro {
    margin: 0 0 22px;

    color: var(--muted);

    font-size: 14px;
}

.login-card button {
    width: 100%;
}

/* =========================
   MOBILE
   ========================= */

.mobile-menu-button {
    display: none;

    align-items: center;
    justify-content: center;

    flex: 0 0 44px;
    width: 44px;
    height: 44px;

    padding: 0;

    border: 1px solid var(--border);

    background: white;
    color: var(--navy-900);

    box-shadow: none;
}

.mobile-menu-icon {
    display: block;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.mobile-overlay {
    display: none;
}

/* =========================
   COMPACT DESKTOP SIDEBAR
   ========================= */

.sidebar-collapse-button {
    position: fixed;
    top: 76px;
    left: calc(var(--sidebar-width) - 13px);
    z-index: 110;
    transition: left .2s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}

/* Shared arrow controls collapse navigation and editing drawers with the same geometry. */
.panel-collapse-button {
    width: 26px;
    min-width: 26px;
    height: 26px;
    min-height: 26px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: #fff;
    color: var(--blue-700);
    box-shadow: 0 2px 8px rgba(7,23,39,.14);
}
.panel-collapse-button:hover {
    border-color: var(--blue-500);
    background: var(--blue-050);
    color: var(--navy-800);
    transform: none;
    box-shadow: 0 3px 10px rgba(7,23,39,.18);
}
.panel-collapse-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .2s ease;
}

@media (min-width: 821px) {
    html.sidebar-is-collapsed {
        --sidebar-width: 76px;
    }
    .sidebar,
    .app-layout {
        transition: width .2s ease, grid-template-columns .2s ease;
    }
    html.sidebar-is-collapsed .sidebar {
        padding-inline: 10px;
    }
    html.sidebar-is-collapsed .sidebar-brand-zone {
        flex-basis: 126px;
    }
    html.sidebar-is-collapsed .sidebar-brand {
        width: 56px;
        height: 82px;
    }
    html.sidebar-is-collapsed .brand-logo {
        display: none;
    }
    html.sidebar-is-collapsed .brand-logo-small {
        position: absolute;
        top: 19px;
        left: 5px;
        display: block;
        width: 46px;
        height: 46px;
        object-fit: contain;
    }
    html.sidebar-is-collapsed .sidebar-collapse-button svg {
        transform: rotate(180deg);
    }
    html.sidebar-is-collapsed .sidebar-link,
    html.sidebar-is-collapsed .sidebar-group-button,
    html.sidebar-is-collapsed .sidebar-single-link {
        justify-content: center;
        width: 100%;
        margin-left: 0;
        padding-inline: 0;
        gap: 0;
    }
    html.sidebar-is-collapsed .sidebar-link > span:not(.menu-icon),
    html.sidebar-is-collapsed .sidebar-group-name,
    html.sidebar-is-collapsed .sidebar-chevron,
    html.sidebar-is-collapsed .sidebar-single-link > span:not(.menu-icon),
    html.sidebar-is-collapsed .sidebar-submenu,
    html.sidebar-is-collapsed .user-details,
    html.sidebar-is-collapsed .logout-form {
        display: none;
    }
    html.sidebar-is-collapsed .sidebar-divider {
        margin-inline: 5px;
    }
    html.sidebar-is-collapsed .sidebar-ria {
        right: 8px;
        bottom: 2px;
        left: 8px;
        justify-content: center;
        width: auto;
        height: 34px;
        padding: 0;
        border-radius: 10px;
    }
    html.sidebar-is-collapsed .sidebar-ria-label,
    html.sidebar-is-collapsed .sidebar-ria-status {
        display: none;
    }
    html.sidebar-is-collapsed .sidebar-user {
        display: flex;
        justify-content: center;
    }
    html.sidebar-is-collapsed .user-card {
        margin: 0;
        padding: 6px;
        background: transparent;
    }
    html.sidebar-is-collapsed .sidebar .sidebar-link.active::before,
    html.sidebar-is-collapsed .sidebar .sidebar-group-button.active::before,
    html.sidebar-is-collapsed .sidebar .sidebar-single-link.active::before {
        left: 1px;
    }
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 1100px) {

    .stats-grid {
        grid-template-columns:
                    repeat(2, minmax(0, 1fr));
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {

    .sidebar-collapse-button {
        display: none;
    }

    .app-layout {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);

        transition: transform 0.22s ease;
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .app-main {
        min-width: 0;
    }

    .mobile-menu-button {
        display: inline-flex;
    }

    .topbar {
        min-height: 60px;

        padding: 10px 18px;
    }

    body:has([data-tabs]) .topbar {
        left: 0;
    }

    body:has([data-tabs]) .content {
        padding-top: calc(var(--tabs-topbar-height, 65px) + 20px);
    }

    .topbar-left {
        display: flex;
        align-items: center;

        gap: 12px;
    }

    .page-title {
        max-width: 240px;

        font-size: 20px;
    }

    .content {
        padding: 20px 18px 34px;
    }

    body.menu-open
    .mobile-overlay {
        position: fixed;
        inset: 0;
        z-index: 90;

        display: block;

        background: rgba(7, 23, 39, 0.55);
    }

    .hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid-equal {
        grid-template-columns: 1fr;
    }
}

.relation-link {
    color: inherit;
    text-decoration: none;
}

.relation-link:hover {
    color: #0067a5;
    text-decoration: underline;
}

@media (max-width: 620px) {

    .topbar-actions
    .button-text {
        display: none;
    }

    .content {
        padding-inline: 14px;
    }

    .card {
        padding: 18px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .details {
        grid-template-columns: 1fr;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        margin-bottom: 12px;

        padding: 10px;

        border: 1px solid var(--border);
        border-radius: var(--radius-small);

        background: white;
    }

    td {
        padding: 6px 2px;
        border: 0;
    }
}

/* =========================
   RELATION SEARCH AND FILTERS
   ========================= */

.relation-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 18px;

    margin-bottom: 18px;
}

.relation-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 8px;
}

.relation-search {
    display: flex;
    align-items: center;

    gap: 12px;

    width: min(100%, 420px);
    margin-left: 0;
    margin-right: auto;
}

.relation-search input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}

.relation-search .button {
    flex: 0 0 auto;
}

@media (max-width: 760px) {
    .relation-search {
        width: 100%;
        margin-left: 0;
    }
}

/* =========================
   RELATION TOOLBAR
   ========================= */

.relation-toolbar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    gap: 14px;

    margin: 18px 0;
}

/* Search bar. */

.relation-search {
    display: flex;
    align-items: center;

    gap: 10px;
}

.relation-search input[type="search"] {
    width: 340px;
    height: 42px;

    padding: 0 14px;

    border: 1px solid var(--border-strong);
    border-radius: var(--radius-small);

    background: white;
    color: var(--text);

    font: inherit;
    font-size: 14px;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.relation-search input[type="search"]:focus {
    border-color: var(--blue-500);

    box-shadow:
        0 0 0 3px rgba(49, 146, 208, 0.10);
}

/* Filter buttons. */

.relation-tabs {
    display: flex;
    align-items: center;

    gap: 6px;

    padding: 4px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--blue-050);
}

.relation-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 34px;

    padding: 6px 13px;

    border-radius: 7px;

    color: var(--muted);

    font-size: 13px;
    font-weight: 650;

    text-decoration: none;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease;
}

.relation-tab:hover {
    background: rgba(255, 255, 255, 0.75);
    color: var(--navy-900);
}

.relation-tab.active {
    background: white;
    color: var(--blue-700);

    box-shadow:
        0 1px 4px rgba(7, 23, 39, 0.08);
}

/* Shared checkbox control for all forms. */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    display: inline-grid;
    place-content: center;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    min-height: 20px;
    margin: 0;
    padding: 0;
    border: 1.5px solid #9eafbd;
    border-radius: 5px;
    background: #fff;
    color: #fff;
    vertical-align: middle;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease,
        box-shadow .15s ease, transform .1s ease;
}

input[type="checkbox"]::before {
    width: 9px;
    height: 5px;
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
    content: "";
    opacity: 0;
    transform: translateY(-1px) rotate(-45deg) scale(.65);
    transition: opacity .12s ease, transform .12s ease;
}

input[type="checkbox"]:hover {
    border-color: var(--blue-600);
    background: var(--blue-050);
}

input[type="checkbox"]:checked {
    border-color: var(--blue-600);
    background: var(--blue-600);
    box-shadow: 0 2px 6px rgba(31, 120, 180, .2);
}

input[type="checkbox"]:checked::before {
    opacity: 1;
    transform: translateY(-1px) rotate(-45deg) scale(1);
}

input[type="checkbox"]:focus-visible {
    border-color: var(--blue-600);
    outline: none;
    box-shadow: 0 0 0 3px rgba(49, 146, 208, .18);
}

input[type="checkbox"]:active {
    transform: scale(.92);
}

input[type="checkbox"]:disabled {
    border-color: #cad4dc;
    background: #edf1f4;
    cursor: not-allowed;
    opacity: .7;
}

/* Shared boolean choice cards follow the central field and interaction contract. */
.boolean-choice{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:46px;margin:0;padding:10px 12px;border:1px solid var(--border-strong);border-radius:var(--radius-small);background:var(--surface);color:var(--text);cursor:pointer;transition:border-color .15s ease,background .15s ease,box-shadow .15s ease}.boolean-choice:hover{border-color:var(--blue-500);background:var(--blue-050)}.boolean-choice:focus-within{border-color:var(--blue-600);box-shadow:0 0 0 3px rgba(49,146,208,.14)}.boolean-choice:has(input:checked){border-color:var(--blue-500);background:var(--blue-050)}
.boolean-choice>strong{font-size:12px}.boolean-choice>span:not(.info-tip){display:flex;flex-direction:column}.boolean-choice>.info-tip{margin-left:auto}.boolean-choice.is-disabled,.boolean-choice:has(input:disabled){border-color:var(--border);background:#edf1f4;cursor:not-allowed;opacity:.72}.boolean-choice.has-error{border-color:var(--danger);background:var(--danger-light);box-shadow:0 0 0 2px rgba(201,66,66,.08)}
/* Every pill switch shares one neutral off mark while features may tune only its geometry and on colour. */
.ratio-switch{--ratio-switch-width:40px;--ratio-switch-height:23px;--ratio-switch-thumb-size:17px;--ratio-switch-inset:3px;--ratio-switch-travel:17px;--ratio-switch-off-background:#c9d3dc;--ratio-switch-off-border:transparent;--ratio-switch-on-background:var(--blue-600);--ratio-switch-on-border:transparent;position:relative;display:inline-block;box-sizing:border-box;flex:0 0 var(--ratio-switch-width);width:var(--ratio-switch-width);height:var(--ratio-switch-height);border:1px solid var(--ratio-switch-off-border);border-radius:999px;background:var(--ratio-switch-off-background);color:var(--muted);transition:background-color .15s ease,border-color .15s ease}
.ratio-switch>i{position:absolute;z-index:1;top:var(--ratio-switch-inset);left:var(--ratio-switch-inset);width:var(--ratio-switch-thumb-size);height:var(--ratio-switch-thumb-size);border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(7,23,39,.2);transition:transform .15s ease}
input:not(:checked)+.ratio-switch::after{position:absolute;top:calc(50% - 1px);right:calc(var(--ratio-switch-inset) + 2px);color:currentColor;content:"×";font-size:calc(var(--ratio-switch-height) * .58);font-weight:700;line-height:1;transform:translateY(-54%)}
input:checked+.ratio-switch{border-color:var(--ratio-switch-on-border);background:var(--ratio-switch-on-background)}
input:checked+.ratio-switch>i{transform:translateX(var(--ratio-switch-travel))}
input:focus-visible+.ratio-switch{outline:2px solid var(--blue-600);outline-offset:2px}
input:disabled+.ratio-switch{opacity:.62}
/* The compact variant keeps the off mark aligned with the active thumb. */
.ratio-switch-compact{--ratio-switch-width:38px;--ratio-switch-height:22px;--ratio-switch-thumb-size:16px;--ratio-switch-inset:3px;--ratio-switch-travel:16px;--ratio-switch-off-background:#c5d0d8}
input:not(:checked)+.ratio-switch-compact::after{top:50%;right:var(--ratio-switch-inset);display:grid;place-items:center;width:var(--ratio-switch-thumb-size);height:var(--ratio-switch-thumb-size);font-size:12px;line-height:1;transform:translateY(-50%)}
/* Read-only and editable booleans share one round mark. */
.boolean-value,.boolean-value-control{display:inline-flex;align-items:center;gap:8px;margin:0;color:var(--navy-900);font-size:12px;font-weight:650;line-height:1.2;white-space:nowrap}.boolean-value{cursor:default}.boolean-value-control{position:relative;cursor:pointer}.boolean-value>i,.boolean-value-control>i{display:inline-grid;flex:0 0 18px;width:18px;height:18px;border-radius:50%;place-items:center;background:#edf1f4;color:#8b98a5}.boolean-value>i svg,.boolean-value-control>i svg{display:block;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}.boolean-value.is-on>i,.boolean-value-control:has(input:checked)>i{background:var(--blue-100);color:var(--blue-700)}.boolean-value-control>input[type=checkbox],label.boolean-value-control>input[type=checkbox]{position:absolute;z-index:1;inset:0 auto 0 0;box-sizing:border-box;width:18px;max-width:18px;height:18px;min-height:18px;margin:0;padding:0;opacity:0;cursor:inherit}.boolean-value-control>i svg.boolean-value-on,.boolean-value-control:has(input:checked)>i svg.boolean-value-off{display:none}.boolean-value-control:has(input:checked)>i svg.boolean-value-on{display:block}.boolean-value-control:has(input:disabled){cursor:default}.boolean-value-control:focus-within>i{box-shadow:0 0 0 3px rgba(49,146,208,.18)}
label.boolean-value-control{display:inline-flex!important;margin:0!important}
