/* ===========================================================
   App 3 — NikPay · Orders
   Tokens documented in DESIGN-SYSTEM.md
   =========================================================== */
:root{
  --bg:#e9e9e9;
  --frame:#f1f1f1;
  --side:#dcdcdc;          /* sidebar glass */
  --surface:#f7f7f7;       /* cards */
  --surface-2:#ececec;     /* chips, search */
  --line:#e2e2e2;
  --ink:#1c1c1c;
  --ink-2:#333;
  --muted:#6b6b6b;
  --muted-2:#9a9a9a;
  --lime:#b8f227;          /* brand accent */
  --lime-ink:#1c2a00;
  --lime-deep:#2f8a12;     /* up-trend arrows */
  --violet:#4a22d6;        /* chart + ribbon */
  --violet-2:#6a45f0;
  --dark:#1f1f1f;          /* active nav, hero card */
  --r-frame:48px; --r-card:20px; --r-md:12px; --r-pill:999px;
  --shadow:0 1px 0 rgba(255,255,255,.9) inset, 0 12px 30px -18px rgba(0,0,0,.25);
  --font:'Inter', ui-sans-serif, system-ui, sans-serif;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{min-height:100%}
body{font-family:var(--font);color:var(--ink);background:var(--bg);-webkit-font-smoothing:antialiased;overflow-x:hidden}
button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
input{font:inherit;border:0;background:none;outline:none;color:inherit}
ul{list-style:none}

/* faceted grey backdrop */
.facets{position:fixed;inset:0;z-index:0;pointer-events:none;background:
  linear-gradient(118deg,transparent 0 38%,rgba(255,255,255,.55) 38% 52%,transparent 52%),
  linear-gradient(62deg,rgba(0,0,0,.06) 0 22%,transparent 22%),
  linear-gradient(160deg,transparent 0 60%,rgba(255,255,255,.5) 60% 72%,transparent 72%),
  linear-gradient(20deg,transparent 0 70%,rgba(0,0,0,.05) 70%),
  linear-gradient(200deg,#f2f2f2,#dadada)}

.back-link{position:fixed;top:14px;left:16px;z-index:60;white-space:nowrap;color:#444;font-size:12px;font-weight:600;text-decoration:none;padding:6px 12px;border-radius:999px;background:rgba(255,255,255,.75);border:1px solid rgba(0,0,0,.06)}
.back-link:hover{background:#fff}

.layout-toggle{position:absolute;top:30px;right:24px;z-index:60;width:40px;height:40px;color:#222;transition:transform .2s}
.layout-toggle:hover{transform:scale(1.08)}
.layout-toggle svg{width:100%;height:100%}

/* ---------- Frame ---------- */
.frame{
  position:relative;z-index:1;margin:96px auto 60px;width:1320px;
  min-height:860px;display:grid;grid-template-columns:272px 1fr;
  background:var(--frame);border-radius:var(--r-frame);
  box-shadow:0 40px 80px -40px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.6) inset;
  overflow:hidden;transition:grid-template-columns .45s cubic-bezier(.2,.8,.2,1);
}
.frame.collapsed{grid-template-columns:98px 1fr}

/* ---------- Sidebar ---------- */
.sidebar{background:linear-gradient(180deg,#dedede,#d6d6d6);padding:48px 28px;overflow:hidden}
.brand{display:flex;align-items:center;gap:14px;height:42px;margin-bottom:46px}
.brand-mark{width:42px;height:42px;border-radius:8px;background:#262626;display:grid;place-items:center;flex:none;box-shadow:inset 0 0 0 1px rgba(255,255,255,.06)}
.brand-mark svg{width:24px;height:18px}
.brand-name{font-size:23px;font-weight:700;letter-spacing:-.01em;white-space:nowrap;transition:opacity .25s}
.nav{display:flex;flex-direction:column;gap:10px}
.nav a{
  position:relative;display:flex;align-items:center;gap:12px;height:41px;padding:0 12px;
  border-radius:8px;color:var(--ink);text-decoration:none;font-size:15px;font-weight:600;white-space:nowrap;
  transition:background .2s,color .2s;
}
.nav a svg{width:18px;height:18px;flex:none}
.nav a:hover{background:rgba(0,0,0,.05)}
.nav a.active{background:var(--dark);color:#fff;box-shadow:0 0 0 1px rgba(255,255,255,.1) inset}
.nav .lbl{transition:opacity .25s}
.count{margin-left:auto;min-width:22px;height:22px;border-radius:50%;background:var(--lime);color:var(--lime-ink);font-size:12px;font-weight:700;display:grid;place-items:center;transition:all .35s}
.frame.collapsed .sidebar{padding:48px 28px}
.frame.collapsed .brand-name,.frame.collapsed .nav .lbl{opacity:0;pointer-events:none}
.frame.collapsed .nav a{width:41px;padding:0 11.5px}
.frame.collapsed .count{position:absolute;top:-4px;right:-10px;margin:0}

/* ---------- Main ---------- */
.main{padding:48px 30px 40px;min-width:0}
.topbar{display:flex;align-items:center;justify-content:space-between;height:32px}
.page-title{display:flex;align-items:center;gap:14px;font-size:18px;font-weight:500;color:var(--ink-2);text-decoration:none}
.page-title svg{width:20px;height:20px}
.search{display:flex;align-items:center;gap:8px;width:260px;height:34px;border-radius:var(--r-pill);background:#dcdcdc;padding:0 14px;color:#555}
.search svg{width:16px;height:16px;flex:none}
.search input{font-size:13px;width:100%}
.search input::placeholder{color:#666}

.sort{display:flex;align-items:center;gap:14px;margin-top:22px}
.sort-lbl{display:flex;align-items:center;gap:6px;font-size:15px;color:var(--ink-2)}
.sort-lbl svg{width:17px;height:17px}
.chips{display:flex;gap:8px}
.chips button{height:27px;padding:0 17px;border-radius:var(--r-pill);background:#e0e0e0;font-size:13px;color:var(--ink-2);transition:.2s}
.chips button:hover{background:#d6d6d6}
.chips button.on{background:var(--lime);color:var(--lime-ink);font-weight:600}

/* KPI row */
.kpis{display:grid;grid-template-columns:156px 156px 156px 1fr;gap:18px;margin-top:22px;align-items:stretch}
.kpi{position:relative;height:180px;border-radius:var(--r-card);background:linear-gradient(180deg,#f0f0f0,#fafafa);box-shadow:var(--shadow);display:flex;flex-direction:column;align-items:center;padding:12px 10px 16px;text-align:center}
.delta{position:absolute;top:10px;left:10px;display:flex;align-items:center;gap:3px;height:18px;padding:0 6px;border-radius:6px;background:#fff;font-size:10px;font-weight:600;color:var(--ink)}
.delta svg{width:10px;height:10px;color:var(--lime-deep)}
.kpi-img{width:84px;height:84px;object-fit:cover;margin-top:8px;mix-blend-mode:multiply;-webkit-mask-image:radial-gradient(circle at 50% 50%,#000 48%,transparent 70%);mask-image:radial-gradient(circle at 50% 50%,#000 48%,transparent 70%)}
.kpi-lbl{font-size:14px;font-weight:500;color:var(--ink-2);margin-top:auto}
.kpi-val{font-size:30px;font-weight:700;color:#3a3a3a;letter-spacing:-.01em;margin-top:2px}
.kpi.dark{background:#252525;box-shadow:0 0 0 1px #111 inset, 0 12px 30px -16px rgba(0,0,0,.5);overflow:visible}
.kpi.dark .kpi-lbl{color:#eee}
.kpi.dark .kpi-val{color:#fff}
.dark-img{mix-blend-mode:screen;width:92px;height:92px;filter:brightness(1.35) contrast(1.1)}
.ribbon{position:absolute;top:-6px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:5px;height:24px;padding:0 10px;border-radius:var(--r-pill);background:var(--violet);color:#fff;font-size:10.5px;font-weight:600;white-space:nowrap;box-shadow:0 4px 12px -4px rgba(74,34,214,.6)}
.ribbon svg{width:13px;height:13px}
.top3{align-items:stretch;text-align:left;padding:18px 16px 10px;background:#fbfbfb}
.t3-title{font-size:14px;font-weight:600;color:var(--ink-2);margin-bottom:6px}
.t3 li{display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid var(--line)}
.t3 li:last-child{border-bottom:0}
.t3 .rk{font-size:12px;color:var(--muted);width:20px}
.t3 img{width:28px;height:28px;object-fit:cover;mix-blend-mode:multiply;border-radius:6px}
.t3 .nm{flex:1;font-size:11px;color:var(--ink-2);line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.t3 .nm b{display:block;font-size:10px;font-weight:700;color:var(--ink)}
.t3 .go{width:16px;height:16px;color:#222}

/* Board */
.board{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);gap:18px;margin-top:22px;align-items:start}
.col{display:flex;flex-direction:column;gap:18px;min-height:120px}
.card{background:linear-gradient(180deg,#f9f9f9,#f3f3f3);border-radius:var(--r-card);box-shadow:var(--shadow);padding:22px 28px 24px;transition:box-shadow .2s, transform .2s}
.card-head{display:flex;align-items:center;justify-content:space-between;cursor:grab;user-select:none}
.card-head h3{font-size:17px;font-weight:600;color:var(--ink-2)}
.more{width:24px;height:24px;display:grid;place-items:center;color:#333}
.more svg{width:18px;height:18px}

.chart{height:160px;margin-top:18px}
.chart svg{width:100%;height:100%;display:block}
.days{display:flex;justify-content:space-between;margin-top:12px;font-size:13px;color:#555}

.status{margin-top:18px;display:flex;flex-direction:column;gap:12px}
.st-row{display:grid;grid-template-columns:90px 1fr 36px;align-items:center;gap:12px;font-size:13px;color:var(--ink-2)}
.st-bar{height:8px;border-radius:99px;background:#e2e2e2;overflow:hidden}
.st-bar i{display:block;height:100%;border-radius:99px}
.st-row b{text-align:right;font-weight:600}

.table{width:100%;border-collapse:collapse;margin-top:14px;font-size:14px}
.table th{white-space:nowrap;text-align:left;font-weight:500;color:var(--ink-2);padding:12px 0}
.table td{padding:11px 0;color:#333;white-space:nowrap}
.table th:first-child,.table td:first-child{width:44px}
.table td:last-child,.table th:last-child{text-align:right;font-weight:600}
.table th:last-child{font-weight:500}
.table td{padding-right:12px}.table td:last-child{padding-right:0}
.table tbody tr{border-top:1px solid #ececec}
.prod{display:inline-flex;align-items:center;gap:8px;color:var(--muted);font-size:13px}
.prod img{width:24px;height:24px;border-radius:6px;object-fit:cover;mix-blend-mode:multiply}
.prod img.dk{mix-blend-mode:normal;background:#000}
.pill{display:inline-block;height:22px;line-height:22px;padding:0 10px;border-radius:99px;font-size:11.5px;font-weight:600}
.pill.delivered{background:#1f1f1f;color:#fff}
.pill.shipped{background:#e7e1ff;color:#4a22d6}
.pill.processing{background:#b8f227;color:#1c2a00}
.pill.cancelled{background:#e4e4e4;color:#777}

.table tr.hit td{background:rgba(184,242,39,.25)}

/* ---------- Drag & drop ---------- */
.card.dragging{position:absolute;z-index:100;pointer-events:none;box-shadow:0 30px 60px -20px rgba(0,0,0,.35),0 0 0 1px rgba(0,0,0,.04);transform:rotate(-1deg) scale(1.02);background:#fbfbfb}
.drop-slot{border:2px dashed #b9b9b9;border-radius:var(--r-card);display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:8px;padding-bottom:28px;color:#555;font-size:17px;font-weight:600;background:rgba(255,255,255,.25)}
.drop-slot svg{width:26px;height:26px}
body.is-dragging{cursor:grabbing}

/* fixed canvas scaled to viewport */
.stage{position:relative;z-index:1;width:100%;overflow:hidden}
.canvas{position:relative;width:1460px;padding-bottom:1px;transform-origin:top left}
.board{grid-template-columns:minmax(0,.74fr) minmax(0,1.26fr)}
.main{min-width:0}
.table th,.table td{padding-right:10px}
.table{font-size:13.5px}
.prod{font-size:12.5px}
.card[data-id="orders"]{overflow:hidden}
.table th:first-child,.table td:first-child{width:34px}
.card[data-id="orders"]{padding:22px 24px 18px}
.prod{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.table td:nth-child(4){max-width:160px}
