@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{--bg:#fafafa;--surface:#fff;--surface-2:#f5f5f4;--surface-3:#eee;--border:#e7e5e4;--border-strong:#d6d3d1;--fg:#0c0a09;--fg-2:#44403c;--fg-3:#78716c;--fg-4:#a8a29e;--accent:#5b5bd6;--accent-fg:#fff;--accent-soft:#eeeefc;--radius:6px;--radius-sm:4px;--radius-lg:10px;--radius-xl:14px;--shadow-pop:0 8px 30px rgba(10,10,10,.14),0 0 0 1px rgba(10,10,10,.05);--font-body:'IBM Plex Sans',ui-sans-serif,system-ui,sans-serif;--font-mono:'Geist Mono',ui-monospace,monospace}
[data-theme="dark"]{--bg:#0a0a0a;--surface:#111;--surface-2:#171717;--surface-3:#1e1e1e;--border:#262626;--border-strong:#333;--fg:#fafafa;--fg-2:#d4d4d4;--fg-3:#a3a3a3;--fg-4:#737373;--accent:#8b8bf5;--accent-fg:#0a0a0a;--accent-soft:#1a1a3a;--shadow-pop:0 8px 30px rgba(0,0,0,.4),0 0 0 1px rgba(255,255,255,.06)}
html,body{height:100%}
body{font-family:var(--font-body);-webkit-font-smoothing:antialiased;color:var(--fg);background:var(--bg);line-height:1.5;overflow-x:hidden}

/* ═══ TOPBAR ═══ */
.topbar{border-bottom:1px solid var(--border);background:var(--surface);position:sticky;top:0;z-index:10}
.topbar-inner{max-width:1600px;margin:0 auto;padding:0 32px;height:56px;display:flex;align-items:center;gap:24px}
.brand{display:flex;align-items:center;gap:10px;font-weight:600;font-size:14px;letter-spacing:-.01em;color:var(--fg);user-select:none}
.brand-mark{width:22px;height:22px;border-radius:5px;background:var(--fg);display:grid;place-items:center;color:var(--bg);font-family:var(--font-mono);font-size:10px;font-weight:600}
.nav-tabs{display:flex;gap:2px;height:100%;align-items:stretch}
.nav-tab{display:flex;align-items:center;padding:0 14px;font-size:13.5px;color:var(--fg-3);cursor:pointer;border:none;background:none;border-bottom:2px solid transparent;margin-bottom:-1px;font-weight:500;font-family:inherit;text-decoration:none;transition:color .12s}
.nav-tab:hover{color:var(--fg-2)}
.nav-tab.active{color:var(--fg);border-bottom-color:var(--fg)}
.nav-tab.active:hover{color:var(--fg)}
.nav-tab-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;margin-left:7px;border-radius:999px;background:#dc2626;color:#fff;font-size:10.5px;font-weight:700;font-family:var(--font-mono);line-height:1;box-shadow:0 0 0 2px var(--bg)}
[data-theme="dark"] .nav-tab-badge{background:#ef4444}
.spacer{flex:1}
.top-actions{display:flex;align-items:center;gap:10px}
.avatar{width:28px;height:28px;border-radius:999px;background:var(--accent);color:var(--accent-fg);display:grid;place-items:center;font-weight:600;font-size:11px}
.theme-toggle{display:inline-flex;border:1px solid var(--border);border-radius:var(--radius-sm);padding:2px;background:var(--surface);gap:2px}
.theme-toggle button{border:0;background:transparent;width:26px;height:24px;display:grid;place-items:center;color:var(--fg-3);cursor:pointer;border-radius:calc(var(--radius-sm) - 1px);line-height:0}
.theme-toggle button.active{background:var(--surface-2);color:var(--fg)}
.sync-ind{display:none}
.spin{animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}

/* ═══ PAGE ═══ */
.page{max-width:1600px;margin:0 auto;padding:28px 32px 80px}
.page-head{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:24px;gap:16px;flex-wrap:wrap}
.page-title{font-size:22px;font-weight:600;letter-spacing:-.02em}
.page-sub{font-size:13px;color:var(--fg-3);margin-top:4px}
.view[hidden]{display:none}

/* Empty / coming-soon placeholder */
.empty-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:80px 32px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface)}
.empty-placeholder .empty-icon{width:48px;height:48px;border-radius:12px;background:var(--surface-2);display:grid;place-items:center;color:var(--fg-3);margin-bottom:14px}
.empty-placeholder .empty-title{font-size:15px;font-weight:600;color:var(--fg);margin-bottom:6px}
.empty-placeholder .empty-sub{font-size:13px;color:var(--fg-3);max-width:380px;line-height:1.5}

/* ═══ MATERIALS PAGE ═══ */
.kpi-value .kpi-of{font-size:13px;font-weight:500;color:var(--fg-4);margin-left:4px}
.mat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:8px;margin-bottom:32px}
.mat-card{display:flex;align-items:center;gap:12px;padding:12px 14px;background:var(--surface);border:1px solid var(--border);border-radius:10px;transition:all .12s;position:relative;cursor:pointer}
.mat-card:hover{border-color:var(--border-strong);transform:translateY(-1px);box-shadow:0 4px 12px rgba(0,0,0,.04)}
[data-theme="dark"] .mat-card:hover{box-shadow:0 4px 12px rgba(0,0,0,.3)}
.mat-card.is-empty{opacity:.55;background:repeating-linear-gradient(135deg,var(--surface) 0 8px,var(--surface-2) 8px 9px)}
.mat-card.is-low{border-color:#f59e0b}
.mat-card.is-low .mat-sub{color:#d97706}
[data-theme="dark"] .mat-card.is-low{border-color:#fbbf24}
[data-theme="dark"] .mat-card.is-low .mat-sub{color:#fbbf24}
.mat-swatch{width:32px;height:32px;border-radius:8px;flex-shrink:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12)}
.mat-icon{width:32px;height:32px;border-radius:8px;background:var(--surface-2);color:var(--fg-3);display:grid;place-items:center;flex-shrink:0;border:1px solid var(--border)}
.mat-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.mat-name{font-size:13px;font-weight:600;color:var(--fg);line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mat-sub{font-size:10.5px;color:var(--fg-4);line-height:1.2;text-transform:uppercase;letter-spacing:.06em;font-family:var(--font-mono)}
.mat-val{display:flex;align-items:baseline;gap:3px;flex-shrink:0;font-family:var(--font-mono)}
.mat-num{font-size:20px;font-weight:600;color:var(--fg);letter-spacing:-.02em;line-height:1}
.mat-unit{font-size:11px;font-weight:500;color:var(--fg-4)}

/* ═══ MATERIAL MODAL — designed card ═══ */
.mat-card-modal{max-width:420px;padding:0;overflow:hidden;position:relative}
.mat-modal-close{position:absolute;top:14px;right:14px;width:30px;height:30px;border-radius:999px;border:0;background:rgba(255,255,255,.85);backdrop-filter:blur(6px);color:var(--fg-2);cursor:pointer;display:grid;place-items:center;z-index:5;transition:all .12s;box-shadow:0 1px 2px rgba(0,0,0,.06)}
.mat-modal-close:hover{background:#fff;color:var(--fg);transform:scale(1.05)}
[data-theme="dark"] .mat-modal-close{background:rgba(40,40,40,.7);color:var(--fg-2)}
[data-theme="dark"] .mat-modal-close:hover{background:rgba(60,60,60,.9);color:var(--fg)}

.mat-hero{position:relative;display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;padding:48px 28px 28px;border-bottom:1px solid var(--border);overflow:hidden;isolation:isolate}
.mat-hero::before{content:"";position:absolute;inset:0;background:linear-gradient(180deg,var(--surface-2) 0%,var(--surface) 100%);z-index:-2}
.mat-hero-tint{position:absolute;inset:0;z-index:-1;opacity:.18;pointer-events:none}
[data-theme="dark"] .mat-hero-tint{opacity:.28}

.mat-hero-swatch{width:84px;height:84px;border-radius:22px;box-shadow:0 12px 28px rgba(0,0,0,.12),inset 0 0 0 1px rgba(0,0,0,.1),0 0 0 6px rgba(255,255,255,.6);transition:transform .2s}
[data-theme="dark"] .mat-hero-swatch{box-shadow:0 12px 28px rgba(0,0,0,.5),inset 0 0 0 1px rgba(255,255,255,.1),0 0 0 6px rgba(255,255,255,.04)}
.mat-hero-icon{width:84px;height:84px;border-radius:22px;background:var(--surface);border:1px solid var(--border);display:grid;place-items:center;color:var(--fg-2);box-shadow:0 12px 28px rgba(0,0,0,.06),0 0 0 6px rgba(255,255,255,.6)}
[data-theme="dark"] .mat-hero-icon{box-shadow:0 12px 28px rgba(0,0,0,.4),0 0 0 6px rgba(255,255,255,.04)}

.mat-hero-name{font-size:20px;font-weight:700;color:var(--fg);letter-spacing:-.02em;line-height:1.15}
.mat-hero-meta{font-size:10.5px;color:var(--fg-4);font-family:var(--font-mono);text-transform:uppercase;letter-spacing:.1em;display:flex;align-items:center;gap:6px}
.mat-hero-meta-divider{width:3px;height:3px;border-radius:999px;background:var(--fg-4);opacity:.5}
.mat-hero-meta .mono{text-transform:none;letter-spacing:0}

.mat-modal-body{padding:22px 24px}
.mat-section + .mat-section{margin-top:18px}
.mat-section-label{font-size:10px;font-weight:700;color:var(--fg-4);text-transform:uppercase;letter-spacing:.1em;font-family:var(--font-mono);margin-bottom:8px}

/* Stepper */
.qty-stepper{display:flex;align-items:center;border:0;border-bottom:1px solid var(--border);border-radius:0;background:transparent;overflow:visible;transition:border-color .14s;padding-bottom:2px}
.qty-stepper:focus-within{border-bottom-color:var(--fg)}
.qty-stepper:focus-within{border-color:var(--fg);box-shadow:0 0 0 3px var(--surface-3)}
.qty-btn{width:42px;height:42px;border:0;background:transparent;color:var(--fg-3);cursor:pointer;display:grid;place-items:center;transition:all .12s;flex-shrink:0}
.qty-btn:hover{background:var(--surface-2);color:var(--fg)}
.qty-btn:active{background:var(--surface-3)}
.qty-input{flex:1;height:42px;border:0;background:transparent;color:var(--fg);font-size:20px;font-weight:600;font-family:var(--font-mono);text-align:center;outline:none;letter-spacing:-.02em;width:100%;padding:0;-moz-appearance:textfield}
.qty-input::-webkit-outer-spin-button,.qty-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.qty-unit{padding:0 16px 0 4px;color:var(--fg-4);font-size:12px;font-family:var(--font-mono);text-transform:uppercase;letter-spacing:.06em;font-weight:500}

/* Unit chips (segmented control) */
.unit-chips{display:grid;grid-template-columns:repeat(auto-fit,minmax(48px,1fr));gap:3px;padding:3px;background:var(--surface-2);border-radius:9px;border:1px solid var(--border)}
.unit-chip{width:100%;height:30px;padding:0 6px;border:0;background:transparent;color:var(--fg-3);font-size:12px;font-weight:500;cursor:pointer;border-radius:6px;transition:all .12s;font-family:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.icon-chips{display:grid;grid-template-columns:repeat(auto-fit,minmax(40px,1fr));gap:3px;padding:3px;background:var(--surface-2);border-radius:9px;border:1px solid var(--border)}
.icon-chip{width:100%;height:36px;display:grid;place-items:center;padding:0;border:0;background:transparent;color:var(--fg-3);cursor:pointer;border-radius:6px;transition:all .12s}
.icon-chip:hover{color:var(--fg-2)}
.icon-chip.active{background:var(--surface);color:var(--fg);box-shadow:0 1px 2px rgba(0,0,0,.06),0 0 0 1px var(--border)}
[data-theme="dark"] .icon-chip.active{box-shadow:0 1px 2px rgba(0,0,0,.4),0 0 0 1px var(--border)}
.unit-chip:hover{color:var(--fg-2)}
.unit-chip.active{background:var(--surface);color:var(--fg);box-shadow:0 1px 2px rgba(0,0,0,.06),0 0 0 1px var(--border)}
[data-theme="dark"] .unit-chip.active{box-shadow:0 1px 2px rgba(0,0,0,.4),0 0 0 1px var(--border)}

/* ═══ BUTTONS ═══ */
.btn{height:32px;padding:0 12px;border-radius:var(--radius-sm);border:1px solid var(--border);background:var(--surface);color:var(--fg-2);font-size:13px;font-weight:500;display:inline-flex;align-items:center;gap:6px;cursor:pointer;transition:all .12s;font-family:inherit;white-space:nowrap}
.btn:hover{background:var(--surface-2);color:var(--fg)}
.btn.primary{background:var(--fg);color:var(--bg);border-color:var(--fg)}
.btn.primary:hover{opacity:.9}
.btn.ghost{border-color:transparent;background:transparent}
.btn.ghost:hover{background:var(--surface-2)}
.btn.sm{height:26px;font-size:12px;padding:0 8px}
.btn svg,.icon-btn svg{flex-shrink:0}
.icon-btn{width:32px;height:32px;display:grid;place-items:center;border-radius:var(--radius-sm);background:transparent;border:1px solid transparent;cursor:pointer;color:var(--fg-3)}
.icon-btn:hover{background:var(--surface-2);color:var(--fg-2)}

/* ═══ SEARCH ═══ */
.search-box{display:inline-flex;align-items:center;gap:8px;height:32px;padding:6px 2px;border:0;border-bottom:1px solid var(--border);border-radius:0;background:transparent;font-size:13px;min-width:180px;transition:border-color .14s}
.search-box:focus-within{border-bottom-color:var(--fg)}
.search-box svg,.search-box i{flex-shrink:0;color:var(--fg-4)}
.search-box input{border:0;outline:0;background:transparent;color:var(--fg);font:inherit;flex:1;width:100%}
.search-box input::placeholder{color:var(--fg-4)}
.search-clear{border:0;background:transparent;color:var(--fg-4);cursor:pointer;padding:0;display:none;line-height:0}
.search-clear.visible{display:flex;align-items:center}

/* ═══ CHIP (coloured badge) ═══ */
.chip{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;font-size:11.5px;font-weight:500;border-radius:6px;white-space:nowrap;cursor:default;line-height:1}
.chip.clickable{cursor:pointer;transition:opacity .12s}
.chip.clickable:hover{opacity:.8}

/* ═══ PILL (white badge like size/design/pers) ═══ */
.pill{display:inline-flex;align-items:center;height:22px;padding:0 8px;font-size:12px;font-weight:500;border-radius:4px;background:#fff;color:var(--fg-2);border:1px solid #d1d1d1;white-space:nowrap;text-align:center;line-height:1}
[data-theme="dark"] .pill{background:var(--surface-2);border-color:var(--border)}

/* ═══ CARD ═══ */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}

/* ═══ KPI GRID ═══ */
.kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:1px;background:var(--border);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.kpi{background:var(--surface);padding:16px 18px}
.kpi-label{font-size:10.5px;color:var(--fg-4);text-transform:uppercase;letter-spacing:.08em;font-weight:600;margin-bottom:6px;display:flex;align-items:center;gap:4px}
.kpi-value{font-size:24px;font-weight:500;letter-spacing:-.02em;font-variant-numeric:tabular-nums;font-family:var(--font-mono)}

/* ═══ SECTION ═══ */
.section-head{display:flex;align-items:center;justify-content:space-between;margin:28px 0 12px}
.section-title{font-size:13px;font-weight:600}
.section-meta{font-size:12px;color:var(--fg-4);font-family:var(--font-mono)}

/* ═══ TOOLBAR ═══ */
.toolbar{display:flex;align-items:center;gap:6px;padding:8px 10px;border-bottom:1px solid var(--border);background:var(--surface);flex-wrap:wrap}
.toolbar-divider{width:1px;height:18px;background:var(--border);margin:0 2px}
.filter-btn{position:relative}
.filter-badge{position:absolute;top:-4px;right:-4px;min-width:16px;height:16px;border-radius:999px;background:var(--accent);color:var(--accent-fg);font-size:10px;font-weight:600;display:none;align-items:center;justify-content:center;padding:0 4px}
.filter-badge.active{display:flex}

/* ═══ TABLE — fits screen ═══ */
.table-scroll{overflow-x:auto}
.data-table{width:100%;border-collapse:collapse;font-size:13px;table-layout:fixed}
.data-table thead th{text-align:left;font-size:10.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--fg-4);padding:10px 8px;border-bottom:1px solid var(--border);background:var(--surface);white-space:nowrap;user-select:none;overflow:hidden}
.data-table tbody td{padding:10px 8px;border-bottom:1px solid var(--border);color:var(--fg-2);vertical-align:middle;overflow:hidden;text-overflow:ellipsis}
.data-table tbody tr:last-child td{border-bottom:0}
.data-table tbody tr{transition:background .08s}
.data-table tbody tr:hover{background:var(--surface-2)}
.data-table tbody tr.selected{background:var(--accent-soft)}

/* Column widths — total ≈ 100% */
.col-check{width:36px}
.col-ind{width:4px}
.col-num{width:38px}
.col-source{width:88px}
.col-date{width:50px}
.col-name{width:112px}
.col-product{width:124px}
.col-pers{width:128px}
.col-color{width:90px}
.col-size{width:46px}
.col-design{width:60px}
.col-recipient{width:124px}
.col-status{width:88px}
.col-tracking{width:74px}
.col-mockup{width:128px}

/* Cell styles */
.cell-id{font-family:var(--font-mono);font-size:11px;color:var(--fg-4)}
.cell-date{font-family:var(--font-mono);font-size:10.5px;color:#c0c4cc;font-weight:500;line-height:1.5;letter-spacing:.01em}
.cell-name{color:var(--fg);font-weight:500;font-size:12.5px;word-wrap:break-word}
.cell-pers{font-size:11.5px;color:var(--fg-3);word-wrap:break-word}
.cell-pers-label{font-size:9.5px;color:var(--fg-4);display:block;line-height:1.2;margin-bottom:1px}
/* Multi-line cells (pers / color / size / design) — aligned rows with breathing space */
.multi-line{display:flex;align-items:center;min-height:24px}
.multi-line + .multi-line{margin-top:6px}
/* HW/WT pers — label STACKED above pill */
.pers-pair{display:flex;flex-direction:column;align-items:flex-start;gap:2px;margin-bottom:6px}
.pers-pair:last-child{margin-bottom:0}
.cell-tracking-text{font-size:11px;font-family:var(--font-mono);color:var(--fg-3);display:inline-block;width:100%;overflow:hidden;white-space:nowrap;-webkit-mask-image:linear-gradient(to right,#000 0,#000 8ch,transparent 100%);mask-image:linear-gradient(to right,#000 0,#000 8ch,transparent 100%)}
.cell-muted{color:var(--fg-4);font-size:11px}
.empty-row{text-align:center;padding:60px 20px!important;color:var(--fg-4);font-size:13px}

/* Editable cell hover */
.cell-edit{cursor:pointer;border-radius:var(--radius-sm);padding:1px 4px;margin:-1px -4px;transition:background .1s;display:inline-block;max-width:100%;min-height:20px;min-width:40px}
.cell-edit:hover{background:var(--surface-3)}
.cell-edit:empty{min-width:100%;min-height:24px}

/* Row indicator */
.row-ind{width:3px;height:22px;border-radius:2px}

/* Checkbox */
.checkbox{width:14px;height:14px;border:1.5px solid var(--border-strong);border-radius:3px;background:var(--surface);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:all .1s}
.checkbox svg{display:none;stroke-width:3}
.checkbox.checked{background:var(--fg);border-color:var(--fg)}
.checkbox.checked svg{display:block;color:var(--bg)}

/* Color circle */
.color-circle{width:12px;height:12px;border-radius:999px;flex-shrink:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12);display:inline-block;vertical-align:middle;margin-right:4px}

/* Recipient */
.cell-recip-name{color:var(--fg);font-size:12px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cell-recip-rest{font-size:10px;color:var(--fg-4);line-height:1.3;max-height:26px;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}

/* Mockup */
.mockup-img{width:52px;height:36px;border-radius:var(--radius-sm);border:1px solid var(--border);object-fit:cover;display:block}
.mockup-empty{width:52px;height:36px;border-radius:var(--radius-sm);background:repeating-linear-gradient(45deg,var(--surface-2) 0 5px,var(--surface) 5px 10px);border:1px solid var(--border)}

/* Bulk meta — count of selected rows shown next to action buttons */
.bulk-meta{display:inline-flex;align-items:center;height:32px;padding:0 10px;border-radius:var(--radius-sm);background:var(--accent-soft);color:var(--accent);font-size:12px;font-weight:600;font-family:var(--font-mono)}

/* ═══ PAGINATION ═══ */
.pagination{display:flex;align-items:center;justify-content:center;gap:8px;padding:12px;border-top:1px solid var(--border)}
.pg-btn{height:30px;padding:0 12px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface);color:var(--fg-2);font-size:12px;font-weight:500;cursor:pointer;display:inline-flex;align-items:center;gap:4px;justify-content:center;font-family:inherit}
.pg-btn:hover:not(:disabled){background:var(--surface-2)}
.pg-btn:disabled{opacity:.4;cursor:default}
.pg-info{font-size:12px;color:var(--fg-3);min-width:90px;text-align:center;font-weight:500}

/* ═══ POPOVER — strict premium (Linear/Notion vibe) ═══ */
.popover-backdrop{position:fixed;inset:0;z-index:80}
.popover{position:fixed;z-index:81;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:0 1px 2px rgba(0,0,0,.04),0 8px 24px rgba(0,0,0,.08);min-width:240px;max-width:360px;animation:popIn .14s cubic-bezier(.2,.9,.3,1);overflow:hidden}
[data-theme="dark"] .popover{box-shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.5)}
.popover-header{padding:12px 14px 10px;font-size:10px;font-weight:700;color:var(--fg-3);letter-spacing:.1em;text-transform:uppercase;font-family:var(--font-mono);border-bottom:1px solid var(--border);background:var(--surface)}
.pop-options{padding:4px}
.pop-option{display:flex;align-items:center;gap:10px;padding:7px 10px;border-radius:6px;font-size:13px;color:var(--fg-2);cursor:pointer;transition:background .08s;user-select:none}
.pop-option:hover{background:var(--surface-2);color:var(--fg)}
.pop-option.active{background:var(--surface-2);color:var(--fg);font-weight:500}
.pop-option .pop-check{width:14px;height:14px;border-radius:3px;border:1.5px solid var(--border-strong);display:grid;place-items:center;flex-shrink:0;transition:all .12s}
.pop-option.active .pop-check{background:var(--fg);border-color:var(--fg)}
.pop-option.active .pop-check svg{display:block;color:var(--bg)}
.pop-option .pop-check svg{display:none;width:9px;height:9px;stroke-width:3}
.pop-input-wrap{padding:12px 14px;display:flex;flex-direction:column;gap:10px}
.pop-input{width:100%;padding:6px 2px;border:0;border-bottom:1px solid var(--border);border-radius:0;background:transparent;color:var(--fg);font:inherit;font-size:13px;outline:none;transition:border-color .14s;display:block;box-sizing:border-box}
.pop-input:focus{border-bottom-color:var(--fg)}
textarea.pop-input{resize:vertical;min-height:64px;line-height:1.5;padding:8px 2px}
.pop-field{display:flex;flex-direction:column;gap:5px}
.pop-field-label{font-size:10px;font-weight:700;color:var(--fg-4);text-transform:uppercase;letter-spacing:.08em;font-family:var(--font-mono);line-height:1}
.pop-footer{padding:8px 14px;border-top:1px solid var(--border);display:flex;align-items:center;gap:8px;background:var(--surface-2)}
.pop-hint{font-size:10.5px;color:var(--fg-4);flex:1;font-family:var(--font-mono);letter-spacing:.02em}
.pop-hint kbd{font-family:var(--font-mono);font-size:10px;background:var(--surface);border:1px solid var(--border);border-radius:3px;padding:1px 5px;margin:0 1px;color:var(--fg-3)}
.pop-empty{padding:14px;color:var(--fg-3);font-size:12px;text-align:center}
/* Color picker grid (smaller, denser) */
.pop-color-grid{display:flex;flex-wrap:wrap;gap:6px;padding:12px;justify-content:flex-start}
.pop-color-btn{width:26px;height:26px;border-radius:6px;border:2px solid transparent;cursor:pointer;transition:transform .1s,border-color .1s,box-shadow .1s;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}
.pop-color-btn:hover{transform:scale(1.08)}
.pop-color-btn.active{border-color:var(--fg);box-shadow:inset 0 0 0 2px var(--surface),inset 0 0 0 1px rgba(0,0,0,.1)}
/* Size/design buttons (chips) */
.pop-size-grid{display:flex;flex-wrap:wrap;gap:4px;padding:10px 12px;justify-content:flex-start}
.pop-size-btn{height:28px;min-width:36px;padding:0 10px;border:1px solid var(--border);border-radius:6px;background:var(--surface);color:var(--fg-2);font-size:12.5px;font-weight:500;cursor:pointer;transition:all .1s;font-family:inherit}
.pop-size-btn:hover{background:var(--surface-2);color:var(--fg);border-color:var(--border-strong)}
.pop-size-btn.active{background:var(--fg);color:var(--bg);border-color:var(--fg)}
/* Multi-item sections (kopilka multi-pers) */
.pop-item-section{padding:10px 12px;border-bottom:1px solid var(--border)}
.pop-item-section:last-child{border-bottom:0}
.pop-item-label{font-size:10px;font-weight:700;color:var(--fg-4);margin-bottom:6px;text-align:left;text-transform:uppercase;letter-spacing:.08em;font-family:var(--font-mono)}
/* HW design rows */
.pop-design-row{display:flex;align-items:center;gap:10px;padding:6px 12px}
.pop-design-row:not(:last-child){border-bottom:1px solid var(--border)}
.pop-design-label{font-size:10px;color:var(--fg-4);width:48px;flex-shrink:0;text-align:left;font-weight:700;text-transform:uppercase;letter-spacing:.08em;font-family:var(--font-mono)}

/* ═══ FILTER PANEL ═══ */
.filter-overlay{position:fixed;inset:0;background:rgba(0,0,0,.3);z-index:70;animation:fadeIn .12s ease}
.filter-panel{position:fixed;right:0;top:0;bottom:0;width:380px;max-width:100vw;background:var(--surface);border-left:1px solid var(--border);box-shadow:-10px 0 40px rgba(0,0,0,.1);display:flex;flex-direction:column;z-index:71;animation:slideInR .2s ease}
.fp-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--border)}
.fp-title{font-size:14px;font-weight:600;display:flex;align-items:center;gap:8px}
.fp-body{padding:20px 24px;overflow-y:auto;flex:1;display:flex;flex-direction:column;gap:20px}
.fp-footer{padding:16px 24px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:8px}
.fp-label{font-size:12px;font-weight:600;color:var(--fg-3);margin-bottom:8px;text-transform:uppercase;letter-spacing:.04em}
.fp-chips{display:flex;flex-wrap:wrap;gap:6px}
.fp-chip{display:inline-flex;align-items:center;gap:4px;padding:5px 10px;border-radius:6px;font-size:12px;font-weight:500;cursor:pointer;border:1px solid var(--border);background:var(--surface);color:var(--fg-2);transition:all .12s;user-select:none}
.fp-chip:hover{border-color:var(--border-strong)}
.fp-chip.selected{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}

/* ═══ CONTEXT MENU ═══ */
.ctx-menu{position:fixed;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-pop);z-index:90;min-width:180px;padding:4px;display:none}
.ctx-menu.visible{display:block}
.ctx-item{display:flex;align-items:center;gap:10px;padding:8px 12px;font-size:13px;cursor:pointer;border-radius:var(--radius-sm);color:var(--fg-2);transition:background .08s}
.ctx-item svg{flex-shrink:0}
.ctx-item:hover{background:var(--surface-2)}
.ctx-item.danger{color:#dc2626}

/* ═══ TOAST ═══ */
.toast{position:fixed;bottom:28px;left:50%;transform:translateX(-50%);background:var(--fg);color:var(--bg);padding:10px 20px;border-radius:var(--radius);font-size:13px;font-weight:500;z-index:200;box-shadow:0 8px 30px rgba(0,0,0,.25);animation:toastIn .25s ease;display:none}
.toast.visible{display:block}

/* ═══ UTILITIES ═══ */
.row{display:flex;align-items:center;gap:8px}
.muted{color:var(--fg-3)}
.mono{font-family:var(--font-mono)}

/* ═══ ANIMATIONS ═══ */
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes slideUp{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
@keyframes toastIn{from{opacity:0;transform:translate(-50%,12px)}to{opacity:1;transform:translate(-50%,0)}}
@keyframes popIn{from{opacity:0;transform:scale(.96) translateY(-4px)}to{opacity:1;transform:scale(1) translateY(0)}}
@keyframes slideInR{from{transform:translateX(100%)}to{transform:translateX(0)}}
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:10px}

/* ═══ MODAL ═══ */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:100;display:none;align-items:center;justify-content:center;padding:20px;overflow-y:auto;animation:fadeIn .15s ease}
.modal-overlay.visible{display:flex}
.modal-card{background:var(--surface);border-radius:14px;box-shadow:0 24px 64px rgba(0,0,0,.18),0 0 0 1px var(--border);width:100%;max-width:560px;max-height:90vh;display:flex;flex-direction:column;animation:slideUp .22s ease;color:var(--fg)}
.modal-card.sm{max-width:380px}
.modal-card.md{max-width:480px}
.modal-card.lg{max-width:920px}
.modal-header{padding:20px 24px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0}
.modal-title-block{flex:1;min-width:0}
.modal-eyebrow{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--fg-4);margin-bottom:4px}
.modal-title{font-size:15px;font-weight:700;color:var(--fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.modal-close{width:30px;height:30px;border-radius:999px;border:0;background:var(--surface-2);color:var(--fg-3);cursor:pointer;display:grid;place-items:center;flex-shrink:0;transition:all .12s}
.modal-close:hover{background:var(--surface-3);color:var(--fg)}
.modal-body{padding:20px 24px;overflow-y:auto;flex:1;min-height:0}
.modal-footer{padding:14px 24px;border-top:1px solid var(--border);background:var(--surface-2);border-radius:0 0 14px 14px;display:flex;align-items:center;gap:8px;flex-shrink:0}
.modal-status{flex:1;font-size:11.5px;color:var(--fg-4)}
.modal-status.success{color:#059669}
.modal-status.error{color:#dc2626}
.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.field.full{grid-column:1/-1}
.field-label{font-size:11px;font-weight:600;color:var(--fg-3);text-transform:uppercase;letter-spacing:.04em}
/* Underline-style input — мінімальний, як у назви товара */
.field-input{height:34px;padding:6px 2px;border:0;border-bottom:1px solid var(--border);border-radius:0;background:transparent;color:var(--fg);font:inherit;font-size:13.5px;outline:none;transition:border-color .14s;width:100%;font-family:inherit}
.field-input:focus{border-bottom-color:var(--fg)}
.field-input::placeholder{color:var(--fg-4)}
/* Textarea — multi-line, оставляем подкреку снизу но даём верт. бордер для чёткости */
textarea.field-input{height:auto;min-height:60px;padding:8px 2px;line-height:1.45;resize:vertical}
/* Select — лёгкий бордер вокруг, чтобы chevron был узнаваемым */
select.field-input{height:34px;padding:6px 22px 6px 2px;border:0;border-bottom:1px solid var(--border);border-radius:0;cursor:pointer;appearance:none;-webkit-appearance:none;background-color:transparent;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");background-repeat:no-repeat;background-position:right 4px center}
select.field-input:focus{border-bottom-color:var(--fg)}
.modal-section-title{font-size:10px;font-weight:700;color:var(--fg-4);text-transform:uppercase;letter-spacing:.08em;margin:16px 0 8px}
.modal-section-title:first-child{margin-top:0}

/* Confirm modal layout */
.confirm-body{display:flex;align-items:flex-start;gap:14px;padding:24px}
.confirm-icon{width:36px;height:36px;border-radius:8px;background:#fff7e6;color:#d97706;display:grid;place-items:center;flex-shrink:0}
[data-theme="dark"] .confirm-icon{background:rgba(217,119,6,.18);color:#fbbf24}
.confirm-text{flex:1;min-width:0}
.confirm-title{font-size:14px;font-weight:600;color:var(--fg);line-height:1.35;margin-bottom:4px}
.confirm-sub{font-size:12.5px;color:var(--fg-3);line-height:1.5}

/* History timeline (Деталі замовлення) */
.timeline{display:flex;flex-direction:column;gap:0}
.timeline-item{display:flex;gap:10px;padding:8px 0}
.timeline-dot{width:10px;height:10px;border-radius:999px;background:var(--accent);flex-shrink:0;margin-top:6px;box-shadow:0 0 0 3px var(--accent-soft)}
.timeline-line{flex:1;width:1px;background:var(--border);margin-top:4px}
.timeline-content{flex:1;min-width:0}
.timeline-time{font-size:11px;color:var(--fg-4);font-family:var(--font-mono)}
.timeline-action{font-size:12px;color:var(--fg-3);margin:2px 0 4px}
.timeline-duration{font-size:10.5px;color:var(--fg-4);margin-top:6px;padding-left:14px;border-left:1px dashed var(--border-strong);font-style:italic}

/* Comment indicator on row */
.comment-badge{display:inline-grid;place-items:center;width:18px;height:18px;border-radius:5px;background:#fff7e6;color:#d97706;margin-left:6px;flex-shrink:0;cursor:pointer;transition:transform .1s}
.comment-badge:hover{transform:scale(1.15)}
[data-theme="dark"] .comment-badge{background:rgba(217,119,6,.22);color:#fbbf24}

/* ═══ LIGHTBOX — mockup preview ═══ */
.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.85);z-index:150;display:none;align-items:center;justify-content:center;animation:fadeIn .2s ease;cursor:zoom-out}
.lightbox.visible{display:flex}
.lightbox img{max-width:90vw;max-height:90vh;border-radius:12px;box-shadow:0 20px 60px rgba(0,0,0,.5);object-fit:contain}
.lightbox-close{position:absolute;top:20px;right:20px;width:40px;height:40px;border-radius:999px;background:rgba(255,255,255,.15);border:none;color:#fff;cursor:pointer;display:grid;place-items:center;transition:background .15s}
.lightbox-close:hover{background:rgba(255,255,255,.25)}

/* ═══ CONTEXT MENU — wider for more options ═══ */
.ctx-menu{min-width:220px}
.ctx-divider{height:1px;background:var(--border);margin:4px 8px}
.ctx-icon{width:18px;height:18px;border-radius:5px;display:inline-grid;place-items:center;flex-shrink:0;color:#fff}
.ctx-icon-ship{background:linear-gradient(135deg,#10b981,#059669)}
.ctx-icon-invoice{background:linear-gradient(135deg,#6366f1,#8b5cf6)}

/* ═══ PRINT — only show selected rows ═══ */
@media print{
  body *{visibility:hidden}
  .data-table,.data-table *{visibility:visible}
  .data-table tbody tr:not(.selected){display:none}
  body.print-all .data-table tbody tr{display:table-row}
  .col-check,.col-ind,.col-mockup,.col-tracking{display:none}
  .data-table{position:absolute;left:0;top:0;width:100%}
  .topbar,.page-head,.kpi-grid,.section-head,.toolbar,.pagination,.ctx-menu,.popover,.modal-overlay,.lightbox,.toast,.bulk-meta{display:none!important}
}

/* ═══ COLOR PILL (used in color column) ═══ */
.color-pill{display:inline-flex;align-items:center;gap:5px;height:22px;padding:0 8px 0 6px;font-size:11.5px;font-weight:500;border-radius:4px;background:#fff;color:var(--fg-2);border:1px solid #d1d1d1;white-space:nowrap;line-height:1}
[data-theme="dark"] .color-pill{background:var(--surface-2);border-color:var(--border)}
.color-pill .color-dot{width:10px;height:10px;border-radius:999px;flex-shrink:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12)}

/* ═══ MULTI-INPUT POPOVER (Personalization with add/remove rows) ═══ */
.multi-input-list{padding:10px 12px;display:flex;flex-direction:column;gap:6px;max-height:280px;overflow-y:auto}
.multi-input-row{display:flex;align-items:center;gap:6px}
.multi-input-row input{flex:1;height:34px;padding:6px 2px;border:0;border-bottom:1px solid var(--border);border-radius:0;background:transparent;color:var(--fg);font:inherit;font-size:13px;outline:none;transition:border-color .14s;font-family:inherit}
.multi-input-row input:focus{border-bottom-color:var(--fg)}
.multi-input-row .mi-del{width:28px;height:28px;border-radius:6px;border:1px solid var(--border);background:var(--surface);color:var(--fg-4);cursor:pointer;display:grid;place-items:center;flex-shrink:0;transition:all .12s}
.multi-input-row .mi-del:hover{color:var(--fg-2);background:var(--surface-2);border-color:var(--border-strong)}
.multi-input-add{margin:4px 12px 12px;padding:7px 10px;border:1px dashed var(--border-strong);border-radius:6px;background:transparent;color:var(--fg-3);font-size:12px;font-weight:500;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:6px;font-family:inherit;transition:all .12s}
.multi-input-add:hover{border-color:var(--fg-3);color:var(--fg-2);background:var(--surface-2);border-style:solid}

/* ═══ FLATPICKR overrides — match new design ═══ */
.flatpickr-calendar{background:var(--surface)!important;border:1px solid var(--border)!important;border-radius:12px!important;box-shadow:none!important;font-family:var(--font-body)!important;color:var(--fg)!important}
.flatpickr-calendar.inline{box-shadow:none!important}
.flatpickr-months .flatpickr-month{color:var(--fg)!important;background:var(--surface)!important}
.flatpickr-current-month .flatpickr-monthDropdown-months,.flatpickr-current-month input.cur-year{color:var(--fg)!important}
.flatpickr-weekdays,span.flatpickr-weekday{background:var(--surface)!important;color:var(--fg-4)!important}
.flatpickr-day{color:var(--fg-2)!important;border-radius:8px!important;border:0!important}
.flatpickr-day:hover{background:var(--surface-2)!important}
.flatpickr-day.today{border-color:var(--accent)!important;color:var(--accent)!important}
.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange{background:var(--accent)!important;color:var(--accent-fg)!important}
.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay{color:var(--fg-4)!important}
.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{color:var(--fg-3)!important;fill:var(--fg-3)!important}
.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:var(--fg)!important}

/* ═══ LAYOUT CELL (mockup column) ═══ */
.layout-cell{display:flex;align-items:center;justify-content:space-between;gap:6px}
.layout-empty{width:72px;height:52px;border-radius:var(--radius);background:var(--surface-2);border:1px solid var(--border);cursor:pointer;display:grid;place-items:center;color:var(--fg-4);transition:border-color .12s,color .12s,background .12s}
.layout-empty:hover{border-color:var(--fg-3);color:var(--fg-2);background:var(--surface)}
.layout-thumb{width:72px;height:52px;border-radius:var(--radius);overflow:hidden;border:1px solid var(--border);position:relative;cursor:pointer;background:var(--surface-2);flex-shrink:0}
.layout-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.layout-thumb-overlay{position:absolute;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;gap:6px;opacity:0;transition:opacity .14s}
.layout-thumb:hover .layout-thumb-overlay{opacity:1}
.layout-action-btn{width:26px;height:26px;border-radius:6px;border:0;background:rgba(255,255,255,.16);color:#fff;cursor:pointer;display:grid;place-items:center;transition:background .12s,transform .12s;backdrop-filter:blur(4px)}
.layout-action-btn:hover{background:rgba(255,255,255,.32);transform:scale(1.06)}
.layout-dxf-dl{width:26px;height:26px;border-radius:var(--radius-sm);border:1px solid var(--border);background:var(--surface);color:var(--fg-3);cursor:pointer;display:grid;place-items:center;padding:0;transition:all .12s;flex-shrink:0}
.layout-dxf-dl:hover{background:var(--surface-2);color:var(--fg);border-color:var(--border-strong)}
.layout-add-dxf{border-style:dashed;color:var(--fg-4)}
.layout-add-dxf:hover{border-style:solid;color:var(--accent);border-color:var(--accent);background:var(--accent-soft)}
.layout-uploading{width:72px;height:52px;border-radius:var(--radius);border:1px solid var(--border);background:var(--surface-2);display:grid;place-items:center;position:relative;overflow:hidden}
.layout-uploading-ring{width:28px;height:28px;border-radius:999px;border:2px solid var(--border);border-top-color:var(--accent);animation:spin .9s linear infinite}
.layout-uploading-pct{position:absolute;font-size:10px;font-family:var(--font-mono);color:var(--fg-3);font-weight:600}

/* ═══ UPLOAD POPOVER (Layout) ═══ */
.upload-list{padding:4px}
.upload-row{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:6px;transition:background .08s}
.upload-row:hover{background:var(--surface-2)}
.upload-icon{width:28px;height:28px;border-radius:5px;background:var(--surface-2);display:grid;place-items:center;color:var(--fg-3);flex-shrink:0}
.upload-row:hover .upload-icon{background:var(--surface);color:var(--fg-2)}
.upload-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.upload-title{font-size:12.5px;font-weight:600;color:var(--fg);line-height:1.2}
.upload-sub{font-size:10.5px;color:var(--fg-4);line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--font-mono);letter-spacing:.02em}
.upload-sub.has-file{color:var(--fg-2)}
.upload-actions{display:flex;gap:3px;flex-shrink:0}
.upload-btn{height:24px;padding:0 9px;border-radius:5px;border:1px solid var(--border);background:var(--surface);color:var(--fg-2);font-size:11.5px;font-weight:500;cursor:pointer;display:inline-flex;align-items:center;gap:4px;font-family:inherit;transition:all .1s}
.upload-btn:hover{background:var(--surface-2);border-color:var(--border-strong);color:var(--fg)}
.upload-btn.primary{background:var(--fg);border-color:var(--fg);color:var(--bg)}
.upload-btn.primary:hover{opacity:.9;background:var(--fg)}
.upload-btn.icon{width:24px;padding:0;justify-content:center;color:var(--fg-4)}
.upload-btn.icon:hover{color:var(--fg-2);background:var(--surface-2);border-color:var(--border-strong)}

/* ═══ AUTH — login screen + loading splash ═══ */
.auth-loading{position:fixed;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;background:var(--bg);z-index:9999}
.loading-mark{position:relative;width:56px;height:56px;border-radius:14px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-family:var(--font-mono);font-size:16px;font-weight:600;letter-spacing:-.02em;animation:loading-pulse 1.6s cubic-bezier(.4,0,.2,1) infinite}
.loading-mark-text{position:relative;z-index:2}
.loading-ring{position:absolute;inset:0;border-radius:14px;border:1.5px solid var(--fg);opacity:0;animation:loading-ripple 1.6s cubic-bezier(.2,.8,.2,1) infinite}
.loading-ring-2{animation-delay:.5s}
@keyframes loading-pulse{0%,100%{transform:scale(1)}50%{transform:scale(.92)}}
@keyframes loading-ripple{0%{transform:scale(1);opacity:.5}100%{transform:scale(1.8);opacity:0}}
.auth-loading-text{font-size:12.5px;color:var(--fg-3);font-weight:500;letter-spacing:.02em}
.auth-body{margin:0;background:var(--bg)}

/* Split layout: gradient panel left + form panel right */
.auth-split{display:flex;min-height:100vh;width:100%}

.auth-side{position:relative;flex:1 1 50%;min-height:100vh;color:#fff;overflow:hidden;display:flex}
.auth-side-bg{position:absolute;inset:0;width:100%;height:100%;display:block}
.auth-side-inner{position:relative;z-index:1;flex:1;display:flex;flex-direction:column;padding:48px 56px}
.auth-side-top{flex:0 0 auto}
.auth-side-mark{width:48px;height:48px;border-radius:12px;background:rgba(255,255,255,.12);backdrop-filter:blur(4px);display:grid;place-items:center;color:#fff;border:1px solid rgba(255,255,255,.18)}
.auth-side-mid{flex:1;display:flex;flex-direction:column;justify-content:center;max-width:440px}
.auth-side-title{font-size:48px;font-weight:700;line-height:1.1;letter-spacing:-.025em;margin-bottom:20px;color:#fff}
.auth-side-title .wave{display:inline-block;animation:wave 2.4s ease-in-out infinite;transform-origin:70% 70%}
@keyframes wave{0%,60%,100%{transform:rotate(0)}10%{transform:rotate(14deg)}20%{transform:rotate(-8deg)}30%{transform:rotate(14deg)}40%{transform:rotate(-4deg)}50%{transform:rotate(10deg)}}
.auth-side-sub{font-size:15px;line-height:1.6;color:rgba(255,255,255,.78);max-width:380px}
.auth-side-foot{flex:0 0 auto;font-size:12px;color:rgba(255,255,255,.55)}

.auth-main{flex:1 1 50%;display:flex;flex-direction:column;background:var(--surface);min-height:100vh}
.auth-main-inner{flex:1;display:flex;flex-direction:column;justify-content:center;align-items:stretch;width:100%;max-width:420px;margin:0 auto;padding:48px 32px}
.auth-main-brand{align-self:flex-end;font-size:14px;font-weight:600;color:var(--fg);letter-spacing:-.01em;margin-bottom:auto;padding-bottom:24px}
.auth-main-head{margin-bottom:28px}
.auth-main-title{font-size:28px;font-weight:700;letter-spacing:-.02em;color:var(--fg);margin-bottom:8px}
.auth-main-sub{font-size:13.5px;color:var(--fg-3);line-height:1.5}

.auth-form{display:flex;flex-direction:column;gap:12px}
.auth-field .field-input{width:100%;height:42px;padding:6px 2px;border:0;border-bottom:1px solid var(--border);border-radius:0;background:transparent;font-size:15px;font-family:inherit;color:var(--fg);outline:none;transition:border-color .14s}
.auth-field .field-input::placeholder{color:var(--fg-4)}
.auth-field .field-input:focus{border-bottom-color:var(--fg)}
.auth-error{font-size:12.5px;color:#dc2626;min-height:16px}
[data-theme="dark"] .auth-error{color:#f87171}
.auth-submit{height:46px;justify-content:center;font-size:14px;font-weight:500;border-radius:10px;margin-top:6px}

.auth-foot{margin-top:auto;padding-top:32px;display:flex;justify-content:center}
.link-btn{background:none;border:0;color:var(--fg-3);font-size:12.5px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:6px;font-family:inherit}
.link-btn:hover{color:var(--fg);background:var(--surface-2)}

/* Mobile: stack panels — hide left, full width form */
@media (max-width: 800px) {
  .auth-side{display:none}
  .auth-main{flex:1 1 100%}
  .auth-main-brand{align-self:flex-start;margin-bottom:32px}
}

/* ═══ MESSAGING — topbar icons + dropdowns + chat panel ═══ */
.topbar-icon-wrap{position:relative}
.topbar-icon-btn{position:relative;width:32px;height:32px;border-radius:8px;border:1px solid var(--border);background:var(--surface);color:var(--fg-3);cursor:pointer;display:grid;place-items:center;transition:all .12s}
.topbar-icon-btn:hover{background:var(--surface-2);color:var(--fg)}
.topbar-badge{position:absolute;top:1px;right:1px;width:8px;height:8px;border-radius:999px;background:#dc2626;border:2px solid var(--surface);font-size:0;color:transparent}
[data-theme="dark"] .topbar-badge{border-color:var(--surface)}

.topbar-dropdown{position:absolute;top:calc(100% + 8px);right:0;width:340px;max-height:480px;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-pop);overflow:hidden;display:flex;flex-direction:column;z-index:60}
.td-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid var(--border);flex-shrink:0}
.td-title{font-size:13px;font-weight:600;color:var(--fg)}
.td-action{background:none;border:0;color:var(--accent);font-size:12px;font-weight:500;cursor:pointer;padding:4px 8px;border-radius:5px;display:inline-flex;align-items:center;gap:4px;font-family:inherit}
.td-action:hover{background:var(--accent-soft)}
.td-body{flex:1;overflow-y:auto;padding:6px}
.td-empty{padding:32px 16px;text-align:center;font-size:12.5px;color:var(--fg-3)}
.td-back{padding:10px 12px;font-size:12px;color:var(--fg-3);cursor:pointer;border-bottom:1px solid var(--border);margin:-6px -6px 6px;display:flex;align-items:center;gap:4px}
.td-back:hover{background:var(--surface-2);color:var(--fg)}

/* Notification item */
.notif-item{display:flex;align-items:flex-start;gap:10px;padding:10px;border-radius:8px;cursor:pointer;transition:background .1s}
.notif-item:hover{background:var(--surface-2)}
.notif-item.unread{background:var(--accent-soft)}
[data-theme="dark"] .notif-item.unread{background:rgba(139,139,245,.08)}
.notif-item.unread:hover{background:var(--accent-soft);filter:brightness(.97)}
.notif-dot{width:8px;height:8px;border-radius:999px;background:var(--accent);margin-top:6px;flex-shrink:0;opacity:0}
.notif-item.unread .notif-dot{opacity:1}
.notif-main{flex:1;min-width:0}
.notif-title{font-size:13px;font-weight:500;color:var(--fg);line-height:1.3}
.notif-body{font-size:12px;color:var(--fg-3);margin-top:2px;line-height:1.4;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.notif-time{font-size:11px;color:var(--fg-4);margin-top:4px}

/* Chat list item */
.chat-item{display:flex;align-items:center;gap:10px;padding:10px;border-radius:8px;cursor:pointer;transition:background .1s}
.chat-item:hover{background:var(--surface-2)}
.chat-avatar{width:34px;height:34px;border-radius:999px;background:var(--surface-2);color:var(--fg-2);display:grid;place-items:center;font-weight:600;font-size:12px;flex-shrink:0;border:1px solid var(--border)}
.chat-main{flex:1;min-width:0}
.chat-name{font-size:13px;font-weight:500;color:var(--fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-last{font-size:12px;color:var(--fg-3);margin-top:1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-unread{min-width:18px;height:18px;border-radius:999px;background:var(--accent);color:var(--accent-fg);font-size:10.5px;font-weight:600;padding:0 6px;display:grid;place-items:center;font-family:var(--font-mono)}

/* Chat side panel — slide-in from right */
.chat-panel{position:fixed;top:0;right:0;bottom:0;width:380px;max-width:90vw;background:var(--surface);border-left:1px solid var(--border);box-shadow:-8px 0 30px rgba(0,0,0,.06);z-index:70;display:flex;flex-direction:column;transform:translateX(100%);transition:transform .22s cubic-bezier(.2,.9,.3,1)}
[data-theme="dark"] .chat-panel{box-shadow:-8px 0 30px rgba(0,0,0,.5)}
.chat-panel.open{transform:translateX(0)}
.cp-header{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--border);flex-shrink:0}
.cp-close{border:0;background:none;color:var(--fg-3);cursor:pointer;width:28px;height:28px;border-radius:6px;display:grid;place-items:center}
.cp-close:hover{background:var(--surface-2);color:var(--fg)}
.cp-avatar{width:34px;height:34px;border-radius:999px;background:var(--surface-2);color:var(--fg-2);display:grid;place-items:center;font-weight:600;font-size:12px;border:1px solid var(--border)}
.cp-name{font-size:14px;font-weight:600;color:var(--fg);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cp-messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:8px}
.cp-empty,.cp-loading{margin:auto;color:var(--fg-3);font-size:13px}
.cp-msg{display:flex;flex-direction:column;max-width:78%}
.cp-msg.mine{align-self:flex-end;align-items:flex-end}
.cp-msg.theirs{align-self:flex-start;align-items:flex-start}
.cp-bubble{padding:8px 12px;border-radius:14px;font-size:13.5px;line-height:1.45;word-wrap:break-word;white-space:pre-wrap}
.cp-msg.mine .cp-bubble{background:var(--fg);color:var(--bg);border-bottom-right-radius:4px}
.cp-msg.theirs .cp-bubble{background:var(--surface-2);color:var(--fg);border-bottom-left-radius:4px;border:1px solid var(--border)}
.cp-msg-time{font-size:10.5px;color:var(--fg-4);margin-top:3px;padding:0 4px}
.cp-form{display:flex;gap:6px;padding:12px 14px;border-top:1px solid var(--border);align-items:flex-end;flex-shrink:0}
.cp-attach{width:36px;height:36px;border-radius:10px;border:1px solid var(--border);background:var(--surface-2);color:var(--fg-3);cursor:pointer;display:grid;place-items:center;flex-shrink:0;transition:all .12s}
.cp-attach:hover{background:var(--surface);color:var(--fg);border-color:var(--border-strong)}
.cp-input{flex:1;resize:none;min-height:32px;max-height:140px;padding:6px 2px;border:0;border-bottom:1px solid var(--border);border-radius:0;background:transparent;font-size:13.5px;font-family:inherit;color:var(--fg);outline:none;line-height:1.4;transition:border-color .14s}
.cp-input:focus{border-bottom-color:var(--fg)}
.cp-send{width:36px;height:36px;border-radius:10px;border:0;background:var(--fg);color:var(--bg);cursor:pointer;display:grid;place-items:center;flex-shrink:0}
.cp-send:hover{opacity:.9}
.cp-bubble-img{padding:0;background:none!important;border:0!important;border-radius:14px;overflow:hidden;line-height:0}
.cp-bubble-img img{display:block;max-width:240px;max-height:320px;width:auto;height:auto;cursor:zoom-in;border-radius:14px}
.cp-msg.mine .cp-bubble-img{border-bottom-right-radius:4px}
.cp-msg.theirs .cp-bubble-img{border-bottom-left-radius:4px}
.cp-bubble-loading{display:inline-flex;align-items:center;gap:6px;background:var(--surface-2);color:var(--fg-3);font-size:12.5px}
.cp-bubble-loading i{animation:spin 1s linear infinite}

/* ═══ COMMENT PINS (avatar-style badge) ═══ */
.comment-pin{position:absolute;width:28px;height:28px;border-radius:999px;background:var(--surface);border:2px solid var(--border-strong);color:var(--fg-2);font-size:11px;font-weight:600;font-family:var(--font-mono);letter-spacing:.02em;display:grid;place-items:center;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,.1),0 0 0 3px var(--surface);z-index:5;transition:transform .14s cubic-bezier(.2,.9,.3,1),box-shadow .14s,border-color .14s,background .14s,color .14s;user-select:none}
[data-theme="dark"] .comment-pin{box-shadow:0 2px 8px rgba(0,0,0,.5),0 0 0 3px var(--surface)}
.comment-pin:hover{transform:scale(1.1) translateY(-1px);box-shadow:0 6px 14px rgba(0,0,0,.16),0 0 0 3px var(--surface)}
[data-theme="dark"] .comment-pin:hover{box-shadow:0 6px 14px rgba(0,0,0,.6),0 0 0 3px var(--surface)}
.comment-pin.unread{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.comment-pin .cmt-pin-dot{position:absolute;top:-3px;right:-3px;width:9px;height:9px;border-radius:999px;background:#dc2626;border:2px solid var(--surface);display:none}
.comment-pin.unread .cmt-pin-dot{display:block}
.comment-pin.empty{font-size:0}
.comment-pin.empty::before{content:'';width:5px;height:5px;border-radius:999px;background:var(--fg-3)}

/* ═══ COMMENT POPOVER — refined modern design ═══ */
.comment-popover{position:fixed;z-index:90;width:380px;max-width:calc(100vw - 24px);background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:0 1px 2px rgba(0,0,0,.04),0 12px 36px rgba(0,0,0,.12);display:flex;flex-direction:column;overflow:hidden;animation:popIn .16s cubic-bezier(.2,.9,.3,1)}
[data-theme="dark"] .comment-popover{box-shadow:0 1px 2px rgba(0,0,0,.4),0 12px 36px rgba(0,0,0,.6)}

.cmt-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 12px;border-bottom:1px solid var(--border);flex-shrink:0;background:var(--surface)}
.cmt-title{font-size:13px;font-weight:600;color:var(--fg);letter-spacing:-.005em;display:flex;align-items:center;gap:6px}
.cmt-title::before{content:'';width:6px;height:6px;border-radius:999px;background:var(--accent)}
.cmt-close{border:0;background:none;color:var(--fg-3);cursor:pointer;width:26px;height:26px;border-radius:6px;display:grid;place-items:center;transition:all .1s}
.cmt-close:hover{background:var(--surface-2);color:var(--fg)}

.cmt-messages{flex:1;max-height:340px;overflow-y:auto;padding:14px 16px;display:flex;flex-direction:column;gap:10px;background:var(--bg)}
.cmt-empty{color:var(--fg-4);font-size:12.5px;text-align:center;padding:32px 0;font-style:italic}
.cmt-msg{display:flex;flex-direction:column;max-width:84%;animation:popIn .14s cubic-bezier(.2,.9,.3,1)}
.cmt-msg.mine{align-self:flex-end;align-items:flex-end}
.cmt-msg.theirs{align-self:flex-start;align-items:flex-start}
.cmt-author{font-size:11px;color:var(--fg-3);font-weight:500;margin-bottom:3px;padding:0 4px}
.cmt-bubble{padding:8px 12px;border-radius:14px;font-size:13px;line-height:1.45;word-wrap:break-word;white-space:pre-wrap;letter-spacing:-.003em}
.cmt-msg.mine .cmt-bubble{background:var(--fg);color:var(--bg);border-bottom-right-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.06)}
.cmt-msg.theirs .cmt-bubble{background:var(--surface);color:var(--fg);border-bottom-left-radius:4px;border:1px solid var(--border);box-shadow:0 1px 2px rgba(0,0,0,.04)}
[data-theme="dark"] .cmt-msg.theirs .cmt-bubble{background:var(--surface-2)}
.cmt-time{font-size:10.5px;color:var(--fg-4);margin-top:3px;padding:0 6px}

.cmt-form{display:flex;gap:8px;padding:10px 12px;border-top:1px solid var(--border);align-items:flex-end;flex-shrink:0;background:var(--surface)}
.cmt-input{flex:1;resize:none;min-height:32px;max-height:120px;padding:6px 2px;border:0;border-bottom:1px solid var(--border);border-radius:0;background:transparent;font-size:13px;font-family:inherit;color:var(--fg);outline:none;line-height:1.45;transition:border-color .14s}
.cmt-input:focus{border-bottom-color:var(--fg)}
.cmt-send{width:36px;height:36px;border-radius:10px;border:0;background:var(--fg);color:var(--bg);cursor:pointer;display:grid;place-items:center;flex-shrink:0;transition:opacity .1s,transform .1s}
.cmt-send:hover{opacity:.9}
.cmt-send:active{transform:scale(.96)}

.cmt-delete{position:absolute;top:14px;right:48px;border:0;background:none;color:var(--fg-4);cursor:pointer;width:26px;height:26px;border-radius:6px;display:grid;place-items:center;transition:all .1s}
.cmt-delete:hover{color:#dc2626;background:rgba(220,38,38,.08)}
[data-theme="dark"] .cmt-delete:hover{color:#f87171;background:rgba(248,113,113,.1)}

/* ═══ AI FILL BUTTON & FIELD HIGHLIGHT ═══ */
.ai-fill-btn{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 14px;border-radius:8px;border:1px solid transparent;background:linear-gradient(135deg,#7c3aed 0%,#5b5bd6 100%);color:#fff;font-size:13px;font-weight:500;font-family:inherit;cursor:pointer;transition:opacity .15s,transform .1s,box-shadow .15s;box-shadow:0 1px 2px rgba(124,58,237,.25),0 4px 12px rgba(124,58,237,.18)}
.ai-fill-btn:hover:not(:disabled){opacity:.95;transform:translateY(-1px);box-shadow:0 2px 4px rgba(124,58,237,.3),0 6px 16px rgba(124,58,237,.22)}
.ai-fill-btn:active{transform:translateY(0)}
.ai-fill-btn:disabled{opacity:.7;cursor:wait}
.ai-fill-btn.loading i{animation:spin 1s linear infinite}
[data-theme="dark"] .ai-fill-btn{background:linear-gradient(135deg,#8b5cf6 0%,#6366f1 100%);box-shadow:0 1px 2px rgba(139,92,246,.3),0 4px 12px rgba(0,0,0,.3)}

.field-input.ai-fill-active{border-color:#8b5cf6!important;background:rgba(139,92,246,.06)!important;box-shadow:0 0 0 3px rgba(139,92,246,.12);transition:border-color .2s,background .2s,box-shadow .2s}
[data-theme="dark"] .field-input.ai-fill-active{background:rgba(139,92,246,.12)!important}

/* ═══ INVOICE — collapsible sections ═══ */
.inv-section{border:1px solid var(--border);border-radius:10px;background:var(--surface);margin-top:12px;overflow:hidden}
.inv-section-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;cursor:pointer;font-size:13px;font-weight:600;color:var(--fg);user-select:none;transition:background .12s}
.inv-section-head:hover{background:var(--surface-2)}
.inv-section-head .inv-chevron{color:var(--fg-3);transition:transform .18s cubic-bezier(.2,.9,.3,1)}
.inv-section.open .inv-section-head .inv-chevron{transform:rotate(180deg)}
.inv-section-body{display:none;padding:0 14px 14px}
.inv-section.open .inv-section-body{display:block}
#modal-invoice .field-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px 16px}
#modal-invoice .field-grid .field.full{grid-column:1/-1}
#modal-invoice .btn.full{width:100%}
#modal-invoice .btn.loading i{animation:spin 1s linear infinite}

.inv-alert{padding:12px 14px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2);font-size:13px;color:var(--fg-2)}
.inv-alert.err{background:#fef2f2;border-color:#fecaca;color:#b91c1c}
.inv-alert.ok{background:#f0fdf4;border-color:#bbf7d0;color:#15803d}
[data-theme="dark"] .inv-alert.err{background:#3a1616;border-color:#7f1d1d;color:#fca5a5}
[data-theme="dark"] .inv-alert.ok{background:#082812;border-color:#14532d;color:#86efac}

.rates-wrap{padding:14px;background:var(--surface);border:1px solid var(--border);border-radius:12px}
.rates-label{font-size:10.5px;color:var(--fg-3);font-weight:700;text-transform:uppercase;letter-spacing:.06em;margin-bottom:12px}
.rates-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:8px}
.rate-card{position:relative;padding:12px;border:1.5px solid var(--border);border-radius:10px;background:var(--surface);cursor:pointer;transition:all .12s;display:flex;flex-direction:column;gap:6px}
.rate-card:hover{border-color:var(--border-strong);background:var(--surface-2)}
.rate-card.selected{border-color:var(--accent);background:var(--accent-soft);box-shadow:0 0 0 3px rgba(91,91,214,.12)}
.rate-card-top{display:flex;flex-direction:column}
.rate-card-carrier{font-size:13px;font-weight:600;color:var(--fg);letter-spacing:-.005em}
.rate-card-service{font-size:11px;color:var(--fg-3);margin-top:1px}
.rate-card-price{font-size:18px;font-weight:700;color:var(--fg);font-family:var(--font-mono);letter-spacing:-.01em}
.rate-card-days{font-size:11.5px;color:var(--fg-3)}
.rate-card-ai{display:inline-flex;align-items:center;gap:4px;background:linear-gradient(135deg,#7c3aed,#5b5bd6);color:#fff;font-size:10px;font-weight:700;padding:3px 8px;border-radius:8px;letter-spacing:.02em;align-self:flex-start;margin-top:4px}
.ai-reason{margin-top:12px;padding:10px 14px;background:var(--accent-soft);border:1px solid var(--accent);border-radius:10px;font-size:12.5px;color:var(--accent);line-height:1.45;display:flex;align-items:flex-start;gap:6px}
[data-theme="dark"] .ai-reason{background:rgba(139,92,246,.1);border-color:rgba(139,92,246,.4);color:#c4b5fd}

.ai-status-pill{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border-radius:999px;background:var(--accent-soft);border:1px solid var(--accent);font-size:12px;font-weight:600;color:var(--accent);margin-bottom:12px}
.ai-status-pill[data-kind="loading"] i{animation:spin 1s linear infinite}

.row-pdf-btn{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border:1px solid var(--border);border-radius:5px;background:var(--surface);color:var(--fg-3);cursor:pointer;margin-left:6px;vertical-align:middle;transition:all .12s;flex-shrink:0;padding:0}
.row-pdf-btn:hover{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.row-pdf-btn:disabled{opacity:.5;pointer-events:none}
.row-pdf-btn.loading i{animation:spin 1s linear infinite}

/* PDF badge in recipient cell — fade-out text + clean badge on right */
.col-recipient{position:relative}
.col-recipient.has-pdf .cell-edit{
  -webkit-mask-image:linear-gradient(to right, black 0%, black calc(100% - 190px), transparent calc(100% - 70px));
  mask-image:linear-gradient(to right, black 0%, black calc(100% - 190px), transparent calc(100% - 70px));
  display:block;
  padding-right:6px;
}
.recip-pdf-badge{position:absolute;top:50%;right:10px;transform:translateY(-50%);display:inline-flex;align-items:center;gap:5px;padding:4px 8px 4px 6px;border:1px solid var(--border);border-radius:7px;background:var(--surface);color:var(--fg-2);cursor:pointer;font-family:inherit;font-size:10.5px;font-weight:600;letter-spacing:.04em;font-family:var(--font-mono);transition:all .14s cubic-bezier(.2,.9,.3,1);box-shadow:0 1px 2px rgba(0,0,0,.04)}
.recip-pdf-badge:hover{border-color:#dc2626;color:#dc2626;background:#fef2f2;transform:translateY(-50%) scale(1.04)}
[data-theme="dark"] .recip-pdf-badge:hover{background:#3a1616;color:#fca5a5;border-color:#7f1d1d}
.recip-pdf-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:4px;background:#dc2626;color:#fff;flex-shrink:0;transition:background .14s}
[data-theme="dark"] .recip-pdf-icon{background:#dc2626;color:#fff}
.recip-pdf-badge:hover .recip-pdf-icon{background:#b91c1c}
.recip-pdf-label{line-height:1}
.recip-pdf-badge:disabled{opacity:.5;pointer-events:none}
.recip-pdf-badge.loading .recip-pdf-icon i{animation:spin 1s linear infinite}

.modal-sub{font-size:11.5px;color:var(--fg-3);margin-top:3px}
.np-list{max-height:340px;overflow-y:auto;border:1px solid var(--border);border-radius:8px;background:var(--surface)}
.np-item{padding:9px 12px;border-bottom:1px solid var(--border);cursor:pointer;font-size:13px;color:var(--fg-2);transition:background .1s,color .1s}
.np-item:last-child{border-bottom:0}
.np-item:hover{background:var(--surface-2);color:var(--fg)}
.np-item.selected{background:var(--accent-soft);color:var(--accent);font-weight:500}
.np-empty{padding:20px;text-align:center;color:var(--fg-3);font-size:12.5px}
.np-empty.err{color:#dc2626}
.rate-card-np-branch{font-size:10.5px;color:#16a34a;margin-top:6px;padding:5px 8px;background:rgba(22,163,74,.08);border-radius:6px;line-height:1.35;word-break:break-word}
[data-theme="dark"] .rate-card-np-branch{color:#86efac;background:rgba(34,197,94,.12)}

/* ═══ PRODUCTS — 4-col card grid (example design) ═══ */
.prod-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
@media (max-width:1100px){.prod-grid{grid-template-columns:repeat(3,1fr)}}
@media (max-width:780px){.prod-grid{grid-template-columns:repeat(2,1fr)}}
@media (max-width:520px){.prod-grid{grid-template-columns:1fr}}

.prod-card{background:var(--surface);border:1px solid var(--border);border-radius:6px;padding:18px;display:flex;flex-direction:column;gap:14px;min-height:148px;cursor:pointer;transition:border-color .12s,background .12s}
.prod-card:hover{border-color:var(--border-strong)}
.prod-card-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.prod-card-name{font-size:15px;font-weight:600;color:var(--fg);letter-spacing:-.01em;line-height:1.3;flex:1;min-width:0;word-wrap:break-word}
.prod-card-orders{display:inline-flex;align-items:center;height:22px;padding:0 8px;font-size:11px;font-weight:500;border-radius:var(--radius-sm,4px);background:var(--surface-2);color:var(--fg-2);border:1px solid var(--border);white-space:nowrap;font-family:var(--font-mono);font-feature-settings:"tnum";flex-shrink:0}
.prod-card-spacer{flex:1}
.prod-card-bottom{display:flex;flex-direction:column;gap:10px}
.prod-card-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.size-pill{font-family:var(--font-mono);font-size:10.5px;font-weight:500;color:var(--fg-3);border:1px solid var(--border);border-radius:3px;padding:2px 5px;background:var(--surface);letter-spacing:.02em}
.dot{width:14px;height:14px;border-radius:999px;display:inline-block;flex-shrink:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.08)}
.dot-more{font-size:11px;color:var(--fg-4);font-family:var(--font-mono);font-weight:500;margin-left:2px}

.prod-card-add{align-items:center;justify-content:center;color:var(--fg-4);border:1px dashed var(--border-strong);background:transparent;gap:8px}
.prod-card-add:hover{border-color:var(--fg-3);color:var(--fg-3);background:var(--surface)}
.prod-card-add-text{font-size:13px}
.prod-hint{font-size:11px;color:var(--fg-4);margin-top:14px}

/* ═══ MATERIALS — example design ═══ */
.seg{display:inline-flex;background:var(--surface-2);border:1px solid var(--border);border-radius:6px;padding:2px;gap:2px}
.seg button{border:0;background:transparent;padding:5px 12px;font-size:12px;font-weight:500;border-radius:3px;color:var(--fg-3);cursor:pointer;font-family:inherit}
.seg button.active{background:var(--surface);color:var(--fg);box-shadow:0 1px 2px rgba(0,0,0,.04)}
[data-theme="dark"] .seg button.active{box-shadow:0 1px 2px rgba(0,0,0,.4)}

.kicker{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--fg-4);font-weight:500}

.paint-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:10px}
.paint-pill{display:flex;align-items:center;gap:12px;padding:10px 14px 10px 10px;border:1px solid var(--border);border-radius:999px;background:var(--surface);cursor:pointer;transition:border-color .12s}
.paint-pill:hover{border-color:var(--border-strong)}
.paint-pill.is-empty{opacity:.55}
.paint-add-tile{display:flex;align-items:center;justify-content:center;border:1px dashed var(--border-strong);border-radius:999px;background:transparent;color:var(--fg-3);cursor:pointer;transition:all .12s;min-height:54px}
.paint-add-tile:hover{border-color:var(--fg);color:var(--fg);background:var(--surface-2)}
.paint-pill[draggable="true"],.basic-card[draggable="true"]{cursor:grab}
.paint-pill[draggable="true"]:active,.basic-card[draggable="true"]:active{cursor:grabbing}
.paint-pill.dragging,.basic-card.dragging{opacity:.4}
.paint-pill.drop-target,.basic-card.drop-target{outline:2px solid var(--fg);outline-offset:-2px}

/* ═══ PURCHASE ORDERS ═══ */
.po-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:10px}
.po-card{position:relative;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:14px 14px 14px 18px;cursor:pointer;transition:all .12s;display:flex;flex-direction:column;gap:6px;min-height:124px}
.po-card:hover{border-color:var(--border-strong);transform:translateY(-1px);box-shadow:0 4px 12px rgba(0,0,0,.04)}
[data-theme="dark"] .po-card:hover{box-shadow:0 4px 12px rgba(0,0,0,.25)}
.po-card::before{content:"";position:absolute;left:0;top:14px;bottom:14px;width:3px;border-radius:0 3px 3px 0;background:var(--po-color,#a3a3a3)}
.po-card-top{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:2px}
.po-card-num{font-family:var(--font-mono);font-size:11.5px;color:var(--fg-3);letter-spacing:.02em}
.po-card-date{font-size:11px;color:var(--fg-4)}
.po-card-supplier{display:inline-flex;align-items:center;gap:4px;font-size:11px;color:var(--fg-3);margin-top:2px}
.po-card-status{display:inline-flex;align-items:center;gap:4px;font-size:10.5px;font-weight:600;padding:3px 8px;border-radius:999px;background:var(--po-bg,#f3f3f2);color:var(--po-color,#37352f);letter-spacing:.02em;white-space:nowrap}
.po-card-meta{display:flex;justify-content:space-between;align-items:flex-end;margin-top:auto}
.po-card-count{font-size:11.5px;color:var(--fg-3)}
.po-card-total{font-size:17px;font-weight:700;color:var(--fg);font-family:var(--font-mono)}
.po-add-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;border:1px dashed var(--border-strong);border-radius:12px;background:transparent;color:var(--fg-3);cursor:pointer;transition:all .12s;min-height:124px;font-size:12px;font-weight:500}
.po-add-tile:hover{border-color:var(--fg);color:var(--fg);background:var(--surface-2)}
.po-empty{padding:36px 24px;text-align:center;color:var(--fg-3);font-size:13px;border:1px dashed var(--border);border-radius:12px}

/* Status colors */
.po-st-pending{--po-color:#b45309;--po-bg:#fef3c7}
.po-st-paid{--po-color:#0369a1;--po-bg:#dbeafe}
.po-st-partially_received{--po-color:#c2410c;--po-bg:#ffedd5}
.po-st-received{--po-color:#15803d;--po-bg:#dcfce7}
.po-st-closed{--po-color:#15803d;--po-bg:#dcfce7}
.po-st-cancelled{--po-color:#737373;--po-bg:#f5f5f5}
[data-theme="dark"] .po-st-pending{--po-color:#fbbf24;--po-bg:rgba(180,83,9,.18)}
[data-theme="dark"] .po-st-paid{--po-color:#60a5fa;--po-bg:rgba(3,105,161,.18)}
[data-theme="dark"] .po-st-partially_received{--po-color:#fb923c;--po-bg:rgba(194,65,12,.2)}
[data-theme="dark"] .po-st-received{--po-color:#4ade80;--po-bg:rgba(21,128,61,.2)}
[data-theme="dark"] .po-st-closed{--po-color:#4ade80;--po-bg:rgba(21,128,61,.2)}
[data-theme="dark"] .po-st-cancelled{--po-color:#a3a3a3;--po-bg:rgba(115,115,115,.18)}

/* PO modal */
.po-modal{max-width:560px;width:calc(100vw - 32px);max-height:calc(100vh - 64px);display:flex;flex-direction:column;padding:0;overflow:hidden}
.po-modal-head{display:flex;align-items:center;gap:12px;padding:18px 24px 14px;border-bottom:1px solid var(--border)}
.po-modal-head-icon{width:36px;height:36px;border-radius:10px;background:var(--surface-2);display:grid;place-items:center;color:var(--fg)}
.po-modal-title{font-size:15px;font-weight:700;color:var(--fg);line-height:1.2}
.po-modal-sub{font-size:11.5px;color:var(--fg-4);margin-top:3px}
.po-modal-toolbar{padding:10px 18px;border-bottom:1px solid var(--border)}
.po-search{width:100%;height:34px;padding:0 12px;border:1px solid var(--border);border-radius:8px;background:var(--surface);color:var(--fg);font-size:12.5px;outline:none}
.po-search:focus{border-color:var(--fg)}
.po-modal-body{flex:1;overflow-y:auto;padding:6px 14px 12px}
.po-row{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;transition:background .1s}
.po-row:hover{background:var(--surface-2)}
.po-row + .po-row{border-top:1px solid var(--border)}
.po-row-check{width:18px;height:18px;flex-shrink:0;cursor:pointer;accent-color:var(--fg)}
.po-row-swatch{width:24px;height:24px;border-radius:6px;flex-shrink:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12);display:grid;place-items:center;color:var(--fg-2);background:var(--surface-2)}
.po-row-name-wrap{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.po-row-name{font-size:13px;color:var(--fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.po-row-stock{font-size:10.5px;color:var(--fg-4);font-family:var(--font-mono)}
.po-row-stock b{color:var(--fg-3);font-weight:600}
.po-row-qty,.po-row-price{height:30px;padding:0 8px;border:1px solid var(--border);border-radius:6px;background:var(--surface);color:var(--fg);font-size:12.5px;text-align:right;font-family:var(--font-mono);outline:none;width:78px}
.po-row-qty:focus,.po-row-price:focus{border-color:var(--fg)}
.po-row-unit{font-size:11px;color:var(--fg-4);min-width:26px;text-align:left}
.po-row-currency{font-size:11px;color:var(--fg-4)}
.po-row.dimmed{opacity:.5}
.po-row-low{display:inline-block;font-size:9.5px;font-weight:700;color:#b45309;background:#fef3c7;padding:2px 5px;border-radius:4px;margin-left:6px;letter-spacing:.04em;text-transform:uppercase}
[data-theme="dark"] .po-row-low{color:#fbbf24;background:rgba(180,83,9,.2)}
.po-modal-notes{padding:8px 18px 0;border-top:1px solid var(--border)}
.po-notes-label{display:block;font-size:10px;font-weight:700;color:var(--fg-4);margin:8px 0 4px;text-transform:uppercase;letter-spacing:.08em;font-family:var(--font-mono)}
.po-notes-input{width:100%;min-height:90px;padding:10px 12px;border:1px solid var(--border);border-radius:8px;background:var(--surface);color:var(--fg);font-size:12.5px;font-family:inherit;resize:vertical;outline:none;line-height:1.45}
.po-notes-input:focus{border-color:var(--fg)}
.po-modal-footer{padding:12px 18px;border-top:1px solid var(--border);display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.po-modal-total{flex:1;font-size:12.5px;color:var(--fg-3);font-family:var(--font-mono)}
.po-modal-total b{color:var(--fg);font-size:14px;font-weight:700}

/* PO detail header */
.po-detail-head-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;flex:1}
.po-detail-num{font-family:var(--font-mono);font-size:14px;font-weight:700;color:var(--fg);letter-spacing:.02em}
.po-detail-date{font-size:11.5px;color:var(--fg-4)}
.po-detail-by{font-size:11px;color:var(--fg-4);margin-top:2px}

/* PO detail item row */
.po-detail-row{display:flex;align-items:center;gap:10px;padding:10px;border-radius:8px;border:1px solid var(--border)}
.po-detail-row + .po-detail-row{margin-top:6px}
.po-detail-row.received{background:var(--surface-2);border-color:transparent}
.po-detail-row.received .po-detail-row-name{text-decoration:line-through;color:var(--fg-3)}
.po-detail-row-info{flex:1;min-width:0}
.po-detail-row-name{font-size:13px;color:var(--fg);font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.po-detail-row-meta{font-size:11px;color:var(--fg-4);margin-top:2px;font-family:var(--font-mono)}
.po-detail-row-price{font-size:13px;color:var(--fg);font-weight:600;font-family:var(--font-mono);flex-shrink:0}
.po-detail-row-check{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--fg-3);cursor:pointer;user-select:none;flex-shrink:0}
.po-detail-row-check input{accent-color:var(--fg);cursor:pointer}

/* Expense kind picker tiles */
.expense-kind-tile{display:flex;flex-direction:column;align-items:center;gap:6px;padding:14px 8px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--fg-2);cursor:pointer;transition:all .12s;font-family:inherit}
.expense-kind-tile:hover{border-color:var(--fg);background:var(--surface-2);color:var(--fg);transform:translateY(-1px)}
.expense-kind-tile-icon{width:32px;height:32px;border-radius:8px;background:var(--surface-2);display:grid;place-items:center;color:var(--fg)}
.expense-kind-tile-label{font-size:11.5px;font-weight:600;letter-spacing:.02em}

/* Filter chips for expense kinds */
.expense-filter-row{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:14px;align-items:center}
.expense-filter-chip{display:inline-flex;align-items:center;gap:5px;padding:5px 10px;border-radius:999px;border:1px solid var(--border);background:var(--surface);color:var(--fg-3);font-size:11.5px;font-weight:500;cursor:pointer;transition:all .12s}
.expense-filter-chip:hover{border-color:var(--border-strong);color:var(--fg-2)}
.expense-filter-chip.active{background:var(--fg);color:var(--bg);border-color:var(--fg)}
.expense-filter-chip .count{font-family:var(--font-mono);font-size:10.5px;opacity:.75}
.paint-swatch{width:34px;height:34px;border-radius:999px;display:grid;place-items:center;color:#fff;font-size:9.5px;font-weight:600;line-height:1.1;flex-shrink:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.08);font-family:var(--font-mono)}
.paint-name{font-size:11px;color:var(--fg-3);line-height:1.2}
.paint-amount{font-family:var(--font-mono);font-size:15px;font-weight:500;color:var(--fg);font-feature-settings:"tnum";font-variant-numeric:tabular-nums;line-height:1.2}
.paint-amount.is-low{color:var(--warn,#b45309)}

.basics-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:12px}
@media (max-width:1100px){.basics-grid{grid-template-columns:repeat(4,1fr)}}
@media (max-width:780px){.basics-grid{grid-template-columns:repeat(3,1fr)}}
@media (max-width:520px){.basics-grid{grid-template-columns:repeat(2,1fr)}}
.basic-card{background:var(--surface);border:1px solid var(--border);border-radius:6px;padding:16px 18px;display:flex;flex-direction:column;gap:10px;min-height:110px;cursor:pointer;transition:border-color .12s}
.basic-card:hover{border-color:var(--border-strong)}
.basic-card-top{display:flex;justify-content:space-between;align-items:flex-start}
.basic-card-icon{width:28px;height:28px;border-radius:4px;background:var(--surface-2);display:grid;place-items:center;color:var(--fg-3)}
.basic-card-bottom{margin-top:auto;display:flex;flex-direction:column;gap:4px}
.basic-card-name{font-size:12px;color:var(--fg-3)}
.basic-card-value{display:flex;align-items:baseline;gap:6px}
.basic-card-num{font-size:22px;font-weight:600;letter-spacing:-.02em;color:var(--fg);font-feature-settings:"tnum";font-variant-numeric:tabular-nums}
.basic-card-num.is-low{color:#b45309}
[data-theme="dark"] .basic-card-num.is-low{color:#f59e0b}
.basic-card-unit{font-family:var(--font-mono);font-size:11px;color:var(--fg-4)}
.basic-card-low-icon{color:#b45309}
[data-theme="dark"] .basic-card-low-icon{color:#f59e0b}

.basic-card-add{display:flex;align-items:center;justify-content:center;border:1px dashed var(--border-strong);color:var(--fg-4);background:transparent;cursor:pointer;min-height:110px;border-radius:6px;transition:all .12s}
.basic-card-add:hover{border-color:var(--fg-3);color:var(--fg-3);background:var(--surface)}

.purchase-card{padding:20px;background:var(--surface);border:1px solid var(--border);border-radius:6px}
.purchase-row{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--border)}
.purchase-row:last-child{border-bottom:0}
.purchase-row-name{flex:1;font-size:13px;color:var(--fg-2)}
.purchase-row-qty{font-family:var(--font-mono);font-size:12px;color:var(--fg-3)}
.purchase-empty{color:var(--fg-3);font-size:13px;padding:10px 0}

/* ═══ STATISTICS PAGE ═══ */
.stats-kpi{display:grid;grid-template-columns:repeat(6,1fr);gap:1px;background:var(--border);border:1px solid var(--border);border-radius:8px;overflow:hidden;margin-bottom:18px}
@media (max-width:1100px){.stats-kpi{grid-template-columns:repeat(3,1fr)}}
@media (max-width:600px){.stats-kpi{grid-template-columns:repeat(2,1fr)}}
.stats-kpi .kpi{background:var(--surface);padding:18px 20px}
.stats-kpi .kpi-label{font-size:10.5px;color:var(--fg-4);text-transform:uppercase;letter-spacing:.06em;font-weight:600;margin-bottom:8px;display:flex;align-items:center;gap:5px}
.stats-kpi .kpi-value{font-size:24px;font-weight:600;letter-spacing:-.02em;color:var(--fg);font-feature-settings:"tnum";font-variant-numeric:tabular-nums}
.stats-kpi .kpi-sub{font-size:11px;color:var(--fg-3);margin-top:4px}

.stats-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}
@media (max-width:900px){.stats-grid{grid-template-columns:1fr}}

.stats-card{background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:18px 20px;display:flex;flex-direction:column;gap:6px}
.stats-card-wide{grid-column:1/-1}
.stats-card-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.stats-empty{padding:20px 0;color:var(--fg-4);font-size:12.5px;text-align:center}

.stat-row{display:grid;grid-template-columns:1fr 2fr auto;gap:10px;align-items:center;padding:5px 0;font-size:13px}
.stat-row-label{color:var(--fg-2);font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.stat-row-bar{height:8px;border-radius:4px;background:var(--surface-2);overflow:hidden;border:1px solid var(--border)}
.stat-row-fill{height:100%;border-radius:4px;transition:width .3s cubic-bezier(.2,.9,.3,1)}
.stat-row-value{font-family:var(--font-mono);font-size:12px;color:var(--fg);font-weight:500;font-feature-settings:"tnum";min-width:40px;text-align:right}
.stat-row-suffix{color:var(--fg-4);margin-left:3px;font-size:11px}

.stats-months{display:flex;gap:6px;align-items:flex-end;height:200px;padding-top:20px;overflow-x:auto}
.month-bar{flex:1;min-width:32px;display:flex;flex-direction:column;align-items:center;gap:6px;height:100%}
.month-bar-fill{width:100%;background:linear-gradient(180deg,var(--accent) 0%,var(--accent-soft) 100%);border-radius:4px 4px 0 0;min-height:2px;transition:height .3s cubic-bezier(.2,.9,.3,1);margin-top:auto}
[data-theme="dark"] .month-bar-fill{background:linear-gradient(180deg,var(--accent) 0%,rgba(139,139,245,.2) 100%)}
.month-bar-value{font-family:var(--font-mono);font-size:11px;color:var(--fg-2);font-weight:500;line-height:1}
.month-bar-label{font-size:10.5px;color:var(--fg-4);text-transform:uppercase;letter-spacing:.04em;line-height:1}

/* ═══ PRODUCT MODAL — two-pane design ═══ */
.modal-card.xl{max-width:1040px}
.prod-modal .modal-body{padding:0}
.prod-modal-body{display:grid;grid-template-columns:280px 1fr;gap:0;align-items:stretch}
.prod-preview-pane{padding:24px;background:var(--bg);border-right:1px solid var(--border);display:flex;flex-direction:column;gap:14px;position:sticky;top:0;align-self:flex-start;max-height:80vh;overflow-y:auto}
.prod-preview-label{font-size:10.5px;color:var(--fg-3);font-weight:600;text-transform:uppercase;letter-spacing:.06em}
.prod-preview-pane #prod-preview-card .prod-card{cursor:default;pointer-events:none}
.prod-preview-pane #prod-preview-card .prod-card:hover{transform:none;box-shadow:none;border-color:var(--border)}
.prod-preview-hint{font-size:11px;color:var(--fg-4);font-style:italic;line-height:1.4}

.prod-form-pane{padding:22px 24px;overflow-y:auto;max-height:80vh}
.prod-name-input{width:100%;border:0;background:none;font-size:24px;font-weight:700;letter-spacing:-.02em;color:var(--fg);padding:0;outline:none;margin-bottom:16px;border-bottom:1px solid transparent;transition:border-color .12s;font-family:inherit}
.prod-name-input:focus{border-bottom-color:var(--fg-3)}
.prod-name-input::placeholder{color:var(--fg-4);font-weight:600}

.prod-section{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}
.prod-section:first-of-type{border-top:0;padding-top:4px;margin-top:6px}
.prod-section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.prod-section-title{font-size:11.5px;color:var(--fg-3);font-weight:600;text-transform:uppercase;letter-spacing:.04em}
.prod-section-count{font-size:11px;color:var(--fg-4);font-family:var(--font-mono);background:var(--surface-2);padding:1px 7px;border-radius:999px;min-width:22px;text-align:center;border:1px solid var(--border)}

/* Palette swatches */
.prod-palette{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:6px;margin-bottom:8px}
.swatch{display:flex;align-items:center;gap:8px;padding:6px 8px;border:1.5px solid var(--border);border-radius:8px;background:var(--surface);cursor:pointer;font-family:inherit;text-align:left;transition:all .1s;position:relative;min-height:32px}
.swatch:hover{border-color:var(--border-strong);background:var(--surface-2)}
.swatch.selected{border-color:var(--fg);background:var(--surface-2)}
.swatch.selected .swatch-name{color:var(--fg);font-weight:500}
.swatch.custom::after{content:'';position:absolute;top:3px;right:3px;width:5px;height:5px;border-radius:999px;background:var(--accent)}
.swatch-dot{width:14px;height:14px;border-radius:999px;flex-shrink:0;border:1px solid var(--border-strong);box-shadow:inset 0 0 0 1px rgba(255,255,255,.4)}
.swatch-name{font-size:11.5px;color:var(--fg-2);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.swatch-check{color:var(--fg);flex-shrink:0}

/* Toggle pills (sizes / designs) — scoped to products edit modal so the global .pill in the table stays compact */
.prod-toggle-row{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}
.prod-toggle-row .pill{padding:6px 14px;border:1.5px solid var(--border);border-radius:999px;background:var(--surface);cursor:pointer;font-family:var(--font-mono);font-size:12.5px;font-weight:500;color:var(--fg-3);transition:all .1s;position:relative;letter-spacing:.02em;height:auto}
.prod-toggle-row .pill:hover{border-color:var(--border-strong);color:var(--fg-2)}
.prod-toggle-row .pill.selected{border-color:var(--fg);background:var(--fg);color:var(--bg)}
.prod-toggle-row .pill.custom::after{content:'';position:absolute;top:3px;right:6px;width:5px;height:5px;border-radius:999px;background:var(--accent)}

.prod-add-custom{background:none;border:1px dashed var(--border-strong);color:var(--fg-3);padding:6px 12px;border-radius:8px;cursor:pointer;font-family:inherit;font-size:12px;font-weight:500;display:inline-flex;align-items:center;gap:5px;transition:all .12s;margin-top:4px}
.prod-add-custom:hover{border-color:var(--fg);color:var(--fg);background:var(--surface-2)}

.prod-custom-color-row,.prod-custom-tag-row{display:flex;gap:6px;align-items:center;margin-top:8px;padding:8px;background:var(--surface-2);border:1px solid var(--border);border-radius:8px}
.prod-color-picker{width:36px;height:36px;border:1px solid var(--border);border-radius:8px;cursor:pointer;background:none;padding:2px;flex-shrink:0}
.prod-tag-input{border:0;border-bottom:1px solid var(--border);border-radius:0;background:transparent;outline:none;font-family:inherit;font-size:13px;color:var(--fg);height:32px;padding:6px 2px;transition:border-color .14s}
.prod-tag-input:focus{border-bottom-color:var(--fg)}

.btn.danger-link{background:none;border:0;color:#dc2626;padding:6px 8px}
.btn.danger-link:hover{background:rgba(220,38,38,.08)}
[data-theme="dark"] .btn.danger-link{color:#f87171}
[data-theme="dark"] .btn.danger-link:hover{background:rgba(248,113,113,.1)}
.btn.danger{background:#fff;border:1px solid rgba(220,38,38,.35);color:#dc2626}
.btn.danger:hover{background:rgba(220,38,38,.08);border-color:#dc2626}
[data-theme="dark"] .btn.danger{background:transparent;color:#f87171;border-color:rgba(248,113,113,.4)}
[data-theme="dark"] .btn.danger:hover{background:rgba(248,113,113,.12)}

.modal-card.lg{max-width:720px}

/* Mobile: stack panes */
@media (max-width: 800px) {
  .prod-modal-body{grid-template-columns:1fr}
  .prod-preview-pane{position:static;border-right:0;border-bottom:1px solid var(--border);max-height:none}
}
.ai-status-pill[data-kind="ok"]{background:#f0fdf4;border-color:#bbf7d0;color:#16a34a}
.ai-status-pill[data-kind="err"]{background:#fef2f2;border-color:#fecaca;color:#dc2626}
[data-theme="dark"] .ai-status-pill[data-kind="ok"]{background:#082812;border-color:#14532d;color:#86efac}
[data-theme="dark"] .ai-status-pill[data-kind="err"]{background:#3a1616;border-color:#7f1d1d;color:#fca5a5}

/* ═══ USER MENU — avatar dropdown ═══ */
.user-menu-wrap{position:relative}
.user-menu{position:absolute;top:calc(100% + 8px);right:0;min-width:220px;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow-pop);padding:6px;z-index:50;opacity:0;transform:translateY(-4px);pointer-events:none;transition:opacity .12s,transform .12s}
.user-menu.open{opacity:1;transform:none;pointer-events:auto}
.user-menu-head{padding:10px 12px 12px;border-bottom:1px solid var(--border);margin-bottom:6px}
.user-menu-name{font-size:13px;font-weight:600;color:var(--fg)}
.user-menu-email{font-size:11.5px;color:var(--fg-3);margin-top:2px;font-family:var(--font-mono)}
.user-menu-role{display:inline-block;margin-top:6px;font-size:10.5px;font-weight:500;padding:2px 8px;border-radius:999px;background:var(--surface-2);color:var(--fg-3);text-transform:uppercase;letter-spacing:.04em}
.user-menu-role.admin{background:var(--accent-soft);color:var(--accent)}
.user-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:8px 10px;border:0;background:none;color:var(--fg-2);font-size:13px;cursor:pointer;border-radius:6px;font-family:inherit;text-align:left;text-decoration:none}
.user-menu-item:hover{background:var(--surface-2);color:var(--fg)}
.user-menu-item.danger{color:#dc2626}
.user-menu-item.danger:hover{background:#fee;color:#b91c1c}
[data-theme="dark"] .user-menu-item.danger{color:#f87171}
[data-theme="dark"] .user-menu-item.danger:hover{background:#3a1616;color:#fca5a5}

/* ═══ ADMIN — user list + edit modal ═══ */
.user-list{display:flex;flex-direction:column}
.user-card{display:flex;align-items:center;gap:14px;padding:14px 16px;border-bottom:1px solid var(--border);cursor:pointer;transition:background .1s}
.user-card:last-child{border-bottom:0}
.user-card:hover{background:var(--surface-2)}
.user-card.inactive{opacity:.55}
.user-card-avatar{width:36px;height:36px;border-radius:999px;background:var(--surface-2);color:var(--fg-2);display:grid;place-items:center;font-weight:600;font-size:12px;flex-shrink:0;border:1px solid var(--border)}
.user-card-main{flex:1;min-width:0}
.user-card-name{font-size:13.5px;font-weight:500;color:var(--fg);display:flex;align-items:center;gap:6px}
.user-card-email{font-size:12px;color:var(--fg-3);font-family:var(--font-mono);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-card-me{font-size:10px;font-weight:500;padding:1px 6px;border-radius:4px;background:var(--accent-soft);color:var(--accent);text-transform:uppercase;letter-spacing:.04em}
.user-card-inactive{font-size:10px;font-weight:500;padding:1px 6px;border-radius:4px;background:var(--surface-3);color:var(--fg-3);text-transform:uppercase;letter-spacing:.04em}
.user-card-role{font-size:11px;font-weight:500;padding:3px 10px;border-radius:999px;background:var(--surface-2);color:var(--fg-3);text-transform:uppercase;letter-spacing:.04em}
.user-card-role.admin{background:var(--accent-soft);color:var(--accent)}
.user-card-arrow{color:var(--fg-4)}

.ue-section{margin-top:16px}
.ue-section-label{font-size:11.5px;color:var(--fg-3);font-weight:500;margin-bottom:8px;text-transform:uppercase;letter-spacing:.04em}
.ue-role-toggle{display:inline-flex;border:1px solid var(--border);border-radius:8px;padding:3px;background:var(--surface-2);gap:2px}
.ue-role-btn{height:30px;padding:0 14px;border:0;background:transparent;color:var(--fg-3);font-size:12.5px;font-weight:500;font-family:inherit;cursor:pointer;border-radius:5px}
.ue-role-btn.active{background:var(--surface);color:var(--fg);box-shadow:0 1px 2px rgba(0,0,0,.05)}
.ue-perms{display:flex;flex-direction:column;gap:2px;border:1px solid var(--border);border-radius:8px;padding:6px;background:var(--surface)}
.perm-row{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:6px;cursor:pointer;font-size:13px;color:var(--fg-2)}
.perm-row:hover{background:var(--surface-2)}
.perm-row input[type="checkbox"]{width:14px;height:14px;accent-color:var(--fg)}
.perm-row input[type="checkbox"]:disabled{opacity:.4}
.perm-name{flex:1}
.ue-active{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--fg-2);cursor:pointer}
.ue-active input{width:14px;height:14px;accent-color:var(--fg)}
