:root {
  --navy: #0F2739; --ink: #0F2739; --muted: #4A5D72; --paper: #FAF7F2; --white: #fff;
  --accent: #12957A; --accent-d: #0E7A64; --accent-soft: rgba(18,149,122,.10); --accent-soft2: rgba(18,149,122,.18);
  --line: rgba(15,39,57,.08); --line2: rgba(15,39,57,.14);
  --shadow: 0 1px 2px rgba(15,39,57,.05); --shadow-lg: 0 12px 40px rgba(15,39,57,.18);
  --red: #C2372B; --red-soft: rgba(194,55,43,.10);
  --ease: cubic-bezier(.22,1,.36,1);
  --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Manrope', system-ui, sans-serif; font-size: 15px; line-height: 24px; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-d); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 20px; }
.block { display: block; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.mb16 { margin-bottom: 16px; } .mt12 { margin-top: 12px; }
.grow { flex: 1; }
.accent-num { color: var(--accent-d); }
.red-num { color: var(--red); }
.ic { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 12px; border: 1px solid transparent; background: none; font-weight: 600; cursor: pointer; white-space: nowrap; transition: transform .15s var(--ease), background-color .15s, border-color .15s, box-shadow .15s; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(18,149,122,.3); }
.btn-primary:hover:not(:disabled) { background: var(--accent-d); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: #18374f; }
.btn-ghost { background: #fff; border-color: var(--line2); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-d); }
.btn-ghost.danger:hover { border-color: var(--red); color: var(--red); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a92e23; }
.btn-sm { min-height: 36px; padding: 4px 12px; font-size: 14px; border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: 16px; }
.btn-xl { min-height: 56px; font-size: 17px; width: 100%; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: none; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s, transform .15s var(--ease); }
.icon-btn:hover { background: rgba(15,39,57,.06); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--accent-d); font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.light { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; line-height: 20px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.pill-grey { background: rgba(15,39,57,.07); color: #3b4d61; }
.pill-red { background: rgba(194,55,43,.12); color: #A52A20; }
.pill-orange { background: rgba(230,110,30,.14); color: #A8490B; }
.pill-amber { background: rgba(224,160,20,.18); color: #855A00; }
.pill-yellow { background: rgba(214,196,40,.22); color: #6B6100; }
.pill-green { background: rgba(18,149,122,.13); color: #0B6B57; }
.pill-teal { background: var(--accent-soft); color: var(--accent-d); }
.pill-blue { background: rgba(40,110,200,.12); color: #1F5AA6; }
.pill-purple { background: rgba(120,80,190,.12); color: #5B3A9A; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .toolbar select, .po-line select, .po-line input, .two input, .qty-in {
  height: 44px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 12px; background: #fff; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .toolbar select:focus, .po-line select:focus, .po-line input:focus, .two input:focus, .qty-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.invalid { border-color: var(--red) !important; box-shadow: 0 0 0 3px var(--red-soft) !important; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.one { grid-template-columns: 1fr; }
.span2 { grid-column: span 2; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check.inline { align-items: center; min-height: 44px; font-size: 14px; color: var(--muted); }
.check.inline input { margin: 0; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.pw-eye { position: absolute; right: 2px; top: 0; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.pw-eye:hover { color: var(--ink); }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; padding: 48px; position: relative; overflow: hidden; }
.login-art::before { content: ''; position: absolute; width: 560px; height: 560px; border-radius: 50%; background: radial-gradient(circle, rgba(18,149,122,.35), transparent 65%); top: -160px; right: -200px; }
.login-art::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); bottom: -140px; left: -120px; }
.login-art-inner { max-width: 440px; position: relative; z-index: 1; }
.login-art h2 { font-size: 32px; line-height: 40px; margin: 24px 0 24px; }
.login-art ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; color: rgba(255,255,255,.85); }
.login-art li { display: flex; gap: 12px; align-items: center; }
.login-art li .ic { color: #5fd6b9; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-card { width: 100%; max-width: 420px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-brand b { display: block; font-size: 17px; }
.login-brand span { font-size: 13px; color: var(--muted); }
.login h1 { font-size: 28px; line-height: 36px; }
.login-card > .muted { margin: 4px 0 24px; }
.login-or { text-align: center; color: var(--muted); font-size: 13px; margin: 24px 0 12px; }
.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-card { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 16px 8px; border: 1px solid var(--line2); border-radius: 14px; background: #fff; cursor: pointer; transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; }
.role-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(15,39,57,.08); transform: translateY(-1px); }
.role-card b { display: block; font-size: 14px; line-height: 20px; }
.role-card small { display: block; font-size: 12px; color: var(--muted); line-height: 16px; }
#toggle-form { display: block; margin: 24px auto 0; }
.login-form { margin-top: 16px; display: grid; gap: 16px; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.form-err { color: var(--red); font-size: 14px; font-weight: 600; }
.hint { font-size: 12px; line-height: 18px; color: var(--muted); }
.login-foot { margin-top: 32px; text-align: center; font-size: 12px; color: var(--muted); }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-mark.lg { width: 64px; height: 64px; border-radius: 18px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft2); color: var(--accent-d); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }

/* Shell */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 248px; flex: none; background: var(--navy); color: #fff; display: flex; flex-direction: column; z-index: 40; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 24px 16px 16px; }
.side-brand b { display: block; font-size: 15px; line-height: 20px; }
.side-brand span { font-size: 12px; color: rgba(255,255,255,.6); }
.side-close { display: none; margin-left: auto; color: rgba(255,255,255,.7); }
.side-close:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: grid; align-content: start; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 12px; color: rgba(255,255,255,.78); font-weight: 600; font-size: 14px; transition: background-color .15s, color .15s; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-badge { margin-left: auto; font-style: normal; font-size: 12px; line-height: 20px; min-width: 24px; text-align: center; padding: 0 8px; border-radius: 999px; background: rgba(255,255,255,.14); }
.nav-item.active .nav-badge { background: rgba(255,255,255,.25); }
.side-foot { padding: 16px 24px 24px; font-size: 12px; color: rgba(255,255,255,.5); }
.scrim { display: none; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.demo-strip { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 4px 16px; background: #183a52; color: rgba(255,255,255,.9); font-size: 13px; line-height: 20px; flex: none; }
.demo-strip .link-btn { font-size: 13px; padding: 0; }
.strip-x { width: 32px; height: 32px; color: rgba(255,255,255,.7); }
.strip-x:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar { display: flex; align-items: center; gap: 12px; height: 72px; padding: 0 32px; background: var(--paper); border-bottom: 1px solid var(--line); flex: none; }
.hamburger { display: none; }
.page-title { font-size: 24px; line-height: 32px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 12px; }
.type-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-d); font-size: 13px; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.user-chip b { display: block; font-size: 13px; line-height: 18px; }
.user-chip small { display: block; font-size: 12px; line-height: 16px; color: var(--muted); }
.content { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page { padding: 32px; max-width: 1360px; margin: 0 auto; display: grid; gap: 24px; animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Cards and layout */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 24px; min-width: 0; }
.card.flush { padding: 0; overflow: clip; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head h3 { font-size: 17px; line-height: 24px; }
.card-head p { font-size: 13px; line-height: 20px; margin-top: 2px; }
.card-head.pad { padding: 24px 24px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.stack { display: grid; gap: 24px; align-content: start; }
.greet { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.greet h2 { font-size: 20px; line-height: 28px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.kpis.four { grid-template-columns: repeat(4, 1fr); }
.kpi { display: flex; flex-direction: column; gap: 4px; color: var(--ink); transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; }
.kpi-link:hover { border-color: var(--accent-soft2); box-shadow: 0 6px 18px rgba(15,39,57,.07); transform: translateY(-1px); }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.kpi-top .ic { color: var(--accent); }
.kpi > b { font-size: 28px; line-height: 36px; font-variant-numeric: tabular-nums; }
.kpi > b small, .exp-tile b small { font-size: 15px; color: var(--muted); font-weight: 600; }
.kpi .muted { font-size: 13px; line-height: 20px; }
.exp-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.exp-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); color: var(--ink); transition: border-color .15s, background-color .15s, transform .15s var(--ease); }
.exp-tile:hover { border-color: var(--accent-soft2); background: #fcfbf8; transform: translateY(-1px); }
.exp-tile b { font-size: 24px; line-height: 32px; }
.exp-tile .muted { font-size: 13px; line-height: 20px; }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; background: var(--accent-soft); color: #0b5a4a; font-size: 14px; line-height: 22px; }
.note .ic { margin-top: 1px; }
.filter-tag { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.sum-line { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: -12px; }
.sum-line b { color: var(--ink); }
.sum-line.nomargin { margin: 0; }
.foot-note { text-align: center; font-size: 13px; color: var(--muted); }
.danger-zone .card-head { margin: 0; align-items: center; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 160px; cursor: pointer; }
.search-box { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; background: #fff; border: 1px solid var(--line2); border-radius: 12px; flex: 1; min-width: 220px; color: var(--muted); transition: border-color .15s, box-shadow .15s; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { border: 0; outline: none; background: none; flex: 1; min-width: 0; height: 100%; color: var(--ink); }
.search-box.big { height: 52px; }
.search-box.big input { font-size: 16px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line2); background: #fff; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent-d); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.date-range { display: flex; gap: 12px; flex-wrap: wrap; }
.date-range input { height: 40px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line2); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 0; background: none; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .15s, border-color .15s; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent-d); border-bottom-color: var(--accent); }
.tab em { font-style: normal; font-size: 12px; padding: 0 8px; border-radius: 999px; background: rgba(15,39,57,.07); color: var(--muted); line-height: 20px; }
.tab.on em { background: var(--accent-soft); color: var(--accent-d); }

/* Segmented and switch */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: rgba(15,39,57,.06); border-radius: 12px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 0; border-radius: 9px; background: none; font-weight: 600; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,39,57,.12); }
.seg.sm button { min-height: 36px; font-size: 14px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; font-size: 14px; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: rgba(15,39,57,.18); position: relative; flex: none; transition: background-color .2s; }
.switch .track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tables */
.tbl-wrap { overflow-x: clip; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 20px; }
.tbl th { position: sticky; top: 0; z-index: 2; background: #fbfaf7; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color .12s; }
.tbl tbody tr:hover { background: #fbfaf6; }
.tbl tr.click { cursor: pointer; }
.tbl tr.dim td { opacity: .55; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl .clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .actions { white-space: nowrap; }
.tbl .actions > * { vertical-align: middle; }
.tbl .actions.wide .btn + .btn { margin-left: 8px; }
.tbl .cb { width: 48px; }
.tbl .cb input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.tbl.compact td, .tbl.compact th { padding: 8px 12px; }
.tbl small.block { font-size: 12px; line-height: 16px; margin-top: 2px; }
.tbl-note { padding: 12px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.qty-in { width: 96px; height: 40px; text-align: right; display: inline-block; }

/* Rows (ranked lists) */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--line); text-align: left; }
.row:last-child { border-bottom: 0; }
.row-btn { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; cursor: pointer; border-radius: 0; transition: background-color .12s; padding-left: 4px; padding-right: 4px; }
.row-btn:hover { background: #fbfaf6; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-size: 14px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { font-size: 12px; line-height: 18px; color: var(--muted); }
.rank { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-d); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.row .num { white-space: nowrap; }

/* Empty */
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 24px; color: var(--muted); text-align: center; }
.empty .ic { color: rgba(15,39,57,.3); }

/* Chart */
.chart { width: 100%; min-height: 240px; }
.chart-box { position: relative; }
.chart svg { display: block; }
.ch-grid { stroke: rgba(15,39,57,.07); stroke-width: 1; }
.ch-lbl { fill: var(--muted); font-size: 11px; font-family: inherit; }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.ch-cursor { stroke: rgba(15,39,57,.25); stroke-dasharray: 3 3; transition: opacity .12s; }
.ch-dot { fill: #fff; stroke: var(--accent); stroke-width: 2.4; transition: opacity .12s; }
.ch-tip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; padding: 6px 12px; border-radius: 10px; font-size: 12px; line-height: 18px; display: flex; flex-direction: column; white-space: nowrap; transition: opacity .12s; box-shadow: var(--shadow-lg); }
.ch-tip b { font-size: 14px; }
.ch-tip span { color: rgba(255,255,255,.7); }

/* Sell */
.sell { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.sell-left { display: grid; gap: 16px; min-width: 0; }
.sell-search { padding: 16px; display: grid; gap: 12px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.prod { position: relative; display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; min-height: 132px; }
.prod:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(15,39,57,.08); transform: translateY(-1px); }
.prod:active { transform: scale(.98); }
.prod.is-out { opacity: .55; }
.prod-name { font-weight: 600; font-size: 14px; line-height: 20px; }
.prod-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; line-height: 16px; }
.prod-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.prod-foot b { font-size: 15px; color: var(--accent-d); }
.prod-foot b small { font-size: 12px; color: var(--muted); font-weight: 500; }
.prod-exp { align-self: flex-start; }
.stock-low { color: #A8490B; font-weight: 600; }
.prod-incart { position: absolute; top: -8px; right: 12px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px; padding: 0 8px; border-radius: 999px; }
.cart { position: sticky; top: 0; padding: 0; display: flex; flex-direction: column; max-height: calc(100vh - 140px); }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.cart-head h3 { font-size: 17px; }
.cart-lines { overflow-y: auto; flex: 1; min-height: 120px; }
.cline { padding: 12px 24px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.cline-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cline-name { font-weight: 600; font-size: 14px; line-height: 20px; }
.cline-name .pill { margin-top: 4px; }
.cline-bot { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.cline-bot .num { margin-left: auto; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.stepper button { width: 36px; height: 36px; border: 0; background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.stepper button:hover { background: var(--accent-soft); color: var(--accent-d); }
.stepper input { width: 52px; height: 36px; border: 0; border-left: 1px solid var(--line2); border-right: 1px solid var(--line2); text-align: center; font-weight: 600; }
.cart-sum { padding: 16px 24px 24px; display: grid; gap: 12px; border-top: 1px solid var(--line); background: #fcfbf8; border-radius: 0 0 var(--r) var(--r); }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; }
.sum-row.green { color: var(--accent-d); font-weight: 600; }
.sum-row.grand { font-size: 20px; line-height: 28px; font-weight: 700; }
.disc-box { display: grid; gap: 8px; padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.cart-fab { display: none; }

/* Receipt */
.receipt { font-size: 13px; line-height: 20px; max-width: 340px; margin: 0 auto; padding: 16px; background: #fff; border: 1px dashed var(--line2); border-radius: 8px; }
.rc-head { text-align: center; display: flex; flex-direction: column; margin-bottom: 12px; }
.rc-head b { font-size: 16px; }
.rc-head span { font-size: 12px; color: var(--muted); line-height: 18px; }
.rc-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.rc-meta b { color: var(--ink); }
.rc-lines { border-top: 1px dashed var(--line2); border-bottom: 1px dashed var(--line2); margin: 8px 0; padding: 8px 0; display: grid; gap: 8px; }
.rc-name { font-weight: 600; }
.rc-calc { display: flex; justify-content: space-between; color: var(--muted); }
.rc-calc b { color: var(--ink); }
.rc-lot { font-size: 11px; line-height: 16px; color: var(--muted); }
.rc-tot > div { display: flex; justify-content: space-between; }
.rc-grand { font-size: 17px; font-weight: 700; padding: 4px 0; }
.rc-disc { margin-top: 8px; padding: 8px; background: var(--accent-soft); border-radius: 8px; font-size: 12px; line-height: 18px; }
.rc-foot { text-align: center; margin-top: 12px; font-size: 12px; color: var(--muted); }

/* PO */
.po-lines-head, .po-line { display: grid; grid-template-columns: minmax(0, 1fr) 96px 112px 112px 36px; gap: 8px; align-items: center; }
.po-lines-head { margin-top: 24px; padding-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.po-line { padding: 8px 0; border-bottom: 1px solid var(--line); }
.po-line input { text-align: right; }
.po-lt { text-align: right; font-size: 14px; }
.po-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; font-size: 15px; }
.po-foot b { font-size: 18px; margin-left: 8px; }
.pad { padding: 16px 0; }
.po-doc { display: grid; gap: 16px; }
.po-doc-head, .po-doc-meta { display: flex; justify-content: space-between; gap: 16px; }
.po-doc-meta { padding: 16px; background: #fbfaf7; border-radius: 12px; font-size: 14px; }
.po-doc-meta small { display: block; margin-top: 4px; }
.po-doc-total { display: flex; justify-content: flex-end; gap: 16px; font-size: 18px; align-items: baseline; }
.recv-list { display: grid; gap: 12px; }
.recv { display: grid; grid-template-columns: minmax(0, 1.4fr) 100px 1fr 1fr; gap: 12px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.recv-name { display: flex; flex-direction: column; align-self: center; font-size: 14px; line-height: 20px; }
.recv-name small { font-size: 12px; }
.recv .field .pill { align-self: flex-start; margin-top: 10px; }
.dl-list { display: grid; gap: 8px; }

/* Settings */
.type-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.type-card { display: flex; align-items: flex-start; gap: 16px; text-align: left; padding: 16px; border: 2px solid var(--line2); border-radius: 16px; background: #fff; cursor: pointer; transition: border-color .15s, background-color .15s; }
.type-card:hover { border-color: var(--accent-soft2); }
.type-card.on { border-color: var(--accent); background: #f6fbf9; }
.type-card > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.type-card b { font-size: 16px; }
.type-card small { font-size: 13px; line-height: 20px; }
.type-card:not(.on) .brand-mark { background: var(--navy); }

/* Modal */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-back { position: absolute; inset: 0; background: rgba(15,39,57,.45); opacity: 0; transition: opacity .2s var(--ease); }
.modal { position: relative; background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .22s var(--ease), transform .22s var(--ease); }
.modal-sm { max-width: 440px; } .modal-md { max-width: 640px; } .modal-lg { max-width: 860px; } .modal-receipt { max-width: 440px; }
.modal-wrap.show .modal-back { opacity: 1; }
.modal-wrap.show .modal { opacity: 1; transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px 24px; }
.modal-head h2 { font-size: 20px; line-height: 28px; }
.modal-body { padding: 8px 24px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-text { font-size: 15px; line-height: 24px; }
body.modal-open { overflow: hidden; }

/* Toast */
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px; line-height: 20px; opacity: 0; transform: translateY(8px); transition: opacity .25s var(--ease), transform .25s var(--ease); pointer-events: auto; }
.toast.show { opacity: 1; transform: none; }
.toast .ic { color: #5fd6b9; }
.toast-warn .ic { color: #ffb36b; }
.toast-link { color: #5fd6b9; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* Responsive */
@media (max-width: 1180px) {
  .kpis.four { grid-template-columns: repeat(2, 1fr); }
  .sell { grid-template-columns: minmax(0, 1fr) 340px; }
  .type-chip { display: none; }
}
@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .side-close { display: inline-flex; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(15,39,57,.45); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .hamburger { display: inline-flex; margin-left: -8px; }
  .topbar { padding: 0 16px; height: 64px; }
  .page { padding: 24px 16px; gap: 16px; }
  .sell { grid-template-columns: 1fr; }
  .cart { position: static; max-height: none; }
  .cart-fab { display: flex; position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 20; align-items: center; gap: 12px; min-height: 56px; padding: 8px 20px; border: 0; border-radius: 16px; background: var(--navy); color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); cursor: pointer; opacity: 0; transform: translateY(16px); pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease); }
  .cart-fab.show { opacity: 1; transform: none; pointer-events: auto; }
  .cart-fab span { flex: 1; text-align: left; }
  .grid-2 { grid-template-columns: 1fr; gap: 16px; }
  .kpis { gap: 16px; }
}
@media (max-width: 760px) {
  .kpis, .kpis.four { grid-template-columns: 1fr 1fr; }
  .kpis > .kpi:first-child { grid-column: span 2; }
  .kpis.four > .kpi:first-child { grid-column: auto; }
  .kpi > b { font-size: 22px; line-height: 30px; }
  .exp-tiles { grid-template-columns: 1fr; gap: 8px; }
  .exp-tile { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 12px; row-gap: 4px; }
  .exp-tile b { font-size: 20px; line-height: 28px; margin-left: auto; }
  .exp-tile .muted { flex-basis: 100%; }
  .card { padding: 16px; }
  .card-head.pad { padding: 16px 16px 0; }
  .uc-text { display: none; }
  .user-chip { padding: 4px; }
  .page-title { font-size: 20px; }
  .greet .btn { display: none; }
  .toolbar { gap: 8px; }
  .toolbar .search-box { flex-basis: 100%; min-width: 0; }
  .toolbar select { flex: 1; min-width: 0; }
  .toolbar .btn { flex: 1; }
  .toolbar .grow { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding-bottom: 2px; }
  .chip { flex: none; min-height: 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .type-pick { grid-template-columns: 1fr; }
  .demo-strip { font-size: 12px; justify-content: space-between; text-align: left; gap: 8px; }
  .danger-zone .card-head { flex-direction: column; align-items: stretch; }

  /* Tables to stacked cards */
  .card.flush { background: none; border: 0; box-shadow: none; overflow: visible; }
  .card.flush > .card-head.pad { padding: 0 0 12px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; }
  .tbl tbody { display: grid; gap: 12px; }
  .tbl tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow); }
  .tbl tbody tr:hover { background: #fff; }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; text-align: right; min-height: 32px; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 600; text-align: left; flex: none; }
  .tbl td.cell-main { display: block; text-align: left; padding: 0 0 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
  .tbl td.cell-main::before { display: none; }
  .tbl td.actions { justify-content: flex-end; padding-top: 8px; }
  .tbl td.actions::before { display: none; }
  .tbl td.actions .icon-btn.sm { width: 44px; height: 44px; }
  .tbl td.actions.wide .btn { flex: 1; min-height: 44px; }
  .tbl td.cb { position: absolute; right: 12px; top: 10px; padding: 0; min-height: 0; }
  .tbl td.cb::before { display: none; }
  .tbl tr { position: relative; }
  .tbl .cb ~ .cell-main { padding-right: 40px; }
  .tbl .clip { max-width: 60%; }
  .tbl td > small.block { display: inline; margin: 0 0 0 8px; }
  .tbl td > .pill + small.block { display: block; }
  .tbl td[data-label="Expiry"] { flex-wrap: wrap; }
  .tbl td[data-label="Expiry"] > :not(.pill) { flex-basis: 100%; text-align: right; }
  .tbl td[data-label="Suggested"] { flex-wrap: wrap; }
  .tbl td[data-label="Suggested"] small.block { flex-basis: 100%; display: block; margin: 0; }
  .tbl-note { border: 0; text-align: center; }
  .tbl.compact tr { box-shadow: none; }
  .po-lines-head { display: none; }
  .po-line { grid-template-columns: 1fr 1fr 36px; padding: 12px 0; }
  .po-line select { grid-column: 1 / -1; }
  .po-line .po-lt { grid-column: 1 / 3; text-align: left; }
  .po-line [data-rm] { grid-row: 3; grid-column: 3; }
  .po-doc-head, .po-doc-meta { flex-direction: column; }
  .po-doc-head .r { text-align: left; }
  .recv { grid-template-columns: 1fr 1fr; }
  .recv-name { grid-column: 1 / -1; }
  .recv .field:nth-of-type(2) { grid-column: auto; }
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal { max-width: none !important; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-body { padding: 8px 16px 16px; }
  .modal-head { padding: 12px 8px 4px 16px; }
  .modal-foot { padding: 12px 16px; }
  .modal-foot .btn { flex: 1; }
  .role-cards { gap: 8px; }
  .role-card { padding: 12px 4px; }
  .login-panel { padding: 32px 16px; align-items: flex-start; }
  .login-brand { margin-bottom: 24px; }
  #toast-root { bottom: 88px; }
  .tbl.compact td { padding: 4px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  body * { visibility: hidden !important; }
  #receipt-print, #receipt-print * { visibility: visible !important; }
  #receipt-print { position: absolute; left: 0; top: 0; width: 100%; border: 0; }
  .modal-wrap, .modal { position: static; box-shadow: none; }
}

/* nowrap cells (desktop) */
@media (min-width: 761px) {
  .tbl td.num, .tbl .mono, .tbl td[data-label="Received"], .tbl td[data-label="Date"], .tbl td[data-label="Made"], .tbl td[data-label="Expected"],
  .tbl td[data-label="Expiry"], .tbl td[data-label="Category"], .tbl td[data-label="Phone"], .tbl td[data-label="Next expiry"] { white-space: nowrap; }
}
#r-body, #pu-body { display: grid; gap: 24px; min-width: 0; }
@media (max-width: 960px) { #r-body, #pu-body { gap: 16px; } }
.page { grid-template-columns: minmax(0, 1fr); }
.page > *, .toolbar > * { min-width: 0; }
@media (max-width: 760px) {
  .tbl tbody { grid-template-columns: minmax(0, 1fr); }
  .tbl .clip { white-space: normal; max-width: none; overflow: visible; }
  .tbl td::before { margin-right: 8px; }
}
@media (max-width: 760px) {
  .tbl td { justify-content: flex-start; }
  .tbl td::before { margin-right: auto; }
  .tbl td.actions { justify-content: flex-end; }
  .toolbar .btn { flex: 1 1 140px; }
  .toolbar .check.inline { flex-basis: 100%; }
  .prod-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .prod { padding: 12px; min-height: 120px; }
  .prod-meta .muted { display: none; }
  .prod-foot { flex-direction: column; align-items: flex-start; gap: 0; }
}
.sell-left { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 960px) { .sell { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .prod-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .prod-name { overflow-wrap: anywhere; } }
@media (max-width: 760px) { .tbl td { gap: 6px; } }

/* Shared demo strip colours: identical on every EulClavie demo */
.demo-strip { background: #FFF6E5; color: #6B4A00; border-bottom: 1px solid rgba(183, 121, 31, .22); font-size: 13px; line-height: 20px; font-weight: 500; }
.demo-strip .ic, .demo-strip > svg { color: #6B4A00; }
.demo-strip .link-btn { color: #6B4A00; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; background: none; }
.demo-strip .link-btn:hover { background: rgba(183, 121, 31, .12); }
.demo-strip .strip-x { color: #6B4A00; text-decoration: none; background: none; }
.demo-strip .strip-x:hover { background: rgba(183, 121, 31, .14); color: #6B4A00; }
