/* POZUZ: shared design tokens, primitives and responsive patterns. No build step. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    @font-face {
        font-family: 'Figtree'; font-style: normal; font-weight: 400 800; font-display: swap;
        src: url('../fonts/figtree/figtree-latin-ext.woff2') format('woff2');
        unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
    }
    @font-face {
        font-family: 'Figtree'; font-style: normal; font-weight: 400 800; font-display: swap;
        src: url('../fonts/figtree/figtree-latin.woff2') format('woff2');
        unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    }

    /* Design tokens */
    :root {

        --color-primary: #29506d;
        --color-primary-dark: #1d3c53;
        --color-primary-soft: #e9eef2;
        --color-success: #4a8348;
        --color-danger: #b3401f;
        --color-warning: #b05e10;
        --color-bg: #f6f2ec;
        --color-surface: #fffdfa;
        --color-border: #e9e1d5;
        --color-border-strong: #d6cbbb;
        --color-text: #2b2320;
        --color-muted: #6b5f52;
        --color-on-primary: #ffffff;
        --color-success-dark: #3c6c3b;
        --color-danger-dark: #93341a;
        --color-warning-dark: #8a4a0c;
        --color-focus: rgba(41,80,109,.20);
        --color-error-focus: rgba(179,64,31,.18);
        --color-scrim: rgba(43,35,32,.45);
        --color-lightbox-scrim: rgba(24,20,18,.82);
        --color-faint: #8a7c6c;

        --ok-bg: #eaf4e4; --ok-border: #a4cd8b; --ok-text: #33632a;
        --warn-bg: #fcf3dd; --warn-border: #eac36e; --warn-text: #7d4e0a;
        --err-bg: #faece7; --err-border: #e8a28f; --err-text: #99311b;
        --info-bg: #e9f1f8; --info-border: #a9c6e0; --info-text: #2c5a83;
        --note-bg: #fbf8f2;

        --accent-bg: #e9e9f8; --accent-border: #c3c3ec; --accent-text: #403f9e;

        --own-pozuz-bg: #e4f4f0; --own-pozuz-border: #7fc7b6; --own-pozuz-text: #156355;
        --own-customer-bg: #f0edf9; --own-customer-border: #b3a3dd; --own-customer-text: #533a94;

        --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem;
        --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem;

        --font-xs: .75rem; --font-sm: .875rem; --font-base: 1rem;
        --font-lg: 1.125rem; --font-xl: 1.375rem; --font-title: 1.75rem;
        --weight-medium: 500; --weight-semibold: 600; --weight-bold: 700;
        --control-height: 2.75rem;
        --control-height-sm: 44px;
        --control-padding-x: .8rem;
        --panel-padding: var(--space-5);
        --transition: .15s ease;

        --radius-sm: .5rem; --radius: .7rem; --radius-lg: .95rem; --radius-xl: 1.3rem;
        --shadow-sm: 0 1px 2px rgba(60,47,32,.06);
        --shadow: 0 1px 2px rgba(60,47,32,.06), 0 1px 3px rgba(60,47,32,.08);
        --shadow-md: 0 2px 4px rgba(60,47,32,.06), 0 4px 12px rgba(60,47,32,.08);
        --shadow-lg: 0 10px 30px rgba(60,47,32,.12), 0 4px 8px rgba(60,47,32,.06);

        --content-max: 1040px;
        --sidebar-width: 240px;

        --safe-t: env(safe-area-inset-top, 0px);
        --safe-b: env(safe-area-inset-bottom, 0px);
        --safe-l: env(safe-area-inset-left, 0px);
        --safe-r: env(safe-area-inset-right, 0px);
    }

    /* Role widths */
    .customer-portal { --content-max: 960px; }
    .admin-portal { --content-max: 1600px; }

    /* Base and typography */
    html { font-size: 17px; -webkit-text-size-adjust: 100%; }
    body {
        font-family: 'Figtree', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        background: var(--color-bg); color: var(--color-text); line-height: 1.65; min-height: 100vh;
        -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    }
    button, input, select, textarea { font-family: inherit; }
    [x-cloak] { display: none !important; }

    .icon { display: inline-block; vertical-align: -.14em; flex-shrink: 0; }
    .btn .icon, .sidebar-link .icon { vertical-align: middle; }

    :where(a, button, input, select, textarea, summary, [tabindex], .btn, .sidebar-link, .menu-toggle, .toast-x, .card-link):focus-visible {
        outline: 3px solid var(--color-primary); outline-offset: 2px; border-radius: var(--radius-sm);
    }

    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
    .skip-link {
        position: absolute; left: .5rem; top: -3rem; z-index: 999; background: var(--color-primary); color: var(--color-on-primary);
        padding: .55rem .9rem; border-radius: var(--radius); text-decoration: none; transition: top .15s;
    }
    .skip-link:focus { top: calc(.5rem + var(--safe-t)); }

    .measure { max-width: 640px; }
    .measure-wide { max-width: 880px; }

    @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
    }

    /* Application shell */
    .layout { display: flex; min-height: 100vh; }
    .sidebar {
        width: var(--sidebar-width); flex-shrink: 0;
        background: var(--color-surface); border-right: 1px solid var(--color-border);
        display: flex; flex-direction: column;
        position: sticky; top: 0; height: 100vh;
    }
    .sidebar-brand { display: flex; align-items: center; padding: 1rem 1.1rem; border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
    .sidebar-brand img { height: 30px; width: auto; display: block; }
    .sidebar-nav { flex: 1; padding: .6rem 0; overflow-y: auto; }
    .sidebar-link {
        display: flex; align-items: center; gap: .5rem;
        padding: .65rem 1.1rem; color: var(--color-text); text-decoration: none;
        font-size: .9375rem; font-weight: 600; border-left: 3px solid transparent;
        transition: background .12s, color .12s;
    }
    .sidebar-link:hover { background: var(--color-bg); }
    .sidebar-link.active { background: var(--color-primary-soft); color: var(--color-primary); border-left-color: var(--color-primary); }
    .sidebar-foot { padding: .75rem 1.1rem calc(.75rem + var(--safe-b)); border-top: 1px solid var(--color-border); display: flex; flex-direction: column; gap: .5rem; }
    .sidebar-user { font-size: .8125rem; color: var(--color-muted); word-break: break-word; }
    .sidebar-close { display: none; }

    .content { flex: 1; min-width: 0; }
    .main { max-width: var(--content-max); margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

    .mobile-topbar { display: none; }
    .sidebar-backdrop { display: none; }

    /* Panels */
    .card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--panel-padding); box-shadow: var(--shadow-sm); min-width: 0; }
    .card + .card { margin-top: 1rem; }

    .card-flush { padding: 0; }
    .card-link { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s, border-color .15s; }
    .card-link:hover { box-shadow: var(--shadow-md); border-color: var(--color-border-strong); transform: translateY(-1px); }
    .card-link:focus-within { box-shadow: var(--shadow-md); }

    .tint-info { background: var(--info-bg); border-color: var(--info-border); }
    .tint-warn { background: var(--warn-bg); border-color: var(--warn-border); }
    .tint-ok   { background: var(--ok-bg);   border-color: var(--ok-border); }
    .tint-err  { background: var(--err-bg);  border-color: var(--err-border); }

    .card-accent-primary { border-left: 4px solid var(--color-primary); }
    .card-accent-danger  { border-left: 4px solid var(--color-danger); }
    .card-accent-warn    { border-left: 4px solid var(--color-warning); }

    .card-muted { background: var(--color-bg); box-shadow: none; }

    .price-headline { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }

    .legend-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
    .legend-item { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid; border-radius: 999px; padding: .3rem .7rem; font-size: .875rem; }

    .state-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
    .state-chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid; border-radius: 999px; padding: .3rem .7rem; font-size: .8125rem; font-weight: 600; }
    .state-chip-status { font-weight: 400; opacity: .85; }

    h1 { font-size: 1.6rem; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; margin-bottom: .5rem; }
    h2 { font-size: 1.3rem; font-weight: 700; line-height: 1.3; margin-bottom: .5rem; }
    h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .25rem; }

    .page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
    .page-header h1 { margin-bottom: .15rem; }
    .page-header .page-sub { color: var(--color-muted); font-size: .9375rem; }
    .breadcrumb { font-size: .9375rem; color: var(--color-muted); margin-bottom: .75rem; }
    .breadcrumb a { color: var(--color-primary); text-decoration: none; }
    .breadcrumb a:hover { text-decoration: underline; }
    .back-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--color-primary); font-size: .9375rem; font-weight: 600; text-decoration: none; margin-bottom: 1rem; }
    .back-link:hover { text-decoration: underline; }

    /* Buttons */
    .btn {
        display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
        min-height: var(--control-height); padding: .55rem var(--space-4); font-size: var(--font-base); font-weight: var(--weight-semibold);
        border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; text-decoration: none;
        text-align: center; line-height: 1.35; transition: background .14s, box-shadow .14s, transform .06s, border-color .14s; white-space: normal;
    }
    .btn:hover { box-shadow: var(--shadow-sm); }
    .btn:active { transform: translateY(1px); box-shadow: none; }
    .btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
    .btn-primary { background: var(--color-primary); color: var(--color-on-primary); }
    .btn-primary:hover { background: var(--color-primary-dark); }
    .btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong); }
    .btn-secondary:hover { background: var(--color-bg); }
    .btn-danger { background: var(--color-danger); color: var(--color-on-primary); }
    .btn-danger:hover { background: var(--color-danger-dark); }
    .btn-approve { background: var(--color-success); color: var(--color-on-primary); }
    .btn-approve:hover { background: var(--color-success-dark); }
    .btn-warning { background: var(--color-warning); color: var(--color-on-primary); }
    .btn-warning:hover { background: var(--color-warning-dark); }
    .btn-ghost { background: transparent; color: var(--color-primary); border-color: transparent; }
    .btn-ghost:hover { background: var(--color-primary-soft); }
    .btn-full { width: 100%; }
    .btn-sm { min-height: var(--control-height-sm); padding: .5rem .8rem; font-size: var(--font-sm); }

    .btn-icon { padding: 0; min-width: 2.75rem; width: 2.75rem; min-height: 2.75rem; font-size: 1.05rem; }
    .btn-icon.btn-sm { min-width: var(--control-height-sm); width: var(--control-height-sm); min-height: var(--control-height-sm); }

    .spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; vertical-align: -.15em; }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* Pagination */
    .pagination { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
    .pagination-link {
        display: inline-flex; align-items: center; justify-content: center;
        min-width: var(--control-height-sm); min-height: var(--control-height-sm); padding: 0 .6rem;
        border: 1px solid var(--color-border); border-radius: var(--radius);
        background: var(--color-surface); color: var(--color-text);
        text-decoration: none; font-size: .875rem; font-weight: 600; line-height: 1; transition: background .12s;
    }
    .pagination-link:hover { background: var(--color-bg); }
    .pagination-link.is-current { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
    .pagination-link.is-disabled { opacity: .4; pointer-events: none; }

    /* Alerts */
    .alert { padding: .875rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9375rem; border: 1px solid transparent; }
    .alert-success { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
    .alert-error   { background: var(--err-bg); border-color: var(--err-border); color: var(--err-text); }
    .alert-info    { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
    .alert-warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }

    /* Forms */
    .form-group { margin-bottom: 1rem; }
    .form-label { display: block; font-size: var(--font-sm); font-weight: var(--weight-semibold); margin-bottom: var(--space-2); color: var(--color-text); line-height: 1.4; }
    .form-label .req { color: var(--color-danger); }

    input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; accent-color: var(--color-primary); }

    .form-control {
        width: 100%; min-height: var(--control-height); padding: .55rem var(--control-padding-x); line-height: 1.5; font-size: var(--font-base);
        border: 1px solid var(--color-border-strong); border-radius: var(--radius);
        background: var(--color-surface); color: var(--color-text);
        transition: border-color .14s, box-shadow .14s;
    }
    .form-control::placeholder { color: var(--color-faint); }
    .form-control:focus, .form-control:focus-visible {
        outline: none; border-color: var(--color-primary);
        box-shadow: 0 0 0 3px var(--color-focus);
    }
    .form-control.input-error, .form-control[aria-invalid="true"] { border-color: var(--color-danger); }
    .form-control.input-error:focus, .form-control[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--color-error-focus); }
    select.form-control { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.25rem; }
    .form-error, .field-error { font-size: .8125rem; color: var(--color-danger); margin-top: .25rem; font-weight: 500; }
    .form-hint, .hint { font-size: .8125rem; color: var(--color-muted); }
    .form-hint { margin-top: var(--space-1); line-height: 1.5; }
    textarea.form-control { min-height: 7rem; resize: vertical; }
    .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--space-4); align-items: start; }
    .form-grid > * { min-width: 0; }
    .field-check, .form-check { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-height); font-size: var(--font-sm); line-height: 1.4; cursor: pointer; }
    .field-check input, .form-check input { flex-shrink: 0; }
    input.form-control:not([type="file"]), select.form-control { height: var(--control-height); }
    .form-stack { margin-top: var(--space-4); }
    .form-stack > .form-control { margin-bottom: var(--space-4); }
    .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-4); }
    .error-list { margin: 0; padding-left: var(--space-5); }

    /* Filters */
    .filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); padding: var(--panel-padding); margin-bottom: var(--space-5); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
    .filter-group { display: flex; flex-direction: column; flex: 1 1 11rem; min-width: 0; }
    .filter-group .form-label { color: var(--color-muted); }
    .filter-group .form-control { width: 100%; min-width: 0; }
    .filter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
    .filter-bar input[type="date"] { max-width: 100%; }
    .filters-disclosure { margin-bottom: var(--space-5); }
    .filters-disclosure > summary { display: none; }
    .filters-disclosure .filter-bar { margin-bottom: 0; }

    /* Navigation filters */
    .tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-4) 0; }
    .tab { display: inline-flex; justify-content: center; align-items: center; gap: var(--space-2); min-height: var(--control-height-sm); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border-strong); border-radius: var(--radius); background: var(--color-surface); color: var(--color-primary); text-decoration: none; font-size: var(--font-sm); font-weight: var(--weight-semibold); line-height: 1.4; }
    .tab:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }
    .tab.active, .tab[aria-current="page"] { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary); }

    /* Tables */
    .table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
    .table th, .table td { padding: .7rem .75rem; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
    .table th { font-weight: 600; background: var(--color-bg); color: var(--color-muted); font-size: .8125rem; text-transform: uppercase; letter-spacing: .03em; }
    .table tbody tr:hover { background: var(--note-bg); }
    .table-scroll { width: 100%; min-width: 0; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }
    .card .table-scroll { border-radius: var(--radius); }
    .table-scroll .table { margin: 0; }
    .table tbody tr:last-child td { border-bottom: 0; }
    .table th { white-space: nowrap; }
    .table td { overflow-wrap: anywhere; }
    .table .btn { overflow-wrap: normal; }

    /* Status badges */
    .badge { display: inline-flex; align-items: center; gap: .25rem; font-size: var(--font-xs); font-weight: var(--weight-semibold); padding: .2rem .6rem; border: 1px solid var(--color-border); border-radius: 9999px; white-space: normal; line-height: 1.4; }
    .badge-doc, .badge-neutral { background: var(--note-bg); color: var(--color-muted); border: 1px solid var(--color-border); }
    .badge-success { background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border); }
    .badge-warning { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }
    .badge-danger  { background: var(--err-bg); color: var(--err-text); border: 1px solid var(--err-border); }
    .badge-info    { background: var(--info-bg); color: var(--info-text); border: 1px solid var(--info-border); }
    .badge-none, .badge-missing, .badge-muted, .badge-off, .badge-draft { background: var(--note-bg); color: var(--color-muted); border-color: var(--color-border); }
    .badge-pending, .badge-on { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
    .badge-submitted { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
    .badge-approved { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
    .badge-returned, .badge-rejected { background: var(--err-bg); color: var(--err-text); border-color: var(--err-border); }
    .badge-published { background: var(--accent-bg); color: var(--accent-text); border-color: var(--accent-border); }

    .stack > * + * { margin-top: var(--space-4); }
    .stack-sm > * + * { margin-top: var(--space-2); }
    .cluster { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
    .actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
    .chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem; border-radius: var(--radius-sm); background: var(--color-bg); border: 1px solid var(--color-border); font-size: .8125rem; }

    .data-list { display: flex; flex-direction: column; }
    .data-row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--color-border); font-size: .9375rem; }
    .data-row:last-child { border-bottom: 0; }
    .data-row .k { color: var(--color-muted); flex-shrink: 0; }
    .data-row .v { text-align: right; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

    .section-title { font-size: 1.0625rem; font-weight: 700; color: var(--color-text); }

    .empty-state { text-align: center; padding: 2rem 1rem; color: var(--color-muted); }
    .empty-state .empty-icon { font-size: 2rem; margin-bottom: .5rem; opacity: .85; }
    .empty-state .empty-title { font-weight: 600; color: var(--color-text); margin-bottom: .25rem; }
    .empty-note { color: var(--color-muted); font-size: .9375rem; padding: .5rem 0; }

    .skeleton { position: relative; overflow: hidden; background: #e9eef5; border-radius: var(--radius); }
    .skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: shimmer 1.3s infinite; }
    .skeleton-line { height: .8rem; margin: .4rem 0; }
    .skeleton-line.short { width: 55%; }
    @keyframes shimmer { 100% { transform: translateX(100%); } }

    /* Sticky actions */
    .action-bar {
        display: flex; gap: .75rem; flex-wrap: wrap;
        position: sticky; bottom: 0; z-index: 20;
        margin: 1.5rem -1.25rem 0; padding: .75rem 1.25rem calc(.75rem + var(--safe-b));
        background: color-mix(in srgb, var(--color-surface) 92%, transparent);
        backdrop-filter: saturate(180%) blur(6px);
        border-top: 1px solid var(--color-border); box-shadow: 0 -2px 10px rgba(15,23,42,.05);
    }
    .action-bar .btn { flex: 1; min-width: 8rem; }

    details > summary { list-style: none; }
    details > summary::-webkit-details-marker { display: none; }

    .text-muted { color: var(--color-muted); font-size: .875rem; }
    .text-danger { color: var(--color-danger); }
    .text-success { color: var(--ok-text); }
    .text-center { text-align: center; }
    .page-header-copy { flex: 1 1 18rem; min-width: 0; }
    .page-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
    .sidebar-mode { font-size: var(--font-sm); color: var(--warn-text); font-weight: var(--weight-semibold); }
    .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
    .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }

    @media (min-width: 768px) {
        h1 { font-size: 1.75rem; }
    }

    @media (max-width: 767px) {
        .layout { display: block; }
        .mobile-topbar {
            display: flex; align-items: center; gap: .75rem;
            background: var(--color-surface); border-bottom: 1px solid var(--color-border);
            padding: var(--safe-t) calc(1rem + var(--safe-r)) 0 calc(1rem + var(--safe-l));
            height: calc(3.25rem + var(--safe-t)); position: sticky; top: 0; z-index: 150;
        }
        .mobile-topbar a { display: inline-flex; align-items: center; }
        .mobile-topbar img { height: 26px; width: auto; display: block; }
        .menu-toggle {
            background: none; border: 1px solid var(--color-border-strong); border-radius: var(--radius);
            width: 2.75rem; height: 2.75rem; font-size: 1.2rem; cursor: pointer; color: var(--color-text);
            display: flex; align-items: center; justify-content: center; flex-shrink: 0;
        }
        .sidebar {
            position: fixed; top: 0; left: 0; height: 100vh; z-index: 200; width: min(82vw, 320px);
            padding-left: var(--safe-l);
            transform: translateX(-100%); transition: transform .22s ease;
            box-shadow: var(--shadow-lg);
        }
        .layout.nav-open .sidebar { transform: translateX(0); }
        .sidebar-close {
            display: flex; align-items: center; justify-content: center;
            position: absolute; top: calc(.4rem + var(--safe-t)); right: .4rem; z-index: 2;
            width: 2.75rem; height: 2.75rem; border: 1px solid transparent; border-radius: var(--radius);
            background: none; color: var(--color-muted); font-size: 1.75rem; line-height: 1; cursor: pointer;
        }
        .sidebar-close:hover { background: var(--color-bg); color: var(--color-text); }
        .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 180; border: none; animation: fadeIn .2s ease; }
        .main { padding: 1.25rem max(1rem, var(--safe-l)) calc(3rem + var(--safe-b)) max(1rem, var(--safe-r)); }
        :root { --panel-padding: var(--space-4); }
        .filter-group, .filter-actions { flex-basis: 100%; width: 100%; }
        .filters-disclosure > summary { display: flex; }
        .filters-disclosure[open] > summary { margin-bottom: var(--space-2); }
        .filter-actions > .btn { flex: 1; }
        .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .table-scroll:has(> .jobs-table) { border: 0; background: transparent; }
        .page-header-actions { width: 100%; }
        .page-header-actions .btn { flex: 1; }
        .action-bar { margin-left: calc(-1 * max(1rem, var(--safe-l))); margin-right: calc(-1 * max(1rem, var(--safe-r))); padding-left: max(1rem, var(--safe-l)); padding-right: max(1rem, var(--safe-r)); }
        .action-bar .btn { flex: 1 1 100%; }
        .page-header { gap: .5rem; }
    }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    @media (max-width: 700px) {
        .table-scroll:has(> .publish-table) { border: 0; background: transparent; }
    }

    /* Feedback */
    .toast-wrap {
        position: fixed; top: calc(.75rem + var(--safe-t)); left: 50%; transform: translateX(-50%);
        z-index: 500; width: calc(100% - 1.5rem); max-width: 560px;
        display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
    }
    .toast {
        pointer-events: auto; display: flex; align-items: flex-start; justify-content: space-between;
        gap: .75rem; padding: .75rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow-lg);
        font-size: .9rem; font-weight: 500; animation: toastIn .2s ease; border: 1px solid transparent;
    }
    .toast-success { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
    .toast-error   { background: var(--err-bg); color: var(--err-text); border-color: var(--err-border); }
    .toast-warning { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
    .toast-info    { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
    .toast-x { background: none; border: none; font-size: 1.25rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; flex-shrink: 0; padding: 0; min-width: 2.5rem; min-height: 2.5rem; display: flex; align-items: center; justify-content: center; }
    .toast-x:hover { opacity: 1; }
    .toast.hide { opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; }
    @keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

    button:not(:disabled), select:not(:disabled), summary, input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled) { cursor: pointer; }
    :disabled, fieldset:disabled .form-control { cursor: not-allowed; }
    .form-control:disabled, fieldset:disabled .form-control, .form-control[readonly] { background-color: var(--color-bg); border-style: dashed; color: var(--color-muted); }
    .main a:not(.btn):not(.card-link):not(.job-row):not(.pagination-link):not(.tab):not(.queue-chip):not(.alert-card) { color: var(--color-primary); text-decoration: underline; text-underline-offset: .2em; }
    .card-link .job-card-title { text-decoration: underline; text-underline-offset: .2em; }
    .card-link .chev-end { color: var(--color-primary); background: var(--color-primary-soft); border-radius: var(--radius-sm); padding: var(--space-1); }
    details > summary { position: relative; display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-height); padding: var(--space-3) var(--space-8) var(--space-3) var(--space-3); border: 1px solid var(--color-border-strong); border-radius: var(--radius); background: var(--note-bg); color: var(--color-primary); cursor: pointer; font-weight: var(--weight-semibold); line-height: 1.4; }
    details > summary::after { content: "\25B8"; position: absolute; right: var(--space-3); top: 50%; transform: translateY(-50%); transition: transform var(--transition); }
    details[open] > summary::after { transform: translateY(-50%) rotate(90deg); }
    details > summary:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
    .form-control:not(:disabled):not([readonly]):hover { border-color: var(--color-primary); }

/* Authentication shell */
    .guest-portal { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(var(--space-4), var(--safe-t)) max(var(--space-4), var(--safe-r)) max(var(--space-4), var(--safe-b)) max(var(--space-4), var(--safe-l)); }
.guest-card { width: 100%; max-width: 440px; padding: var(--space-8) var(--space-6); box-shadow: var(--shadow-md); }
.brand { text-align: center; margin-bottom: var(--space-6); }
.brand img { height: 54px; width: auto; max-width: 100%; }
.brand p { color: var(--color-muted); margin-top: var(--space-2); }
.brandline { margin-top: var(--space-4); font-size: var(--font-xs); color: var(--color-muted); text-align: center; }
.login-hint { display: flex; align-items: flex-start; gap: var(--space-2); margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--color-border); color: var(--color-muted); font-size: var(--font-sm); line-height: 1.5; }
.login-hint .icon { margin-top: var(--space-1); }

/* Confirmation dialog */
    .confirm-modal { margin: auto; border: none; border-radius: var(--radius-lg); padding: 0; max-width: 440px; width: calc(100% - 2rem); box-shadow: var(--shadow-lg); background: var(--color-surface); color: var(--color-text); }
    .confirm-modal::backdrop { background: var(--color-scrim); }
    .confirm-modal-inner { padding: 1.4rem; }
    .confirm-modal-msg { font-size: 1.02rem; line-height: 1.55; margin-bottom: 1.3rem; white-space: pre-line; }
    .confirm-modal-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
    .confirm-modal-actions .btn { min-width: 7rem; }

/* Acting as customer */
    .acting-banner {
            display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
            gap: .75rem; padding: .75rem 1rem; margin-bottom: 1rem;
            background: var(--warn-bg); border: 1px solid var(--warn-border);
            border-left: 4px solid var(--color-warning); border-radius: var(--radius);
            color: var(--warn-text); font-size: .9375rem; line-height: 1.5;
        }
        .acting-banner-text { flex: 1 1 22rem; min-width: 0; }
        .acting-banner-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
        @media (max-width: 640px) {
            .acting-banner-actions { width: 100%; }
            .acting-banner-actions .btn, .acting-banner-actions form { flex: 1 1 auto; }
            .acting-banner-actions .btn { width: 100%; }
        }

/* Customer job cards */
    .job-card { display: block; border-left-width: 5px; margin-bottom: .7rem; }
    .job-card-title { font-size: 1.08rem; font-weight: 700; line-height: 1.3; }
    .job-card-meta { font-size: .84rem; color: var(--color-muted); margin-top: .1rem; }
    .job-card-status { display: flex; align-items: center; gap: .45rem; margin-top: .55rem; font-weight: 600; font-size: .95rem; }
    .job-card-status .icon { flex-shrink: 0; }
    .job-card-note { font-size: .84rem; color: var(--color-muted); margin-top: .35rem; }
    .job-card-msg { margin-top: .55rem; border: 1px solid; border-radius: var(--radius); padding: .55rem .7rem; font-size: .9rem; }
    .job-row { display: flex; align-items: center; gap: .8rem; }
    .job-row-body { flex: 1; min-width: 0; }
    .job-row .chev-end { color: var(--color-faint); flex-shrink: 0; display: inline-flex; }

/* Help */
    .guide { max-width: 860px; }
    .guide-lead { font-size: 1.05rem; color: var(--color-muted); margin: .35rem 0 1.4rem; line-height: 1.55; }
    .guide h2 { margin: 2.2rem 0 .4rem; font-size: 1.25rem; }
    .guide h2:first-of-type { margin-top: 1.2rem; }
    .guide p { line-height: 1.6; }

    .flowstrip { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1rem 0 1.4rem; }
    .flowstrip .fs { flex: 1 1 140px; border: 1px solid var(--color-border); border-radius: var(--radius); padding: .7rem .6rem; text-align: center; }
    .flowstrip .fs .n { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 999px; background: var(--color-primary); color: var(--color-on-primary); font-weight: 800; font-size: .85rem; margin-bottom: .3rem; }
    .flowstrip .fs strong { display: block; font-size: .92rem; }
    .flowstrip .fs span { font-size: .8rem; color: var(--color-muted); }

    .gstep { display: flex; gap: 1rem; align-items: flex-start; margin: .85rem 0; border-left: 4px solid var(--color-primary); }
    .gstep .num { flex: 0 0 2.3rem; height: 2.3rem; border-radius: 999px; background: var(--color-primary); color: var(--color-on-primary); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.05rem; }
    .gstep .body { flex: 1; min-width: 0; }
    .gstep h3 { margin: .15rem 0 .5rem; font-size: 1.08rem; }
    .gstep .cap { display: block; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--color-faint); margin: .7rem 0 .2rem; }
    .gstep p { margin: .2rem 0; }
    .gstep ul { margin: .3rem 0 .3rem 1.1rem; line-height: 1.55; }

    .demo-btn { display: inline-flex; align-items: center; gap: .4rem; pointer-events: none; margin: .15rem .25rem .15rem 0; cursor: default; }
    .demo-row { margin: .35rem 0; }

    .gkey { display: flex; flex-direction: column; gap: .5rem; margin: .6rem 0 .3rem; }
    .gkey .row { display: flex; align-items: center; gap: .65rem; }
    .gkey .chip { width: 1.7rem; height: 1.7rem; border-radius: .45rem; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; border: 1px solid; }
    .gkey .row b { font-weight: 700; }
    .gkey .row span { color: var(--color-muted); }

    .callout { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem .9rem; border-radius: var(--radius); margin: .8rem 0; font-size: .95rem; line-height: 1.5; }
    .callout.tip { background: var(--info-bg, #e9f1f8); color: var(--info-text, #2c5a83); }
    .callout.warn { background: var(--warn-bg); color: var(--warn-text); }
    .callout .ic { flex: 0 0 auto; margin-top: .1rem; }

    .guide .btn { text-decoration: none; }
    @media (max-width: 560px) { .gstep .num { width: 2rem; height: 2rem; flex-basis: 2rem; } }

/* Photo viewer */
    .lightbox { margin: auto; border: none; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
    .lightbox::backdrop { background: var(--color-lightbox-scrim); }
    .lightbox img { display: block; max-width: 92vw; max-height: 84vh; width: auto; height: auto; border-radius: var(--radius); box-shadow: var(--shadow-lg); background: #fff; }
    .lightbox-cap { margin-top: .6rem; text-align: center; color: var(--color-on-primary); font-size: .9rem; word-break: break-word; }
    .lightbox-close { position: fixed; top: calc(.6rem + var(--safe-t, 0px)); right: .8rem; width: 2.75rem; height: 2.75rem; border-radius: 999px; border: none; background: rgba(0, 0, 0, .5); color: var(--color-on-primary); font-size: 1.6rem; line-height: 1; cursor: pointer; }
    .lightbox-close:hover { background: rgba(0, 0, 0, .75); }

/* Upload thumbnails */
    .up-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .5rem; margin-top: .6rem; }
    .up-thumb { display:block; position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--color-border-strong); background: var(--note-bg); min-height:44px; cursor:pointer; }
    .up-thumb:hover {border-color:var(--color-primary);box-shadow:var(--shadow-sm)}
    .up-thumb-action{position:absolute;bottom:.3rem;right:.3rem;display:flex;align-items:center;justify-content:center;width:1.8rem;height:1.8rem;border-radius:.4rem;background:var(--color-surface);color:var(--color-primary);border:1px solid var(--color-border);pointer-events:none}
    .up-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .up-thumb .up-fallback { display: none; width: 100%; height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; color: var(--color-faint); font-size: .66rem; line-height: 1.2; text-align: center; padding: .3rem; word-break: break-word; }
    .up-thumb.is-file .up-fallback { display: flex; }

.tile-grid { display: grid; grid-template-columns: 1fr; gap: .875rem; margin-top: .75rem; }
    @media (min-width: 560px) { .tile-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }
    .tile-grid.is-compact { gap: .625rem; }
    @media (min-width: 560px) { .tile-grid.is-compact { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }

    .tile {
        display: flex; flex-direction: column; gap: .5rem;
        border: 2px solid; border-radius: var(--radius-lg);
        padding: 1.1rem 1.15rem; min-height: 9rem;
        transition: box-shadow .15s, transform .15s;
    }
    .is-compact .tile { min-height: 6.5rem; padding: .8rem .9rem; }
    .tile:hover { box-shadow: var(--shadow-md); }

    .tile-head { display: flex; align-items: flex-start; gap: .7rem; }
    .tile-icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }
    .is-compact .tile-icon { font-size: 1.5rem; }
    .tile-icon .icon { width: 1em; height: 1em; }
    .tile-title { font-size: 1.15rem; font-weight: 700; line-height: 1.25; }
    .is-compact .tile-title { font-size: 1rem; }

    .tile-status {
        align-self: flex-start; background: #fff; border: 1px solid;
        border-radius: 999px; padding: .2rem .7rem;
        font-size: .875rem; font-weight: 700; white-space: nowrap;
    }
    .tile-desc { font-size: .95rem; line-height: 1.5; }
    .is-compact .tile-desc { font-size: .85rem; }
    .tile-note { background: #fff; border: 1px solid; border-radius: var(--radius); padding: .55rem .7rem; font-size: .9rem; }
    .tile-cta { margin-top: auto; }
    .tile-cta .btn { width: 100%; min-height: 3rem; font-size: 1rem; }
    .is-compact .tile-cta .btn { min-height: 2.5rem; font-size: .9rem; }
    .tile-block { font-size: .85rem; font-weight: 600; }
