/* Blooms Ink POS - brand colours come from /brand.css (generated from settings). */
:root {
  --bg: #f4f8f8;
  --surface: #ffffff;
  --surface-2: #f8fbfb;
  --text: #13292b;
  --muted: #5f7576;
  --line: #dde8e8;
  --danger: #c62f45;
  --danger-soft: #fdecef;
  --warn: #a8660b;
  --warn-soft: #fff4e0;
  --ok: #1f8a4c;
  --ok-soft: #e5f6ec;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 40, 42, .06), 0 4px 14px rgba(16, 40, 42, .06);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .25);
  --input-line: #c9d8d8;
  --danger-line: #f3c3cb;
  --warn-line: #f5ddb0;
  --ok-line: #bfe6cf;
  --info: #3b4cb8;
  --info-soft: #eef2ff;
  --info-line: #d6dcfb;
  --grid: #e6eeee;
  --axis: #c9d6d6;
  --overlay: rgba(10, 30, 32, .45);
  --toast-bg: #13292b;
  --toast-text: #ffffff;
  --chip-bw-bg: #eceff0;
  --chip-bw-text: #333333;
  --chip-color-bg: linear-gradient(90deg, #ffe1ea, #e0f7f5, #fff3cf);
  --chip-color-text: #7a2c48;
  --dash-line: #b9cccc;
  color-scheme: light;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dark mode: set on <html data-theme="dark"> by theme-init.js. */
:root[data-theme="dark"] {
  --bg: #0e1819;
  --surface: #162324;
  --surface-2: #1a2a2b;
  --text: #e2eded;
  --muted: #9bb0b1;
  --line: #273839;
  --danger: #f38595;
  --danger-soft: #3a1d24;
  --warn: #f1b866;
  --warn-soft: #362a15;
  --ok: #63d394;
  --ok-soft: #14301f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
  --input-line: #34494a;
  --danger-line: #5c2a35;
  --warn-line: #5a4520;
  --ok-line: #24533a;
  --info: #9fadff;
  --info-soft: #1e2440;
  --info-line: #2f3a66;
  --grid: #223233;
  --axis: #3a4f50;
  --overlay: rgba(0, 0, 0, .6);
  --toast-bg: #e2eded;
  --toast-text: #0e1819;
  --chip-bw-bg: #2a3637;
  --chip-bw-text: #d5dddd;
  --chip-color-bg: linear-gradient(90deg, #4a2433, #17403d, #4a3d17);
  --chip-color-text: #f4c3d3;
  --dash-line: #3a4f50;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-strong); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-weight: 550; cursor: pointer; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; transition: background .12s, border-color .12s, box-shadow .12s; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--brand-line); background: var(--brand-softer); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}
button:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(.94); background: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-line); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 18px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn { padding: 5px 8px; border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

label { display: grid; gap: 5px; font-weight: 550; font-size: 13px; }
label .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--input-line);
  border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 64px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }
input[type="range"] { padding: 0; border: 0; accent-color: var(--brand); }
input[type="color"] { padding: 2px; height: 38px; width: 56px; cursor: pointer; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.search { max-width: 320px; }

/* ---------- login ---------- */
.login-page { min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, var(--accent-soft), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  padding: 32px 28px; display: grid; gap: 16px; border-top: 4px solid var(--brand); }
.login-brand { display: grid; justify-items: center; padding: 4px 0 8px; }
.login-brand img { display: block; height: 130px; width: auto; max-width: 100%; object-fit: contain; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100%; }
.sidebar { background: var(--sidebar); color: var(--on-sidebar); display: flex; flex-direction: column; padding: 16px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
/* The light-on-dark logo sits straight on the menu colour. */
.sidebar .brand { display: block; padding: 4px 4px 16px; border-radius: 12px; }
.sidebar .brand img { display: block; width: 100%; height: 96px; object-fit: contain; transition: transform .15s; }
.sidebar .brand:hover img { transform: scale(1.03); }
.sidebar .brand:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: inherit; text-decoration: none;
  opacity: .88; font-weight: 500; }
.nav a:hover { background: var(--sidebar-hover); opacity: 1; }
.nav a.active { background: var(--sidebar-active); opacity: 1; font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
/* Top bar: theme switch + account menu on the right, on every screen size.
   Colours derive from currentColor so the same controls work on the light
   desktop bar and the dark phone bar. */
:root { --topbar-h: 56px; }
.content { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 26px; position: sticky; top: 0; z-index: 30;
  background: var(--surface); color: var(--text); border-bottom: 1px solid var(--line); }
.mobile-only { display: none !important; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.theme-switch { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: color-mix(in srgb, currentColor 7%, transparent); }
.theme-switch button { width: 34px; height: 30px; padding: 0; border: 0; border-radius: 8px; font-size: 15px; color: inherit;
  background: transparent; opacity: .65; }
.theme-switch button:hover { opacity: 1; border: 0; background: color-mix(in srgb, currentColor 10%, transparent); }
.theme-switch button[aria-checked="true"] { opacity: 1; background: var(--surface); color: var(--brand-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.usermenu { position: relative; }
.user-btn { gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; color: inherit; background: transparent; border-color: color-mix(in srgb, currentColor 20%, transparent); }
.user-btn:hover { background: color-mix(in srgb, currentColor 7%, transparent); border-color: color-mix(in srgb, currentColor 30%, transparent); }
.user-btn .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: var(--on-brand); }
.user-btn .u-name { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.user-btn .caret { font-size: 11px; opacity: .6; }
.user-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 60; display: grid; padding: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.user-pop .up-head { display: grid; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-pop button { justify-content: flex-start; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; font-weight: 500; }
.user-pop button:hover { background: var(--brand-softer); border: 0; }
.user-pop .danger-item { color: var(--danger); }
.user-pop .danger-item:hover { background: var(--danger-soft); }
.main { min-width: 0; padding: 22px 26px 40px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { padding: 0 12px 0 16px; background: var(--sidebar); color: var(--on-sidebar); border-bottom: 0; }
  .mobile-only { display: inline-flex !important; }
  #nav-toggle { background: transparent; color: inherit; border-color: rgba(255, 255, 255, .25); }
  .topbar img { height: 38px; width: auto; max-width: 130px; object-fit: contain; }
  .theme-switch button[aria-checked="true"] { background: rgba(255, 255, 255, .2); color: inherit; box-shadow: none; }
  .user-btn { padding: 3px; border-color: transparent; }
  .user-btn .u-name, .user-btn .caret { display: none; }
  .main { padding: 16px; }
}

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--brand-softer); }
table.data tr.inactive td { opacity: .55; }
table.data .r, table.data th.r { text-align: right; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge-quotation { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.badge-invoiced { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge-paid { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.badge-cancelled { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge-brand { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--brand-line); }
.badge-low { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge-out { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { border-color: transparent; background: transparent; color: var(--muted); padding: 7px 12px; }
.tabs button:hover { background: var(--brand-softer); color: var(--text); }
.tabs button.active { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--brand-line); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat.hl { border-color: var(--brand-line); background: linear-gradient(180deg, var(--brand-softer), var(--surface)); }
.stat.hl .value { color: var(--brand-deep); }

.bar { height: 8px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-line), var(--brand)); border-radius: 99px; }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 820px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--toast-bg); color: var(--toast-text); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); max-width: 360px;
  animation: toast-in .18s ease-out; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 18px; align-items: start; }
@media (max-width: 1150px) { .pos { grid-template-columns: 1fr; } }
/* item picker: a searchable list that scales to thousands of items */
.picker { display: flex; flex-direction: column; position: sticky; top: calc(var(--topbar-h) + 16px); height: calc(100vh - 120px - var(--topbar-h)); min-height: 420px; overflow: hidden; }
.picker-tools { display: flex; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1 1 260px; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap input { padding: 11px 12px 11px 38px; font-size: 15px; border-color: var(--brand-line); }
.picker-tools select { flex: 0 1 220px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.quick button { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.pick-head, .pick { display: grid; grid-template-columns: 116px minmax(0, 1fr) 150px 112px; gap: 12px; align-items: center; padding: 8px 14px; }
.pick-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.picker-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.pick { border-bottom: 1px solid var(--line); cursor: pointer; border-left: 3px solid transparent; padding-left: 11px; }
.pick:hover { background: var(--brand-softer); }
.pick.active { background: var(--brand-soft); border-left-color: var(--brand); }
.p-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; font-weight: 600; color: var(--brand-deep); overflow-wrap: anywhere; }
.p-desc { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-weight: 550; min-width: 0; }
.p-cat { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-rate { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-rate strong { color: var(--brand-strong); }
.picker-foot { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); background: var(--surface-2); }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.chip-color { background: var(--chip-color-bg); color: var(--chip-color-text); }
.chip-bw { background: var(--chip-bw-bg); color: var(--chip-bw-text); }
.chip-stock { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip-out { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }
@media (max-width: 1150px) { .picker { position: static; height: 60vh; } }
@media (max-width: 640px) {
  .pick-head, .pick { grid-template-columns: 84px minmax(0, 1fr) 92px; }
  .pick-head span:nth-child(3), .p-cat { display: none; }
}

.cart { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; max-height: calc(100vh - 32px - var(--topbar-h)); }
@media (max-width: 1150px) { .cart { position: static; max-height: none; } }
.cart-body { overflow-y: auto; padding: 4px 0; flex: 1; }
.cart-line { padding: 12px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.cart-line .l-top { display: flex; gap: 8px; align-items: flex-start; }
.cart-line .l-name { font-weight: 600; line-height: 1.3; }
.cart-line .l-cat { font-size: 11.5px; color: var(--muted); }
.cart-line .l-inputs { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.cart-line .l-inputs label { font-size: 11.5px; color: var(--muted); font-weight: 550; gap: 3px; }
.cart-line .l-inputs input { width: 82px; padding: 6px 8px; }
.cart-line .l-inputs input.note { width: 100%; }
.cart-line .l-calc { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cart-line .l-total { font-weight: 700; font-variant-numeric: tabular-nums; margin-left: auto; white-space: nowrap; }
.cart-line.flash { animation: line-flash 1s ease-out; }
@keyframes line-flash { from { background: var(--brand-soft); } to { background: transparent; } }
.tier-hint { font-size: 11.5px; color: var(--brand-strong); background: var(--brand-softer); border-radius: 6px; padding: 3px 8px; }
.cart-foot { border-top: 1px solid var(--line); padding: 14px 18px; display: grid; gap: 10px; background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius); }
.totals-row { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.totals-row.grand { font-size: 20px; font-weight: 750; color: var(--brand-deep); }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cart-actions .btn-lg { grid-column: 1 / -1; }

.cust-box { padding: 12px 18px; border-bottom: 1px solid var(--line); position: relative; }
.cust-pill { display: flex; align-items: center; gap: 10px; background: var(--brand-softer); border: 1px solid var(--brand-line);
  border-radius: 9px; padding: 8px 10px; }
.cust-pill .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--on-brand);
  display: grid; place-items: center; font-weight: 700; flex: none; }
.suggest { position: absolute; left: 18px; right: 18px; top: calc(100% - 6px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: var(--shadow); z-index: 20; max-height: 260px; overflow-y: auto; }
.suggest button { width: 100%; justify-content: flex-start; border: 0; border-radius: 0; text-align: left; display: block; padding: 9px 12px; }
.suggest button + button { border-top: 1px solid var(--line); }

/* ---------- dashboard ---------- */
.dash-filters { display: flex; gap: 10px; align-items: center; margin: -6px 0 16px; }
.dash { transition: opacity .15s; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
/* Gradient icon tiles; sales and collected echo their chart colours. */
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; color: #fff;
  --kpi-a: #3fd4c8; --kpi-b: #0b8a8a; background: linear-gradient(135deg, var(--kpi-a), var(--kpi-b));
  box-shadow: 0 6px 14px -6px var(--kpi-b); }
.kpi-icon svg { width: 21px; height: 21px; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 550; }
.kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 6px; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-sub { color: var(--muted); font-size: 12.5px; }
.kpi-delta { display: flex; align-items: center; gap: 4px; font-size: 12.5px; flex-wrap: wrap; }
.kpi-delta svg { width: 14px; height: 14px; }
.kpi-delta span { color: var(--muted); }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--danger); }
.dash-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dash-side { align-content: start; }
@media (max-width: 1100px) { .dash-row { grid-template-columns: 1fr; } }
.dash-card { border-radius: 14px; overflow: hidden; }
.dash-card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; flex-wrap: wrap; }
.dash-card .table-wrap, .dash-card > table { border-top: 1px solid var(--line); }
.dash-side { display: grid; gap: 16px; }
#col-chart { padding: 0 12px 10px 4px; position: relative; }

.viz { position: relative; }
.viz svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.viz-grid { stroke: var(--grid); stroke-width: 1; }
.viz-base { stroke: var(--axis); stroke-width: 1; }
.viz-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-hit { fill: transparent; }
.viz-band { outline: none; cursor: default; }
.viz-band:hover .viz-hit, .viz-band:focus .viz-hit { fill: var(--brand-softer); }
.viz-band:focus-visible .viz-hit { stroke: var(--brand); stroke-width: 1.5; }
.viz-slice { stroke: var(--surface); stroke-width: 2; outline: none; transition: opacity .12s; }
.viz-slice:hover, .viz-slice:focus { opacity: .82; }
.viz-center-label { fill: var(--muted); font-size: 11px; }
.viz-center-value { fill: var(--text); font-size: 15px; font-weight: 700; }
.viz-tip { position: absolute; display: none; z-index: 5; pointer-events: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 12.5px; min-width: 140px; }
.viz-tip-title { color: var(--muted); font-size: 12px; margin-bottom: 4px; white-space: nowrap; }
.viz-tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.viz-tip-row strong { font-variant-numeric: tabular-nums; }
.viz-tip-label { color: var(--muted); }
.viz-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.viz-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i, .cat-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.donut-wrap { display: grid; place-items: center; padding: 4px 0 8px; }
.donut-wrap .viz { width: 200px; }
.cat-legend { list-style: none; margin: 0; padding: 0 18px 10px; display: grid; gap: 7px; }
.cat-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-pct { color: var(--muted); font-variant-numeric: tabular-nums; width: 38px; text-align: right; }
.cl-val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 92px; text-align: right; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px 12px; }
.mini { background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; min-width: 0; }
.mini-value { font-size: 22px; font-weight: 700; margin: 2px 0 4px; }
.stock-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.stock-list li { display: flex; align-items: center; gap: 10px; padding: 8px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.stock-list li:last-child { border-bottom: 0; }
.sl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- order detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.action-list { display: grid; gap: 8px; }
.share-box { display: flex; gap: 6px; }
.share-box input { font-size: 12px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.brand-preview { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); display: grid; grid-template-columns: 120px 1fr; min-height: 170px; }
.brand-preview .pv-side { padding: 12px; display: grid; gap: 6px; align-content: start; }
.brand-preview .pv-side span { display: block; height: 8px; border-radius: 4px; opacity: .35; background: currentColor; }
.brand-preview .pv-main { padding: 14px; display: grid; gap: 10px; align-content: start; background: var(--bg); }
.img-slot { width: 84px; height: 84px; border: 1px dashed var(--dash-line); border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); }
.img-slot img { max-width: 72px; max-height: 72px; object-fit: contain; }
.img-slot-dark { background: var(--sidebar); border-style: solid; border-color: var(--sidebar); }

/* dashboard colour settings */
.dc-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1000px) { .dc-layout { grid-template-columns: 1fr; } }
.dc-h { margin-bottom: 8px; }
.dc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dc-field { gap: 3px; font-size: 12px; }
.dc-field input[type="color"] { width: 38px; height: 34px; flex: none; }
.dc-hex { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; padding: 6px 8px; }
.dc-kpis { display: grid; gap: 8px; }
.dc-kpi-row { display: grid; grid-template-columns: 150px 1fr 1fr; gap: 10px; align-items: end; }
@media (max-width: 560px) { .dc-kpi-row { grid-template-columns: 1fr 1fr; } .dc-kpi-name { grid-column: 1 / -1; } }
.dc-kpi-name { font-weight: 550; font-size: 13px; padding-bottom: 8px; }
.dc-dot { width: 14px; height: 14px; border-width: 1px; margin-right: -4px; cursor: inherit; }
.dc-preview { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: 14px; display: grid; gap: 14px; }
.dc-tiles { display: flex; gap: 10px; }
.dc-tile { width: 38px; height: 38px; border-radius: 11px; }
.dc-chart { display: flex; align-items: flex-end; justify-content: space-around; height: 110px; background: var(--surface);
  border-radius: 10px; padding: 10px 10px 0; border-bottom: 1px solid var(--axis); }
.dc-pair { display: flex; gap: 2px; align-items: flex-end; height: 100%; }
.dc-pair span { width: 14px; border-radius: 4px 4px 0 0; display: block; }
.dc-donut { width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.dc-donut > div { width: 64px; height: 64px; border-radius: 50%; background: var(--bg); }
.dc-legend { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.dc-legend span { display: flex; align-items: center; gap: 6px; }
.dc-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.tier-table input { padding: 6px 8px; }
.callout { background: var(--brand-softer); border: 1px solid var(--brand-line); color: var(--brand-deep); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; }
.callout.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }

@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; }
  body { background: #fff; }
}
