/* 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;
}

/* Optical Brand Display: Uppercase presentation for all brand names */
.optical-brand-name {
    text-transform: uppercase;
}

/* Global Brand Multi-Select Selector */
.optical-brand-selector {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    width: 100%;
    min-width: 0;
    /* Span full width in CRUD form grid layout */
    grid-column: 1 / -1;
}

.optical-brand-selector-search {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    width: 100%;
}

.optical-brand-selector-search label {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    font-size: .78rem;
    font-weight: 670;
    color: #52686b;
}

.optical-brand-selector-search-wrapper {
    position: relative;
    width: 100%;
}

.optical-brand-selector-search input {
    width: 100%;
    min-height: 37px;
    color: #183437;
    border-color: var(--optical-border-strong);
    border-radius: 8px;
    background-color: #fff;
    padding: .5rem .75rem;
    padding-right: 2.5rem;
    font-size: .875rem;
}

.optical-brand-selector-search input:hover {
    border-color: #98b8b4;
}

.optical-brand-selector-search input:focus {
    border-color: var(--optical-teal);
    box-shadow: 0 0 0 3px rgba(18, 111, 100, .10);
    outline: none;
}

.optical-brand-selector-search-clear {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--optical-muted);
    background: transparent;
    border: none;
    border-radius: .25rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    opacity: .6;
    transition: opacity .15s ease, color .15s ease;
}

.optical-brand-selector-search-clear:hover {
    opacity: 1;
    color: var(--optical-ink);
}

.optical-brand-selector-search-icon {
    position: absolute;
    right: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: var(--optical-muted);
    pointer-events: none;
}

.optical-brand-selector-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: .5rem;
    padding: .5rem .75rem;
    background: #fafcfb;
    border: 1px solid var(--optical-border);
    border-radius: 8px;
}

.optical-brand-toolbar-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.optical-brand-toolbar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.optical-brand-count {
    font-size: .75rem;
    color: var(--optical-muted);
    font-weight: 500;
}

.optical-brand-selector-list {
    flex: 1 1 auto;
    min-height: 200px;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--optical-border);
    border-radius: 10px;
    background: #fff;
}

.optical-brand-selector-list:empty::before {
    content: "No brands found";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--optical-muted);
    padding: 2rem;
    text-align: center;
}

.optical-brand-selector-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4375rem .875rem;
    border-bottom: 1px solid var(--optical-border);
    cursor: pointer;
    transition: background .15s ease;
    width: 100%;
    box-sizing: border-box;
}

.optical-brand-selector-item:last-child {
    border-bottom: none;
}

.optical-brand-selector-item:hover {
    background: #f7fbfa;
}

.optical-brand-selector-item.already-linked {
    opacity: .6;
    background: #fafcfb;
}

.optical-brand-selector-item.already-linked:hover {
    background: #f5faf8;
}

.optical-brand-selector-item.selected {
    background: var(--z-primary-soft);
}

.optical-brand-selector-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--z-primary);
    flex-shrink: 0;
    margin-right: .5rem;
}

.optical-brand-selector-item input[type="checkbox"]:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.optical-brand-selector-item .optical-brand-name {
    flex: 1;
    font-weight: 600;
    color: var(--optical-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .8125rem;
}

.optical-brand-selector-item.already-linked .optical-brand-name {
    color: var(--optical-muted);
}

.already-linked-badge {
    font-size: .5625rem;
    padding: 1px 5px;
    flex-shrink: 0;
    background: var(--z-primary-soft);
    color: var(--z-primary);
    border-radius: .25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.optical-brand-selector-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--optical-border);
    margin-top: auto;
    padding-bottom: .5rem;
}

/* Override zn-form grid behavior inside the selector */
.optical-brand-selector .zn-form {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    flex: 1 1 auto;
    min-height: 0;
}

.optical-brand-selector .zn-field {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    width: 100%;
    min-width: 0;
}

.optical-brand-selector .zn-field > span:first-child {
    font-size: .78rem;
    font-weight: 670;
    color: #52686b;
}

.optical-brand-selector .zn-field > input,
.optical-brand-selector .zn-field > select {
    width: 100%;
    min-height: 37px;
    color: #183437;
    border-color: var(--optical-border-strong);
    border-radius: 8px;
    background-color: #fff;
    padding: .5rem .75rem;
    font-size: .875rem;
}

.optical-brand-selector .zn-field > input:focus,
.optical-brand-selector .zn-field > select:focus {
    border-color: var(--optical-teal);
    box-shadow: 0 0 0 3px rgba(18, 111, 100, .10);
    outline: none;
}

.optical-brand-selector .zn-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--optical-border);
}

.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; }
}

/* Quick-add drawer (Brand / Category) */
.quick-add-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  justify-content: flex-end;
  background: rgba(14, 37, 40, .42);
  backdrop-filter: blur(2px);
}

.quick-add-drawer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(460px, 100%);
  height: 100%;
  background: #fff;
  border-left: 1px solid #cbdcda;
  box-shadow: -18px 0 50px rgba(18, 51, 53, .16);
}

.quick-add-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #dbe7e5;
}

.quick-add-drawer-header h3 {
  margin: 0;
  color: #102f33;
  font-size: 1.25rem;
}

.quick-add-drawer-close {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #bdd1d4;
  border-radius: 6px;
  background: #fbfefd;
  color: #0a5560;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  flex: 0 0 auto;
}

.quick-add-drawer-close:hover {
  border-color: #0d817c;
  background: #eaf7f5;
}

.quick-add-drawer-body {
  overflow-y: auto;
  padding: 20px 24px 24px;
}

.quick-add-drawer-body .zn-field {
  margin-bottom: 14px;
}

.quick-add-drawer-body .zn-input {
  min-height: 40px;
  border-radius: 6px;
  font-size: .87rem;
}

.quick-add-drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid #dbe7e5;
  background: #f8fbfa;
}

.quick-add-drawer-confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px 24px;
  text-align: center;
}

.quick-add-drawer-confirm p {
  margin: 0;
  color: #102f33;
  font-size: 1rem;
  font-weight: 600;
}

.quick-add-drawer-confirm-actions {
  display: flex;
  gap: 12px;
}

@media (max-width: 700px) {
  .quick-add-drawer {
    width: 100%;
  }

  .quick-add-drawer-header {
    padding: 16px 18px;
  }

  .quick-add-drawer-body {
    padding: 16px 18px 18px;
  }

  .quick-add-drawer-footer {
    padding: 12px 18px;
  }
}

/* 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);
}

/* Brand logo upload */
.optical-brand-logo-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
}

.optical-brand-initials-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: #e0ece9;
  color: #126f64;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .03em;
}

/* Active checkbox field */
.optical-brand-active-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.optical-brand-active-checkbox {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: #126f64;
}

.optical-brand-active-hint {
  flex-basis: 100%;
  font-size: 0.8rem;
  color: #6f8683;
  margin-top: -0.25rem;
  padding-left: 0;
}

/* Brand logo section */
.optical-brand-logo-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.optical-brand-logo-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.optical-brand-logo-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a2e2b;
}

.optical-brand-logo-section-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: #6f8683;
  background: #e8f0ee;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.optical-brand-logo-section-hint {
  font-size: 0.8rem;
  color: #6f8683;
  margin: 0;
}

/* Logo preview image */
.optical-brand-logo-preview-img {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #e0ece9;
}

/* Selected logo card */
.optical-brand-logo-selected {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem;
  background: #fafcfc;
  border: 1px solid #d4e2df;
  border-radius: 6px;
}

.optical-brand-logo-selected-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.optical-brand-logo-filename {
  font-size: 0.85rem;
  font-weight: 500;
  color: #1a2e2b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.optical-brand-logo-filesize {
  font-size: 0.75rem;
  color: #6f8683;
}

.optical-brand-logo-remove-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #c0392b;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0;
  margin-top: 0.25rem;
  width: fit-content;
}

.optical-brand-logo-remove-btn:hover {
  color: #96281b;
  text-decoration: underline;
}

/* Upload dropzone */
.optical-brand-upload-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 120px;
  padding: 1.25rem;
  border: 2px dashed #c2d4d0;
  border-radius: 8px;
  background: #f6fafa;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.optical-brand-upload-dropzone:hover {
  border-color: #126f64;
  background: #eef7f5;
}

.optical-brand-upload-dropzone:hover .optical-brand-upload-icon {
  color: #126f64;
}

.optical-brand-upload-dropzone:hover .optical-brand-upload-browse {
  color: #0d5a50;
  text-decoration: underline;
}

.optical-brand-upload-icon {
  color: #8faa9e;
  transition: color .2s;
}

.optical-brand-upload-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.optical-brand-upload-primary {
  font-size: 0.85rem;
  font-weight: 500;
  color: #1a2e2b;
}

.optical-brand-upload-secondary {
  font-size: 0.8rem;
  color: #6f8683;
}

.optical-brand-upload-browse {
  font-weight: 500;
  color: #126f64;
}

.optical-brand-upload-hint {
  font-size: 0.75rem;
  color: #8faa9e;
  margin-top: 0.25rem;
}

.optical-brand-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Drawer footer */
.optical-brand-drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0ece9;
  background: #fff;
}

/* Grid row actions */
.optical-actions-col {
  width: 1%;
  white-space: nowrap;
}

.optical-row-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.optical-row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #6f8683;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.optical-row-action-btn:hover {
  background: #eef7f5;
  color: #126f64;
}

.optical-row-action-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.optical-row-action-btn--danger:hover {
  background: #fdf0ef;
  color: #c0392b;
}

/* Delete confirmation */
.optical-delete-warning {
  font-size: 0.85rem;
  color: #6f8683;
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------------------------
   OpticalDropdown (common searchable dropdown / combobox)
   --------------------------------------------------------------------------- */
.optical-dropdown {
  position: relative;
  min-width: 0;
  width: 100%;
}

/* Inside the inline "field + Add" rows the dropdown takes the free space. */
.product-inline-action > .optical-dropdown {
  flex: 1 1 auto;
}

.optical-dropdown .zn-combobox-input {
  cursor: text;
}

.optical-dropdown .zn-combobox-input:disabled,
.optical-dropdown .zn-combobox-toggle:disabled {
  cursor: not-allowed;
  opacity: .7;
}

.optical-dropdown .zn-combobox-clear {
  font-size: 1.1rem;
  line-height: 1;
}

/* Viewport-aware fallback: shown until the positioning helper has placed the
   popover (the framework helper rewrites it to fixed coordinates). */
.optical-dropdown .zn-combobox-popover[data-positioned="false"] {
  position: absolute;
  visibility: visible;
  inset-inline: 0;
  top: calc(100% + 5px);
  width: auto;
  max-height: 240px;
}

.optical-dropdown .zn-combobox-add {
  color: var(--z-primary);
  font-weight: 700;
  border-top: 1px solid var(--z-border);
  border-radius: 0;
}

.optical-dropdown .zn-combobox-add:hover {
  background: var(--z-primary-soft);
}

/* ---------------------------------------------------------------------------
   OpticalPhotoUploader — drag-and-drop multi-photo control
   --------------------------------------------------------------------------- */
.optical-photo-uploader { display: flex; flex-direction: column; gap: .55rem; }

.optical-photo-uploader-head { display: flex; align-items: center; justify-content: space-between; }
.optical-photo-uploader-title { color: #071735; font-size: .78rem; font-weight: 700; }
.optical-photo-uploader-count { color: var(--optical-muted); font-size: .72rem; font-weight: 600; }

.optical-photo-dropzone {
  position: relative;
  border: 1.5px dashed var(--optical-border-strong, #9fb3b0);
  border-radius: 8px;
  background: #fbfefd;
  transition: border-color .15s ease, background .15s ease;
}
.optical-photo-dropzone:hover,
.optical-photo-dropzone.is-dragover {
  border-color: var(--optical-teal, #0d817c);
  background: #eef7f5;
}
.optical-photo-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: 1.15rem .75rem;
  cursor: pointer;
  text-align: center;
}
.optical-photo-dropzone-icon { font-size: 1.35rem; color: var(--optical-teal, #0d817c); line-height: 1; }
.optical-photo-dropzone-text { color: #071735; font-size: .82rem; font-weight: 650; }
.optical-photo-dropzone-sub { color: var(--optical-muted); font-size: .72rem; }
.optical-photo-file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.optical-photo-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}
.optical-photo-thumb {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  width: 108px;
  min-width: 0;
  overflow: hidden;
}
.optical-photo-thumb-img {
  position: relative;
  width: 108px;
  height: 108px;
  border: 1px solid var(--optical-border);
  border-radius: 6px;
  overflow: hidden;
  background: #f4f7f6;
}
.optical-photo-thumb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.optical-photo-primary-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--optical-teal, #0d817c);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
}
.optical-photo-status {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .68rem;
  font-weight: 800;
  color: #fff;
}
.optical-photo-status.is-error { background: #c0392b; }
.optical-photo-status.is-uploading { background: var(--optical-teal, #0d817c); }
/* Actions wrap inside the 108px thumbnail instead of overflowing past its edge:
   "Set as primary" takes its own line and "Remove" wraps below when both are shown. */
.optical-photo-thumb-actions { display: flex; flex-wrap: wrap; gap: .25rem; min-width: 0; }
.optical-photo-action {
  flex: 1 1 auto;
  min-width: 0;
  padding: 2px 5px;
  border: 1px solid var(--optical-border);
  border-radius: 4px;
  background: #fff;
  color: #0a5560;
  font-size: .62rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}
.optical-photo-action:hover { border-color: var(--optical-teal, #0d817c); background: #eaf7f5; }
.optical-photo-action--remove { color: #c0392b; }
.optical-photo-thumb-error {
  color: #c0392b;
  font-size: .62rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
   Compact Variant Cards
   --------------------------------------------------------------------------- */
.variant-card {
  border: 1px solid var(--optical-border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.variant-card + .variant-card { margin-top: .55rem; }

.variant-card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .55rem;
  padding: .55rem .75rem;
  background: #f6faf9;
  border-bottom: 1px solid var(--optical-border);
}
.variant-card-title {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  min-width: 0;
  flex: 1 1 auto;
  color: #071735;
  font-size: .82rem;
  font-weight: 700;
}
.variant-card-index { color: var(--optical-teal, #0d817c); font-weight: 800; }
.variant-card-identity {
  color: #44566b;
  font-size: .76rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.variant-card-actions { display: flex; gap: .35rem; flex: 0 0 auto; align-items: center; }
.variant-card-active {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex: 0 0 auto;
  color: #071735;
  font-size: .76rem;
  font-weight: 650;
  white-space: nowrap;
}
.variant-card-action {
  padding: 3px 9px;
  border: 1px solid var(--optical-border);
  border-radius: 5px;
  background: #fff;
  color: #0a5560;
  font-size: .7rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.variant-card-action:hover { border-color: var(--optical-teal, #0d817c); background: #eaf7f5; }
.variant-card-action--remove { color: #c0392b; }

.variant-card-body { padding: .75rem; display: flex; flex-direction: column; gap: .55rem; }
.variant-card-row {
  display: grid;
  gap: .55rem .75rem;
  grid-template-columns: repeat(24, minmax(0, 1fr));
}
/* Framework gives every .zn-field grid-column: span 12, which forces one field per
   line inside a row. Reset it and re-apply the reference spans per position.
   Row 1 (reference): Colour 6, Colour Code 4, Eye Size 3, Bridge 3, Temple 3, SKU 5.
   Row 2 (reference): Purchase 4, MRP 4, Sales 4, Alert 4, Barcode+Generate 8. */
.variant-card-row > .zn-field { grid-column: auto; min-width: 0; }
.variant-card-row--dimensions > .zn-field:nth-child(1) { grid-column: span 6; }
.variant-card-row--dimensions > .zn-field:nth-child(2) { grid-column: span 4; }
.variant-card-row--dimensions > .zn-field:nth-child(3) { grid-column: span 3; }
.variant-card-row--dimensions > .zn-field:nth-child(4) { grid-column: span 3; }
.variant-card-row--dimensions > .zn-field:nth-child(5) { grid-column: span 3; }
.variant-card-row--dimensions > .zn-field:nth-child(6) { grid-column: span 5; }
.variant-card-row--pricing > .zn-field:nth-child(1) { grid-column: span 4; }
.variant-card-row--pricing > .zn-field:nth-child(2) { grid-column: span 4; }
.variant-card-row--pricing > .zn-field:nth-child(3) { grid-column: span 4; }
.variant-card-row--pricing > .zn-field:nth-child(4) { grid-column: span 4; }
.variant-card-row--pricing > .zn-field:nth-child(5) { grid-column: span 8; }
/* Variant Photos (body-level field) is a flex child (full width); the span keeps
   the 24-track grid model consistent if the body ever becomes a grid. */
.variant-card-body > .zn-field { grid-column: span 24; min-width: 0; }
.variant-card-row .zn-field { gap: .25rem; }
.variant-card-row .zn-input { min-height: 38px; border-radius: 6px; font-size: .87rem; }
.variant-card-row .zn-field > span { color: #52686b; font-size: .78rem; font-weight: 670; }

.variant-barcode-cell { display: flex; gap: .4rem; align-items: center; min-width: 0; }
.variant-barcode-cell .zn-input { flex: 1 1 auto; min-width: 0; }
.variant-gen-button {
  flex: 0 0 auto;
  padding: 3px 10px;
  border: 1px solid #bdd1d4;
  border-radius: 5px;
  background: #fbfefd;
  color: #0a5560;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
}
.variant-gen-button:hover { border-color: #0d817c; background: #eaf7f5; }

/* The variant card container (.product-variant-grid-card) sets container-type:
   inline-size, so these reflow on the card itself rather than the viewport.
   Rows use a 24-track grid: 12 tracks = 2-up, 24 = 1-up. */
@container (max-width: 720px) {
  .variant-card-row > .zn-field,
  .variant-card-row--dimensions > .zn-field:nth-child(n),
  .variant-card-row--pricing > .zn-field:nth-child(n) { grid-column: span 12; }
}

@container (max-width: 640px) {
  .variant-card-row > .zn-field,
  .variant-card-row--dimensions > .zn-field:nth-child(n),
  .variant-card-row--pricing > .zn-field:nth-child(n) { grid-column: span 24; }
  .variant-card-header { flex-wrap: wrap; }
}

/* Optical stock reports: presentation only; scroll stays inside the report. */
.optical-stock-reporting { display: grid; gap: 1rem; min-width: 0; max-width: 100%; }
.optical-stock-reporting > * { min-width: 0; }
.optical-stock-reporting .optical-entry-card { background: var(--optical-surface); border: 1px solid var(--optical-border); border-radius: var(--optical-radius); padding: 1rem; box-shadow: var(--optical-shadow); }
.optical-stock-reporting .report-filter-card, .optical-stock-reporting .report-filter-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .85rem; align-items: end; }
.optical-stock-reporting .report-filter-card .zn-field { min-width: 0; }
.optical-stock-reporting .report-filter-card .zn-input { width: 100%; min-width: 0; box-sizing: border-box; }
.optical-stock-reporting .report-branch-scope { display: flex; align-items: center; background: var(--optical-surface-muted); height: auto; min-height: 38px; overflow-wrap: anywhere; }
.optical-stock-reporting .zn-form-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.optical-stock-reporting .report-advanced { grid-column: 1 / -1; border-top: 1px solid var(--optical-border); padding-top: .75rem; }
.optical-stock-reporting summary { cursor: pointer; font-weight: 650; color: var(--optical-ink); }
.optical-stock-reporting summary:focus-visible, .optical-stock-reporting .report-grid-scroll:focus-visible { outline: 2px solid var(--z-primary); outline-offset: 3px; }
.optical-stock-reporting .report-advanced summary span { font-size: .8rem; color: var(--optical-muted); font-weight: 400; margin-left: .5rem; }
.optical-stock-reporting .report-filter-grid { padding-top: 1rem; }
.optical-stock-reporting .report-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.optical-stock-reporting.stock-report-page .report-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.optical-stock-reporting .report-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: 1rem 1.15rem; border-radius: var(--optical-radius); border: 1px solid var(--optical-border); background: var(--optical-surface); box-shadow: var(--optical-shadow); border-top: 3px solid var(--optical-border-strong); }
.optical-stock-reporting .report-kpi-closing { background: var(--z-primary-soft); border-top-color: var(--z-primary); }
.optical-stock-reporting .report-kpi span { font-size: .85rem; color: var(--optical-muted); }
.optical-stock-reporting .report-kpi strong { font-size: clamp(1.3rem, 2.3vw, 1.85rem); line-height: 1.2; color: var(--optical-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.optical-stock-reporting .report-kpi small { color: var(--optical-muted); font-size: .75rem; }
.optical-stock-reporting .report-secondary { display: flex; flex-wrap: wrap; gap: .7rem 1.25rem; }
.optical-stock-reporting .report-secondary > div { display: flex; flex-direction: column; gap: .3rem; flex: 1 1 105px; }
.optical-stock-reporting .report-secondary span { color: var(--optical-muted); font-size: .75rem; }
.optical-stock-reporting .report-secondary strong { font-size: .95rem; font-variant-numeric: tabular-nums; }
.optical-stock-reporting .report-recon-status { display: inline-block; color: var(--optical-muted); font-size: .8rem; font-weight: 400; margin-left: .6rem; }
.optical-stock-reporting .report-recon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.optical-stock-reporting .report-recon-grid section { padding: 1rem; border-radius: var(--optical-radius); background: var(--optical-surface-muted); }
.optical-stock-reporting .report-recon-grid h3 { font-size: .9rem; margin: 0 0 .7rem; }
.optical-stock-reporting dl { display: grid; grid-template-columns: 1fr auto; gap: .6rem; margin: 0 0 .8rem; font-size: .85rem; }
.optical-stock-reporting dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.optical-stock-reporting .report-variance { color: #a45912; }
.optical-stock-reporting .report-context, .optical-stock-reporting .report-grid-head p { color: var(--optical-muted); font-size: .8rem; margin: .5rem 0; }
.optical-stock-reporting .report-grid-head h2 { font-size: 1rem; margin: 0; }
.optical-stock-reporting .report-grid-head h2 span { color: var(--optical-muted); font-weight: 400; }
.optical-stock-reporting .report-grid-scroll { width: 100%; max-width: 100%; min-width: 0; overflow: auto; max-height: 64vh; overscroll-behavior-inline: contain; border-radius: var(--optical-radius); border: 1px solid var(--optical-border); }
.optical-stock-reporting .report-data-grid { table-layout: auto; border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: .82rem; }
.optical-stock-reporting .report-data-grid th, .optical-stock-reporting .report-data-grid td { padding: .65rem .8rem; white-space: nowrap; min-width: 100px; border-right: 1px solid var(--optical-border); line-height: 1.4; }
.optical-stock-reporting .report-data-grid th { position: sticky; top: 0; z-index: 2; background: var(--optical-surface-muted); text-transform: none; letter-spacing: normal; font-size: .75rem; }
.optical-stock-reporting .history-grid thead tr:last-child th { top: 32px; }
.optical-stock-reporting .report-column-groups th { height: 32px; box-sizing: border-box; padding-block: .35rem; color: var(--z-primary); font-size: .7rem; }
.optical-stock-reporting .report-data-grid tbody td:first-child, .optical-stock-reporting .report-data-grid thead tr:last-child th:first-child { position: sticky; left: 0; z-index: 1; min-width: 320px; max-width: 400px; white-space: normal; overflow-wrap: anywhere; background: var(--optical-surface); border-right: 2px solid var(--optical-border-strong); }
.optical-stock-reporting .report-data-grid thead tr:last-child th:first-child { z-index: 3; background: var(--optical-surface-muted); }
.optical-stock-reporting .report-data-grid tbody td:first-child strong { display: block; font-size: .85rem; }
.optical-stock-reporting .stock-history-sub { color: var(--optical-muted); font-size: .75rem; margin-top: .25rem; line-height: 1.5; }
.optical-stock-reporting .history-grid tbody td:nth-child(n+4):nth-child(-n+14), .optical-stock-reporting .history-grid thead tr:last-child th:nth-child(n+4):nth-child(-n+14), .optical-stock-reporting .current-stock-grid td:nth-child(n+5), .optical-stock-reporting .current-stock-grid th:nth-child(n+5) { text-align: right; font-variant-numeric: tabular-nums; }
.optical-stock-reporting .history-grid tbody td:nth-child(13), .optical-stock-reporting .history-grid tbody td:nth-child(14), .optical-stock-reporting .history-grid thead tr:last-child th:nth-child(13), .optical-stock-reporting .history-grid thead tr:last-child th:nth-child(14), .optical-stock-reporting .report-closing { background: var(--z-primary-soft); font-weight: 750; color: var(--z-primary); }
.optical-stock-reporting .report-data-grid td:last-child { min-width: 110px; }
.optical-stock-reporting .report-detail-grid { min-width: 850px; }
.optical-stock-reporting .report-detail-grid th { position: sticky; top: 0; background: var(--optical-surface-muted); }
.optical-stock-reporting .report-detail-grid td:nth-last-child(2), .optical-stock-reporting .report-detail-grid td:nth-last-child(3), .optical-stock-reporting .report-detail-grid td:nth-last-child(4) { text-align: right; font-variant-numeric: tabular-nums; }
.optical-stock-reporting .stock-history-detail-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.optical-stock-reporting .stock-history-detail-head h2 { font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.optical-stock-reporting .stock-history-detail-head p { font-size: .8rem; color: var(--optical-muted); }
.optical-stock-reporting .stock-history-pager { display: flex; justify-content: center; align-items: center; gap: .75rem; margin-top: .75rem; }
.optical-stock-reporting .optical-loading-state, .optical-stock-reporting .optical-empty-state, .optical-stock-reporting .optical-error-state { display: flex; flex-direction: column; align-items: center; padding: 2.5rem 1rem; text-align: center; gap: .75rem; color: var(--optical-muted); }
.optical-stock-reporting .optical-empty-state h2 { font-size: 1.1rem; margin: 0; }
.optical-stock-reporting .optical-loading-spinner { width: 1.5rem; height: 1.5rem; border: 3px solid var(--optical-border); border-top-color: var(--z-primary); border-radius: 50%; }
@media (max-width: 1100px) {
    .optical-stock-reporting .report-filter-card, .optical-stock-reporting .report-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .optical-stock-reporting .report-filter-card .zn-field, .optical-stock-reporting .report-filter-card .zn-form-actions { grid-column: span 1; }
    .optical-stock-reporting .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .optical-stock-reporting .report-filter-card, .optical-stock-reporting .report-filter-grid, .optical-stock-reporting .report-recon-grid { grid-template-columns: minmax(0, 1fr); }
    .optical-stock-reporting.stock-report-page .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .optical-stock-reporting .report-kpi { padding: .8rem; }
    .optical-stock-reporting .report-advanced summary span { display: block; margin: .4rem 0 0; }
    .optical-stock-reporting .report-recon-status { display: block; margin: .4rem 0 0; line-height: 1.6; }
    .optical-stock-reporting .report-data-grid tbody td:first-child, .optical-stock-reporting .report-data-grid thead tr:last-child th:first-child { min-width: 180px; max-width: 210px; }
    .optical-stock-reporting .report-data-grid th, .optical-stock-reporting .report-data-grid td { padding: .55rem .65rem; font-size: .78rem; }
    .optical-stock-reporting .report-kpi strong { font-size: 1.35rem; }
}
.optical-stock-reporting.stock-history-page .report-filter-card > .zn-field { grid-column: span 3; }
.optical-stock-reporting.stock-history-page .report-filter-card > .zn-field:nth-of-type(5) { grid-column: span 8; }
.optical-stock-reporting.stock-history-page .report-filter-card > .zn-form-actions { grid-column: span 4; justify-content: flex-end; margin: 0; padding: 0; }
.optical-stock-reporting.stock-history-page .report-filter-grid > .zn-field { grid-column: span 3; }
@media (max-width: 1100px) {
    .optical-stock-reporting.stock-history-page .report-filter-card > .zn-field,
    .optical-stock-reporting.stock-history-page .report-filter-card > .zn-field:nth-of-type(5),
    .optical-stock-reporting.stock-history-page .report-filter-card > .zn-form-actions,
    .optical-stock-reporting.stock-history-page .report-filter-grid > .zn-field { grid-column: span 1; }
    .optical-stock-reporting.stock-history-page .report-filter-card > .zn-form-actions { justify-content: flex-start; }
}
/* Constrain the shell's intrinsic grid track only while a stock report is mounted. */
.z-main:has(.optical-stock-reporting) { grid-template-columns: minmax(0, 1fr); }
.optical-stock-reporting .zn-page-head p { white-space: normal; overflow-wrap: anywhere; }
.optical-stock-reporting .report-grid-scroll { box-sizing: border-box; }

/* Stock reporting closure: consistent KPIs, compact descriptions and discoverable scrolling. */
.optical-stock-reporting .report-kpi { min-width: 0; box-sizing: border-box; }
.optical-stock-reporting .report-scroll-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .65rem; }
.optical-stock-reporting .report-scroll-toolbar > span { color: var(--optical-muted); font-size: .75rem; flex: 1 1 260px; }
.optical-stock-reporting .report-scroll-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.optical-stock-reporting .report-scroll-actions button { min-height: 32px; padding: .3rem .65rem; font-size: .78rem; }
.optical-stock-reporting .report-grid-scroll { overflow-x: scroll; scrollbar-width: auto; scrollbar-color: var(--optical-border-strong) var(--optical-surface-muted); }
.optical-stock-reporting .report-grid-scroll::-webkit-scrollbar { height: 14px; width: 12px; }
.optical-stock-reporting .report-grid-scroll::-webkit-scrollbar-track { background: var(--optical-surface-muted); }
.optical-stock-reporting .report-grid-scroll::-webkit-scrollbar-thumb { background: var(--optical-border-strong); border: 3px solid var(--optical-surface-muted); border-radius: 8px; }
.optical-stock-reporting .report-data-grid tbody td:first-child { box-shadow: 3px 0 5px rgba(20, 44, 48, .06); }
.optical-stock-reporting .report-product-description summary { display: flex; align-items: start; gap: .4rem; list-style: none; font-weight: 650; }
.optical-stock-reporting .report-product-description summary::-webkit-details-marker { display: none; }
.optical-stock-reporting .report-data-grid tbody td:first-child .report-product-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; line-height: 1.4; max-height: 2.8em; flex: 1; min-width: 0; }
.optical-stock-reporting .report-description-icon { color: var(--optical-muted); font-size: .85rem; flex: none; }
.optical-stock-reporting .report-product-description p { white-space: normal; overflow-wrap: anywhere; font-size: .8rem; font-weight: 400; line-height: 1.5; margin: .65rem 0 0; padding-top: .5rem; border-top: 1px solid var(--optical-border); }
.optical-stock-reporting .report-scope-note, .optical-stock-reporting .report-monthly-note { margin: 0; }
@media (max-width: 1100px) and (min-width: 601px) {
    .optical-stock-reporting.stock-report-page .report-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .optical-stock-reporting.stock-report-page .report-kpis { grid-template-columns: minmax(0, 1fr); }
    .optical-stock-reporting .report-scroll-actions { width: 100%; justify-content: space-between; }
}

/* Optical navigation: permission-filtered icons and responsive shell. */
.optical-nav-link::before { display:none !important; }
.optical-nav-icon { width:19px; height:19px; flex:0 0 19px; }
.optical-nav-link { gap:10px; }
.z-nav .optical-nav-link.active { background:var(--optical-teal-light,#dcefeb); color:var(--optical-teal-dark,#075c52); box-shadow:inset 3px 0 0 var(--optical-teal); }
.optical-nav-close { display:none; }
.optical-nav-tooltip { position:fixed; z-index:1100; padding:7px 10px; border-radius:6px; background:#12383d; color:white; font-size:.8rem; pointer-events:none; box-shadow:0 3px 10px #0003; }
.optical-sidebar-backdrop { position:fixed; inset:0; background:#102b3d70; border:0; z-index:1040; }
.optical-sidebar-backdrop[hidden], .optical-nav-tooltip[hidden] { display:none; }
.z-app-shell[data-optical-shell] .z-main { min-width:0; grid-template-columns:minmax(0,1fr); }
.z-app-shell[data-optical-shell] .z-content { min-width:0; max-width:100%; box-sizing:border-box; }
.z-app-shell[data-optical-shell] .z-topbar-title { display:block; min-width:0; }
.z-app-shell[data-optical-shell] .z-topbar-title strong { font-size:.8rem; }
.z-app-shell[data-optical-shell] .z-topbar-title > span { display:none; }
.z-app-shell[data-optical-shell][data-shell-collapsed="true"] { grid-template-columns:72px minmax(0,1fr); }
.z-app-shell[data-optical-shell][data-shell-collapsed="true"] .z-sidebar { padding-inline:8px; }
.z-app-shell[data-optical-shell][data-shell-collapsed="true"] .optical-nav-link { min-height:40px; font-size:0; }
.z-app-shell[data-optical-shell][data-shell-collapsed="true"] .optical-nav-icon { display:block; }
.z-app-shell[data-optical-shell][data-shell-collapsed="true"] .z-brand-mark { width:40px; }
@media (min-width:768px) and (max-width:1100px) {
  .z-app-shell[data-optical-shell] { grid-template-columns:244px minmax(0,1fr); }
  .z-app-shell[data-optical-shell][data-shell-collapsed="true"] { grid-template-columns:72px minmax(0,1fr); }
  .z-app-shell[data-optical-shell] .z-sidebar { position:relative; inset:auto; width:auto; transform:none; height:100%; z-index:auto; }
}
@media (max-width:767px) {
  .z-app-shell[data-optical-shell] { grid-template-columns:minmax(0,1fr); }
  .z-app-shell[data-optical-shell] .z-sidebar { position:fixed; inset:0 auto 0 0; width:min(320px,calc(100vw - 32px)); transform:translateX(-105%); z-index:1050; height:100dvh; }
  body.z-sidebar-open .z-app-shell[data-optical-shell] .z-sidebar { transform:translateX(0); }
  .optical-nav-close { display:grid; place-items:center; position:absolute; right:10px; top:10px; width:34px; height:34px; border:0; border-radius:6px; background:var(--optical-surface,#fff); color:var(--optical-text,#183b3c); font-size:24px; cursor:pointer; }
  .z-app-shell[data-optical-shell] .z-brand-block { padding-right:26px; }
  .z-app-shell[data-optical-shell] .z-topbar-title { max-width:calc(100vw - 90px); }
}
@media (min-width:768px) and (max-width:1100px) {
  .z-app-shell[data-optical-shell] .z-main { grid-column:2; grid-row:1; }
  .z-app-shell[data-optical-shell] .z-sidebar { grid-column:1; grid-row:1; }
}

/* Optical Roles & Permissions editor */
.roles-toolbar{display:grid;grid-template-columns:minmax(220px,1fr) minmax(260px,1.5fr) auto;gap:18px;align-items:end;margin-bottom:16px;overflow:visible}.roles-toolbar label,.roles-field-label{display:block;font-size:.85rem;font-weight:600;margin-bottom:4px}.roles-toolbar input{width:100%;box-sizing:border-box}.roles-selection{min-width:140px;padding-bottom:6px}.roles-selection small{display:block;margin-top:4px;color:#577078}.roles-modules{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.roles-module{min-width:0}.roles-module>header{display:flex;justify-content:space-between;align-items:center;gap:10px;padding-bottom:12px;border-bottom:1px solid #dce7e7}.roles-module h2{margin:0 0 4px;font-size:1rem}.roles-module small{color:#577078;font-size:.76rem}.roles-module-actions{display:flex;gap:6px;flex-shrink:0}.roles-permissions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-top:12px}.roles-permission{display:flex;align-items:flex-start;gap:9px;padding:9px;border:1px solid #e0e9e9;border-radius:6px;cursor:pointer;min-width:0}.roles-permission:has(input:checked){background:#edf8f5;border-color:#b4dcd2}.roles-permission input{flex:none;margin-top:3px}.roles-permission span{min-width:0}.roles-permission strong{display:block;font-size:.8rem;line-height:1.4}.roles-permission code{display:block;font-size:.7rem;color:#526c73;overflow-wrap:anywhere;margin:4px 0}.roles-permission small{display:block;overflow-wrap:anywhere}.roles-save{display:flex;justify-content:space-between;align-items:center;margin-top:16px;gap:12px}.roles-save button{display:flex;align-items:center;gap:8px}.roles-spinner{width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:roles-spin .7s linear infinite}@keyframes roles-spin{to{transform:rotate(360deg)}}@media(max-width:1000px){.roles-permissions{grid-template-columns:1fr}}@media(max-width:760px){.roles-toolbar,.roles-modules{grid-template-columns:1fr}.roles-module>header{flex-wrap:wrap}.roles-save{flex-wrap:wrap}}

/* Stock Availability product summaries and read-only source details. */
.stock-availability-summary .stock-summary-results{overflow:auto}.stock-availability-summary .stock-summary-table{width:100%;table-layout:fixed}.stock-availability-summary .stock-summary-table>thead th:first-child{width:36%}.stock-availability-summary .stock-summary-table>thead th:nth-child(2){width:22%}.stock-availability-summary .stock-summary-table>thead th:last-child{width:100px}.stock-availability-summary .stock-summary-table td{overflow-wrap:anywhere;vertical-align:top}.stock-availability-summary .stock-product-row small{display:block;color:#526d75;font-size:.75rem;margin-top:4px}.stock-availability-summary .stock-number{text-align:right!important;font-variant-numeric:tabular-nums}.stock-availability-summary .stock-detail-row>td{padding:12px;background:#f5f9f9}.stock-source-details{max-height:340px;overflow:auto}.stock-source-details>p{margin:0 0 10px;font-size:.8rem;color:#526d75}.stock-branch-detail{margin-bottom:14px}.stock-branch-detail h2{font-size:.9rem;margin:0 0 6px;display:flex;justify-content:space-between;gap:12px}.stock-branch-detail h2 small{font-size:.75rem;font-weight:400}.stock-branch-detail table{width:100%;font-size:.8rem}.stock-summary-pagination{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-top:14px;font-size:.8rem}@media(max-width:700px){.stock-availability-summary .stock-summary-table{table-layout:auto;font-size:.75rem}.stock-availability-summary .stock-summary-table>thead th:last-child{width:auto}.stock-branch-detail h2,.stock-summary-pagination{flex-wrap:wrap}.stock-availability-summary .stock-summary-table td,.stock-availability-summary .stock-summary-table th{padding:6px}.stock-availability-summary .stock-product-row button{padding:6px;font-size:.75rem}}
/* Existing shop setup: single product-selection workflow and tenant logo upload. */
.shop-setup-page h2{font-size:1rem;margin:0 0 6px}.shop-logo-section{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:center}.shop-logo-section img{display:block;max-width:180px;max-height:100px;object-fit:contain;margin:10px 0}.shop-logo-section h2 small{font-size:.75rem;color:#577078}.shop-logo-drop{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;border:2px dashed #9fc6bf;border-radius:8px;background:#f4faf8;min-height:140px;cursor:pointer;padding:15px;text-align:center}.shop-logo-drop input[type=file]{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}.shop-logo-drop:focus-within{outline:2px solid #08786e;outline-offset:3px}.shop-selection-head{display:flex;justify-content:space-between;gap:15px;align-items:center;margin-bottom:16px}.shop-selection-head small{font-size:.8rem;color:#577078}.shop-family-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px;margin-top:14px}.shop-family-option{display:flex;align-items:flex-start;gap:10px;padding:14px;border:1px solid #dbe7e5;border-radius:7px;cursor:pointer}.shop-family-option.selected{background:#edf8f4;border-color:#9bcec2}.shop-family-option input{margin-top:3px}.shop-family-option strong{font-size:.86rem}.shop-family-option small{display:block;font-size:.73rem;color:#526d75;margin-top:5px}.shop-mode{max-width:450px}.shop-save-actions{display:flex;justify-content:space-between;gap:15px;align-items:center;margin-top:20px}.shop-save-actions button{display:flex;align-items:center;gap:8px}.shop-saving-spinner{width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:shop-spin .7s linear infinite}@keyframes shop-spin{to{transform:rotate(360deg)}}@media(max-width:700px){.shop-logo-section{grid-template-columns:1fr}.shop-selection-head,.shop-save-actions{flex-wrap:wrap}}
/* Guided setup reuses the existing page and services. */
.shop-steps{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:9px;margin:0 0 18px}.shop-steps button{display:grid;grid-template-columns:26px 1fr;gap:4px 8px;text-align:left;border:1px solid #d5e4df;background:#fff;border-radius:8px;padding:12px;color:#17383d;cursor:pointer}.shop-steps button span{grid-row:span 2;background:#edf5f2;border-radius:50%;width:25px;height:25px;text-align:center;line-height:25px}.shop-steps button strong{font-size:.82rem}.shop-steps button small{font-size:.72rem;color:#61767b}.shop-steps button.active{border-color:#08786e;background:#edf8f5}.shop-info-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:16px}.shop-navigation{display:flex;justify-content:flex-end;gap:10px;margin:18px 0}.shop-navigation button{display:flex;align-items:center;gap:8px}.shop-setup-links{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px}.shop-confirm-country{display:flex;align-items:center;gap:8px;margin:16px 0}.shop-readiness{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:16px 0}.shop-readiness>div{border:1px solid #dce8e4;border-radius:7px;padding:14px}.shop-readiness p{font-size:.85rem;margin:10px 0}.shop-readiness span{float:right;font-size:.75rem}.shop-readiness .ready{color:#08786e}.shop-readiness .pending{color:#a25810}@media(max-width:1000px){.shop-steps{grid-template-columns:repeat(3,minmax(0,1fr))}.shop-info-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:650px){.shop-steps{grid-template-columns:repeat(2,minmax(0,1fr))}.shop-info-grid,.shop-readiness{grid-template-columns:1fr}}
.shop-info-grid>.zn-field{grid-column:auto;min-width:0}
.shop-validation-summary{margin:12px 0;padding:14px 18px;border:2px solid #c52929;border-radius:8px;background:#fff2f2;color:#8f1919;scroll-margin-top:90px}.shop-validation-summary ul{margin:8px 0 0;padding-left:22px}.shop-validation-summary a{color:inherit;text-decoration:underline}.shop-setup-page [aria-invalid=true]{border:2px solid #c52929!important;outline-color:#c52929;background:#fffafa}.shop-field-error{display:block;color:#a91f1f;font-size:.82rem;font-weight:600;margin-top:5px}.shop-setup-page [id^=shop-field-]{scroll-margin-top:90px}
.shop-confirmation{margin:16px 0}.shop-confirmation-label{display:flex;align-items:flex-start;gap:8px;cursor:pointer}.shop-confirmation-label input[type=checkbox]{flex:0 0 auto;width:16px;height:16px;margin:2px 0 0}.shop-confirmation-label span{flex:1;min-width:0;line-height:1.4}.shop-confirmation>.shop-field-error{margin-left:24px}

.shop-advanced-settings{margin-top:16px}.shop-advanced-settings>summary{cursor:pointer;font-weight:600}.shop-advanced-settings .shop-setup-links{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}

/* Brand media: preserve logo proportions in both global and tenant catalogues. */
.brand-logo-editor { display:grid; gap:.75rem; padding:1rem; border:1px solid var(--z-border,#d0dfdf); border-radius:.75rem; }
.brand-logo-label { font-weight:600; }
.brand-logo-editor-preview { width:100%; height:150px; object-fit:contain; background:#fff; }
.brand-logo-actions { display:flex; gap:.65rem; align-items:center; flex-wrap:wrap; }
.brand-logo-select { position:relative; display:inline-flex; gap:.5rem; align-items:center; overflow:hidden; cursor:pointer; }
.brand-logo-select input[type=file] { position:absolute; inset:0; width:100%; opacity:0; cursor:pointer; }
.brand-logo-select:has(input:disabled) { opacity:.6; cursor:wait; }
.brand-logo-error { display:block; color:#a31515; background:#fff4f4; padding:.5rem; border-radius:.35rem; overflow-wrap:anywhere; }
.brand-logo-spinner { display:inline-block; width:1rem; height:1rem; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:brand-logo-spin .8s linear infinite; }
@keyframes brand-logo-spin { to { transform:rotate(360deg); } }
.brand-logo-dropzone { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.5rem; min-height:180px; padding:1rem; border:2px dashed var(--z-border,#b8d8d2); border-radius:.75rem; background:#f6fbfa; text-align:center; cursor:pointer; }
.brand-logo-dropzone input[type=file] { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.brand-logo-dropzone:hover, .brand-logo-dropzone--over, .brand-logo-dropzone:focus-within { border-color:#147d70; background:#eaf7f3; }
.brand-logo-dropzone:has(input:disabled) { opacity:.65; cursor:wait; }
.brand-logo-browse { color:#096b60; text-decoration:underline; font-weight:600; }

/* The global-brand drawer is a single-column form, not the shared 12-column CRUD grid. */
.global-brand-form.zn-form { display:flex; flex-direction:column; align-items:stretch; gap:18px; margin-top:0; }
.global-brand-form > * { min-width:0; width:100%; box-sizing:border-box; }
.global-brand-form .brand-logo-editor { min-width:0; width:100%; grid-template-columns:minmax(0,1fr); box-sizing:border-box; }
.global-brand-form .brand-logo-dropzone { min-width:0; width:100%; box-sizing:border-box; }
.global-brand-form .brand-logo-label { white-space:normal; }
.global-brand-active { display:flex; align-items:center; gap:10px; font-weight:600; }
.global-brand-active input[type=checkbox] { flex:0 0 auto; width:18px; height:18px; margin:0; }
.global-brand-form-actions { display:flex; justify-content:flex-end; align-items:center; flex-wrap:wrap; gap:10px; padding-top:16px; border-top:1px solid var(--z-border,#d0dfdf); }
.global-brand-form-actions button { flex:0 0 auto; }
/* Also cover an already-running drawer until its next Razor rebuild. */
.z-drawer-panel:has(.brand-logo-editor) .zn-form { display:flex; flex-direction:column; align-items:stretch; gap:18px; margin-top:0; }
.z-drawer-panel:has(.brand-logo-editor) .zn-form > * { min-width:0; width:100%; box-sizing:border-box; }
.z-drawer-panel:has(.brand-logo-editor) .brand-logo-editor { min-width:0; width:100%; grid-template-columns:minmax(0,1fr); box-sizing:border-box; }
.z-drawer-panel:has(.brand-logo-editor) .brand-logo-dropzone { min-width:0; width:100%; box-sizing:border-box; }
.z-drawer-panel:has(.brand-logo-editor) .zn-form > div.brand-logo-actions { justify-content:flex-end; padding-top:16px; border-top:1px solid var(--z-border,#d0dfdf); }
.z-drawer-panel:has(.brand-logo-editor) .zn-form > label input[type=checkbox] { flex:0 0 auto; width:18px; height:18px; margin:0; }

/* Global template mode uses the shared specification editor, without commercial inputs. */
.global-template .product-tenant-unit,
.global-template .product-tax-guidance,
.global-template .product-tax-warning,
.global-template .product-pricing-card .product-card-heading,
.global-template .product-pricing-card label[class*="pricing-field-"],
.global-template .variant-card-row--pricing,
.global-template .variant-card-row--identification,
.global-template .variant-commercial-groups .variant-group-label,
.global-template .product-service-note { display:none !important; }
.global-template .product-pricing-card .zn-field:has(#product-barcode-input),
.global-template .product-pricing-card .zn-field:has(input[type="checkbox"]) { display:none; }.global-template .variant-commercial-groups { display:none !important; }
.global-template .product-entry-mode .zn-help-text { display:none; }
.global-template .product-pricing-card label.pricing-field-description { display:flex !important; }

.lens-power-availability tr.lens-stock-selected > td { background: #e0f3ef; font-weight: 600; }
.lens-power-availability tr.lens-stock-selected > td:first-child { box-shadow: inset 3px 0 #008c80; }

/* FocusOnNavigate adds tabindex=-1 to the route h1. Initial/pointer focus is
   an accessibility announcement, not a keyboard target; other focus rings stay intact. */
html:not([data-optical-keyboard="true"]) h1[tabindex="-1"]:focus {
    outline: 0;
    box-shadow: none;
}
html[data-optical-keyboard="true"] h1[tabindex="-1"]:focus {
    outline: 3px solid var(--z-focus-ring);
    outline-offset: 3px;
}
