/* ======================================================================
   LLT Operational Desktop / Tablet Refinement
   This file intentionally scopes visual changes to >= 761px so the
   existing phone experience remains intact.
   ====================================================================== */

@media (max-width: 760px) {
    .desktop-only { display: none !important; }

    /* Only new mobile element: account Active/Inactive control. */
    .user-active-toggle {
        min-height: 58px;
        margin: 0 !important;
        padding: 10px 12px;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface-2);
    }
    .user-active-toggle__copy strong { display: block; font-size: 13px; }
    .user-active-toggle__copy small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
    .toggle-checkbox { position: absolute; opacity: 0; pointer-events: none; }
    .toggle-switch { position: relative; width: 44px; height: 26px; flex: 0 0 auto; border-radius: 999px; background: var(--border-strong); }
    .toggle-switch i { position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.18); transition: transform 180ms ease; }
    .toggle-checkbox:checked + .toggle-switch { background: #2f9e68; }
    .toggle-checkbox:checked + .toggle-switch i { transform: translateX(18px); }
    [dir="rtl"] .toggle-checkbox:checked + .toggle-switch i { transform: translateX(-18px); }
}

@media (min-width: 761px) {
    :root {
        --desktop-content-max: 1560px;
        --desktop-gutter: clamp(22px, 2.2vw, 42px);
        --desktop-section-gap: 22px;
        --desktop-control-height: 42px;
        --desktop-radius-panel: 14px;
        --desktop-radius-card: 12px;
        --desktop-shadow-panel: 0 1px 2px rgba(15,23,42,.04), 0 10px 30px rgba(15,23,42,.07);
        --desktop-shadow-raised: 0 2px 5px rgba(15,23,42,.05), 0 18px 44px rgba(15,23,42,.10);
        --desktop-ease: cubic-bezier(.2,.8,.2,1);
        --desktop-fast: 120ms;
        --desktop-state: 190ms;
    }

    html[data-theme="dark"] {
        --desktop-shadow-panel: 0 1px 2px rgba(0,0,0,.20), 0 14px 34px rgba(0,0,0,.24);
        --desktop-shadow-raised: 0 4px 12px rgba(0,0,0,.22), 0 22px 52px rgba(0,0,0,.34);
    }

    /* Shell / scale ---------------------------------------------------- */
    body {
        font-size: 15.5px;
        line-height: 1.55;
    }

    .page-shell {
        width: min(calc(100% - (var(--desktop-gutter) * 2)), var(--desktop-content-max));
        max-width: none;
        padding: 34px 0 64px;
    }

    .app-header {
        height: 74px;
        border-bottom-color: color-mix(in srgb, var(--border) 82%, transparent);
        box-shadow: 0 1px 0 rgba(15,23,42,.02), 0 8px 26px rgba(15,23,42,.035);
    }

    html[data-theme="dark"] .app-header {
        box-shadow: 0 1px 0 rgba(255,255,255,.015), 0 10px 30px rgba(0,0,0,.20);
    }

    .app-header__inner {
        width: min(calc(100% - (var(--desktop-gutter) * 2)), var(--desktop-content-max));
        max-width: none;
        padding-inline: 0;
        gap: 20px;
    }

    .brand__logo {
        width: 92px;
        max-height: 48px;
        object-fit: contain;
    }

    .desktop-nav {
        gap: 4px;
        padding: 4px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: color-mix(in srgb, var(--surface-2) 92%, transparent);
    }

    .nav-link {
        position: relative;
        min-height: 40px;
        padding-inline: 12px;
        border-radius: 9px;
        font-size: 13px;
        font-weight: 650;
        gap: 7px;
        color: var(--muted);
        transition: color var(--desktop-fast) var(--desktop-ease), background-color var(--desktop-fast) var(--desktop-ease), transform var(--desktop-fast) var(--desktop-ease);
    }

    .nav-link:hover {
        color: var(--text);
        background: var(--surface-3);
        transform: translateY(-1px);
    }

    .nav-link.is-active {
        color: var(--text);
        background: var(--surface);
        box-shadow: 0 1px 2px rgba(15,23,42,.05), inset 0 0 0 1px color-mix(in srgb, var(--gold) 18%, var(--border));
    }

    .nav-link.is-active::after {
        content: '';
        position: absolute;
        inset-inline: 11px;
        bottom: -5px;
        height: 2px;
        border-radius: 999px;
        background: var(--gold);
        transform-origin: center;
        animation: lltNavActive 180ms var(--desktop-ease) both;
    }

    .nav-icon-svg {
        width: 17px;
        height: 17px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
        flex: 0 0 auto;
        color: var(--gold-dark);
    }

    .header-actions { gap: 8px; }
    .header-select, .icon-button { min-height: 40px; height: 40px; border-radius: 9px; }
    .account-menu { min-height: 44px; border-radius: 11px; }
    .account-avatar { width: 33px; height: 33px; }
    .account-copy strong { font-size: 12.5px; }
    .account-copy small { font-size: 10.5px; }

    /* Contextual page heading ----------------------------------------- */
    .dashboard-heading, .page-heading {
        margin-bottom: var(--desktop-section-gap);
    }

    .dashboard-heading {
        padding: 2px 2px 0;
        align-items: center;
    }

    .dashboard-heading h1, .page-heading h1 {
        margin: 5px 0 5px;
        font-size: clamp(30px, 2.2vw, 36px);
        line-height: 1.12;
        font-weight: 720;
        letter-spacing: -.025em;
    }

    html[lang="ar"] .dashboard-heading h1,
    html[lang="ar"] .page-heading h1 {
        letter-spacing: 0;
        font-weight: 700;
    }

    .dashboard-heading p, .page-heading p {
        max-width: 760px;
        font-size: 14.5px;
        line-height: 1.6;
    }

    .eyebrow, .section-kicker {
        font-size: 10.5px;
        letter-spacing: .07em;
    }

    .dashboard-new-order { min-width: 144px; }

    /* Buttons / controls ---------------------------------------------- */
    .btn {
        min-height: var(--desktop-control-height);
        border-radius: 9px;
        padding-inline: 15px;
        font-size: 13px;
        font-weight: 680;
        box-shadow: 0 1px 2px rgba(15,23,42,.035);
        transition: transform var(--desktop-fast) var(--desktop-ease), box-shadow var(--desktop-fast) var(--desktop-ease), background-color var(--desktop-state) var(--desktop-ease), border-color var(--desktop-state) var(--desktop-ease), opacity var(--desktop-state) var(--desktop-ease);
    }

    .btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(15,23,42,.09); }
    .btn:active { transform: scale(.985); }
    .btn-large { min-height: 46px; border-radius: 10px; }
    .btn-primary { box-shadow: 0 2px 6px rgba(159,112,20,.16), 0 8px 18px rgba(159,112,20,.10); }
    .btn-primary:hover { box-shadow: 0 4px 10px rgba(159,112,20,.19), 0 12px 25px rgba(159,112,20,.14); }

    /* Store-manager operational scope -------------------------------- */
    .manager-scope-panel {
        margin-bottom: 16px;
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 7px 8px 7px 12px;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: var(--surface-2);
        box-shadow: 0 1px 2px rgba(15,23,42,.025);
    }

    [dir="rtl"] .manager-scope-panel { padding: 7px 12px 7px 8px; }

    .scope-panel-label {
        flex: 0 0 auto;
        color: var(--muted);
        font-size: 11px;
        font-weight: 700;
        padding-inline: 4px;
    }

    .manager-scope-tabs {
        flex: 1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
        padding: 3px;
        border: 0;
        background: var(--surface-3);
        border-radius: 10px;
    }

    .manager-scope-tab {
        min-height: 44px;
        padding: 6px 10px;
        border: 1px solid transparent;
        border-radius: 8px;
        background: transparent;
        box-shadow: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 9px;
    }

    .manager-scope-tab::before { display: none; }
    .manager-scope-tab:hover { transform: none; background: color-mix(in srgb, var(--surface) 55%, transparent); }
    .manager-scope-tab.is-active {
        background: var(--surface);
        border-color: color-mix(in srgb, var(--gold) 20%, var(--border));
        box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 3px 10px rgba(15,23,42,.05);
    }
    .manager-scope-tab__copy { min-width: 0; }
    .manager-scope-tab__copy strong { font-size: 12.5px; }
    .manager-scope-tab__copy small { display: none; }
    .manager-scope-tab__count {
        min-width: 28px;
        height: 25px;
        display: inline-grid;
        place-items: center;
        padding: 0 7px;
        border-radius: 7px;
        font-size: 11px;
        background: var(--surface-2);
        color: var(--muted);
    }
    .manager-scope-tab.is-active .manager-scope-tab__count { background: var(--gold-soft); color: var(--gold-dark); }

    /* General Manager branch scope ----------------------------------- */
    .gm-branch-scope {
        min-height: 50px;
        margin-bottom: 16px;
        padding: 7px 9px 7px 13px;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: var(--surface-2);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }
    [dir="rtl"] .gm-branch-scope { padding: 7px 13px 7px 9px; }
    .gm-branch-scope__label { flex: 0 0 auto; }
    .branch-segmented {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: 3px;
        border-radius: 10px;
        background: var(--surface-3);
    }
    .branch-segmented__button {
        min-width: 86px;
        min-height: 34px;
        padding-inline: 13px;
        border: 1px solid transparent;
        border-radius: 8px;
        background: transparent;
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
        cursor: pointer;
        transition: color var(--desktop-fast) var(--desktop-ease), background-color var(--desktop-fast) var(--desktop-ease), border-color var(--desktop-fast) var(--desktop-ease), box-shadow var(--desktop-fast) var(--desktop-ease);
    }
    .branch-segmented__button:hover { color: var(--text); }
    .branch-segmented__button.is-active {
        color: var(--text);
        background: var(--surface);
        border-color: color-mix(in srgb, var(--gold) 20%, var(--border));
        box-shadow: 0 1px 3px rgba(15,23,42,.07);
    }

    /* Quick overview -------------------------------------------------- */
    .summary-section { margin-bottom: 18px; }
    .section-heading-row { margin-bottom: 8px; padding-inline: 2px; }
    .result-count {
        min-height: 28px;
        padding: 0 9px;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--surface-2);
        font-size: 11px;
    }
    .summary-grid { gap: 8px; }
    .summary-card {
        min-height: 82px;
        padding: 12px 13px;
        border-radius: var(--desktop-radius-card);
        box-shadow: 0 1px 2px rgba(15,23,42,.035), 0 7px 18px rgba(15,23,42,.045);
        gap: 5px 8px;
    }
    .summary-card::after { width: 2px; opacity: .62; }
    .summary-card::before {
        content: '';
        position: absolute;
        inset-inline: 9px;
        bottom: 0;
        height: 2px;
        border-radius: 999px 999px 0 0;
        background: var(--accent);
        transform: scaleX(0);
        opacity: 0;
        transition: transform var(--desktop-state) var(--desktop-ease), opacity var(--desktop-state) var(--desktop-ease);
    }
    .summary-card:hover {
        transform: translateY(-1px);
        box-shadow: 0 3px 8px rgba(15,23,42,.055), 0 13px 30px rgba(15,23,42,.075);
    }
    .summary-card.is-active {
        background: color-mix(in srgb, var(--accent) 5%, var(--surface));
        border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
        box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 8%, transparent), 0 11px 24px rgba(15,23,42,.06);
    }
    .summary-card.is-active::before { transform: scaleX(1); opacity: 1; }
    .summary-card strong {
        font-size: 27px;
        font-weight: 710;
        letter-spacing: -.025em;
    }
    html[lang="ar"] .summary-card strong { letter-spacing: 0; }
    .summary-label { font-size: 11.5px; font-weight: 650; }
    .summary-dot { width: 7px; height: 7px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }

    /* Workspace / filters -------------------------------------------- */
    .workspace-card {
        border-radius: var(--desktop-radius-panel);
        box-shadow: var(--desktop-shadow-panel);
        overflow: hidden;
    }
    .workspace-toolbar {
        padding: 13px 14px;
        background: color-mix(in srgb, var(--surface-2) 90%, var(--surface));
        border-bottom-color: var(--border);
    }
    .toolbar-title {
        margin: 0 0 7px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    .active-filter-indicator {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 650;
    }
    .active-filter-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

    .filter-bar {
        display: grid;
        grid-template-columns: minmax(360px, 2.4fr) minmax(145px, .8fr) minmax(165px, .9fr) auto;
        gap: 8px;
        align-items: center;
    }
    .filter-options { display: contents; }
    /* Branch is a first-class GM scope on desktop, not a duplicate filter.
       The native select remains in the DOM for form submission and stays
       available on mobile where the segmented scope is intentionally hidden. */
    .filter-bar select[name="branch"] { display: none; }
    .filter-actions { display: flex; gap: 7px; }
    .filter-actions .btn { min-height: 40px; white-space: nowrap; }
    .filter-bar input, .filter-bar select {
        min-height: 40px;
        border-radius: 9px;
        font-size: 12.5px;
        padding-block: 8px;
    }
    .search-field input { padding-inline-start: 36px; padding-inline-end: 70px; }
    .search-icon { inset-inline-start: 12px; font-size: 16px; }
    .search-clear {
        position: absolute;
        inset-inline-end: 38px;
        inset-block-start: 50%;
        transform: translateY(-50%);
        width: 24px;
        height: 24px;
        border: 0;
        border-radius: 6px;
        background: transparent;
        color: var(--muted);
        cursor: pointer;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--desktop-fast) var(--desktop-ease), background-color var(--desktop-fast) var(--desktop-ease), color var(--desktop-fast) var(--desktop-ease);
    }
    .search-field.has-value .search-clear { opacity: 1; pointer-events: auto; }
    .search-clear:hover { background: var(--surface-3); color: var(--text); }
    .search-shortcut {
        position: absolute;
        inset-inline-end: 10px;
        inset-block-start: 50%;
        transform: translateY(-50%);
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        display: inline-grid;
        place-items: center;
        border: 1px solid var(--border);
        border-bottom-color: var(--border-strong);
        border-radius: 6px;
        background: var(--surface-2);
        color: var(--soft-text);
        font: 600 10px/1 "Segoe UI", sans-serif;
        box-shadow: 0 1px 1px rgba(15,23,42,.04);
    }
    .search-field:focus-within .search-shortcut { opacity: 0; }

    /* Desktop table --------------------------------------------------- */
    .orders-table-wrap {
        max-height: max(360px, calc(100vh - 390px));
        background: var(--surface);
        scrollbar-gutter: stable;
    }
    .operational-table {
        min-width: 1240px;
        table-layout: auto;
    }
    .operational-table th {
        padding: 11px 13px;
        font-size: 11.5px;
        font-weight: 680;
        letter-spacing: .015em;
        background: color-mix(in srgb, var(--surface-2) 94%, var(--surface));
        box-shadow: 0 1px 0 var(--border);
    }
    .operational-table td {
        padding: 14px 13px;
        font-size: 13px;
        transition: background-color var(--desktop-state) var(--desktop-ease);
    }
    .operational-table tbody tr { position: relative; }
    .operational-table .clickable-row:hover {
        background: color-mix(in srgb, var(--gold) 2.3%, var(--surface));
        box-shadow: inset 2px 0 0 color-mix(in srgb, var(--gold) 78%, transparent);
    }
    [dir="rtl"] .operational-table .clickable-row:hover { box-shadow: inset -2px 0 0 color-mix(in srgb, var(--gold) 78%, transparent); }
    .order-title-cell { min-width: 245px; }
    .order-title-cell strong {
        min-width: 0;
        max-width: 360px;
        font-size: 13.5px;
        font-weight: 700;
        line-height: 1.35;
    }
    .order-title-secondary {
        display: block;
        max-width: 360px;
        margin-top: 4px;
        color: var(--muted);
        font-size: 10.5px;
        line-height: 1.35;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .system-number { min-height: 26px; border-radius: 7px; font-size: 10.5px; }
    .table-phone {
        color: var(--text);
        font-size: 12.5px;
        text-decoration: none;
        white-space: nowrap;
    }
    .table-phone:hover { color: var(--gold-dark); text-decoration: underline; text-underline-offset: 3px; }
    .external-number { font-size: 12.5px; white-space: nowrap; }
    .assignee-cell { display: flex; align-items: center; gap: 8px; min-width: 145px; }
    .assignee-cell strong { font-size: 12px; font-weight: 650; white-space: nowrap; }
    .assignee-avatar {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        display: inline-grid;
        place-items: center;
        flex: 0 0 auto;
        background: var(--surface-3);
        color: var(--muted);
        border: 1px solid var(--border);
        font-size: 10px;
        font-weight: 800;
    }
    .age-cell { min-width: 118px; }
    .age-cell strong { display: block; font-size: 12px; font-weight: 700; color: var(--text); }
    .age-cell small { display: block; margin-top: 2px; color: var(--soft-text); font-size: 9.5px; }
    .age-cell.is-aging strong { color: color-mix(in srgb, #b7791f 80%, var(--text)); }
    .age-cell.is-stale strong { color: color-mix(in srgb, #a14b2f 74%, var(--text)); }
    .archive-countdown {
        display: block;
        margin-top: 4px;
        color: var(--muted);
        font-size: 9.5px;
        white-space: nowrap;
    }
    .updated-cell { font-size: 11.5px; }
    .updated-cell small { font-size: 9.5px; }
    .branch-pill { min-height: 25px; border-radius: 7px; font-size: 10px; }
    .status { min-height: 26px; border-radius: 7px; padding-inline: 8px; font-size: 10.5px; }

    .clickable-row.is-recently-updated {
        animation: recentOrderHighlight 1.8s var(--desktop-ease) both;
    }

    .workspace-card.is-table-loading .orders-table-wrap { position: relative; }
    .workspace-card.is-table-loading .orders-table-wrap::after {
        content: '';
        position: absolute;
        inset: 0;
        z-index: 5;
        pointer-events: none;
        background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 74%, transparent), transparent);
        transform: translateX(-100%);
        animation: lltTableSweep .7s ease-out infinite;
    }

    /* Empty states ---------------------------------------------------- */
    .empty-state { min-height: 250px; }
    .empty-state--filters .empty-state__icon { background: var(--surface-3); color: var(--muted); }

    /* Order form + guide --------------------------------------------- */
    .order-form-layout {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 355px);
        gap: 20px;
    }
    .form-card {
        padding: 24px;
        border-radius: 14px;
        box-shadow: var(--desktop-shadow-panel);
    }
    .form-grid { gap: 18px 20px; }
    .field-group label { margin-bottom: 7px; font-size: 12px; font-weight: 680; }
    .field-group input, .field-group select, .field-group textarea {
        border-radius: 9px;
        font-size: 14px;
    }
    .field-group input, .field-group select { min-height: 44px; }
    .field-group textarea { min-height: 142px; }
    .field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 10.5px; }
    .status-guide-card {
        top: 94px;
        padding: 18px;
        border-radius: 14px;
        box-shadow: var(--desktop-shadow-panel);
    }
    .status-guide-header h2 { font-size: 18px; }
    .status-guide-item { border-radius: 9px; padding: 9px 7px; }
    .status-guide-item strong { font-size: 12.5px; }
    .status-guide-item p { font-size: 11px; }

    /* Detail page: desktop grouped information ----------------------- */
    .detail-heading__main { align-items: center; }
    .detail-heading__main h1 { max-width: 1050px; font-size: clamp(26px, 2vw, 33px); line-height: 1.32; }
    .detail-heading__status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
    .detail-age-chip, .archive-timer-chip {
        min-height: 32px;
        padding: 0 10px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--surface-2);
        color: var(--muted);
        font-size: 10.5px;
    }
    .detail-age-chip strong { color: var(--text); font-size: 11px; }
    .archive-timer-chip { color: color-mix(in srgb, #20854f 78%, var(--text)); background: color-mix(in srgb, #22a95a 6%, var(--surface)); border-color: color-mix(in srgb, #22a95a 18%, var(--border)); }

    .detail-card {
        padding: 24px;
        border-radius: 14px;
        box-shadow: var(--desktop-shadow-panel);
    }
    .mobile-preserved-detail-grid { display: none !important; }
    .detail-desktop-sections {
        display: grid;
        grid-template-columns: minmax(0, .95fr) minmax(0, 1.35fr);
        gap: 14px;
    }
    .detail-info-group {
        min-width: 0;
        padding: 17px 18px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface-2);
    }
    .detail-info-group__head {
        display: flex;
        align-items: center;
        gap: 9px;
        padding-bottom: 12px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--border);
    }
    .detail-info-group__head h3 { margin: 0; font-size: 14px; font-weight: 700; }
    .detail-group-icon {
        width: 26px;
        height: 26px;
        display: inline-grid;
        place-items: center;
        border-radius: 7px;
        background: var(--gold-soft);
        color: var(--gold-dark);
        font-size: 9px;
        font-weight: 800;
    }
    .detail-definition-list { margin: 0; }
    .detail-definition-list > div {
        display: grid;
        grid-template-columns: minmax(100px, .65fr) minmax(0, 1.35fr);
        align-items: center;
        gap: 14px;
        min-height: 47px;
        border-bottom: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
    }
    .detail-definition-list > div:last-child { border-bottom: 0; }
    .detail-definition-list--order { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
    .detail-definition-list--order > div { grid-template-columns: minmax(95px, .75fr) minmax(0, 1.25fr); }
    .detail-definition-list dt { color: var(--muted); font-size: 10.5px; font-weight: 650; }
    .detail-definition-list dd { min-width: 0; margin: 0; color: var(--text); font-size: 12.5px; font-weight: 650; overflow-wrap: anywhere; }
    .detail-definition-list .info-value-row { justify-content: flex-start; }
    [dir="rtl"] .detail-definition-list .info-value-row { justify-content: flex-start; }
    .notes-panel { margin-top: 14px; border-radius: 11px; padding: 16px 18px; background: color-mix(in srgb, var(--surface-2) 80%, var(--surface)); }
    .notes-panel p { font-size: 13px; line-height: 1.75; }
    .activity-strip { margin-top: 14px; padding-top: 14px; }
    .activity-strip span { font-size: 9.5px; }
    .activity-strip strong { font-size: 11.5px; }

    /* Supervisor notes / audit --------------------------------------- */
    .detail-section-card {
        border-radius: 14px;
        box-shadow: var(--desktop-shadow-panel);
        padding: 22px 24px;
    }
    .supervisor-section {
        border-inline-start: 3px solid color-mix(in srgb, var(--gold) 72%, transparent);
    }
    [dir="rtl"] .supervisor-section { border-inline-start: 3px solid color-mix(in srgb, var(--gold) 72%, transparent); }
    .supervisor-note-form { align-items: end; }
    .supervisor-note-form textarea { min-height: 92px; border-radius: 9px; }
    .supervisor-note-item {
        padding: 13px 15px;
        border-radius: 10px;
        background: color-mix(in srgb, var(--gold) 2.5%, var(--surface-2));
        border-color: color-mix(in srgb, var(--gold) 10%, var(--border));
    }
    .supervisor-note-item p { font-size: 12.5px; line-height: 1.7; }

    .activity-history-card { overflow: hidden; }
    .activity-timeline { padding-top: 2px; }
    .activity-item {
        grid-template-columns: 18px minmax(0, 1fr);
        gap: 13px;
        padding-block: 11px;
    }
    .activity-item:not(:last-child)::before { inset-inline-start: 7px; background: color-mix(in srgb, var(--border-strong) 75%, transparent); }
    .activity-item__marker {
        width: 9px;
        height: 9px;
        margin-top: 6px;
        border: 2px solid var(--surface);
        box-shadow: 0 0 0 1px var(--border-strong);
        background: var(--soft-text);
    }
    .activity-item--latest .activity-item__marker {
        background: var(--gold);
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 35%, var(--border)), 0 0 0 5px color-mix(in srgb, var(--gold) 8%, transparent);
    }
    .activity-item--latest .activity-item__body {
        border-color: color-mix(in srgb, var(--gold) 18%, var(--border));
        background: color-mix(in srgb, var(--gold) 2.5%, var(--surface-2));
    }
    .activity-item__body { padding: 13px 15px; border-radius: 10px; }
    .activity-item__head strong { font-size: 13px; }
    .activity-item__head span, .activity-item__head time { font-size: 10.5px; }
    .activity-latest {
        display: inline-flex;
        margin-inline-start: 7px;
        padding: 2px 6px;
        border-radius: 6px;
        background: var(--gold-soft);
        color: var(--gold-dark);
        font-style: normal;
        font-size: 9px;
        font-weight: 750;
    }
    .activity-change { border-top-style: solid; }
    .activity-change__values span { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; }

    /* Users / hierarchy ---------------------------------------------- */
    .team-structure {
        margin-bottom: 18px;
        padding: 18px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--surface);
        box-shadow: var(--desktop-shadow-panel);
    }
    .team-structure__header { margin-bottom: 13px; }
    .team-structure__header h2 { margin: 2px 0 3px; font-size: 18px; }
    .team-structure__header p { margin: 0; color: var(--muted); font-size: 12px; }
    .team-structure__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .team-branch-card {
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: 11px;
        background: var(--surface-2);
    }
    .team-branch-card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 11px; border-bottom: 1px solid var(--border); }
    .team-branch-card .employee-name-cell div { min-width: 0; }
    .team-branch-card .employee-name-cell small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
    .team-branch-card__members { display: grid; gap: 2px; padding-top: 7px; }
    .team-member-row {
        position: relative;
        min-height: 43px;
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        align-items: center;
        gap: 9px;
        padding: 5px 7px;
        border-radius: 8px;
    }
    .team-member-row:hover { background: var(--surface); }
    .team-member-line { width: 12px; height: 1px; background: var(--border-strong); }
    [dir="rtl"] .team-member-line { transform: scaleX(-1); }
    .employee-avatar--small { width: 27px; height: 27px; border-radius: 8px; font-size: 10px; }
    .team-member-row strong { display: block; font-size: 11.5px; }
    .team-member-row small { display: block; color: var(--muted); font-size: 9.5px; }
    .account-state {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        min-height: 25px;
        padding: 0 7px;
        border: 1px solid var(--border);
        border-radius: 7px;
        background: var(--surface-2);
        color: var(--muted);
        font-size: 9.5px;
        font-weight: 700;
        white-space: nowrap;
    }
    .account-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--soft-text); }
    .account-state.is-active { color: #26734b; border-color: color-mix(in srgb, #22a95a 20%, var(--border)); background: color-mix(in srgb, #22a95a 6%, var(--surface)); }
    .account-state.is-active i { background: #22a95a; }
    .account-state.is-inactive { color: #8b4750; border-color: color-mix(in srgb, var(--danger) 18%, var(--border)); background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
    .account-state.is-inactive i { background: var(--danger); }
    .users-table .employee-name-cell strong { font-size: 12.5px; }
    .users-table .actions-column { width: 92px; }

    /* User active toggle --------------------------------------------- */
    .user-active-field { padding-top: 2px; }
    .user-active-toggle {
        min-height: 62px;
        margin: 0 !important;
        padding: 10px 12px;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-2);
        cursor: pointer;
    }
    .user-active-toggle__copy strong { display: block; font-size: 12.5px; }
    .user-active-toggle__copy small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
    .toggle-checkbox { position: absolute; opacity: 0; pointer-events: none; }
    .toggle-switch {
        position: relative;
        width: 42px;
        height: 24px;
        flex: 0 0 auto;
        border-radius: 999px;
        background: var(--border-strong);
        transition: background-color var(--desktop-state) var(--desktop-ease);
    }
    .toggle-switch i {
        position: absolute;
        top: 3px;
        inset-inline-start: 3px;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 4px rgba(15,23,42,.20);
        transition: transform var(--desktop-state) var(--desktop-ease);
    }
    .toggle-checkbox:checked + .toggle-switch { background: #2f9e68; }
    .toggle-checkbox:checked + .toggle-switch i { transform: translateX(18px); }
    [dir="rtl"] .toggle-checkbox:checked + .toggle-switch i { transform: translateX(-18px); }
    .toggle-checkbox:focus-visible + .toggle-switch { box-shadow: 0 0 0 4px var(--focus); }

    /* Archive is intentionally quieter ------------------------------- */
    .archive-workspace { background: color-mix(in srgb, var(--surface) 96%, var(--surface-2)); }
    .archive-table tbody tr { opacity: .93; }
    .archive-table tbody tr:hover { opacity: 1; }
    .archive-row-label, .archive-badge { border-radius: 7px; font-size: 9.5px; }

    /* Tooltip system -------------------------------------------------- */
    [data-tooltip] { position: relative; }
    [data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        z-index: 80;
        inset-inline-start: 50%;
        bottom: calc(100% + 7px);
        transform: translate(-50%, 4px);
        padding: 5px 7px;
        border: 1px solid var(--border);
        border-radius: 6px;
        background: var(--text);
        color: var(--surface);
        font-size: 9.5px;
        font-weight: 600;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--desktop-fast) ease, transform var(--desktop-fast) ease;
    }
    [dir="rtl"] [data-tooltip]::after { transform: translate(50%, 4px); }
    [data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
    [dir="rtl"] [data-tooltip]:hover::after, [dir="rtl"] [data-tooltip]:focus-visible::after { transform: translate(50%, 0); }

    /* Page-entry rhythm ---------------------------------------------- */
    .dashboard-heading.enter-animation, .page-heading.enter-animation { animation-delay: 0ms; }
    .manager-scope-panel.enter-animation, .gm-branch-scope.enter-animation { animation-delay: 45ms; }
    .summary-section.enter-animation, .team-structure.enter-animation { animation-delay: 80ms; }
    .workspace-card.enter-animation, .form-card.enter-animation, .detail-card.enter-animation { animation-delay: 115ms; }
    .detail-section-card.enter-animation:nth-of-type(3) { animation-delay: 145ms; }
    .detail-section-card.enter-animation:nth-of-type(4) { animation-delay: 175ms; }

    /* Tablet desktop-mode adjustments -------------------------------- */
    @media (max-width: 1080px) {
        .page-shell, .app-header__inner { width: calc(100% - 36px); }
        .desktop-nav { gap: 2px; }
        .nav-link { padding-inline: 9px; }
        .nav-link span:last-child { font-size: 12px; }
        .account-copy { display: none; }
        .summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
        .filter-bar { grid-template-columns: minmax(280px, 1.8fr) repeat(2, minmax(135px, .8fr)) auto; }
        .filter-bar select[name="branch"] { display: none; }
        .detail-desktop-sections { grid-template-columns: 1fr; }
        .detail-definition-list--order { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        .detail-definition-list--order > div { grid-template-columns: 1fr; gap: 3px; padding-block: 8px; }
        .team-structure__grid { grid-template-columns: 1fr; }
    }
}

@keyframes lltNavActive {
    from { transform: scaleX(.45); opacity: 0; }
    to { transform: scaleX(1); opacity: 1; }
}

@keyframes recentOrderHighlight {
    0% { background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }
    45% { background: color-mix(in srgb, var(--gold) 8%, var(--surface)); }
    100% { background: transparent; }
}

@keyframes lltTableSweep {
    to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
    .nav-link.is-active::after,
    .clickable-row.is-recently-updated,
    .workspace-card.is-table-loading .orders-table-wrap::after {
        animation: none !important;
    }
}
