:root{
  --orange:#ff5b14; --orange-soft:#ffece2;
  --green:#16a34a; --green-soft:#e9f8ef;
  --ink:#1c1d22; --muted:#8b8f99; --faint:#b9bcc6;
  --line:#edeef1; --line-2:#f3f4f6;
  --bg:#e7e8ea; --surface:#fff;
  --rail:60px; --nav:184px; --top:54px;
  --indigo:#4f46e5;
  --r:14px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  color:var(--ink); font-size:13px; line-height:1.45;
  -webkit-font-smoothing:antialiased;
  padding:0;
}
a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer;border:none;background:none}
svg{display:block}

/* ---- App frame (full size) ---- */
.frame{
  width:100%; max-width:none; background:var(--surface);
  border-radius:0; overflow:hidden; box-shadow:none;
  display:grid; grid-template-rows:var(--top) 1fr; height:100vh;
}

/* ---- Topbar ---- */
.topbar{
  display:flex; align-items:center; gap:14px;
  padding:0 16px; border-bottom:1px solid var(--line);
}
.brand{display:flex;align-items:center;gap:9px;font-weight:600}
.brand .mark{width:22px;height:22px;border-radius:6px;background:var(--orange);
  display:grid;place-items:center;color:#fff;font-weight:800;font-size:13px}
.brand .chev{color:var(--faint)}
.sep{color:var(--line);font-size:16px}
.crumb{font-weight:600}
/* Quick search */
.qsearch{
  position:relative; flex:1; max-width:430px; margin:0 auto;
  display:flex;align-items:center;gap:9px;
  background:#f5f6f8;border:1px solid var(--line);border-radius:999px;
  padding:0 14px;height:34px;color:var(--muted);
  transition:border-color .15s ease,background .15s ease;
}
.qsearch.open{background:#fff;border-color:var(--orange)}
.qsearch__ico{display:inline-flex}
.qsearch__ico svg{width:15px;height:15px}
.qsearch__input{flex:1;border:none;outline:none;background:none;
  font-size:13px;color:var(--ink);height:100%}
.qsearch__input::placeholder{color:var(--muted)}
.qsearch__menu{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:60;
  background:#fff;border:1px solid var(--line);border-radius:12px;
  box-shadow:0 14px 36px rgba(15,18,30,.16);padding:6px;
  max-height:64vh;overflow-y:auto;animation:qsearch-pop .14s ease}
@keyframes qsearch-pop{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
.qsearch__group{padding:8px 10px 4px;font-size:11px;font-weight:700;
  letter-spacing:.04em;text-transform:uppercase;color:var(--faint)}
.qsearch__status{padding:16px 12px;color:var(--muted);font-size:12.5px;text-align:center}
.qsearch__opt{display:flex;align-items:center;gap:10px;width:100%;
  padding:8px 10px;border-radius:8px;color:var(--ink);font-size:13px;text-align:left}
.qsearch__opt:hover{background:#f5f6f8}
.qsearch__opt-ico{display:inline-flex;color:var(--muted)}
.qsearch__opt-ico svg{width:16px;height:16px}
.qsearch__label{flex:1;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.qsearch__type{color:var(--muted);font-size:11.5px;white-space:nowrap}
.top-actions{display:flex;align-items:center;gap:6px;margin-left:auto}
.tbtn{width:34px;height:34px;border-radius:9px;display:grid;place-items:center;color:var(--muted)}
.tbtn:hover{background:#f5f6f8;color:var(--ink)}
.tbtn svg{width:18px;height:18px}
.avatar{width:30px;height:30px;border-radius:50%;background:var(--indigo);
  color:#fff;font-size:11px;font-weight:700;display:grid;place-items:center;margin-left:4px}

/* Language selector */
.lang{position:relative}
.lang__btn{font-size:11px;font-weight:700;color:var(--ink);letter-spacing:.03em}
.lang__menu{position:absolute;right:0;top:calc(100% + 6px);z-index:40;min-width:150px;
  background:#fff;border:1px solid var(--line);border-radius:10px;
  box-shadow:0 10px 28px rgba(20,22,40,.14);padding:5px}
.lang__opt{display:flex;align-items:center;gap:9px;width:100%;text-align:left;
  padding:8px 9px;border-radius:7px;font-size:12.5px;color:var(--ink);font-weight:500}
.lang__opt:hover{background:#f5f6f8}
.lang__opt.on{background:#f3f4f6;font-weight:600}
.lang__code{display:inline-grid;place-items:center;min-width:26px;height:20px;
  border-radius:6px;background:var(--orange-soft);color:var(--orange);font-size:10px;font-weight:700}

/* ---- Body columns ---- */
.body{display:grid;grid-template-columns:var(--rail) var(--nav) 1fr;min-height:0;
  transition:grid-template-columns .2s ease}
/* Collapsed mode — workspace nav hidden, rail + main only */
.frame.nav-collapsed .body{grid-template-columns:var(--rail) 0 1fr}
.frame.nav-collapsed .nav{opacity:0;pointer-events:none;padding-left:0;padding-right:0}
.rail button.ri.collapse-btn svg{transition:transform .2s ease}
.frame.nav-collapsed .rail button.ri.collapse-btn svg{transform:rotate(180deg)}
/* Section without a submenu — collapse the workspace column entirely */
.frame.nav-empty .body{grid-template-columns:var(--rail) 0 1fr}
.frame.nav-empty.rail-expanded .body{grid-template-columns:190px 0 1fr}
.frame.nav-empty .nav{opacity:0;pointer-events:none;padding-left:0;padding-right:0}
.frame.nav-empty .rail .collapse-btn{display:none}

/* Icon rail */
.rail{
  border-right:1px solid var(--line);
  display:flex;flex-direction:column;align-items:center;gap:6px;
  padding:14px 0;
}
.rail .plus{width:34px;height:34px;border-radius:10px;background:var(--orange);
  color:#fff;display:grid;place-items:center;margin-bottom:8px;
  box-shadow:0 6px 14px rgba(255,91,20,.35)}
.rail .plus svg{width:18px;height:18px}
.rail button.ri{width:36px;height:36px;border-radius:9px;display:grid;place-items:center;color:var(--faint)}
.rail button.ri:hover{background:#f5f6f8;color:var(--ink)}
.rail button.ri.on{background:var(--orange-soft);color:var(--orange)}
.rail button.ri svg{width:18px;height:18px}
.rail .spacer{flex:1}

/* Rail icon labels (revealed when the rail is expanded) */
.ri-text{display:none;font-weight:500;font-size:13px;white-space:nowrap}

/* ---- Tooltips on rail icons (shown only while the rail is collapsed) ---- */
.rail [data-tip]{position:relative}
.rail [data-tip]::after{
  content:attr(data-tip);
  position:absolute;left:calc(100% + 10px);top:50%;transform:translateY(-50%) scale(.96);
  transform-origin:left center;
  background:var(--ink);color:#fff;font-size:11px;font-weight:600;letter-spacing:.01em;
  padding:5px 9px;border-radius:7px;white-space:nowrap;
  box-shadow:0 6px 16px rgba(20,22,40,.22);
  opacity:0;pointer-events:none;transition:opacity .12s ease,transform .12s ease;z-index:60}
.rail [data-tip]::before{
  content:"";position:absolute;left:calc(100% + 4px);top:50%;transform:translateY(-50%);
  border:5px solid transparent;border-right-color:var(--ink);
  opacity:0;pointer-events:none;transition:opacity .12s ease;z-index:60}
.rail [data-tip]:hover::after{opacity:1;transform:translateY(-50%) scale(1)}
.rail [data-tip]:hover::before{opacity:1}
/* No tooltips once the rail is expanded — labels are visible instead */
.frame.rail-expanded .rail [data-tip]::after,
.frame.rail-expanded .rail [data-tip]::before{display:none}

/* ---- Expanded rail (icons + labels) ---- */
.frame.rail-expanded .body{grid-template-columns:190px var(--nav) 1fr}
.frame.rail-expanded.nav-collapsed .body{grid-template-columns:190px 0 1fr}
.frame.rail-expanded .rail{align-items:stretch;padding-left:10px;padding-right:10px}
.frame.rail-expanded .rail .ri-text{display:inline}
.frame.rail-expanded .rail button.ri,
.frame.rail-expanded .rail .plus{
  width:100%;display:flex;align-items:center;justify-content:flex-start;gap:11px;padding:0 10px}
.frame.rail-expanded .rail button.ri{height:38px;border-radius:9px}
.frame.rail-expanded .rail .plus{height:38px;margin-bottom:8px}
.frame.rail-expanded .rail .collapse-btn{justify-content:flex-start}

/* Workspace nav */
.nav{border-right:1px solid var(--line);padding:14px 12px;display:flex;flex-direction:column;
  overflow:hidden;white-space:nowrap;transition:opacity .15s ease}
.nav__head{display:flex;align-items:center;justify-content:space-between;
  font-size:10px;letter-spacing:.08em;color:var(--faint);font-weight:700;padding:4px 6px 10px}
.nav__head .ic{display:flex;gap:8px}
.nav__head svg{width:14px;height:14px}
.nav-item{display:flex;align-items:center;gap:9px;padding:8px 9px;border-radius:9px;
  color:var(--muted);font-weight:500;margin-bottom:2px;width:100%;text-align:left;font-size:13px}
.nav-item:hover{background:#f6f7f9;color:var(--ink)}
.nav-item.on{background:#f3f4f6;color:var(--ink);font-weight:600}
.nav-item .pill{margin-left:auto;background:var(--orange-soft);color:var(--orange);
  font-size:10px;font-weight:700;padding:1px 7px;border-radius:999px}
.nav__foot{margin-top:auto;padding:10px 6px}
.nav__foot p{margin:0;color:var(--muted);font-size:12px}
.nav__foot a{color:#2f6bff;font-weight:600;font-size:12px}

/* ---- Main ---- */
.main{min-width:0;overflow-y:auto;padding:20px 22px;background:#fcfcfd}
.main__head{display:flex;align-items:center;gap:10px;margin-bottom:16px}
.main__head h1{font-size:18px;font-weight:700;margin:0;display:flex;align-items:center;gap:8px}
.main__head h1 .chev,.main__head h1 .add{color:var(--faint)}
.main__head h1 svg{width:16px;height:16px}
.addbtn{margin-left:auto;display:inline-flex;align-items:center;gap:7px;
  background:var(--orange);color:#fff;font-weight:600;height:36px;padding:0 16px;border-radius:9px;
  box-shadow:0 6px 14px rgba(255,91,20,.3)}
.addbtn svg{width:15px;height:15px}

/* Tabs */
.tabs-row{display:flex;align-items:center;border-bottom:1px solid var(--line);margin-bottom:16px}
.tabs{display:flex;align-items:center;gap:2px}
.tab{position:relative;display:inline-flex;align-items:center;gap:6px;padding:9px 12px;
  color:var(--muted);font-weight:500;border-bottom:2px solid transparent;margin-bottom:-1px;
  transition:color .2s ease}
/* Animated underline: grows from the centre when a tab becomes active */
.tab::after{content:"";position:absolute;left:10px;right:10px;bottom:-1px;height:2px;
  background:var(--orange);transform:scaleX(0);transform-origin:center;
  transition:transform .28s cubic-bezier(.4,0,.2,1)}
/* Icons are collapsed by default and revealed on hover / when active */
.tab .ico{display:inline-flex;align-items:center;width:0;opacity:0;margin-right:-6px;
  overflow:hidden;transition:width .22s ease,opacity .22s ease,margin-right .22s ease}
.tab .ico svg{width:15px;height:15px}
.tab:hover{color:var(--ink)}
.tab:hover .ico,.tab.on .ico{width:15px;opacity:1;margin-right:0}
.tab.on{color:var(--ink);font-weight:600}
.tab.on::after{transform:scaleX(1)}
.tab.add{color:var(--muted)}
/* The "+View" action keeps its icon visible at all times */
.tab.add .ico{width:15px;opacity:1;margin-right:0}
.view-set{margin-left:auto;display:inline-flex;align-items:center;gap:6px;color:var(--muted);
  font-weight:500;font-size:12.5px}
.view-set svg{width:15px;height:15px}

/* Filter toolbar */
.filters{display:flex;align-items:center;gap:9px;margin-bottom:18px}
.f-search{display:flex;align-items:center;gap:8px;border:1px solid var(--line);
  border-radius:9px;height:34px;padding:0 12px;width:210px;color:var(--muted)}
.f-search svg{width:14px;height:14px}
.f-search input{border:none;outline:none;background:none;font-size:12.5px;color:var(--ink);width:100%}
.fbtn{display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 12px;
  border:1px solid var(--line);border-radius:9px;color:var(--ink);font-weight:500;font-size:12.5px}
.fbtn svg{width:14px;height:14px;color:var(--muted)}
.fbtn.dark{border-color:var(--ink)}
.fbtn:hover{background:#f7f8fa}
.filters .grow{flex:1}
.fbadge{display:inline-grid;place-items:center;min-width:17px;height:17px;padding:0 5px;border-radius:9px;
  background:var(--orange);color:#fff;font-size:10px;font-weight:700}

/* Advanced filters panel */
.filters-panel{border:1px solid var(--line);border-radius:var(--r);background:#fff;padding:16px;margin-bottom:18px}
.filters-panel__row{display:flex;flex-wrap:wrap;gap:24px}
.filter-group{display:flex;flex-direction:column;gap:8px;min-width:160px}
.filter-group__label{font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--faint)}
.filter-chips{display:flex;flex-wrap:wrap;gap:6px}
.filter-chip{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;font-weight:600;
  border:1px solid var(--line);border-radius:7px;padding:5px 9px;color:var(--muted)}
.filter-chip:hover{background:#f7f8fa}
.filter-chip.on{border-color:var(--orange);background:var(--orange-soft);color:var(--orange)}
.filter-select{height:34px;border:1px solid var(--line);border-radius:9px;padding:0 10px;
  font-family:inherit;font-size:12.5px;color:var(--ink);background:#fff;outline:none}
.filter-select:focus{border-color:var(--orange)}
.filters-panel__foot{display:flex;justify-content:flex-end;margin-top:14px}
.btn-clear{height:32px;padding:0 14px;border:1px solid var(--line);border-radius:8px;
  font-weight:600;font-size:12px;color:var(--ink)}
.btn-clear:hover:not(:disabled){background:#f5f6f8}
.btn-clear:disabled{opacity:.45;cursor:not-allowed}
.toggle{display:flex;border:1px solid var(--line);border-radius:9px;overflow:hidden}
.toggle button{width:34px;height:34px;display:grid;place-items:center;color:var(--faint)}
.toggle button.on{background:var(--orange-soft);color:var(--orange)}
.toggle button svg{width:16px;height:16px}

/* ---- Product grid ---- */
.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.pcard{border:1px solid var(--line);border-radius:var(--r);padding:15px;background:#fff;
  display:flex;flex-direction:column;transition:box-shadow .15s,border-color .15s}
.pcard:hover{box-shadow:0 8px 22px rgba(20,22,40,.07);border-color:#e3e4e8}
.pcard__top{display:flex;gap:11px;align-items:flex-start}
.thumb{width:42px;height:42px;border-radius:9px;background:#f4f5f7;border:1px solid var(--line);
  display:grid;place-items:center;flex-shrink:0;color:var(--faint)}
.thumb svg{width:22px;height:22px}
.pcard__title{flex:1;min-width:0}
.pcard__title h4{margin:0;font-size:13px;font-weight:600;line-height:1.3}
.pcard__title .sku{color:var(--muted);font-size:11.5px;margin-top:2px}
.dots{color:var(--faint);width:26px;height:26px;border-radius:7px;display:grid;place-items:center;flex-shrink:0}
.dots:hover{background:#f5f6f8;color:var(--ink)}
.dots svg{width:16px;height:16px}
.tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:9px}
.tag{font-size:11px;color:var(--muted);background:#f5f6f8;border-radius:6px;padding:2px 8px;font-weight:500}
.divide{height:1px;background:var(--line-2);margin:13px 0}

/* variant rows */
.vrow{display:grid;grid-template-columns:1fr auto auto auto;align-items:center;
  gap:10px;padding:5px 0;font-size:12px}
.vrow .c1{color:var(--ink);font-weight:500}
.vrow .c2{color:var(--muted);justify-self:start}
.vrow .price{color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums}
.stock{display:inline-flex;align-items:center;gap:4px;font-weight:600;font-variant-numeric:tabular-nums;justify-self:end}
.stock svg{width:13px;height:13px}
.stock.g{color:var(--green)} .stock.r{color:#e0481f}
.more{color:var(--orange);font-weight:600;font-size:12px;margin-top:7px;display:inline-block}

/* retail/wholesale block */
.cols{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.kv .k{color:var(--muted);font-size:11px;margin-bottom:3px}
.kv .v{font-weight:700;font-variant-numeric:tabular-nums}
.stock-line{margin-top:11px}
.stock-line .k{color:var(--muted);font-size:11px;margin-bottom:4px}
.stock-pill{display:inline-flex;align-items:center;gap:5px;color:var(--green);font-weight:600}
.stock-pill svg{width:13px;height:13px}

/* footer badges */
.pcard__foot{display:flex;align-items:center;gap:8px;margin-top:auto;padding-top:13px}
.sbadge{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;
  border-radius:7px;padding:4px 9px}
.sbadge.active{color:var(--green);background:var(--green-soft)}
.sbadge.draft{color:var(--muted);background:#f1f2f4}
.sbadge.dropship{color:var(--muted);background:#f5f6f8}
.sbadge svg{width:13px;height:13px}
.expand{margin-left:auto;width:30px;height:26px;border-radius:7px;border:1px solid var(--line);
  display:grid;place-items:center;color:var(--muted)}
.expand:hover{background:#f5f6f8;color:var(--ink)}
.expand svg{width:14px;height:14px}

/* Placeholder views fill the main area and center their card */
.view.center{min-height:100%;display:flex;flex-direction:column}
.view.center .placeholder{margin:auto;width:100%;max-width:440px}

/* Generic placeholder view (Bundle, License Keys, Dropshipping) */
.placeholder{border:1px dashed var(--line);border-radius:var(--r);background:#fff;
  padding:48px 24px;text-align:center;color:var(--muted)}
.placeholder .ph-ico{width:46px;height:46px;border-radius:12px;background:var(--orange-soft);
  color:var(--orange);display:grid;place-items:center;margin:0 auto 14px}
.placeholder .ph-ico svg{width:22px;height:22px}
.placeholder h3{margin:0 0 6px;font-size:15px;color:var(--ink)}
.placeholder p{margin:0 auto;max-width:360px;font-size:12.5px}

/* No-results state */
.empty{grid-column:1/-1;text-align:center;color:var(--muted);padding:40px 0;font-size:13px}

/* ---- Drawer (slide-in create panel) ---- */
.drawer-overlay{position:fixed;inset:0;background:rgba(20,22,40,.38);
  opacity:0;visibility:hidden;transition:opacity .2s ease,visibility .2s ease;z-index:50}
.drawer-overlay.open{opacity:1;visibility:visible}
.drawer{position:fixed;top:0;right:0;height:100vh;width:440px;max-width:92vw;
  background:#fff;box-shadow:-12px 0 40px rgba(20,22,40,.18);
  transform:translateX(100%);transition:transform .25s cubic-bezier(.4,0,.2,1);
  z-index:51;display:flex;flex-direction:column}
.drawer.open{transform:translateX(0)}
.drawer__head{display:flex;align-items:center;gap:10px;padding:18px 20px;border-bottom:1px solid var(--line)}
.drawer__head h2{margin:0;font-size:16px;font-weight:700}
.drawer__head p{margin:2px 0 0;font-size:12px;color:var(--muted)}
.drawer__close{margin-left:auto;width:32px;height:32px;border-radius:8px;display:grid;
  place-items:center;color:var(--muted)}
.drawer__close:hover{background:#f5f6f8;color:var(--ink)}
.drawer__close svg{width:18px;height:18px}
.drawer__form{flex:1;display:flex;flex-direction:column;min-height:0}
.drawer__body{flex:1;overflow-y:auto;padding:20px}
.field{margin-bottom:15px}
.field label{display:block;font-weight:600;font-size:12px;margin-bottom:6px;color:var(--ink)}
.field input,.field select,.field textarea{width:100%;border:1px solid var(--line);border-radius:9px;
  height:38px;padding:0 12px;font-family:inherit;font-size:13px;color:var(--ink);outline:none;background:#fff}
.field textarea{height:auto;padding:10px 12px;resize:vertical;min-height:72px}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--orange)}
.field .req{color:#e0481f;font-weight:700}
.field .validation-message{display:block;margin-top:5px;font-size:11.5px;font-weight:500;color:#e0481f}
.field input.invalid,.field select.invalid,.field textarea.invalid{border-color:#e0481f}
.field input.invalid:focus,.field select.invalid:focus,.field textarea.invalid:focus{
  border-color:#e0481f;box-shadow:0 0 0 3px rgba(224,72,31,.12)}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
/* Grouped sub-section header inside the product drawer */
.drawer__section{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;
  color:var(--muted);margin:6px 0 13px;padding-top:15px;border-top:1px solid var(--line)}
/* Inline checkbox field (label sits beside the box) */
.field--check{display:flex;align-items:center}
.field .check{display:flex;align-items:center;gap:8px;font-weight:600;font-size:13px;cursor:pointer;margin:0}
.field .check input{width:auto;height:auto;margin:0}
/* Read-only live margin box in the drawer */
.margin-readout{display:flex;align-items:center;height:38px;padding:0 12px;border:1px dashed var(--line);
  border-radius:9px;font-weight:700;font-variant-numeric:tabular-nums;background:#fafbfc;color:var(--muted)}
.margin-readout.pos{color:#15803d;border-color:#bbe6c8;background:#f1faf3}
.margin-readout.neg{color:#dc2626;border-color:#f0c5c5;background:#fdf3f3}
/* Coloured margin value on the detail page */
.kv .v.pos{color:#15803d}
.kv .v.neg{color:#dc2626}
.kv--wide{grid-column:1 / -1}
.drawer__foot{display:flex;gap:10px;padding:16px 20px;border-top:1px solid var(--line)}
.drawer__foot .btn-cancel{flex:0 0 auto;height:38px;padding:0 16px;border:1px solid var(--line);
  border-radius:9px;font-weight:600;color:var(--ink)}
.drawer__foot .btn-cancel:hover{background:#f5f6f8}
.drawer__foot .btn-save{flex:1;height:38px;border-radius:9px;background:var(--orange);color:#fff;
  font-weight:600;box-shadow:0 6px 14px rgba(255,91,20,.3)}

/* ---- Notes (product drawer) ---- */
.notes{margin-top:4px;border-top:1px solid var(--line);padding-top:15px}
.notes__head{display:flex;align-items:center;gap:7px;font-weight:700;font-size:12px;
  color:var(--ink);margin-bottom:11px}
.notes__head svg{width:14px;height:14px;color:var(--muted)}
.notes__loading{display:flex;align-items:center;gap:9px;color:var(--muted);font-size:12.5px;padding:10px 0}
.notes__empty{color:var(--muted);font-size:12.5px;padding:4px 0 12px}
/* ~3 notes tall, the rest scroll */
.notes__list{list-style:none;margin:0 0 10px;padding:0;display:flex;flex-direction:column;gap:8px;
  max-height:192px;overflow-y:auto}
.notes__more{display:inline-flex;align-items:center;gap:6px;align-self:flex-start;background:none;
  color:var(--orange);font-weight:600;font-size:12px;padding:2px 0;margin-bottom:12px}
.notes__more svg{width:13px;height:13px}
.notes__more:hover:not(:disabled){text-decoration:underline}
.notes__more:disabled{color:var(--muted);cursor:not-allowed}
.note{background:#f7f8fa;border:1px solid var(--line);border-radius:9px;padding:9px 11px}
.note__content{font-size:12.5px;color:var(--ink);white-space:pre-wrap;word-break:break-word}
.note__time{font-size:10.5px;color:var(--faint);margin-top:5px;font-variant-numeric:tabular-nums}
.notes__add{display:flex;flex-direction:column;gap:8px}
.notes__add textarea{width:100%;border:1px solid var(--line);border-radius:9px;padding:9px 11px;
  font-family:inherit;font-size:12.5px;color:var(--ink);resize:vertical;min-height:54px;outline:none;background:#fff}
.notes__add textarea:focus{border-color:var(--orange)}
.btn-addnote{align-self:flex-start;display:inline-flex;align-items:center;gap:5px;height:32px;
  padding:0 13px;border-radius:8px;background:var(--ink);color:#fff;font-weight:600;font-size:12px}
.btn-addnote svg{width:13px;height:13px}
.btn-addnote:hover:not(:disabled){background:#000}
.btn-addnote:disabled{opacity:.45;cursor:not-allowed}
.spinner{width:15px;height:15px;border:2px solid var(--line);border-top-color:var(--orange);
  border-radius:50%;display:inline-block;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---- Tag picker ---- */
.tagpicker{position:relative}
.tagpicker__control{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-height:38px;
  border:1px solid var(--line);border-radius:9px;padding:5px 8px;background:#fff;cursor:text}
.tagpicker__control:focus-within{border-color:var(--orange)}
.tagpicker__input{border:none;outline:none;flex:1;min-width:90px;height:26px;
  font-family:inherit;font-size:13px;color:var(--ink);background:none}
.tag-chip{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;
  background:#f5f6f8;color:var(--ink);border-radius:7px;padding:3px 8px}
.tag-chip__x{font-size:15px;line-height:1;color:var(--muted);padding:0 1px}
.tag-chip__x:hover{color:var(--ink)}
.tag-dot{width:8px;height:8px;border-radius:50%;background:var(--c,#8b8f99);flex-shrink:0}
.tagpicker__menu{position:absolute;left:0;right:0;top:calc(100% + 5px);z-index:5;background:#fff;
  border:1px solid var(--line);border-radius:9px;box-shadow:0 10px 28px rgba(20,22,40,.12);
  padding:5px;max-height:230px;overflow-y:auto}
.tagpicker__opt{display:flex;align-items:center;gap:8px;width:100%;text-align:left;
  padding:7px 9px;border-radius:7px;font-size:12.5px;color:var(--ink)}
.tagpicker__opt:hover{background:#f5f6f8}
.tagpicker__type{margin-left:auto;font-size:10px;color:var(--faint);font-weight:700;
  text-transform:uppercase;letter-spacing:.04em}
.tagpicker__add{display:flex;align-items:center;gap:6px;width:100%;text-align:left;
  padding:7px 9px;border-radius:7px;font-size:12.5px;font-weight:600;color:var(--orange)}
.tagpicker__add svg{width:14px;height:14px}
.tagpicker__add:hover{background:var(--orange-soft)}
.tagpicker__empty{padding:10px;text-align:center;color:var(--muted);font-size:12px}

/* ---- Tags management grid ---- */
.tag-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:14px}
.tcard{border:1px solid var(--line);border-radius:var(--r);padding:13px 14px;background:#fff;
  display:flex;align-items:center;gap:12px;transition:box-shadow .15s,border-color .15s}
.tcard:hover{box-shadow:0 8px 22px rgba(20,22,40,.07);border-color:#e3e4e8}
.tcard__swatch{width:38px;height:38px;border-radius:10px;flex-shrink:0;border:1px solid rgba(20,22,40,.08)}
.tcard__body{flex:1;min-width:0}
.tcard__name{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tcard__type{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;
  color:var(--faint);margin-top:3px}
.tcard__actions{display:flex;gap:4px;flex-shrink:0}
.tcard__btn{width:28px;height:28px;border-radius:7px;display:grid;place-items:center;color:var(--muted)}
.tcard__btn:hover{background:#f5f6f8;color:var(--ink)}
.tcard__btn.danger:hover{background:#fdecea;color:#e0481f}
.tcard__btn svg{width:15px;height:15px}

/* ---- New tag modal ---- */
.tagmodal-overlay{position:fixed;inset:0;background:rgba(20,22,40,.3);z-index:60}
.tagmodal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:61;
  width:340px;max-width:92vw;background:#fff;border-radius:14px;
  box-shadow:0 24px 60px rgba(20,22,40,.28);display:flex;flex-direction:column}
.tagmodal__head{display:flex;align-items:center;justify-content:space-between;
  padding:16px 18px;border-bottom:1px solid var(--line)}
.tagmodal__head h3{margin:0;font-size:15px;font-weight:700}
.tagmodal__body{padding:18px}
.tagmodal__foot{display:flex;gap:10px;padding:14px 18px;border-top:1px solid var(--line)}
.tagmodal__foot .btn-cancel{flex:0 0 auto;height:36px;padding:0 14px;border:1px solid var(--line);
  border-radius:9px;font-weight:600;color:var(--ink)}
.tagmodal__foot .btn-cancel:hover{background:#f5f6f8}
.tagmodal__foot .btn-save{flex:1;height:36px;border-radius:9px;background:var(--orange);
  color:#fff;font-weight:600}
.tagmodal__foot .btn-save:disabled{opacity:.5;cursor:not-allowed}
.tag-color{padding:2px!important;height:38px;width:100%;cursor:pointer}
.tag-preview{margin-top:4px}

@media(max-width:980px){ .grid{grid-template-columns:repeat(2,1fr)} }
@media(max-width:760px){ .body{grid-template-columns:var(--rail) 1fr} .nav{display:none}
  .grid{grid-template-columns:1fr} .qsearch{display:none} }

/* ---- Detail pages (product / tag) ---- */
.backbtn{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:8px;
  color:var(--muted);margin-right:6px;vertical-align:middle}
.backbtn:hover{background:#f5f6f8;color:var(--ink)}
.backbtn svg{width:16px;height:16px;transform:rotate(180deg)}
.detail{display:flex;flex-direction:column;gap:18px;width:100%}
.detail__badges{display:flex;gap:8px;flex-wrap:wrap}
.detail__tags{display:flex;gap:6px;flex-wrap:wrap}
.detail__tags a.tag{cursor:pointer}
.detail__tags a.tag:hover{background:var(--orange);color:#fff}
.detail__meta{color:var(--muted);font-size:13px}
.detail__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:16px;
  border:1px solid var(--line);border-radius:12px;padding:16px}
.detail__section{font-size:14px;font-weight:600;margin:4px 0 0}
.detail__list{display:flex;flex-direction:column;gap:6px}
.detail__row{display:flex;align-items:center;gap:12px;padding:10px 12px;
  border:1px solid var(--line);border-radius:10px;color:var(--ink);
  transition:border-color .12s ease,background .12s ease}
.detail__row:hover{background:#f5f6f8;border-color:var(--orange)}
.detail__row-ico{display:inline-flex;color:var(--muted)}
.detail__row-ico svg{width:18px;height:18px}
.detail__row-name{flex:1;font-weight:500}
.detail__variants{display:flex;flex-direction:column;gap:4px;
  border:1px solid var(--line);border-radius:12px;padding:8px 12px}

/* Blazor unhandled-error toast (markup lives in MainLayout). Global so it does not
   depend on a component-scoped stylesheet. */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* --- Import by link page + scraped product detail --- */
.muted{ color:var(--muted); margin:.25rem 0 1rem; }
.import{ display:flex; gap:.5rem; margin-bottom:1rem; }
.import__url{ flex:1; padding:.6rem .75rem; border:1px solid var(--line); border-radius:8px; font-size:.95rem; }
.import__ok{ padding:.6rem .9rem; border-radius:8px; background:var(--green-soft); color:var(--green); margin-bottom:1rem; }
.import__error{ color:var(--orange); }
.import__after{ display:flex; gap:.5rem; margin-top:1rem; }
.detail__gallery{ display:flex; flex-wrap:wrap; gap:.5rem; margin:1rem 0; }
.detail__img{ width:120px; height:120px; object-fit:cover; border:1px solid var(--line); border-radius:8px; background:#fff; }
.detail__desc{ margin:1rem 0; line-height:1.5; color:var(--ink);
  max-height:640px; overflow-y:auto; padding:.75rem 1rem;
  border:1px solid var(--line); border-radius:8px; background:#fff; }
.detail__desc img{ max-width:100%; height:auto; }
.detail__specs-head{ font-weight:600; margin:1rem 0 .5rem; }
.detail__specs{ border-collapse:collapse; width:100%; max-width:640px; }
.detail__specs th, .detail__specs td{ text-align:left; padding:.4rem .6rem; border-bottom:1px solid var(--line-2); vertical-align:top; }
.detail__specs th{ width:40%; color:var(--muted); font-weight:500; }

/* Product cards open their own detail page on click. */
.pcard--clickable{ cursor:pointer; }
.pcard--clickable:hover{ border-color:var(--faint); box-shadow:0 2px 10px rgba(0,0,0,.06); }

/* --- Product image slider --- */
.slider{ margin:1rem 0; max-width:50%; }
.slider__stage{ position:relative; display:flex; align-items:center; justify-content:center;
  background:var(--line-2); border:1px solid var(--line); border-radius:12px; padding:.5rem; min-height:200px; }
.slider__main{ max-width:100%; max-height:50vh; object-fit:contain; border-radius:8px; cursor:zoom-in; }
.slider__nav{ position:absolute; top:50%; transform:translateY(-50%); width:38px; height:38px;
  border:1px solid var(--line); background:#fff; border-radius:50%; font-size:1.4rem; line-height:1;
  cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--ink); }
.slider__nav:hover{ border-color:var(--faint); }
.slider__nav--prev{ left:.6rem; }
.slider__nav--next{ right:.6rem; }
.slider__linked{ display:flex; flex-wrap:wrap; align-items:center; gap:.4rem; margin:.6rem 0; }
.slider__linked-label{ color:var(--muted); font-size:.85rem; }
.vchip{ padding:.2rem .55rem; border:1px solid var(--line); border-radius:999px; font-size:.8rem; background:#fff; }
.slider__thumbs{ display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.6rem; }
.slider__thumb{ width:64px; height:64px; padding:0; border:2px solid transparent; border-radius:8px;
  overflow:hidden; cursor:pointer; background:#fff; }
.slider__thumb.on{ border-color:var(--orange); }
.slider__thumb img{ width:100%; height:100%; object-fit:cover; display:block; }

/* --- Lightbox preview --- */
.lightbox{ position:fixed; inset:0; background:rgba(0,0,0,.66); display:flex; align-items:center;
  justify-content:center; z-index:1000; padding:2rem; }
.lightbox__panel{ position:relative; background:#fff; border-radius:12px; padding:1rem;
  max-width:90vw; max-height:90vh; overflow:auto; display:flex; flex-direction:column; gap:.75rem; }
.lightbox__close{ position:absolute; top:.4rem; right:.6rem; border:none; background:transparent;
  font-size:1.8rem; line-height:1; cursor:pointer; color:var(--muted); }
.lightbox__img{ max-width:80vw; max-height:68vh; object-fit:contain; border-radius:8px; }
.vrow--click{ cursor:pointer; }
.vrow--click:hover{ background:var(--line-2); }
.lightbox__caption{ text-align:center; color:var(--ink); font-size:.95rem; }
.lightbox__caption strong{ color:var(--orange); }
.lightbox__variants-head{ font-weight:600; margin-bottom:.25rem; }
.lightbox__novariant{ color:var(--muted); font-size:.9rem; }

/* Variant card main-image thumbnail */
/* --- Order edit page form --- */
.oform{ max-width:820px; }
.oform__grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:.75rem 1rem; margin-bottom:1rem; }
.oform__wide{ grid-column:1 / -1; }
.oform__foot{ display:flex; justify-content:flex-end; gap:.6rem; margin-top:1.2rem; }
.field__hint{ font-size:11px; color:var(--muted); margin-top:.2rem; }
.check{ display:inline-flex; align-items:center; gap:.4rem; cursor:pointer; }
.check input{ width:auto; }
@media(max-width:680px){ .oform__grid{ grid-template-columns:1fr; } }

.detail__badges{ display:flex; align-items:center; gap:.6rem; }
.status-select{ padding:.3rem .6rem; border:1px solid var(--line); border-radius:7px;
  background:#fff; font-size:12.5px; color:var(--ink); cursor:pointer; }

.pcard{ overflow:hidden; }
.pcard__img{ display:block; width:100%; max-width:100%; height:180px; object-fit:cover; border-radius:8px; flex:0 0 auto; }
.pcard__img--empty{ display:flex; align-items:center; justify-content:center; background:var(--line-2); color:var(--faint); }
.pcard__img--empty svg{ width:48px; height:48px; }

/* --- Rich text editor (description) --- */
.rte{ border:1px solid var(--line); border-radius:8px; overflow:hidden; background:#fff; }
.rte__toolbar{ display:flex; flex-wrap:wrap; align-items:center; gap:2px; padding:.35rem .5rem;
  border-bottom:1px solid var(--line); background:var(--line-2); }
.rte__toolbar button{ min-width:30px; height:28px; padding:0 .4rem; border:1px solid transparent;
  background:transparent; border-radius:5px; cursor:pointer; font-size:.85rem; color:var(--ink); }
.rte__toolbar button:hover{ background:#fff; border-color:var(--line); }
.rte__sep{ width:1px; height:18px; background:var(--line); margin:0 4px; }
.rte__editor{ min-height:200px; max-height:420px; overflow-y:auto; padding:.6rem .8rem; line-height:1.5; outline:none; }
.rte__editor:focus{ outline:none; }
.rte__editor h1{ font-size:1.4rem; margin:.4rem 0; }
.rte__editor h2{ font-size:1.2rem; margin:.4rem 0; }
.rte__editor h3{ font-size:1.05rem; margin:.4rem 0; }

/* --- Orders table --- */
.otable{ width:100%; border-collapse:collapse; font-size:12.5px; }
.otable th{ text-align:left; padding:.55rem .6rem; color:var(--muted); font-weight:600;
  border-bottom:1px solid var(--line); white-space:nowrap; }
.otable td{ padding:.55rem .6rem; border-bottom:1px solid var(--line-2); vertical-align:middle; }
.otable th.num, .otable td.num{ text-align:right; }
.otable tbody tr:hover{ background:var(--line-2); }
.otable__product{ max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.otable__actions{ text-align:right; white-space:nowrap; }
.otable__actions .dots{ width:28px; height:28px; border-radius:7px; display:inline-grid; place-items:center; color:var(--muted); }
.otable__actions .dots:hover{ background:#fff; color:var(--ink); }

.src{ display:inline-block; padding:.12rem .5rem; border-radius:999px; font-size:11px; font-weight:600;
  background:var(--line-2); color:var(--ink); }
.src--aliexpress{ background:#fff0e8; color:#e0481f; }
.src--ebay{ background:#eaf1ff; color:#2f6bff; }

.ostatus{ display:inline-block; padding:.12rem .5rem; border-radius:999px; font-size:11px; font-weight:600; }
.ostatus--pending{ background:#fff7e6; color:#b7791f; }
.ostatus--processing{ background:#eef2ff; color:#4f46e5; }
.ostatus--shipped{ background:#eaf1ff; color:#2f6bff; }
.ostatus--delivered{ background:var(--green-soft); color:var(--green); }
.ostatus--cancelled{ background:#fdecec; color:#dc2626; }
.ostatus--refunded{ background:#f3f4f6; color:var(--muted); }

/* --- Order line items (drawer) + profit colours --- */
.profit-pos{ color:var(--green); font-weight:600; }
.profit-neg{ color:#dc2626; font-weight:600; }
.addbtn--sm{ padding:.25rem .55rem; font-size:11.5px; }
.oitems{ margin-top:.5rem; border-top:1px solid var(--line); padding-top:.75rem; }
.oitems__head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:.5rem; font-weight:600; }
.oitems__empty{ color:var(--muted); font-size:12px; padding:.5rem 0; }
.oitem{ border:1px solid var(--line); border-radius:8px; padding:.6rem; margin-bottom:.6rem; background:#fff; }
.oitem__top{ display:flex; gap:.5rem; margin-bottom:.5rem; }
.oitem__name{ flex:1; padding:.4rem .55rem; border:1px solid var(--line); border-radius:6px; }
.oitem__remove{ width:30px; border:1px solid var(--line); border-radius:6px; color:var(--muted); }
.oitem__remove:hover{ color:#dc2626; border-color:#f0c5c5; }
.oitem__grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:.45rem; }
.oitem__grid label{ display:flex; flex-direction:column; gap:.2rem; font-size:11px; color:var(--muted); }
.oitem__grid input{ padding:.35rem .45rem; border:1px solid var(--line); border-radius:6px; font-size:12.5px; color:var(--ink); }
.oitem__wide{ grid-column:1 / -1; }
.oitem__profit{ margin-top:.45rem; font-size:12px; text-align:right; }
.oitems__totals{ display:flex; gap:1.2rem; justify-content:flex-end; padding-top:.4rem; font-size:12.5px; }

/* --- Dashboard --- */
.kpis{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:.75rem; margin-bottom:1rem; }
.kpi{ text-align:left; display:flex; flex-direction:column; gap:.2rem; padding:.85rem 1rem;
  border:1px solid var(--line); border-radius:12px; background:#fff; }
button.kpi{ cursor:pointer; }
button.kpi:hover{ border-color:var(--faint); }
.kpi__label{ font-size:11.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; }
.kpi__value{ font-size:1.5rem; font-weight:700; }
.kpi__sub{ font-size:11.5px; color:var(--muted); }
.kpi--warn .kpi__value{ color:#dc2626; }
.kpi--accent{ background:linear-gradient(135deg,#fff,#fff7f3); border-color:#ffd9c7; }
.kpi--accent .kpi__value{ color:var(--orange); }

.widgets{ display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:.9rem; }
.widget{ border:1px solid var(--line); border-radius:12px; background:#fff; padding:.9rem 1rem; }
.widget--wide{ grid-column:1 / -1; }
.widget__head{ font-weight:600; margin-bottom:.6rem; }
.widget__empty{ color:var(--muted); font-size:12.5px; padding:.4rem 0; }

.bar{ display:grid; grid-template-columns:120px 1fr 36px; align-items:center; gap:.5rem; margin:.3rem 0; font-size:12px; }
.bar__label{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink); }
.bar__track{ background:var(--line-2); border-radius:999px; height:10px; overflow:hidden; }
.bar__fill{ display:block; height:100%; background:var(--orange); border-radius:999px; }
.bar__fill--alt{ background:var(--indigo); }
.bar__count{ text-align:right; color:var(--muted); }

.toplist{ margin:0; padding-left:1.1rem; display:flex; flex-direction:column; gap:.4rem; }
.toplist li{ font-size:12.5px; }
.toplist__name{ font-weight:500; }
.toplist__meta{ display:block; color:var(--muted); font-size:11.5px; }

.wtable{ width:100%; border-collapse:collapse; font-size:12.5px; }
.wtable td{ padding:.45rem .5rem; border-bottom:1px solid var(--line-2); }
.wtable__click{ cursor:pointer; }
.wtable__click:hover{ background:var(--line-2); }
.late-badge{ background:#fdecec; color:#dc2626; border-radius:999px; padding:.1rem .5rem; font-weight:600; font-size:11px; }

/* --- Dashboard: trend chip, chart, recent txns, top product thumbs --- */
.trend{ font-size:10.5px; font-weight:600; padding:.05rem .35rem; border-radius:999px; }
.trend--lg{ font-size:12px; padding:.2rem .55rem; }
.trend--up{ background:var(--green-soft); color:var(--green); }
.trend--down{ background:#fdecec; color:#dc2626; }

/* KPI top-right icon */
.kpi{ position:relative; }
.kpi__ico{ position:absolute; top:.7rem; right:.8rem; color:var(--faint); }
.kpi__ico svg{ width:18px; height:18px; }
.kpi--accent .kpi__ico{ color:var(--orange); }

/* Profit overview hero */
.overview__head{ display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:.75rem; }
.overview__big{ font-size:1.8rem; font-weight:700; line-height:1.1; }
.overview__sub{ font-size:12px; color:var(--muted); margin-top:.15rem; }

.chart{ display:flex; align-items:flex-end; gap:.4rem; height:200px; padding-top:.5rem; }
.chart__col{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:.35rem; height:100%; }
.chart__bar{ width:70%; max-width:34px; background:linear-gradient(180deg,#ffb38f,var(--orange));
  border-radius:6px 6px 0 0; transition:height .3s ease; }
.chart__col:hover .chart__bar{ background:linear-gradient(180deg,var(--orange),#d8430a); }
.chart__x{ font-size:10.5px; color:var(--muted); }

.txn{ display:flex; align-items:center; gap:.6rem; padding:.45rem 0; border-bottom:1px solid var(--line-2); cursor:pointer; }
.txn:hover{ background:var(--line-2); }
.txn__avatar{ width:34px; height:34px; border-radius:50%; display:grid; place-items:center;
  font-size:12px; font-weight:700; background:var(--line-2); color:var(--ink); flex:0 0 auto; }
.txn__main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.txn__name{ font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.txn__sub{ font-size:11px; color:var(--muted); }
.txn__amt{ font-weight:600; }

.topitem{ display:flex; align-items:center; gap:.6rem; padding:.35rem 0; }
.topitem__img{ width:40px; height:40px; border-radius:8px; object-fit:cover; flex:0 0 auto; border:1px solid var(--line); }
.topitem__img--empty{ display:grid; place-items:center; background:var(--line-2); color:var(--faint); }
.topitem__img--empty svg{ width:20px; height:20px; }
.topitem__body{ display:flex; flex-direction:column; min-width:0; }
.toplist{ list-style:none; margin:0; padding:0; }

/* --- Categories view --- */
.cat-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:.9rem; }
.cat-card{ border:1px solid var(--line); border-radius:12px; background:#fff; padding:.5rem; }
.cat-card__head{ display:flex; align-items:center; justify-content:space-between; width:100%;
  padding:.5rem .65rem; border-radius:8px; cursor:pointer; }
.cat-card__head:hover{ background:var(--line-2); }
.cat-card__name{ font-weight:600; }
.cat-card__count{ background:var(--orange-soft); color:var(--orange); border-radius:999px;
  padding:.05rem .5rem; font-size:11px; font-weight:700; }
.cat-card__subs{ display:flex; flex-wrap:wrap; gap:.35rem; padding:.4rem .65rem .55rem; }
.cat-card__subs-label{ width:100%; font-size:10.5px; text-transform:uppercase; letter-spacing:.03em; color:var(--faint); }
.cat-sub{ display:inline-flex; align-items:center; gap:.3rem; padding:.15rem .5rem; border:1px solid var(--line);
  border-radius:999px; font-size:11.5px; background:#fff; }
.cat-sub__count{ color:var(--muted); font-size:10.5px; }

/* --- Category detail editing --- */
.cat-card--link{ text-align:left; cursor:pointer; }
.cat-card--link:hover{ border-color:var(--faint); box-shadow:0 2px 10px rgba(0,0,0,.06); }
.catedit{ display:flex; gap:.5rem; align-items:center; margin-bottom:1rem; }
.catedit__name{ flex:1; max-width:360px; padding:.5rem .65rem; border:1px solid var(--line); border-radius:8px; font-size:14px; font-weight:600; }
.fbtn--danger{ color:#dc2626; }
.fbtn--danger:hover{ border-color:#f0c5c5; }
.sublist{ display:flex; flex-direction:column; gap:.4rem; max-width:520px; margin-bottom:1rem; }
.subrow{ display:flex; gap:.5rem; align-items:center; }
.subrow__name{ flex:1; padding:.4rem .6rem; border:1px solid var(--line); border-radius:7px; }
.subrow__del{ width:32px; height:32px; border:1px solid var(--line); border-radius:7px; color:var(--muted); }
.subrow__del:hover{ color:#dc2626; border-color:#f0c5c5; }

/* --- Order view: clickable row + status timeline --- */
.otable__row--click{ cursor:pointer; }
.timeline{ list-style:none; margin:.5rem 0 0; padding:0 0 0 .25rem; max-width:520px; }
.timeline__item{ display:flex; gap:.7rem; position:relative; padding:0 0 1rem 1rem; border-left:2px solid var(--line); }
.timeline__item:last-child{ border-left-color:transparent; padding-bottom:0; }
.timeline__dot{ position:absolute; left:-7px; top:2px; width:12px; height:12px; border-radius:50%;
  background:var(--faint); box-shadow:0 0 0 3px #fff; }
.timeline__item--current .timeline__dot{ background:var(--orange); }
.timeline__body{ display:flex; flex-direction:column; }
.timeline__status{ font-weight:600; font-size:12.5px; }
.timeline__date{ font-size:11.5px; color:var(--muted); }
.dot--mini{ }
/* colour the dot by status */
.timeline__dot.ostatus--pending{ background:#b7791f; }
.timeline__dot.ostatus--processing{ background:#4f46e5; }
.timeline__dot.ostatus--shipped{ background:#2f6bff; }
.timeline__dot.ostatus--delivered{ background:var(--green); }
.timeline__dot.ostatus--cancelled{ background:#dc2626; }
.timeline__dot.ostatus--refunded{ background:var(--muted); }

/* --- Access control: acting-as switcher, roles & permission matrix --- */
.actas{ display:inline-flex; align-items:center; gap:.4rem; font-size:11.5px; color:var(--muted); }
.actas__label{ text-transform:uppercase; letter-spacing:.03em; }
.actas__select{ padding:.25rem .5rem; border:1px solid var(--line); border-radius:7px; background:#fff; font-size:12px; color:var(--ink); max-width:200px; }

.rolechip{ display:inline-block; padding:.1rem .55rem; border-radius:999px; background:#eef2ff; color:var(--indigo); font-size:11px; font-weight:600; }
.permchips{ display:flex; flex-wrap:wrap; gap:.4rem; }
.permchip{ padding:.15rem .55rem; border:1px solid var(--line); border-radius:999px; font-size:11.5px; background:#fff; }

.roles{ display:grid; grid-template-columns:260px 1fr; gap:1rem; align-items:start; }
@media(max-width:760px){ .roles{ grid-template-columns:1fr; } }
.roles__list{ display:flex; flex-direction:column; gap:.35rem; }
.rolebtn{ display:flex; align-items:center; gap:.5rem; width:100%; text-align:left; padding:.55rem .7rem;
  border:1px solid var(--line); border-radius:9px; background:#fff; cursor:pointer; }
.rolebtn:hover{ border-color:var(--faint); }
.rolebtn.on{ border-color:var(--orange); background:var(--orange-soft); }
.rolebtn__name{ font-weight:600; flex:1; }
.rolebtn__tag{ font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color:var(--muted);
  background:var(--line-2); border-radius:999px; padding:.05rem .4rem; }
.rolebtn__count{ font-size:11px; color:var(--muted); }
.roles__editor{ border:1px solid var(--line); border-radius:12px; background:#fff; padding:1rem; }
.roles__head{ display:flex; align-items:center; gap:.5rem; margin-bottom:1rem; }
.matrix{ display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:1rem; }
.matrix__group{ border:1px solid var(--line-2); border-radius:10px; padding:.6rem .75rem; }
.matrix__area{ display:flex; align-items:center; justify-content:space-between; font-weight:600; font-size:12px;
  text-transform:uppercase; letter-spacing:.03em; color:var(--muted); margin-bottom:.5rem; }
.matrix__all{ font-size:10.5px; font-weight:600; color:var(--orange); background:none; cursor:pointer; }
.matrix__row{ display:flex; align-items:center; gap:.5rem; padding:.25rem 0; font-size:12.5px; cursor:pointer; }
.matrix__row--locked{ cursor:default; color:var(--muted); }
.matrix__row input{ width:auto; }
.matrix__key{ margin-left:auto; font-size:10.5px; color:var(--faint); }

/* --- Auth: login screen, signed-in badge, boot --- */
.boot{display:grid;place-items:center;height:100vh;color:var(--muted);font-size:14px}
.login{min-height:100vh;display:grid;place-items:center;padding:24px;
  background:radial-gradient(80% 60% at 50% -10%,var(--orange-soft),transparent 60%),var(--bg)}
.login__card{width:100%;max-width:380px;background:#fff;border:1px solid var(--line);border-radius:16px;
  padding:32px;box-shadow:0 24px 60px rgba(20,22,40,.12)}
.login__brand{display:flex;align-items:center;gap:9px;font-weight:700;margin-bottom:22px}
.login__mark{width:28px;height:28px;border-radius:8px;background:var(--orange);color:#fff;font-weight:900;
  display:grid;place-items:center}
.login__card h1{font-size:1.5rem;margin:0}
.login__sub{color:var(--muted);font-size:.9rem;margin:.3rem 0 1.4rem}
.login__label{display:block;font-size:.8rem;font-weight:600;color:var(--muted);margin:.7rem 0 .3rem}
.login__input{width:100%;padding:.6rem .7rem;border:1px solid var(--line);border-radius:9px;font-size:.95rem}
.login__input:focus{outline:none;border-color:var(--orange)}
.login__error{margin-top:.8rem;color:#dc2626;font-size:.85rem;background:#fdecec;border-radius:8px;padding:.5rem .7rem}
.login__btn{width:100%;margin-top:1.2rem;padding:.7rem;border:none;border-radius:9px;background:var(--orange);
  color:#fff;font-weight:700;font-size:.95rem;cursor:pointer}
.login__btn:hover{background:#e94e0a}
.login__btn:disabled{opacity:.6;cursor:default}
.login__hint{margin-top:1.2rem;text-align:center;font-size:.75rem;color:var(--faint)}
.whoami{display:flex;flex-direction:column;line-height:1.1;margin-left:6px;text-align:right}
.whoami__name{font-size:12px;font-weight:600;color:var(--ink)}
.whoami__role{font-size:10.5px;color:var(--muted)}

/* --- Apps & integrations --- */
.appcard{display:flex;gap:18px;border:1px solid var(--line);border-radius:14px;background:#fff;padding:22px;max-width:640px}
.appcard__icon{width:54px;height:54px;border-radius:13px;flex:none;display:grid;place-items:center;
  background:linear-gradient(160deg,var(--orange-soft),#fff);border:1px solid var(--line);color:var(--orange)}
.appcard__icon svg{width:26px;height:26px}
.appcard__body{flex:1;min-width:0}
.appcard__top{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.appcard__top h3{margin:0;font-size:1.15rem}
.appcard__tag{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.03em;color:var(--muted);
  background:var(--line-2);border-radius:999px;padding:.1rem .5rem}
.appcard__desc{color:var(--muted);margin:.5rem 0 1rem;font-size:.95rem}
.appcard__actions{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.appcard__actions .addbtn{margin-left:0}
.storelink{font-size:.9rem;font-weight:600;color:var(--orange)}
.storelink:hover{text-decoration:underline}
.appcard__install{margin-top:1.1rem}
.appsteps{margin:.4rem 0 0;padding-left:1.2rem;color:var(--ink);font-size:.9rem;display:flex;flex-direction:column;gap:.4rem}
