/*
 | Seyaq Midnight — theme layer for فواتير سياق
 | Loaded after the compiled app.css (partials/head.blade.php).
 | Unlayered on purpose so it refines the Tailwind utilities.
 | To roll back: remove the <link> to this file in partials/head.blade.php.
 */

/* ---------- 1. Tokens ---------- */
:root {
    --ui-canvas: #f3f5f9;
    --ui-surface: #ffffff;
    --ui-surface-muted: #eef1f6;
    --ui-line: #e0e5ee;
    --ui-line-strong: #c9d2e0;
    --ui-ink: #0e1525;
    --ui-ink-muted: #3f4b63;
    --ui-ink-subtle: #5a667e;
    --ui-side: #ffffff;

    --sq-radius-card: 18px;
    --sq-radius-ctl: 12px;
    --sq-shadow-card: 0 1px 2px rgb(14 21 37 / .04), 0 4px 16px -6px rgb(14 21 37 / .08);
    --sq-shadow-hover: 0 2px 4px rgb(14 21 37 / .05), 0 12px 28px -10px rgb(14 21 37 / .18);
    --sq-display: 'Readex Pro', 'IBM Plex Sans Arabic', ui-sans-serif, system-ui, sans-serif;
    --sq-brand-soft: color-mix(in oklab, var(--brand) 11%, var(--ui-surface));
    --sq-ease: cubic-bezier(.2, .7, .2, 1);
}

.dark {
    --ui-canvas: #0a0f1d;
    --ui-surface: #121a2e;
    --ui-surface-muted: #1a2440;
    --ui-line: #24304d;
    --ui-line-strong: #33426a;
    --ui-ink: #eef2f8;
    --ui-ink-muted: #c3cbdb;
    --ui-ink-subtle: #97a3bb;
    --ui-side: #0d1324;

    --sq-shadow-card: 0 1px 0 rgb(255 255 255 / .03) inset, 0 8px 24px -12px rgb(0 0 0 / .55);
    --sq-shadow-hover: 0 1px 0 rgb(255 255 255 / .04) inset, 0 16px 36px -14px rgb(0 0 0 / .7);
    --sq-brand-soft: color-mix(in oklab, var(--brand) 16%, var(--ui-surface));
}

/* ---------- 2. Type ---------- */
h1, h2, h3, .sq-title {
    font-family: var(--sq-display);
    letter-spacing: -0.01em;
}
.sq-title { font-weight: 600; }
@media (min-width: 640px) { .sq-title { font-size: 1.75rem; line-height: 2.25rem; } }

/* ---------- 3. Shell ---------- */
body { background: var(--ui-canvas); }

.sq-side {
    background: var(--ui-side) !important;
    border-color: var(--ui-line) !important;
}
.sq-side-head { height: 4.5rem !important; border-bottom-color: transparent !important; }
.sq-side-head p:first-child { font-family: var(--sq-display); font-size: .95rem; }

.sq-nav-link {
    min-height: 44px;
    border-radius: var(--sq-radius-ctl) !important;
    font-size: .925rem !important;
    color: var(--ui-ink-muted) !important;
    transition: background-color .15s var(--sq-ease), color .15s var(--sq-ease);
}
.sq-nav-link:hover { background: var(--ui-surface-muted) !important; color: var(--ui-ink) !important; }
.sq-nav-link[data-current] {
    background: var(--sq-brand-soft) !important;
    color: var(--ui-brand-text) !important;
    font-weight: 600 !important;
}
.sq-nav-link[data-current] > span:first-child { display: none !important; }

.sq-top {
    background: color-mix(in oklab, var(--ui-canvas) 82%, transparent) !important;
    border-bottom-color: transparent !important;
    box-shadow: 0 1px 0 var(--ui-line);
}
.sq-top > button[x-on\:click*='command-palette'] {
    height: 44px;
    border-radius: var(--sq-radius-ctl);
    background: var(--ui-surface);
}

.sq-bottom { background: color-mix(in oklab, var(--ui-surface) 94%, transparent) !important; }
.sq-bottom a { min-height: 56px; justify-content: center; }
.sq-bottom a[data-current] { font-weight: 700; }
.sq-bottom a[data-current] svg {
    background: var(--sq-brand-soft);
    border-radius: 999px;
    padding: 2px 14px;
    width: 3.4rem;
    height: 1.9rem;
    box-sizing: border-box;
}

/* ---------- 4. Components ---------- */
.sq-card {
    border-radius: var(--sq-radius-card) !important;
    box-shadow: var(--sq-shadow-card) !important;
}
.sq-card > header { padding: 1.1rem 1.4rem !important; }
.sq-card > header h2 { font-size: 1.05rem; font-weight: 600; }
.sq-card > footer { border-radius: 0 0 var(--sq-radius-card) var(--sq-radius-card) !important; }

.sq-btn { border-radius: var(--sq-radius-ctl) !important; transition: background-color .15s var(--sq-ease), filter .15s var(--sq-ease), transform .15s var(--sq-ease), box-shadow .15s var(--sq-ease); }
.sq-btn.h-10 { height: 2.75rem; }
.sq-btn.h-10.px-4 { padding-inline: 1.15rem; }
.sq-btn.size-10 { width: 2.75rem; height: 2.75rem; }
.sq-btn-primary { font-weight: 600 !important; box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 6px 16px -8px color-mix(in oklab, var(--brand) 70%, transparent) !important; }
.sq-btn-primary:hover { transform: translateY(-1px); }
.sq-btn-secondary { background: var(--ui-surface) !important; }
.sq-btn-secondary:hover { border-color: var(--ui-line-strong) !important; }
.sq-btn-soft { font-weight: 600 !important; }

.sq-badge {
    border-radius: 999px !important;
    padding-inline: .6rem !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    --tw-ring-shadow: 0 0 #0000 !important;
}

input.field, select.field, textarea.field { border-radius: var(--sq-radius-ctl) !important; }
input.field:not(textarea), select.field { min-height: 2.75rem; }

/* Tables inside cards breathe a little more */
.sq-card table th { font-weight: 500; color: var(--ui-ink-subtle); font-size: .8rem; }
.sq-card table td, .sq-card table th { padding-block: .85rem; }

/* Pop-overs and dialogs */
.shadow-pop { box-shadow: 0 24px 60px -20px rgb(0 0 0 / .45), 0 8px 20px -10px rgb(0 0 0 / .25) !important; }
.rounded-2xl.shadow-pop, [role='dialog'] > .rounded-xl, [role='dialog'] .rounded-xl.bg-surface { border-radius: 20px !important; }

/* Hover lift for clickable cards (rows that are links) */
@media (hover: hover) {
    a.sq-card:hover, .sq-card:has(> a:only-child):hover { box-shadow: var(--sq-shadow-hover) !important; }
}

/* Numbers */
.num { font-feature-settings: 'tnum'; }

/* ---------- 5. Home board (livewire/dashboard) ---------- */
:root .sqh.sqh {
    --sq-card: var(--ui-surface);
    --sq-line: var(--ui-line);
    --sq-ink: var(--ui-ink);
    --sq-mut: var(--ui-ink-subtle);
    --sq-track: var(--ui-surface-muted);
    --sq-br: var(--brand);
    --sq-gry-bg: var(--ui-surface-muted);
    --sq-amb: #c27a10;  --sq-amb-ink: #9a5b00; --sq-amb-bg: #fff4e0;
    --sq-grn: #06784f;  --sq-grn-bg: #e3f6ee;
    --sq-blu: #2e64db;  --sq-blu-bg: #e8effe;
    --sq-red: #c9302c;  --sq-red-bg: #fdebea;
    max-width: 1200px;
    gap: 18px;
}
:root.dark .sqh.sqh {
    --sq-amb: #f2b544; --sq-amb-ink: #f6c66a; --sq-amb-bg: rgb(242 181 68 / .13);
    --sq-grn: #5fe3b3; --sq-grn-bg: rgb(61 217 160 / .13);
    --sq-blu: #8db1ff; --sq-blu-bg: rgb(110 155 255 / .14);
    --sq-red: #ff8a8a; --sq-red-bg: rgb(255 122 122 / .14);
}

.sqh.sqh .sqh-tile {
    border-width: 1px;
    border-radius: var(--sq-radius-card);
    padding: 18px 20px;
    box-shadow: var(--sq-shadow-card);
    transition: transform .18s var(--sq-ease), box-shadow .18s var(--sq-ease), border-color .18s var(--sq-ease), background-color .18s var(--sq-ease);
}
@media (hover: hover) { .sqh.sqh .sqh-tile:hover { box-shadow: var(--sq-shadow-hover); transform: translateY(-1px); } }
.sqh.sqh .sqh-tile .l { font-size: 13.5px; font-weight: 500; }
.sqh.sqh .sqh-tile .v { font-family: var(--sq-display); font-weight: 600; font-size: 26px; letter-spacing: -.01em; }
.sqh.sqh .sqh-tile.on { border-width: 1.5px; }

/* Hero: a calm surface card, the figure does the talking */
.sqh.sqh .sqh-hero {
    background:
        radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--brand) 14%, transparent) 0%, transparent 55%),
        var(--ui-surface);
    border-color: var(--ui-line);
    color: var(--ui-ink);
    padding: 24px 26px;
}
.sqh.sqh .sqh-hero .l, .sqh.sqh .sqh-hero .s, .sqh.sqh .sqh-hero .v small, .sqh.sqh .sqh-leg { color: var(--ui-ink-subtle); }
.sqh.sqh .sqh-hero .v { font-size: 40px; line-height: 1.15; }
.sqh.sqh .sqh-hero.on { box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand) 55%, transparent), var(--sq-shadow-card); }
.sqh.sqh .sqh-seg { background: var(--ui-surface-muted); height: 12px; gap: 3px; border-radius: 99px; }
.sqh.sqh .sqh-seg i { border-radius: 99px; }
.sqh.sqh .sqh-leg { font-size: 13px; gap: 6px 18px; }

.sqh.sqh .sqh-acts a { height: 52px; border-radius: 14px; font-weight: 600; font-size: 15.5px; transition: transform .15s var(--sq-ease), box-shadow .15s var(--sq-ease); }
.sqh.sqh .sqh-acts .p { box-shadow: 0 8px 20px -10px color-mix(in oklab, var(--brand) 80%, transparent); }
.sqh.sqh .sqh-acts .o { background: var(--ui-surface); border: 1px solid var(--ui-line); color: var(--ui-ink); }
@media (hover: hover) { .sqh.sqh .sqh-acts a:hover { transform: translateY(-1px); } }

.sqh.sqh .sqh-search { height: 50px; border-radius: 14px; box-shadow: var(--sq-shadow-card); }
.sqh.sqh .sqh-head h2 { font-family: var(--sq-display); font-weight: 600; font-size: 18px; }
.sqh.sqh .sqh-head b { font-family: var(--sq-display); font-weight: 600; }

.sqh.sqh .sqh-grp, .sqh.sqh .sqh-row, .sqh.sqh .sqh-empty { border-radius: var(--sq-radius-card); box-shadow: var(--sq-shadow-card); }
.sqh.sqh .sqh-grp { transition: border-color .18s var(--sq-ease), box-shadow .18s var(--sq-ease); }
.sqh.sqh .sqh-grp:hover { border-color: var(--ui-line-strong); box-shadow: var(--sq-shadow-hover); }
.sqh.sqh .sqh-gh { padding: 16px 18px 12px; }
.sqh.sqh .sqh-who b { font-weight: 600; }
.sqh.sqh .sqh-gsum { font-weight: 700; }
.sqh.sqh .sqh-grp > .sqh-bar { margin: 0 18px 10px; height: 6px; border-radius: 99px; }
.sqh.sqh .sqh-bar i, .sqh.sqh .sqh-il .bar2 i { background: var(--brand); border-radius: 99px; }
.sqh.sqh .sqh-il { padding: 12px 18px; }
.sqh.sqh .sqh-il .amt { font-weight: 700; }
.sqh.sqh .sqh-badge { border-radius: 99px; font-weight: 600; padding: 3px 11px; }
.sqh.sqh .sqh-more-d summary { padding: 11px 18px; }

@media (min-width: 1024px) {
    .sqh.sqh .sqh-hero { column-gap: 56px; padding: 28px 32px; }
    .sqh.sqh .sqh-hero .v { font-size: 44px; }
    .sqh.sqh .sqh-acts { max-width: 560px; }
}
@media (min-width: 1280px) {
    .sqh.sqh .sqh-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 14px; }
    .sqh.sqh .sqh-list > .sqh-empty { grid-column: 1 / -1; }
}

/* ---------- 6. Legacy dashboard KPI cards ---------- */
.kpi { border-radius: var(--sq-radius-card) !important; }
.kpi::after { display: none; }

/* ---------- 7. Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    .sq-btn-primary:hover, .sqh.sqh .sqh-tile:hover, .sqh.sqh .sqh-acts a:hover { transform: none; }
}

/* ---------- 8. Home board: quick actions on invoice lines ---------- */
.sqh.sqh .sqh-il {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "no amt" "badge pay" "bar bar";
    align-items: center;
    row-gap: 8px;
}
.sqh.sqh .sqh-il .no { grid-area: no; }
.sqh.sqh .sqh-il .sqh-badge { grid-area: badge; justify-self: start; }
.sqh.sqh .sqh-il .amt { grid-area: amt; text-align: end; }
.sqh.sqh .sqh-il .bar2 { grid-area: bar; }
.sqh.sqh .sqh-il .sqh-pay { grid-area: pay; justify-self: end; }
.sqh-il-main::after, .sqh-attn-main::after { content: ''; position: absolute; inset: 0; }
@media (min-width: 640px) {
    .sqh.sqh .sqh-il {
        grid-template-columns: minmax(0, 1fr) auto auto auto;
        grid-template-areas: "no badge amt pay" "bar bar bar bar";
        column-gap: 14px;
    }
    .sqh.sqh .sqh-il .sqh-badge { justify-self: end; }
}
.sqh-pay {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: var(--sq-brand-soft);
    color: var(--ui-brand-text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s var(--sq-ease), transform .15s var(--sq-ease);
}
.sqh-pay:hover { background: color-mix(in oklab, var(--brand) 20%, var(--ui-surface)); }
.sqh-pay:active { transform: scale(.97); }

/* Needs follow-up strip (overdue or due today) */
.sqh-attn {
    background: var(--sq-red-bg);
    border: 1px solid color-mix(in oklab, var(--sq-red) 28%, var(--sq-line));
    border-radius: var(--sq-radius-card);
    padding: 14px 18px 4px;
}
.sqh-attn-h { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sqh-attn-h h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--sq-red); }
.sqh-attn-h span { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--sq-red); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
:root.dark .sqh-attn-h span { color: #2a0a0a; }
.sqh-attn ul { list-style: none; margin: 0; padding: 0; }
.sqh-attn li { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 0; border-top: 1px solid color-mix(in oklab, var(--sq-red) 18%, transparent); }
.sqh-attn-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.sqh-attn-main b { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sqh-attn-main small { font-size: 12.5px; color: var(--sq-mut); }
.sqh-attn .amt { font-weight: 700; font-size: 15px; white-space: nowrap; }
.sqh-attn .sqh-pay { background: var(--ui-surface); border: 1px solid var(--ui-line); }

/* ---------- 9. Invoice page: payment bar + progress timeline ---------- */
.sq-paybar { height: 8px; border-radius: 99px; background: var(--ui-surface-muted); overflow: hidden; margin-bottom: 6px; }
.sq-paybar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.sq-paybar-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--ui-ink-subtle); }
.sq-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.sq-step { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.sq-step:last-child { padding-bottom: 0; }
.sq-step::before { content: ''; position: absolute; inset-inline-start: 12px; top: 26px; bottom: 0; width: 2px; background: var(--ui-line); }
.sq-step:last-child::before { display: none; }
.sq-step.is-done::before { background: var(--brand); }
.sq-step-dot { position: relative; z-index: 1; flex: none; width: 26px; height: 26px; border-radius: 99px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--ui-surface); color: var(--ui-ink-subtle); border: 2px solid var(--ui-line-strong); }
.sq-step.is-done .sq-step-dot { background: var(--brand); border-color: var(--brand); color: var(--brand-fg, #fff); }
.sq-step.is-cur .sq-step-dot { border-color: var(--brand); color: var(--ui-brand-text); box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 18%, transparent); }
.sq-step-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding-top: 2px; }
.sq-step-t { font-size: 14px; font-weight: 600; color: var(--ui-ink); }
.sq-step:not(.is-done):not(.is-cur) .sq-step-t { color: var(--ui-ink-subtle); font-weight: 500; }
.sq-step-m { font-size: 12.5px; color: var(--ui-ink-subtle); }
.sq-step-m.is-warn { color: var(--danger-700, #b91c1c); font-weight: 600; }
.dark .sq-step-m.is-warn { color: var(--danger-400, #f87171); }

/* ---------- 10. Mobile: keep money figures on one line ---------- */
.sqh.sqh .sqh-tile .v { white-space: nowrap; word-break: normal; }
@media (max-width: 639px) {
    .sqh.sqh .sqh-tile { padding: 14px 15px; }
    .sqh.sqh .sqh-tile .v { font-size: clamp(18px, 5.2vw, 24px); }
    .sqh.sqh .sqh-hero { padding: 18px; }
    .sqh.sqh .sqh-hero .v { font-size: clamp(26px, 8.4vw, 36px); }
}

/* 11 — speed & feel: no blur on fixed bars, instant touch feedback, progress bar */
.sq-top.sq-top, .sq-bottom.sq-bottom { -webkit-backdrop-filter: none; backdrop-filter: none; }
.sq-top.sq-top, .sq-bottom.sq-bottom { background-color: var(--ui-surface, #121a2e); }
[class*="backdrop-blur"] { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
a, button, [role="button"], summary, label, select, input, textarea { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sq-btn:active, .sqh-pay:active, .sqh-il:active, a.sq-card:active, .sq-nav-link:active { transform: scale(.97); opacity: .88; transition-duration: 40ms; }
#sq-prog { position: fixed; inset-block-start: 0; inset-inline: 0; height: 3px; z-index: 9999; pointer-events: none; opacity: 0; transform-origin: right center; transform: scaleX(0); background: var(--brand, #34d399); box-shadow: 0 0 8px var(--brand, #34d399); }
#sq-prog.on { opacity: 1; transform: scaleX(.85); transition: transform 8s cubic-bezier(.1,.7,.2,1), opacity .1s; }
#sq-prog.end { opacity: 0; transform: scaleX(1); transition: transform .15s, opacity .3s .15s; }
@media (prefers-reduced-motion: reduce) { #sq-prog.on { transition: none; } }

/* 12 — offline state: banner + disabled server actions */
#sq-off { position: fixed; z-index: 9998; inset-inline: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 10px 14px; border-radius: 14px; background: var(--ui-surface, #121a2e); color: var(--ui-ink, #e8eefc); border: 1px solid var(--sq-amber, #f59e0b); box-shadow: 0 8px 24px rgb(0 0 0 / .35); font-size: 13px; line-height: 1.6; display: none; }
#sq-off.on { display: block; }
#sq-off.ok { border-color: var(--brand, #34d399); }
@media (min-width: 1024px) { #sq-off { inset-inline-start: auto; inset-inline-end: 16px; bottom: 16px; max-width: 380px; } }
html.sq-offline .sqh-pay, html.sq-offline [wire\:click], html.sq-offline form button[type="submit"] { opacity: .55; }

/* 13 — quick-add button only where something is listed, not over forms and documents */
html[data-sq-page="form"] .quick-add-fab, html[data-sq-page="doc"] .quick-add-fab { display: none !important; }

/* 14 — dates read day/month/year everywhere (see seyaq-feel 4) */
html.sq-dmy input[data-sqd]:not(:focus)::-webkit-datetime-edit { opacity: 0; }
.sq-dmy-v { position: absolute; display: none; align-items: center; pointer-events: none; color: var(--ui-ink); white-space: nowrap; font-variant-numeric: tabular-nums; z-index: 1; }
html.sq-dmy .sq-dmy-v { display: flex; }
html.sq-dmy input[data-sqd]:focus + .sq-dmy-v { display: none; }
.sq-dmy-v.is-empty { color: var(--ui-ink-subtle); }

/* 15 — home: no empty band under the greeting */
.sqh.sqh > div[wire\:ignore] { display: contents; }
.sqh.sqh > .mb-6:first-child { margin-bottom: 0; }
/* 16 — invoices list: one filter row, lighter KPIs and ageing, compact rows */
.sq-frow { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--ui-line); padding: 10px 16px; overflow-x: auto; scrollbar-width: none; }
.sq-frow::-webkit-scrollbar { display: none; }
.sq-frow > div { border: 0 !important; padding: 0 !important; flex: none; flex-wrap: nowrap !important; overflow: visible !important; }
.sq-frow > div > p { white-space: nowrap; }
.sq-frow > div + div { padding-inline-start: 10px !important; border-inline-start: 1px solid var(--ui-line) !important; }

.sq-kpis { gap: 8px !important; margin-bottom: 14px !important; }
@media (max-width: 639px) {
    .sq-kpis > button { padding: 10px 12px !important; }
    .sq-kpis > button > span:last-child { margin-top: 4px !important; font-size: 15px !important; }
}

.sq-age { padding: 14px 16px !important; margin-bottom: 14px !important; }
.sq-age > div:first-child { margin-bottom: 10px !important; }
.sq-age .inv-age { display: flex !important; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-top: 10px !important; }
.sq-age .inv-age::-webkit-scrollbar { display: none; }
.sq-age .inv-ageitem { flex: 1 0 auto; min-width: 128px; padding: 8px 12px; }
.sq-age .inv-ageval { font-size: 14.5px; }

.inv-compact ul.divide-y > li ol { display: none; }
.inv-compact ul.divide-y > li > div:nth-child(2) { gap: 6px; }
.inv-compact ul.divide-y > li > div:nth-child(2) [role="progressbar"] { height: 4px; }
@media (max-width: 1023px) {
    .inv-compact ul.divide-y > li { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 8px !important; padding: 12px 16px !important; }
    .inv-compact ul.divide-y > li > div:first-child { grid-column: 1 / -1; }
    .inv-compact ul.divide-y > li > div:last-child { align-self: end; flex-wrap: nowrap; }
    .inv-compact .inv-st-btn, .inv-compact ul.divide-y > li > div:last-child > .sq-btn-secondary { display: none !important; }
}

/* 17 — invoice form: document options folded under one line */
.sq-opts { margin-top: 20px; border-top: 1px solid var(--ui-line); padding-top: 14px; }
.sq-opts-s { display: flex; align-items: center; gap: 10px; min-height: 32px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 600; color: var(--ui-ink); }
.sq-opts-s::-webkit-details-marker { display: none; }
.sq-opts-s small { font-size: 12.5px; font-weight: 400; color: var(--ui-ink-subtle); }
.sq-opts-s::after { content: ''; margin-inline-start: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s var(--sq-ease); }
.sq-opts[open] > .sq-opts-s::after { transform: translateY(2px) rotate(-135deg); }

/* 18 — home money board: invoices total, collected, unpaid, due soon; quotations apart */
.sqh.sqh { --sqb-grn: #3fcf95; --sqb-amb: #f0a04b; --sqb-red: #ff7a7a; }
:root:not(.dark) .sqh.sqh { --sqb-grn: #129a64; --sqb-amb: #d98422; --sqb-red: #d83a34; }
.sqh.sqh .sqb .sqh-unpaid { grid-column: auto; }
.sqh.sqh .sqb .sqh-hero .v small { color: var(--ui-ink-subtle); }
.sqb-split { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ui-ink-subtle); }
.sqb-split > span { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.sqb-split b { flex: none; width: 9px; height: 9px; border-radius: 3px; align-self: center; }
.sqb-split strong { color: var(--ui-ink); font-weight: 600; }
.sqb-split strong small { font-size: 11px; color: var(--ui-ink-subtle); }
.sqb-split em { font-style: normal; font-weight: 600; color: var(--sqb-grn); }
.sqb-late { color: var(--sqb-red); font-weight: 600; }
.sqb-late small { color: inherit; }
.sqh.sqh .sqb .sqb-quote { text-decoration: none; color: inherit; border-style: dashed; background: transparent; box-shadow: none; }
@media (hover: hover) { .sqh.sqh .sqb .sqb-quote:hover { border-color: var(--ui-line-strong); background: var(--ui-surface); } }
@media (min-width: 1024px) {
    .sqh.sqh .sqb.sqh-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sqh.sqh .sqb .sqh-hero { grid-column: span 4; }
}

/* 19 — sales lists: top switch (quotations · unpaid · paid · all) and customer-first rows */
.sq-dtabs { --dt-q: #3b82f6; --dt-u: #d98422; --dt-p: #129a64; --dt-a: var(--ui-ink-muted); }
.dark .sq-dtabs { --dt-q: #7aa7ff; --dt-u: #f0a04b; --dt-p: #3fcf95; --dt-a: var(--ui-ink-muted); }
.sq-dtabs-track {
    display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 6px;
    padding: 6px; border: 1px solid var(--ui-line); border-radius: var(--sq-radius-card, 18px);
    background: var(--ui-surface); box-shadow: var(--sq-shadow-card);
}
.sq-dtab {
    --c: var(--dt-a);
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 0; padding: 10px 6px 9px; border-radius: 13px; border: 1px solid transparent;
    color: var(--ui-ink-subtle); text-decoration: none; cursor: pointer; background: transparent;
    transition: background-color .15s, color .15s, border-color .15s;
}
.sq-dtab[data-tone="q"] { --c: var(--dt-q); }
.sq-dtab[data-tone="u"] { --c: var(--dt-u); }
.sq-dtab[data-tone="p"] { --c: var(--dt-p); }
.sq-dtab-i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--c);
    background: color-mix(in srgb, var(--c) 13%, transparent); }
.sq-dtab-l { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.sq-dtab-n { font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 8px; border-radius: 999px;
    color: var(--ui-ink-muted); background: var(--ui-surface-muted); }
@media (hover: hover) { .sq-dtab:hover { color: var(--ui-ink); background: var(--ui-surface-muted); } }
.sq-dtab[data-on] { color: var(--ui-ink); border-color: color-mix(in srgb, var(--c) 45%, transparent);
    background: color-mix(in srgb, var(--c) 11%, var(--ui-surface)); }
.sq-dtab[data-on]::after { content: ""; position: absolute; inset-inline: 22%; bottom: -1px; height: 3px; border-radius: 3px; background: var(--c); }
.sq-dtab[data-on] .sq-dtab-n { color: #fff; background: var(--c); }
.sq-dtab:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.sq-dtabs-more { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; padding: 8px 6px 0; }
.sq-dtabs-more a { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--ui-ink-subtle); text-decoration: none; }
.sq-dtabs-more a:hover { color: var(--ui-ink); }
@media (min-width: 640px) {
    .sq-dtab { flex-direction: row; gap: 9px; padding: 10px 14px; }
    .sq-dtab-l { font-size: 14px; }
    .sq-dtab-n { margin-inline-start: auto; }
}

/* Row header: avatar · customer name (title) · number and date · amount */
.sq-rowhead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px; align-items: start; min-width: 0; }
.sq-rowhead > div { display: contents; }
.sq-rowhead > .sq-ava { grid-column: 1; grid-row: 1 / span 3; }
.sq-rowhead .sq-cust { grid-column: 2; grid-row: 1; }
.sq-rowhead > .sq-amt { grid-column: 3; grid-row: 1; }
.sq-rowhead > div > .sq-meta, .sq-rowhead > div > p { grid-column: 2 / -1; }
.sq-rowhead > div > .sq-meta:first-child { grid-column: 2; grid-row: 1; }
.sq-ava {
    flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
    font-family: var(--sq-display); font-size: 17px; font-weight: 700; line-height: 1;
    color: hsl(var(--h, 200) 55% 30%); background: hsl(var(--h, 200) 70% 92%);
}
.dark .sq-ava { color: hsl(var(--h, 200) 75% 80%); background: hsl(var(--h, 200) 32% 22%); }
.sq-cust { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;
    font-family: var(--sq-display); font-size: 16px; font-weight: 700; line-height: 1.45; color: var(--ui-ink); text-decoration: none; }
.sq-cust:hover { color: var(--brand); }
.sq-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 2px; font-size: 12.5px; color: var(--ui-ink-subtle); }
.sq-no { font-weight: 600; color: var(--ui-ink-muted); font-variant-numeric: tabular-nums; text-decoration: none; direction: ltr; unicode-bidi: isolate; }
.sq-no:hover { color: var(--brand); }
.sq-no.sq-no-title { font-size: 15px; font-weight: 700; color: var(--ui-ink); }
.sq-no.is-draft { color: var(--ui-ink-subtle); font-style: italic; }
.sq-sep { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .55; }
.sq-amt { flex: none; text-align: end; font-size: 15.5px; font-weight: 700; color: var(--ui-ink); white-space: nowrap; line-height: 1.45; }

/* State colour on the start edge of each row */
ul.sq-rows > li { --tone: transparent; }
ul.sq-rows > li[data-tone="due"] { --tone: #d98422; }
ul.sq-rows > li[data-tone="late"] { --tone: #dc2626; }
ul.sq-rows > li[data-tone="done"] { --tone: #129a64; }
ul.sq-rows > li[data-tone="info"] { --tone: #3b82f6; }
ul.sq-rows > li[data-tone="draft"] { --tone: var(--ui-line-strong); }
ul.sq-rows > li[data-tone="muted"] { --tone: var(--ui-line-strong); }
.dark ul.sq-rows > li[data-tone="due"] { --tone: #f0a04b; }
.dark ul.sq-rows > li[data-tone="late"] { --tone: #ff7a7a; }
.dark ul.sq-rows > li[data-tone="done"] { --tone: #3fcf95; }
.dark ul.sq-rows > li[data-tone="info"] { --tone: #7aa7ff; }
[dir="rtl"] ul.sq-rows > li { box-shadow: inset -4px 0 0 var(--tone); }
[dir="ltr"] ul.sq-rows > li { box-shadow: inset 4px 0 0 var(--tone); }

/* Phones and tablets: every document is its own card, with clear space between customers */
@media (max-width: 1023.98px) {
    ul.sq-rows { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 0; }
    ul.sq-rows > li, ul.sq-rows > li:not(:last-child) {
        border: 1px solid var(--ui-line); border-radius: 16px; padding: 14px 14px 12px;
        background: color-mix(in srgb, var(--ui-ink) 2.5%, var(--ui-surface));
    }
    .dark ul.sq-rows > li, .dark ul.sq-rows > li:not(:last-child) { background: color-mix(in srgb, #fff 3%, var(--ui-surface)); border-color: var(--ui-line-strong); }
    ul.sq-rows > li > .sq-rowhead { padding-bottom: 12px; border-bottom: 1px dashed var(--ui-line); }
    .inv-compact ul.sq-rows > li { padding-top: 12px; padding-bottom: 10px; grid-template-columns: minmax(0, 1fr); }
    .inv-compact ul.sq-rows > li > div:last-child { align-self: auto; justify-content: flex-end; }
    ul.sq-rows > li > div:last-child { justify-content: flex-end; }
}
@media (min-width: 1024px) {
    ul.sq-rows > li, div:has(+ ul.sq-rows) { grid-template-columns: minmax(19rem, 1.5fr) minmax(0, 2fr) auto; }
    ul.sq-rows > li { padding-inline-start: 20px; }
    .sq-ava { width: 38px; height: 38px; font-size: 15px; border-radius: 12px; }
}

/* 20 — document editors: "add from the catalogue" drawer (grouped by category, prices up front) */
.sq-cat-drawer { max-width: 44rem; }
.sq-cat-open { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
    color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); cursor: pointer; }
.sq-cat-open:hover { background: color-mix(in srgb, var(--brand) 16%, transparent); }
.sq-cat-tools { position: sticky; top: -20px; z-index: 3; margin: -20px -20px 14px; padding: 16px 20px 12px; background: var(--ui-surface); border-bottom: 1px solid var(--ui-line); }
.sq-cat-chips { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.sq-cat-chips::-webkit-scrollbar { display: none; }
.sq-cat-chips > button { flex: none; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ui-ink-muted);
    background: var(--ui-surface-muted); border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.sq-cat-chips > button[data-on] { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--ui-surface)); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.sq-cat-sep { flex: none; width: 1px; margin: 4px 2px; background: var(--ui-line); }

.sq-cat-list { display: flex; flex-direction: column; gap: 22px; }
.sq-cat-gh { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; font-family: var(--sq-display); font-size: 13px; font-weight: 700; color: var(--ui-ink-muted); letter-spacing: 0; }
.sq-cat-gh::after { content: ""; flex: 1; height: 1px; background: var(--ui-line); }
.sq-cat-gh > span { order: 2; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: var(--ui-ink-muted); background: var(--ui-surface-muted); }
.sq-cat-gh::after { order: 3; }
.sq-cat-group ul { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }

.sq-cat-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 16px;
    border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-surface); transition: border-color .15s, background-color .15s, box-shadow .15s; }
.sq-cat-item:hover { border-color: var(--ui-line-strong); box-shadow: var(--sq-shadow-card); }
.sq-cat-item[data-in] { border-color: color-mix(in srgb, var(--brand) 55%, transparent); background: color-mix(in srgb, var(--brand) 6%, var(--ui-surface)); }
.sq-cat-main { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0; text-align: start; background: none; border: 0; cursor: pointer; color: inherit; }
.sq-cat-ic { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: #7c5cff; background: color-mix(in srgb, #7c5cff 13%, transparent); }
.sq-cat-ic[data-kind="product"] { color: #d98422; background: color-mix(in srgb, #d98422 13%, transparent); }
.sq-cat-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sq-cat-name { font-family: var(--sq-display); font-size: 15.5px; font-weight: 700; color: var(--ui-ink); line-height: 1.45; overflow-wrap: anywhere; }
.sq-cat-desc { font-size: 12.5px; line-height: 1.6; color: var(--ui-ink-muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.sq-cat-meta { font-size: 11.5px; color: var(--ui-ink-subtle); }

.sq-cat-end { display: flex; align-items: center; gap: 14px; }
.sq-cat-price { display: flex; flex-direction: column; align-items: flex-end; min-width: 96px; padding: 6px 12px; border-radius: 12px; text-align: end;
    background: color-mix(in srgb, var(--brand) 8%, var(--ui-surface)); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); }
.sq-cat-amt { font-family: var(--sq-display); font-size: 21px; font-weight: 800; line-height: 1.15; color: var(--brand); white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.dark .sq-cat-amt { color: color-mix(in srgb, var(--brand) 55%, #fff); }
.sq-cat-cur { font-size: 11.5px; font-weight: 600; color: var(--ui-ink-muted); white-space: nowrap; }
.sq-cat-cur i { font-style: normal; font-weight: 500; color: var(--ui-ink-subtle); }
.sq-cat-add { display: inline-flex; align-items: center; gap: 5px; height: 38px; padding: 0 14px; border-radius: 11px; font-size: 13.5px; font-weight: 700;
    color: #fff; background: var(--brand); border: 0; cursor: pointer; box-shadow: 0 4px 12px -6px var(--brand); white-space: nowrap; }
.sq-cat-step { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: var(--ui-surface-muted); border: 1px solid var(--ui-line); }
.sq-cat-step > button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 0; cursor: pointer; color: var(--ui-ink); background: var(--ui-surface); }
.sq-cat-step > button:last-child { color: #fff; background: var(--brand); }
.sq-cat-step > span { min-width: 28px; text-align: center; font-weight: 700; font-size: 14px; color: var(--ui-ink); }

.sq-cat-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 8px; }
.sq-cat-empty-i { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.sq-cat-empty-t { font-family: var(--sq-display); font-size: 17px; font-weight: 700; color: var(--ui-ink); }
.sq-cat-empty-d { max-width: 340px; font-size: 13.5px; line-height: 1.8; color: var(--ui-ink-muted); }
.sq-cat-none { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 0; font-size: 13.5px; color: var(--ui-ink-muted); }

/* Phones: name on top; price on one side and the button on the other, under a fine line */
@media (max-width: 560px) {
    .sq-cat-item { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px; }
    .sq-cat-end { justify-content: space-between; padding-top: 12px; border-top: 1px dashed var(--ui-line); }
    .sq-cat-price { flex-direction: row; align-items: baseline; gap: 6px; min-width: 0; padding: 0; background: none; border: 0; }
    .sq-cat-amt { font-size: 22px; }
}

/* 21 — side menu: ordered by daily use, in groups, with a hint under the main screens */
.sq-side nav { display: flex; flex-direction: column; }
.sq-nav-group + .sq-nav-group { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ui-line); }
.sq-nav-h { margin: 0 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--ui-ink-subtle); }
.sq-nav-sys { margin-top: auto !important; }
.sq-nav-sys .sq-nav-link { padding-top: 8px; padding-bottom: 8px; font-size: 13px; }
.sq-nav-t { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.sq-nav-t small { font-size: 11px; font-weight: 500; color: var(--ui-ink-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sq-nav-link[data-current] .sq-nav-t small { color: inherit; opacity: .75; }
.sq-nav-badge { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center;
    font-size: 11.5px; font-weight: 700; color: #fff; background: #dc2626; }

/* 22. Quotation discussion tags in lists */
.sq-fb-new{display:inline-flex;align-items:center;gap:.25rem;font-size:.72rem;font-weight:700;color:#c2410c;background:color-mix(in oklab,#f97316 14%,transparent);border-radius:999px;padding:.05rem .55rem;white-space:nowrap;text-decoration:none}
.sq-fb-rev{font-size:.7rem;font-weight:600;opacity:.7;border:1px solid currentColor;border-radius:999px;padding:0 .5rem;white-space:nowrap}
