/* Product-level overrides only. Shared layout, shell and component styling lives in zentrack-ui.css. */
:root {
    --z-primary: #136f63;
    --z-primary-hover: #0f5d54;
    --z-primary-soft: #e8f6f3;
}

.zn-login-help {
    margin: 0;
    color: var(--z-text-muted);
}

.zn-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zn-login-brand strong,
.zn-login-brand small {
    display: block;
}

/* Optical commercial entry pattern: compact, task-led and consistent across modules. */
.optical-entry-page {
    --optical-ink: #102a2e;
    --optical-muted: #60727b;
    --optical-line: #d7e4e5;
    --optical-surface: #ffffff;
    --optical-wash: #f3f8f7;
    gap: .85rem;
}

.optical-entry-page .zn-page-head {
    margin-bottom: .15rem;
}

.optical-entry-page .zn-page-head h1 {
    color: var(--optical-ink);
    letter-spacing: -.035em;
}

.optical-entry-card {
    background: linear-gradient(145deg, #fff 0%, #fbfdfd 100%);
    border: 1px solid var(--optical-line);
    border-radius: 16px;
    box-shadow: 0 10px 26px rgba(18, 54, 58, .055);
}

.catalogue-workspace {
    padding: .85rem;
    background:
        radial-gradient(circle at 100% 0, rgba(19, 111, 99, .09), transparent 28rem),
        var(--optical-wash);
    border: 1px solid var(--optical-line);
    border-radius: 20px;
    gap: .65rem;
}

.catalogue-add-page .zn-field {
    gap: .28rem;
}

.catalogue-add-page .zn-input {
    min-height: 40px;
    border-color: #cddcde;
    background-color: #fff;
}

.catalogue-add-page .zn-input:focus {
    border-color: var(--z-primary);
    box-shadow: 0 0 0 3px rgba(19, 111, 99, .12);
}

.optical-mode-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem .8rem;
    background: rgba(255, 255, 255, .86);
    border: 1px solid var(--optical-line);
    border-radius: 14px;
}

.optical-mode-card .zn-help-text {
    margin: 0 0 0 auto;
    max-width: 30rem;
    text-align: right;
}

.optical-segmented {
    display: inline-flex;
    gap: .25rem;
    padding: .24rem;
    background: #e7f0ef;
    border-radius: 12px;
}

.optical-segmented button {
    min-height: 36px;
    border-radius: 9px;
    white-space: nowrap;
}

.optical-section-kicker {
    color: var(--z-primary);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.optical-section-intro {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    padding: .35rem .2rem .15rem;
}

.optical-section-intro h2,
.optical-section-intro p,
.optical-section-banner h3,
.optical-section-banner p {
    margin: 0;
}

.optical-section-intro h2 {
    color: var(--optical-ink);
    font-size: 1.45rem;
    letter-spacing: -.025em;
}

.optical-section-intro > div > p:last-child,
.optical-section-banner p {
    color: var(--optical-muted);
    font-weight: 500;
}

.optical-keyboard-hint {
    color: var(--optical-muted);
    font-size: .78rem;
    padding: .35rem .65rem;
    background: rgba(255, 255, 255, .75);
    border: 1px solid var(--optical-line);
    border-radius: 999px;
}

.optical-section-banner {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .62rem .75rem;
    margin-top: .18rem;
    background: linear-gradient(90deg, #e7f4f1, rgba(255, 255, 255, .82));
    border: 1px solid #cfe2df;
    border-radius: 12px;
}

.optical-section-banner h3 {
    color: var(--optical-ink);
    font-size: 1rem;
    line-height: 1.15;
}

.optical-section-banner p {
    margin-top: .12rem;
    font-size: .75rem;
}

.optical-step {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    color: #fff;
    background: var(--z-primary);
    border-radius: 9px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.catalogue-add-page .optical-primary-field .zn-input {
    border-color: #9fc4bf;
    font-weight: 700;
}

.optical-sticky-actions {
    position: sticky;
    bottom: .65rem;
    z-index: 5;
    justify-content: flex-end;
    padding: .65rem;
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--optical-line);
    border-radius: 13px;
    box-shadow: 0 12px 32px rgba(15, 42, 46, .12);
    backdrop-filter: blur(10px);
}

.opening-stock-page > .optical-entry-card {
    padding: .85rem;
}

.opening-stock-page .opening-entry-card {
    background:
        linear-gradient(90deg, rgba(19, 111, 99, .045), transparent 40%),
        #fff;
}

.purchase-entry-page .optical-entry-card {
    border-color: var(--optical-line);
}

@media (min-width: 1100px) {
    .catalogue-add-page .zn-form {
        row-gap: .62rem;
    }

    .catalogue-add-page .zn-field {
        font-size: .79rem;
    }

    .catalogue-add-page .zn-col-3,
    .catalogue-add-page .zn-col-4,
    .catalogue-add-page .zn-col-6 {
        align-self: end;
    }
}

@media (max-width: 900px) {
    .optical-mode-card,
    .optical-section-intro {
        align-items: stretch;
        flex-direction: column;
    }

    .optical-mode-card .zn-help-text {
        margin: 0;
        max-width: none;
        text-align: left;
    }

    .optical-segmented {
        display: grid;
        grid-template-columns: 1fr;
    }

    .optical-keyboard-hint {
        align-self: flex-start;
    }
}

@media (max-width: 680px) {
    .catalogue-workspace {
        padding: .6rem;
        border-radius: 14px;
    }

    .catalogue-add-page .zn-col-3,
    .catalogue-add-page .zn-col-4,
    .catalogue-add-page .zn-col-6 {
        grid-column: span 12;
    }

    .optical-sticky-actions {
        position: static;
    }
}


/* Selectable fields must read visually as selects or editable comboboxes. */
.optical-entry-page select.zn-input {
    appearance: none;
    padding-right: 2.35rem;
    background-image: linear-gradient(45deg, transparent 50%, #365c62 50%), linear-gradient(135deg, #365c62 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}
.optical-editable-combo, .optical-entry-page .combo { position: relative; }
.optical-editable-combo > .zn-input, .optical-entry-page .combo > .zn-input { padding-right: 2.45rem; }
.optical-editable-combo > .zn-input { cursor: text; }
.optical-editable-combo:hover > .zn-input, .optical-entry-page .combo:hover > .zn-input, .optical-entry-page select.zn-input:hover {
    border-color: #79aaa4;
    background-color: #fbfefd;
}
.optical-combo-chevron {
    position: absolute;
    z-index: 2;
    top: 1px;
    right: 1px;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: calc(100% - 2px);
    padding: 0;
    color: #365c62;
    background: linear-gradient(90deg, rgba(255,255,255,0), #f3f8f7 42%);
    border: 0;
    border-radius: 0 9px 9px 0;
    cursor: pointer;
    font-size: 1rem;
}
.optical-combo-chevron:hover { color: var(--z-primary); background: #e8f4f2; }
.optical-editable-combo:focus-within > .zn-input {
    border-color: var(--z-primary);
    box-shadow: 0 0 0 3px rgba(19, 111, 99, .12);
}
.optical-editable-menu {
    position: absolute;
    z-index: 110;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    max-height: 15rem;
    overflow: auto;
    padding: .3rem;
    background: #fff;
    border: 1px solid #afc9c6;
    border-radius: 12px;
    box-shadow: 0 18px 38px rgba(15, 42, 46, .17);
}
.optical-editable-option {
    display: block;
    width: 100%;
    padding: .58rem .68rem;
    color: var(--optical-ink, #102a2e);
    background: transparent;
    border: 0;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
}
.optical-editable-option:hover, .optical-editable-option.active {
    color: var(--z-primary);
    background: var(--z-primary-soft);
}
.optical-editable-empty { padding: .62rem .7rem; color: var(--optical-muted, #60727b); font-size: .8rem; }
.optical-entry-page .combo::after {
    content: "";
    position: absolute;
    z-index: 2;
    top: 50%;
    right: .9rem;
    width: .42rem;
    height: .42rem;
    border-right: 2px solid #365c62;
    border-bottom: 2px solid #365c62;
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}
.optical-entry-page .combo:focus-within::after { border-color: var(--z-primary); }
.optical-entry-page .combo:has(.combo-menu)::after { transform: translateY(-20%) rotate(225deg); }


/* Zentrack Optical premium shell and page system. */
:root {
    --optical-bg: #f3f6f5;
    --optical-surface: #ffffff;
    --optical-surface-muted: #f7f9f8;
    --optical-border: #dce5e3;
    --optical-border-strong: #c8d7d4;
    --optical-ink: #142c30;
    --optical-muted: #687a7d;
    --optical-teal: #126f64;
    --optical-teal-dark: #0c564e;
    --optical-teal-soft: #e7f3f0;
    --optical-shadow: 0 8px 24px rgba(26, 55, 58, .055);
    --optical-radius: 12px;
    --z-control-md: 38px;
}

html, body {
    font-family: "Aptos", "Segoe UI Variable Text", sans-serif;
    color: var(--optical-ink);
    background: var(--optical-bg);
}

h1, h2, h3, .z-brand-block strong {
    font-family: "Aptos Display", "Bahnschrift", sans-serif;
}

/* Shell */
.z-app-shell {
    grid-template-columns: 244px minmax(0, 1fr);
    background: var(--optical-bg);
}

.z-sidebar {
    gap: 7px;
    padding: 13px 10px 9px;
    border-inline-end: 1px solid #d5e1de;
    background:
        radial-gradient(circle at 12% 2%, rgba(27, 137, 124, .10), transparent 14rem),
        linear-gradient(180deg, #f8fbfa 0%, #edf5f3 100%);
}

.z-brand-block {
    min-height: 48px;
    gap: 9px;
    padding: 2px 5px 7px;
}

.z-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(145deg, #158477, #08625a);
    box-shadow: 0 7px 16px rgba(13, 102, 92, .18);
}

.z-brand-block strong {
    color: #102c30;
    font-size: .91rem;
    letter-spacing: -.015em;
}

.z-brand-block small {
    color: #6b7f80;
    font-size: .68rem;
    letter-spacing: .015em;
}

.z-menu-search {
    position: relative;
}

.z-menu-search::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 12px;
    width: 13px;
    height: 13px;
    border: 1.7px solid #6d8583;
    border-radius: 50%;
    transform: translateY(-58%);
    pointer-events: none;
}

.z-menu-search::after {
    content: "";
    position: absolute;
    z-index: 1;
    top: calc(50% + 5px);
    left: 23px;
    width: 6px;
    height: 1.7px;
    background: #6d8583;
    transform: rotate(45deg);
    pointer-events: none;
}

.z-menu-search input {
    min-height: 35px;
    padding-inline: 32px 9px;
    color: #193638;
    background: rgba(255, 255, 255, .78);
    border-color: #d5e2df;
    border-radius: 9px;
    box-shadow: inset 0 1px 1px rgba(19, 53, 56, .025);
}

.z-menu-search input:focus {
    border-color: #78aaa3;
    box-shadow: 0 0 0 3px rgba(18, 111, 100, .10);
}

.zn-nav-group {
    margin: 9px 8px 3px;
    color: #80908f;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .115em;
}

.z-nav, .zn-nav {
    gap: 1px;
    padding-right: 2px;
    scrollbar-color: rgba(88, 116, 113, .24) transparent;
    scrollbar-width: thin;
}

.z-nav::-webkit-scrollbar { width: 5px; }
.z-nav::-webkit-scrollbar-track { background: transparent; }
.z-nav::-webkit-scrollbar-thumb { background: rgba(88, 116, 113, .22); border-radius: 999px; }

.z-nav a, .zn-nav-link {
    min-height: 34px;
    gap: 8px;
    padding-inline: 9px;
    color: #314b4e;
    border-radius: 8px;
    font-size: .79rem;
    font-weight: 650;
}

.z-nav a::before, .zn-nav-link::before {
    width: 18px;
    height: 18px;
    opacity: .56;
    mask-size: 17px 17px;
}

.z-nav a:hover, .zn-nav-link:hover {
    color: #153c3d;
    background: rgba(255, 255, 255, .67);
}

.z-nav a.active, .zn-nav-link.active {
    color: var(--optical-teal-dark);
    background: #dcefeb;
    box-shadow: inset 0 0 0 1px rgba(18, 111, 100, .09);
    font-weight: 760;
}

.z-nav a.active::before, .zn-nav-link.active::before {
    opacity: .9;
}

.z-nav a.active::after, .zn-nav-link.active::after {
    inset-block: 7px;
    inset-inline-start: -10px;
    width: 3px;
    background: var(--optical-teal);
}

.z-sidebar-footer {
    padding: 3px 5px 0;
    color: #879695;
}

.z-sidebar-footer span {
    min-height: 20px;
    padding-inline: 7px;
    color: #82918f;
    background: transparent;
    border-color: #d8e3e0;
    font-size: .59rem;
    letter-spacing: .07em;
}

/* Top bar and content */
.z-topbar {
    min-height: 54px;
    padding: 7px 15px;
    border-color: var(--optical-border);
    background: rgba(255, 255, 255, .91);
    box-shadow: 0 1px 8px rgba(25, 51, 53, .035);
}

.z-topbar-actions { gap: 6px; }

.z-icon-button,
.z-topbar-chip,
.z-language-selector select,
.z-theme-selector button {
    min-width: 34px;
    min-height: 34px;
    border-color: var(--optical-border);
    background-color: #fff;
    box-shadow: none;
}

.z-topbar-chip {
    padding-inline: 9px;
    color: #5a7073;
    font-size: .69rem;
}

.z-user-menu {
    min-height: 36px;
    padding: 2px 5px;
    border-color: var(--optical-border);
    box-shadow: none;
}

.z-user-avatar {
    width: 29px;
    height: 29px;
    background: var(--optical-teal);
}

.z-user-summary strong { font-size: .77rem; }
.z-user-summary small { color: #7d8b8e; font-size: .64rem; }

.z-content {
    padding: 16px 20px 24px;
    background:
        radial-gradient(circle at 96% 2%, rgba(18, 111, 100, .035), transparent 24rem),
        var(--optical-bg);
}

/* Shared page header */
.zn-page-head,
.zn-page-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: auto;
    margin: 0 0 11px;
    padding: 2px 1px 10px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--optical-border);
    border-radius: 0;
    box-shadow: none;
}

.zn-page-head h1,
.zn-page-hero h1 {
    margin: 1px 0 2px;
    color: var(--optical-ink);
    font-size: clamp(1.45rem, 2vw, 1.8rem);
    line-height: 1.12;
    letter-spacing: -.035em;
}

.zn-page-head p,
.zn-page-hero p {
    margin: 0;
    color: var(--optical-muted);
    font-size: .84rem;
    line-height: 1.35;
}

.zn-page-head .zn-eyebrow,
.zn-page-hero .zn-eyebrow,
.zn-eyebrow {
    color: var(--optical-teal) !important;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

/* Shared surfaces and forms */
.zn-panel,
.optical-entry-card,
.purchase-card,
.opening-entry-card,
.lens-matrix-card {
    padding: 13px;
    background: var(--optical-surface);
    border: 1px solid var(--optical-border);
    border-radius: var(--optical-radius);
    box-shadow: var(--optical-shadow);
}

.zn-panel h2,
.optical-entry-card h2 {
    margin-top: 0;
    font-size: 1.02rem;
    letter-spacing: -.015em;
}

.zn-panel h3 {
    margin: 13px 0 6px;
    color: #41575a;
    font-size: .79rem;
    letter-spacing: .02em;
}

.zn-field {
    color: #52686b;
    font-size: .78rem;
    font-weight: 670;
}

.zn-help-text,
.z-table-description {
    color: var(--optical-muted);
    font-weight: 450;
}

.zn-input {
    min-height: 37px;
    color: #183437;
    border-color: var(--optical-border-strong);
    border-radius: 8px;
    background-color: #fff;
}

.zn-input:hover { border-color: #98b8b4; }
.zn-input:focus {
    border-color: var(--optical-teal);
    box-shadow: 0 0 0 3px rgba(18, 111, 100, .10);
}

.zn-primary,
.z-btn-primary {
    min-height: 36px;
    padding: 7px 13px;
    border-radius: 8px;
    background: var(--optical-teal);
    box-shadow: 0 5px 12px rgba(18, 111, 100, .12);
    font-weight: 740;
}

.zn-primary:hover,
.z-btn-primary:hover { background: var(--optical-teal-dark); }

.z-btn-secondary {
    min-height: 36px;
    padding: 7px 12px;
    color: #365356;
    background: #fff;
    border-color: var(--optical-border-strong);
    border-radius: 8px;
    box-shadow: none;
}

/* Filters */
.zn-grid-toolbar,
.optical-filter-bar,
.zn-update-toolbar {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
    padding: 9px;
    background: #fafcfb;
    border: 1px solid var(--optical-border);
    border-radius: 10px;
    box-shadow: none;
}

.zn-grid-toolbar .zn-field:first-child { flex: 0 1 220px; }
.zn-grid-toolbar .zn-field:nth-child(2) { flex: 1 1 320px; }
.zn-grid-toolbar .zn-field { margin: 0; }

/* Tables */
.zn-table-wrap {
    overflow: auto;
    background: #fff;
    border: 1px solid var(--optical-border);
    border-radius: 10px;
    box-shadow: 0 5px 16px rgba(25, 52, 55, .035);
}

.zn-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.zn-table thead th {
    height: 35px;
    padding: 7px 10px;
    color: #51676a;
    background: #f1f5f4;
    border-bottom: 1px solid var(--optical-border-strong);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .065em;
    text-transform: uppercase;
    white-space: nowrap;
}

.zn-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #edf1f0;
    color: #304a4d;
    font-size: .79rem;
    vertical-align: middle;
}

.zn-table tbody tr:last-child td { border-bottom: 0; }
.zn-table tbody tr:hover td { background: #f7fbfa; }
.zn-table td strong { color: #17383b; font-weight: 750; }
.zn-table .z-table-description { display: block; margin-top: 2px; font-size: .71rem; }
.optical-table-action { text-align: right; white-space: nowrap; }
.optical-table-action a { color: var(--optical-teal); font-weight: 740; text-decoration: none; }

/* Badges, empty/loading and feedback */
.optical-badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 2px 8px;
    color: #496164;
    background: #edf3f2;
    border: 1px solid #d9e5e3;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 760;
}

.optical-badge--source {
    color: #245d58;
    background: #eaf5f2;
    border-color: #d2e9e4;
}

.optical-empty-state {
    display: grid;
    justify-items: center;
    gap: 6px;
    min-height: 190px;
    place-content: center;
    padding: 24px;
    color: var(--optical-muted);
    text-align: center;
    background: #fafcfb;
    border: 1px dashed #cbdad7;
    border-radius: 11px;
}

.optical-empty-state h2 { margin: 2px 0 0; color: var(--optical-ink); font-size: 1.05rem; }
.optical-empty-state p { max-width: 32rem; margin: 0 0 8px; font-size: .82rem; }
.optical-empty-icon {
    width: 34px;
    height: 34px;
    border: 2px solid #91b3ae;
    border-radius: 9px;
    box-shadow: inset 0 -8px 0 #e7f2f0;
}

.optical-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 120px;
    color: var(--optical-muted);
    font-size: .82rem;
}

.optical-loading span {
    width: 18px;
    height: 18px;
    border: 2px solid #d5e5e2;
    border-top-color: var(--optical-teal);
    border-radius: 50%;
    animation: optical-spin .8s linear infinite;
}

@keyframes optical-spin { to { transform: rotate(360deg); } }

.zn-message,
.zn-error,
.zn-warning {
    padding: 9px 11px;
    border-radius: 9px;
    font-size: .8rem;
}

/* Admin and transaction layouts */
.zn-admin-grid {
    gap: 12px;
}

.optical-admin-page .zn-panel {
    min-width: 0;
}

.purchase-entry-page,
.opening-stock-page {
    gap: 10px;
}

.purchase-entry-page .purchase-card,
.opening-stock-page > .optical-entry-card {
    border-radius: var(--optical-radius);
    box-shadow: var(--optical-shadow);
}

.zn-form-actions,
.zn-actions {
    gap: 7px;
}

/* Dashboard refinement */
.z-dashboard {
    gap: 12px;
}

.z-dashboard-hero {
    padding: 16px 18px;
    background:
        linear-gradient(120deg, rgba(18, 111, 100, .09), transparent 44%),
        #fff;
    border-color: var(--optical-border);
    border-radius: 13px;
    box-shadow: var(--optical-shadow);
}

.z-dashboard-card,
.z-kpi-card {
    border-color: var(--optical-border);
    border-radius: 11px;
    box-shadow: 0 5px 17px rgba(25, 52, 55, .04);
}

/* Bring the reconciliation page into the same system. */
.zn-catalogue-updates {
    gap: 10px;
}

.zn-catalogue-updates .zn-page-hero {
    padding: 2px 1px 10px;
    background: transparent;
}

.zn-update-summary { gap: 8px; }
.zn-update-summary div {
    padding: 11px 12px;
    border-color: var(--optical-border);
    border-radius: 10px;
    box-shadow: none;
}
.zn-update-summary strong { font-size: 1.35rem; }
.zn-update-card {
    border-color: var(--optical-border);
    border-radius: 11px;
    box-shadow: var(--optical-shadow);
}

@media (max-width: 980px) {
    .z-app-shell { grid-template-columns: 1fr; }
    .z-content { padding: 14px 14px 22px; }
}

@media (max-width: 720px) {
    .z-topbar { min-height: 52px; padding-inline: 10px; }
    .z-content { padding: 12px 10px 20px; }
    .zn-page-head, .zn-page-hero { align-items: stretch; flex-direction: column; gap: 9px; }
    .zn-page-head > :last-child, .zn-page-hero > :last-child { align-self: flex-start; }
    .zn-grid-toolbar, .optical-filter-bar { align-items: stretch; flex-direction: column; }
    .zn-grid-toolbar .zn-field { width: 100%; flex-basis: auto; }
    .zn-grid-toolbar button { width: 100%; }
    .zn-panel, .optical-entry-card, .purchase-card, .opening-entry-card { padding: 11px; }
    .zn-table tbody td { padding-block: 9px; }
    .optical-empty-state { min-height: 160px; padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .optical-loading span { animation: none; }
}

/* Optical premium login experience */
.optical-login-root { min-height: 100dvh; }

.optical-login-root .zn-login-page {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 11% 18%, color-mix(in srgb, var(--z-primary) 16%, transparent), transparent 24rem),
    radial-gradient(circle at 88% 82%, color-mix(in srgb, #4f86d9 13%, transparent), transparent 28rem),
    linear-gradient(rgba(14, 116, 103, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 116, 103, .04) 1px, transparent 1px),
    linear-gradient(145deg, var(--z-background), var(--z-surface-alt));
  background-size: auto, auto, 40px 40px, 40px 40px, auto;
}

.optical-login-root .zn-login-page::before,
.optical-login-root .zn-login-page::after {
  position: absolute;
  z-index: -1;
  border: 1px solid color-mix(in srgb, var(--z-primary) 24%, transparent);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.optical-login-root .zn-login-page::before {
  inset-block-start: -13rem;
  inset-inline-start: -9rem;
  width: 31rem;
  height: 31rem;
  box-shadow: 0 0 0 34px color-mix(in srgb, var(--z-primary) 4%, transparent);
}

.optical-login-root .zn-login-page::after {
  inset-inline-end: -7rem;
  inset-block-end: -11rem;
  width: 27rem;
  height: 27rem;
  box-shadow: inset 0 0 0 46px color-mix(in srgb, #4f86d9 4%, transparent);
}

.optical-login-root .z-login-story { position: relative; align-content: center; gap: 18px; }

.optical-login-root .z-login-story::after {
  position: absolute;
  inset-inline-end: 4%;
  inset-block-start: 8%;
  width: 148px;
  height: 64px;
  border: 3px solid color-mix(in srgb, var(--z-primary) 28%, transparent);
  border-radius: 32px 32px 26px 26px;
  box-shadow: 184px 0 0 -3px var(--z-background), 184px 0 0 0 color-mix(in srgb, var(--z-primary) 28%, transparent);
  content: "";
  opacity: .52;
  pointer-events: none;
  transform: rotate(-7deg);
}

.optical-login-root .z-login-story h1 { max-width: 620px; font-size: clamp(2.35rem, 4.35vw, 4.15rem); letter-spacing: -.045em; }
.optical-login-root .z-login-story > p { max-width: 590px; font-size: 1.08rem; }
.optical-login-highlights { max-width: 700px; gap: 10px; }

.optical-login-highlights li {
  position: relative;
  min-height: 62px;
  padding: 14px 16px 14px 48px;
  border-radius: 12px;
  font-size: .91rem;
  line-height: 1.35;
  backdrop-filter: blur(10px);
}

.optical-login-highlights li::before {
  position: absolute;
  inset-inline-start: 17px;
  inset-block-start: 50%;
  width: 17px;
  height: 17px;
  border: 2px solid var(--z-primary);
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
}

.optical-login-highlights li::after {
  position: absolute;
  inset-inline-start: 23px;
  inset-block-start: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--z-primary);
  content: "";
  transform: translateY(-50%);
}

[dir="rtl"] .optical-login-highlights li { padding-inline: 48px 16px; }

.optical-login-root .zn-login-panel {
  gap: 15px;
  border-color: color-mix(in srgb, var(--z-primary) 18%, var(--z-border));
  border-radius: 20px;
  background: color-mix(in srgb, var(--z-surface) 94%, transparent);
  box-shadow: 0 24px 70px rgba(20, 48, 66, .13);
  backdrop-filter: blur(18px);
}

.optical-login-root .zn-login-panel h1 { letter-spacing: -.035em; }
.optical-login-form { gap: 13px; }
.optical-login-form label { gap: 6px; }

.optical-login-form .zn-input {
  min-height: 42px;
  border-color: color-mix(in srgb, var(--z-border) 82%, var(--z-primary));
  background: color-mix(in srgb, var(--z-surface) 96%, transparent);
}

.optical-login-form .zn-input:focus {
  border-color: var(--z-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--z-primary) 14%, transparent);
}

.optical-password-control { position: relative; display: block; }
.optical-password-control .zn-input { width: 100%; padding-inline-end: 46px; }

.optical-password-toggle {
  position: absolute;
  inset-inline-end: 5px;
  inset-block-start: 50%;
  display: grid;
  width: 36px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--z-primary);
  background: transparent;
  place-items: center;
  transform: translateY(-50%);
  cursor: pointer;
}

.optical-password-toggle:hover,
.optical-password-toggle:focus-visible { background: var(--z-primary-soft); outline: none; }

.optical-password-toggle > span {
  position: relative;
  width: 18px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 50% / 62%;
}

.optical-password-toggle > span::after {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  transition: transform .15s ease;
}

.optical-password-toggle[aria-pressed="true"] > span::after { transform: scale(.45); }
.optical-login-tools { min-height: 28px; align-items: center; }
.optical-login-tools .zn-login-check { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.optical-login-tools input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--z-primary); }

.optical-sign-in {
  min-height: 42px;
  margin-top: 1px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--z-primary) 22%, transparent);
}

.optical-login-preferences {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-top: 13px;
  border-top: 1px solid var(--z-border);
}

.optical-language-picker { position: relative; min-width: 0; }

.optical-language-picker > summary {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 8px;
  align-items: center;
  min-height: 40px;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--z-border);
  border-radius: 12px;
  color: var(--z-text);
  background: var(--z-surface);
  font-size: .86rem;
  font-weight: 720;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.optical-language-picker > summary::-webkit-details-marker { display: none; }

.optical-language-picker > summary:hover,
.optical-language-picker > summary:focus-visible,
.optical-language-picker[open] > summary {
  border-color: var(--z-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--z-primary) 10%, transparent);
  outline: none;
}

.optical-language-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 1.7px solid currentColor;
  border-radius: 50%;
  color: var(--z-primary);
}

.optical-language-icon::before,
.optical-language-icon::after { position: absolute; content: ""; }
.optical-language-icon::before { inset: 2px 5px; border-inline: 1px solid currentColor; border-radius: 50%; }
.optical-language-icon::after { inset-inline: 1px; inset-block-start: 7px; border-block-start: 1px solid currentColor; }
.optical-language-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.optical-select-chevron {
  width: 7px;
  height: 7px;
  border-inline-end: 1.5px solid currentColor;
  border-block-end: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s ease;
}

.optical-language-picker[open] .optical-select-chevron { transform: translateY(2px) rotate(225deg); }

.optical-language-popover {
  position: absolute;
  inset-inline-start: 0;
  inset-block-end: calc(100% + 8px);
  z-index: 80;
  width: min(320px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--z-border);
  border-radius: 14px;
  background: var(--z-surface-raised);
  box-shadow: 0 20px 48px rgba(16, 42, 54, .2);
}

.optical-preference-heading {
  margin: 1px 3px 9px;
  color: var(--z-text);
  font-size: .77rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.optical-language-search { position: relative; display: block; margin-bottom: 8px; }

.optical-language-search > span[aria-hidden="true"] {
  position: absolute;
  inset-inline-start: 12px;
  inset-block-start: 11px;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--z-text-muted);
  border-radius: 50%;
  pointer-events: none;
}

.optical-language-search > span[aria-hidden="true"]::after {
  position: absolute;
  inset-inline-end: -4px;
  inset-block-end: -3px;
  width: 5px;
  border-block-start: 1.5px solid var(--z-text-muted);
  content: "";
  transform: rotate(45deg);
}

.optical-language-search input {
  width: 100%;
  min-height: 38px;
  padding: 7px 11px 7px 34px;
  border: 1px solid var(--z-border);
  border-radius: 10px;
  color: var(--z-text);
  background: var(--z-surface);
  font: inherit;
}

[dir="rtl"] .optical-language-search input { padding-inline: 7px 34px; }

.optical-language-search input:focus {
  border-color: var(--z-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--z-primary) 10%, transparent);
  outline: none;
}

.optical-language-options {
  display: grid;
  max-height: 284px;
  gap: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: color-mix(in srgb, var(--z-text-muted) 34%, transparent) transparent;
  scrollbar-width: thin;
}

.optical-language-options button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  gap: 12px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  color: var(--z-text);
  background: transparent;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.optical-language-options button:hover,
.optical-language-options button:focus-visible { background: var(--z-surface-alt); outline: none; }

.optical-language-options button.is-current {
  color: var(--z-primary);
  background: var(--z-primary-soft);
  font-weight: 820;
}

.optical-language-check {
  width: 12px;
  height: 7px;
  border-inline-start: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: rotate(-45deg);
}

.optical-language-empty { display: none; margin: 8px; color: var(--z-text-muted); font-size: .82rem; }
.optical-language-options:not(:has([data-language-option]:not([hidden]))) .optical-language-empty { display: block; }

.optical-theme-selector {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--z-border);
  border-radius: 12px;
  background: var(--z-surface-alt);
}

.optical-theme-selector button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  min-height: 32px;
  gap: 6px;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  color: var(--z-text-muted);
  background: transparent;
  font: inherit;
  font-size: .73rem;
  font-weight: 780;
  cursor: pointer;
}

.optical-theme-selector button:hover,
.optical-theme-selector button:focus-visible {
  color: var(--z-text);
  background: color-mix(in srgb, var(--z-surface) 76%, transparent);
  outline: none;
}

:root[data-z-theme-mode="light"] .optical-theme-selector [data-theme-option="light"],
:root[data-z-theme-mode="dark"] .optical-theme-selector [data-theme-option="dark"],
:root[data-z-theme-mode="auto"] .optical-theme-selector [data-theme-option="auto"] {
  color: var(--z-primary);
  background: var(--z-surface);
  box-shadow: 0 1px 4px rgba(18, 43, 55, .11);
}

.optical-theme-icon { position: relative; display: inline-block; width: 13px; height: 13px; flex: 0 0 auto; }
.optical-theme-icon--light { border: 1.5px solid currentColor; border-radius: 50%; box-shadow: 0 -6px 0 -5px currentColor, 0 6px 0 -5px currentColor, 6px 0 0 -5px currentColor, -6px 0 0 -5px currentColor; }
.optical-theme-icon--dark { border: 1.7px solid currentColor; border-radius: 50%; box-shadow: inset -4px -2px 0 -1px currentColor; }
.optical-theme-icon--auto { border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }

@media (max-width: 860px) {
  .optical-login-root .zn-login-page {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 24px;
    padding: 28px;
  }

  .optical-login-root .zn-login-panel { order: 1; justify-self: center; }

  .optical-login-root .z-login-story {
    display: grid;
    order: 2;
    justify-self: center;
    width: min(100%, 480px);
    gap: 12px;
    padding: 2px 4px 24px;
  }

  .optical-login-root .z-login-story::after { display: none; }
  .optical-login-root .z-login-story h1 { font-size: clamp(1.75rem, 8vw, 2.35rem); }
  .optical-login-root .z-login-story > p { font-size: .94rem; line-height: 1.55; }
  .optical-login-highlights { grid-template-columns: 1fr 1fr; }

  .optical-login-highlights li {
    min-height: 54px;
    padding-block: 11px;
    font-size: .82rem;
  }
}

@media (max-width: 560px) {
  .optical-login-root .zn-login-page { padding: 14px; }

  .optical-login-root .zn-login-panel {
    padding: 22px 20px;
    border-radius: 16px;
  }

  .optical-login-preferences { grid-template-columns: 1fr; }
  .optical-theme-selector { width: 100%; }
  .optical-theme-selector button { min-width: 0; }

  .optical-language-popover {
    inset-block-start: calc(100% + 8px);
    inset-block-end: auto;
  }

  .optical-login-highlights { grid-template-columns: 1fr; }
  .optical-login-highlights li:nth-child(n + 3) { display: none; }
}

.optical-language-options [data-language-option][hidden] {
  display: none;
}
/* Optical business dashboard */
.optical-dashboard { gap: 14px; }

.optical-dashboard-hero {
  align-items: center;
  min-height: 118px;
}

.optical-dashboard-context {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.optical-kpi-card { --z-kpi-accent: var(--z-primary); }
.optical-kpi-card--attention { --z-kpi-accent: var(--z-warning); }

.optical-kpi-icon {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: var(--z-primary);
  background: var(--z-primary-soft);
  place-items: center;
}

.optical-kpi-icon::before {
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: -.03em;
}

.optical-kpi-icon--stock::before { content: "ST"; }
.optical-kpi-icon--products::before { content: "PR"; }
.optical-kpi-icon--purchases::before { content: "PO"; }
.optical-kpi-icon--attention::before { content: "!"; }

.optical-kpi-card--attention .optical-kpi-icon {
  color: var(--z-warning);
  background: color-mix(in srgb, var(--z-warning) 12%, transparent);
}

.optical-dashboard-grid:has(> article:only-child) {
  grid-template-columns: minmax(0, 1fr);
}

.optical-dashboard-grid .zn-dashboard-panel {
  min-width: 0;
}

.optical-dashboard-grid .zn-dashboard-panel header > div,
.optical-quick-panel header > div {
  display: grid;
  gap: 3px;
}

.optical-dashboard-grid .zn-dashboard-panel header .zn-eyebrow,
.optical-quick-panel header .zn-eyebrow {
  margin: 0;
}

.optical-panel-link {
  color: var(--z-primary);
  font-size: .8rem;
  font-weight: 800;
  text-decoration: none;
}

.optical-panel-link:hover { text-decoration: underline; }

.optical-branch-stock-list,
.optical-purchase-list {
  display: grid;
  gap: 7px;
}

.optical-branch-stock-row,
.optical-purchase-row {
  display: grid;
  align-items: center;
  min-height: 56px;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--z-border);
  border-radius: 11px;
  background: var(--z-surface-alt);
}

.optical-branch-stock-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.optical-branch-stock-row > div,
.optical-purchase-row > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.optical-branch-stock-row span,
.optical-purchase-row span {
  overflow: hidden;
  color: var(--z-text-muted);
  font-size: .77rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.optical-branch-mark {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--z-primary) !important;
  background: var(--z-primary-soft);
  font-size: .82rem !important;
  font-weight: 900;
  place-items: center;
}

.optical-branch-stock-row > strong {
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
}

.optical-purchase-row {
  grid-template-columns: minmax(0, 1fr) auto;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}

.optical-purchase-row:hover {
  border-color: color-mix(in srgb, var(--z-primary) 48%, var(--z-border));
  background: var(--z-primary-soft);
}

.optical-purchase-meta {
  justify-items: end;
  text-align: end;
}

.optical-purchase-meta strong {
  font-variant-numeric: tabular-nums;
}

.optical-panel-empty,
.optical-dashboard-empty {
  display: grid;
  gap: 4px;
  padding: 18px;
  color: var(--z-text-muted);
}

.optical-panel-empty strong,
.optical-dashboard-empty strong {
  color: var(--z-text);
}

.optical-quick-panel { gap: 10px; }

.optical-quick-actions {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.optical-quick-actions .zn-quick-action {
  min-height: 66px;
}

@media (max-width: 760px) {
  .optical-dashboard-hero {
    align-items: flex-start;
  }

  .optical-dashboard-context {
    justify-content: flex-start;
  }

  .optical-purchase-row {
    grid-template-columns: 1fr;
  }

  .optical-purchase-meta {
    grid-template-columns: 1fr auto;
    justify-items: start;
    text-align: start;
  }

  .optical-purchase-meta span {
    justify-self: end;
  }
}
/* Optical tenant user workspace */
.optical-user-list-card {
  padding: 0;
  overflow: hidden;
}

.optical-user-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-bottom: 1px solid var(--optical-line, #dbe7e5);
  background: #f8fbfa;
}

.optical-user-toolbar .zn-field { margin: 0; }
.optical-user-clear-filter { min-height: 38px; }

.optical-user-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px 10px;
}

.optical-user-list-heading h2,
.optical-user-list-heading p { margin: 0; }
.optical-user-list-heading h2 { font-size: 1rem; }
.optical-user-list-heading p { margin-top: 2px; color: #6b7f80; font-size: .75rem; }
.optical-user-table { min-width: 780px; }
.optical-user-name { display: block; }

.optical-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 750;
}

.optical-status-badge.is-active { color: #087666; background: #e3f4ef; }
.optical-status-badge.is-inactive { color: #7b4a43; background: #f6e9e6; }

.optical-empty-state {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 48px 20px;
  color: #617476;
  text-align: center;
}

.optical-empty-state strong { color: #17383b; font-size: 1rem; }
.optical-empty-state .zn-primary { margin-top: 8px; }

.optical-user-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  justify-content: flex-end;
  background: rgba(14, 37, 40, .42);
  backdrop-filter: blur(2px);
}

.optical-user-drawer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(600px, 100%);
  height: 100%;
  background: #fff;
  border-left: 1px solid #cbdcda;
  box-shadow: -18px 0 50px rgba(18, 51, 53, .16);
}

.optical-user-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #dbe7e5;
}

.optical-user-drawer-head h2,
.optical-user-drawer-head p { margin: 0; }
.optical-user-drawer-head h2 { margin-top: 3px; color: #102f33; font-size: 1.45rem; }
.optical-user-drawer-head p:last-child { margin-top: 5px; color: #65797b; font-size: .82rem; }
.optical-user-drawer-body { overflow-y: auto; padding: 8px 24px 24px; }

.optical-user-editor-section {
  padding: 18px 0;
  border-bottom: 1px solid #e3eceb;
}

.optical-user-editor-section:last-child { border-bottom: 0; }
.optical-user-editor-section h3 { margin: 0 0 12px; color: #17383b; font-size: .9rem; }
.optical-user-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.optical-user-field-wide { grid-column: 1 / -1; }
.optical-user-active { margin-top: 12px; }

.optical-user-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.optical-user-section-head h3 { margin: 0; }
.optical-user-section-head span { color: #748688; font-size: .72rem; }
.optical-choice-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.optical-choice-list-branches { grid-template-columns: 1fr; }

.optical-choice {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d6e3e1;
  border-radius: 8px;
  background: #fbfdfd;
  color: #263f42;
  font-size: .82rem;
  cursor: pointer;
}

.optical-choice:hover { border-color: #91bbb5; background: #f4faf8; }
.optical-choice:has(input:checked) { border-color: #4d9c91; background: #eaf6f2; }
.optical-choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.optical-choice-primary { font-weight: 700; }

.optical-user-drawer-actions {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 14px 24px;
  border-top: 1px solid #dbe7e5;
  background: #f8fbfa;
}

@media (max-width: 1050px) {
  .optical-user-toolbar { grid-template-columns: 2fr 1fr 1fr; }
  .optical-user-clear-filter { justify-self: start; }
}

@media (max-width: 700px) {
  .optical-user-toolbar { grid-template-columns: 1fr; }
  .optical-user-drawer { width: 100%; }
  .optical-user-drawer-head { padding: 18px; }
  .optical-user-drawer-body { padding: 6px 18px 18px; }
  .optical-user-editor-grid,
  .optical-choice-list { grid-template-columns: 1fr; }
  .optical-user-field-wide { grid-column: auto; }
  .optical-user-drawer-actions {
    grid-template-columns: 1fr 1fr;
    padding: 12px 18px;
  }
  .optical-user-drawer-actions span { display: none; }
  .optical-user-drawer-actions .zn-primary { grid-column: 1 / -1; order: -1; }
}

/* Optical login dark-theme contrast */
:root[data-z-theme-mode="dark"] .optical-login-root .z-login-story h1,
:root[data-z-theme-mode="dark"] .optical-login-root .zn-login-panel h1 {
  color: #f2fbfa;
}

@media (prefers-color-scheme: dark) {
  :root[data-z-theme-mode="auto"] .optical-login-root .z-login-story h1,
  :root[data-z-theme-mode="auto"] .optical-login-root .zn-login-panel h1 {
    color: #f2fbfa;
  }
}
/* Keep the Optical palette aligned with the resolved Framework dark theme. */
:root[data-z-theme="dark"] {
  --optical-bg: var(--z-background);
  --optical-surface: var(--z-surface);
  --optical-surface-muted: var(--z-surface-alt);
  --optical-border: var(--z-border);
  --optical-border-strong: var(--z-border-strong);
  --optical-ink: var(--z-text);
  --optical-muted: var(--z-text-muted);
  --optical-teal: var(--z-primary);
  --optical-teal-dark: var(--z-primary-hover);
  --optical-teal-soft: var(--z-primary-soft);
  --optical-shadow: var(--z-shadow-sm);
}

:root[data-z-theme="dark"] .optical-login-root .z-login-story h1,
:root[data-z-theme="dark"] .optical-login-root .zn-login-panel h1 {
  color: var(--z-text);
}
/* Optical dark-theme compatibility for shared shell and page primitives. */
:root[data-z-theme="dark"] .optical-entry-page {
  --optical-ink: var(--z-text);
  --optical-muted: var(--z-text-muted);
  --optical-line: var(--z-border);
  --optical-surface: var(--z-surface);
  --optical-wash: var(--z-surface-alt);
}

:root[data-z-theme="dark"] .z-sidebar {
  border-color: var(--z-sidebar-border);
  background:
    radial-gradient(circle at 12% 2%, color-mix(in srgb, var(--z-primary) 13%, transparent), transparent 14rem),
    linear-gradient(180deg, var(--z-sidebar-bg), color-mix(in srgb, var(--z-sidebar-bg) 88%, var(--z-surface)));
}

:root[data-z-theme="dark"] .z-brand-block strong,
:root[data-z-theme="dark"] .z-nav a,
:root[data-z-theme="dark"] .zn-nav-link {
  color: var(--z-sidebar-text);
}

:root[data-z-theme="dark"] .z-brand-block small,
:root[data-z-theme="dark"] .zn-nav-group,
:root[data-z-theme="dark"] .z-sidebar-footer,
:root[data-z-theme="dark"] .z-sidebar-footer span {
  color: var(--z-sidebar-muted);
}

:root[data-z-theme="dark"] .z-sidebar-footer span {
  border-color: var(--z-sidebar-border);
}

:root[data-z-theme="dark"] .z-menu-search::before {
  border-color: var(--z-sidebar-muted);
}

:root[data-z-theme="dark"] .z-menu-search::after {
  background: var(--z-sidebar-muted);
}

:root[data-z-theme="dark"] .z-menu-search input {
  color: var(--z-sidebar-text);
  background: var(--z-sidebar-card);
  border-color: var(--z-sidebar-border);
  box-shadow: none;
}

:root[data-z-theme="dark"] .z-nav a:hover,
:root[data-z-theme="dark"] .zn-nav-link:hover {
  color: var(--z-sidebar-text);
  background: var(--z-sidebar-hover);
}

:root[data-z-theme="dark"] .z-nav a.active,
:root[data-z-theme="dark"] .zn-nav-link.active {
  color: var(--z-primary);
  background: var(--z-sidebar-active);
  box-shadow: inset 0 0 0 1px var(--z-sidebar-border);
}

:root[data-z-theme="dark"] .z-topbar {
  border-color: var(--z-border);
  background: color-mix(in srgb, var(--z-surface) 94%, transparent);
  box-shadow: var(--z-shadow-sm);
}

:root[data-z-theme="dark"] .z-icon-button,
:root[data-z-theme="dark"] .z-topbar-chip,
:root[data-z-theme="dark"] .z-language-selector select,
:root[data-z-theme="dark"] .z-theme-selector button,
:root[data-z-theme="dark"] .z-user-menu {
  color: var(--z-text);
  background-color: var(--z-surface);
  border-color: var(--z-border);
}

:root[data-z-theme="dark"] .z-topbar-chip,
:root[data-z-theme="dark"] .z-user-summary small {
  color: var(--z-text-muted);
}

:root[data-z-theme="dark"] .z-content {
  background:
    radial-gradient(circle at 96% 2%, color-mix(in srgb, var(--z-primary) 7%, transparent), transparent 24rem),
    var(--z-background);
}

:root[data-z-theme="dark"] .zn-panel h3,
:root[data-z-theme="dark"] .zn-field,
:root[data-z-theme="dark"] .z-btn-secondary {
  color: var(--z-text-secondary);
}

:root[data-z-theme="dark"] .zn-input,
:root[data-z-theme="dark"] .z-btn-secondary,
:root[data-z-theme="dark"] .optical-editable-menu {
  color: var(--z-text);
  background: var(--z-surface);
  border-color: var(--z-border-strong);
}

:root[data-z-theme="dark"] .zn-input:hover,
:root[data-z-theme="dark"] .optical-editable-combo:hover > .zn-input,
:root[data-z-theme="dark"] .optical-entry-page .combo:hover > .zn-input,
:root[data-z-theme="dark"] .optical-entry-page select.zn-input:hover {
  border-color: var(--z-primary);
  background-color: var(--z-surface-raised);
}

:root[data-z-theme="dark"] .optical-combo-chevron:hover,
:root[data-z-theme="dark"] .optical-editable-option:hover,
:root[data-z-theme="dark"] .optical-editable-option.active {
  color: var(--z-primary);
  background: var(--z-primary-soft);
}

:root[data-z-theme="dark"] .optical-editable-option {
  color: var(--z-text);
}

:root[data-z-theme="dark"] .zn-grid-toolbar,
:root[data-z-theme="dark"] .optical-filter-bar,
:root[data-z-theme="dark"] .zn-update-toolbar,
:root[data-z-theme="dark"] .zn-table-wrap,
:root[data-z-theme="dark"] .optical-empty-state {
  color: var(--z-text);
  background: var(--z-surface);
  border-color: var(--z-border);
}

:root[data-z-theme="dark"] .zn-table thead th {
  color: var(--z-text-secondary);
  background: var(--z-surface-alt);
  border-color: var(--z-border-strong);
}

:root[data-z-theme="dark"] .zn-table tbody td {
  color: var(--z-text);
  background: var(--z-surface);
  border-color: var(--z-border);
}

:root[data-z-theme="dark"] .zn-table tbody tr:hover td {
  background: var(--z-surface-raised);
}

:root[data-z-theme="dark"] .zn-table td strong,
:root[data-z-theme="dark"] .optical-empty-state h2 {
  color: var(--z-text-primary);
}

:root[data-z-theme="dark"] .optical-badge {
  color: var(--z-text-secondary);
  background: var(--z-surface-alt);
  border-color: var(--z-border);
}

:root[data-z-theme="dark"] .optical-badge--source {
  color: var(--z-primary);
  background: var(--z-primary-soft);
  border-color: color-mix(in srgb, var(--z-primary) 35%, var(--z-border));
}

:root[data-z-theme="dark"] .optical-empty-state {
  background: var(--z-surface-alt);
}

:root[data-z-theme="dark"] .optical-empty-icon {
  border-color: var(--z-border-strong);
  box-shadow: inset 0 -8px 0 var(--z-primary-soft);
}