/* ============================================================
   DPPI Inventory — dark glassmorphism theme, teal accent
   ============================================================ */

:root {
  --bg: #0A0F12;
  --bg-2: #0D141A;
  --surface: #101820;

  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-border-lit: rgba(148, 226, 213, 0.28);
  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --teal: #2DD4BF;
  --teal-bright: #5EEAD4;
  --teal-dim: rgba(45, 212, 191, 0.55);
  --teal-line: rgba(45, 212, 191, 0.35);
  --teal-soft: rgba(45, 212, 191, 0.12);
  --chart-teal: #0D9488;

  --ink: #E8EEF1;
  --ink-2: #A8B8C0;
  --ink-3: #6E828C;

  --good: #34D399;
  --warn: #FBBF24;
  --bad: #FB7185;

  --job-1: #0D9488; --job-2: #8B5CF6; --job-3: #D97706; --job-4: #0284C7; --job-5: #F43F5E;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 9px;

  --shadow-1: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 16px 48px rgba(0, 0, 0, 0.5);

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --nav-w: 232px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- ambient background ---------- */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(1200px 800px at 85% -10%, rgba(13,148,136,.10), transparent 60%),
    radial-gradient(900px 700px at -10% 100%, rgba(2,132,199,.07), transparent 55%),
    var(--bg);
}
/* orbs are pre-blurred radial gradients — no live blur filter, no animation (GPU-cheap) */
.orb { position: absolute; border-radius: 50%; }
.orb-a { width: 720px; height: 720px; top: -260px; right: -180px; background: radial-gradient(circle, rgba(13,148,136,.13), transparent 70%); }
.orb-b { width: 620px; height: 620px; bottom: -220px; left: -220px; background: radial-gradient(circle, rgba(2,132,199,.09), transparent 70%); }
.orb-c { width: 420px; height: 420px; top: 42%; left: 52%; background: radial-gradient(circle, rgba(94,234,212,.05), transparent 70%); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- glass primitives ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  backdrop-filter: blur(10px) saturate(1.3);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-1), var(--glass-inset);
  border-radius: var(--r-lg);
}
.glass-strong { background: var(--glass-strong); }
/* Cheap glass: repeated small surfaces (list rows, stats, calendar cells, cards)
   skip the live backdrop blur — a translucent gradient reads the same on the dark
   bg at a fraction of the GPU cost. Real blur stays on the big chrome surfaces. */
.row-card.glass, .stat.glass, .cal-cell, .card.glass, .chart-card.glass, .table-wrap.glass, .ditem {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: linear-gradient(165deg, rgba(30, 42, 50, .5), rgba(19, 28, 34, .55));
}

/* ---------- shell layout ---------- */
.shell { position: relative; z-index: 1; display: flex; min-height: 100dvh; }
.view { flex: 1; min-width: 0; padding: calc(24px + var(--sat)) 28px calc(32px + var(--sab)); margin-left: var(--nav-w); }

/* ---------- nav ---------- */
.nav {
  position: fixed; z-index: 40; top: 14px; left: 14px; bottom: 14px; width: calc(var(--nav-w) - 28px);
  display: flex; flex-direction: column; padding: 20px 12px 14px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--teal-soft); border: 1px solid var(--teal-line); display: grid; place-items: center; }
.brand-text { font-weight: 800; letter-spacing: .06em; font-size: 15px; }
.brand-text span { display: block; font-weight: 500; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3); }
.nav-items { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-btn {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 13.5px; font-weight: 600; text-align: left;
  transition: background .15s, color .15s;
}
.nav-btn svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-btn:hover { background: rgba(255,255,255,.05); color: var(--ink); }
.nav-btn.active { background: var(--teal-soft); color: var(--teal-bright); border: 1px solid var(--teal-line); padding: 9px 11px; }
.nav-foot { display: flex; align-items: center; gap: 8px; padding: 12px 6px 0; border-top: 1px solid var(--glass-border); }
.nav-user { flex: 1; display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.nav-user:hover { background: rgba(255,255,255,.05); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--teal-soft); border: 1px solid var(--teal-line); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--teal-bright); flex: none; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: none; }
.sync-dot.live { background: var(--good); box-shadow: 0 0 8px rgba(52,211,153,.6); }
.sync-dot.error { background: var(--bad); }
.sync-dot.signed-out { background: var(--warn); }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-title p { color: var(--ink-3); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 700; letter-spacing: .01em;
  background: var(--glass-strong); border: 1px solid var(--glass-border); color: var(--ink);
  transition: transform .12s, background .15s, border-color .15s;
}
.btn:hover { background: rgba(255,255,255,.1); border-color: var(--glass-border-lit); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #14B8A6, #0D9488); border-color: rgba(94,234,212,.4); color: #04211D; }
.btn.primary:hover { background: linear-gradient(135deg, #2DD4BF, #14B8A6); }
.btn.danger { color: var(--bad); border-color: rgba(251,113,133,.3); }
.btn.danger:hover { background: rgba(251,113,133,.1); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(255,255,255,.06); color: var(--ink); }
.btn.sm { padding: 7px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--ink-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: var(--ink); }
.icon-btn.danger:hover { color: var(--bad); background: rgba(251,113,133,.1); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.field input, .field select, .field textarea {
  background: rgba(0,0,0,.28); border: 1px solid var(--glass-border); border-radius: var(--r-sm);
  padding: 11px 13px; font-size: 14px; color: var(--ink); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--teal-line); box-shadow: 0 0 0 3px rgba(45,212,191,.12);
}
.field textarea { resize: vertical; min-height: 72px; }
.field select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236E828C' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.field .hint { font-size: 11.5px; color: var(--ink-3); text-transform: none; letter-spacing: 0; font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.seg { display: inline-flex; background: rgba(0,0,0,.3); border: 1px solid var(--glass-border); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { padding: 7px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); transition: background .15s, color .15s; }
.seg button.active { background: var(--teal-soft); color: var(--teal-bright); }

/* ---------- cards / stats ---------- */
.card { padding: 20px; border-radius: var(--r-lg); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding: 18px 20px; }
.stat .k { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.stat .sub { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.stat.accent .v { color: var(--teal-bright); }

/* ---------- badges ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.tag.active { background: var(--teal-soft); color: var(--teal-bright); border: 1px solid var(--teal-line); }
.tag.free { background: rgba(255,255,255,.05); color: var(--ink-3); border: 1px solid var(--glass-border); }
.tag.warn { background: rgba(251,191,36,.1); color: var(--warn); border: 1px solid rgba(251,191,36,.25); }
.tag.bad { background: rgba(251,113,133,.1); color: var(--bad); border: 1px solid rgba(251,113,133,.25); }
.tag.good { background: rgba(52,211,153,.1); color: var(--good); border: 1px solid rgba(52,211,153,.25); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* ---------- lists / tables ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row-card { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: var(--r-md); transition: border-color .15s, background .15s; cursor: pointer;
  content-visibility: auto; contain-intrinsic-size: auto 73px; }
.row-card:hover { border-color: var(--glass-border-lit); background: var(--glass-strong); }
.row-thumb { width: 46px; height: 46px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid var(--glass-border); object-fit: cover; flex: none; display: grid; place-items: center; color: var(--ink-3); overflow: hidden; }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-main { flex: 1; min-width: 0; }
.row-main .t { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main .s { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-side { display: flex; align-items: center; gap: 10px; flex: none; }
.money { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.money.big { font-size: 15px; color: var(--ink); }

.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; padding: 10px 14px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--glass-border); white-space: nowrap; }
table.data td { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.045); white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
table.data th.num { text-align: right; }

/* ---------- empty state ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 60px 24px; text-align: center; color: var(--ink-3); }
.empty .glyph { width: 64px; height: 64px; border-radius: 18px; background: var(--glass); border: 1px solid var(--glass-border); display: grid; place-items: center; font-size: 26px; }
.empty h3 { color: var(--ink-2); font-size: 16px; }
.empty p { font-size: 13px; max-width: 340px; line-height: 1.5; }

/* ---------- search ---------- */
.searchbar { display: flex; align-items: center; gap: 9px; padding: 9px 14px; border-radius: var(--r-sm); background: rgba(0,0,0,.28); border: 1px solid var(--glass-border); min-width: 210px; }
.searchbar input { background: none; border: none; outline: none; flex: 1; font-size: 13.5px; color: var(--ink); min-width: 0; }
.searchbar svg { color: var(--ink-3); flex: none; }

/* ============================================================
   JOB BOARD — floating node canvas
   ============================================================ */
.board { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: transparent; }
.board-top {
  margin: calc(12px + var(--sat)) 14px 0 calc(var(--nav-w) + 0px);
  padding: 12px 18px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.board-top .back { flex: none; }
.board-title { flex: 1; min-width: 160px; }
.board-title .t { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.board-title .s { font-size: 12px; color: var(--ink-3); margin-top: 1px; display: flex; gap: 10px; flex-wrap: wrap; }
.board-title .s b { color: var(--teal-bright); font-weight: 700; }
.board-metrics { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.board-metric .k { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.board-metric .v { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--teal-bright); font-variant-numeric: tabular-nums; }

.board-body { flex: 1; display: flex; min-height: 0; margin: 12px 14px calc(12px + var(--sab)) calc(var(--nav-w) + 0px); gap: 12px; }

.canvas-area { flex: 1; min-width: 0; min-height: 0; position: relative; display: flex; }
.canvas-wrap { flex: 1; min-width: 0; position: relative; border-radius: var(--r-lg); overflow: auto;
  background: linear-gradient(160deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  border: 1px solid var(--glass-border);
}
.canvas-sizer { position: relative; }
.canvas { position: relative; width: 2200px; height: 1400px; transform-origin: 0 0;
  background: radial-gradient(rgba(255,255,255,.055) 1px, transparent 1.5px) 0 0 / 26px 26px;
  will-change: transform; contain: layout style;
}
.canvas.drop-hot { outline: 2px dashed var(--teal-line); outline-offset: -6px; }

/* kit-expansion wires (top → bottom) */
#linksSvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#linksSvg .wire { fill: none; stroke-width: 2.5; opacity: .85; }
#linksSvg .wire.off { stroke-dasharray: 6 6; opacity: .6; }

/* expand button on kit nodes */
.gexpand { display: block; width: calc(100% - 24px); margin: 0 12px 10px; padding: 6px 0; border-radius: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-2); background: rgba(255,255,255,.05); border: 1px solid var(--glass-border);
  transition: background .15s, color .15s; }
.gexpand:hover { background: var(--teal-soft); color: var(--teal-bright); border-color: var(--teal-line); }

/* expanded kit pieces */
.gchild { position: absolute; width: 178px; display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 12px;
  background: linear-gradient(165deg, rgba(30, 43, 52, 0.92), rgba(15, 23, 29, 0.94));
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-1);
  user-select: none; -webkit-user-select: none; transition: opacity .2s, border-color .2s; }
.gchild .row-thumb { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.gchild .m { flex: 1; min-width: 0; }
.gchild .m .t { font-size: 11.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gchild .m .s { font-size: 10px; color: var(--ink-3); margin-top: 1px; }
.gchild.off { opacity: .45; border-style: dashed; }
.gchild.off .m .t { text-decoration: line-through; }

/* on/off switch for kit pieces */
.gswitch { flex: none; width: 34px; height: 20px; border-radius: 99px; background: rgba(255,255,255,.12);
  border: 1px solid var(--glass-border); position: relative; transition: background .18s, border-color .18s; }
.gswitch span { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-3); transition: transform .18s, background .18s; }
.gswitch.on { background: var(--teal-soft); border-color: var(--teal-line); }
.gswitch.on span { transform: translateX(14px); background: var(--teal); }

/* zoom + minimap HUD */
.canvas-hud { position: absolute; right: 12px; bottom: 12px; z-index: 6; padding: 8px; display: flex; flex-direction: column; gap: 7px; border-radius: 14px; }
.minimap { position: relative; width: 150px; height: 95px; border-radius: 8px; background: rgba(0,0,0,.4); border: 1px solid var(--glass-border); overflow: hidden; cursor: grab; touch-action: none; }
.mm-node { position: absolute; width: 15px; height: 6px; border-radius: 2px; pointer-events: none; opacity: .9; }
.mm-vp { position: absolute; border: 1.5px solid var(--teal); border-radius: 3px; background: rgba(45,212,191,.08); pointer-events: none; }
.zoomrow { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.zoomrow .btn { min-width: 52px; justify-content: center; font-family: var(--mono); font-size: 11.5px; padding: 6px 8px; }
@media (max-width: 900px) {
  .canvas-hud { right: 8px; bottom: 8px; padding: 6px; }
  .minimap { width: 108px; height: 68px; }
}

.gnode {
  position: absolute; width: 216px; border-radius: var(--r-md);
  /* no live backdrop blur inside the scrolling canvas — repaints every scrolled
     frame and makes panning laggy; a translucent gradient reads the same here */
  background: linear-gradient(165deg, rgba(30, 43, 52, 0.92), rgba(15, 23, 29, 0.94));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-1), var(--glass-inset);
  transition: box-shadow .2s, border-color .2s;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.gnode:hover { border-color: var(--glass-border-lit); }
.gnode.dragging { box-shadow: var(--shadow-2), 0 0 0 1px var(--teal-line); z-index: 10; cursor: grabbing; }
.gnode.kit { border-color: rgba(139,92,246,.35); }
.gnode-head { display: flex; align-items: center; gap: 10px; padding: 11px 12px 9px; cursor: grab; }
.gnode-thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: rgba(255,255,255,.06); border: 1px solid var(--glass-border); flex: none; display: grid; place-items: center; color: var(--ink-3); font-size: 15px; overflow: hidden; pointer-events: none; }
.gnode-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gnode-name { flex: 1; min-width: 0; pointer-events: none; }
.gnode-name .t { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gnode-name .s { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.gnode-x { flex: none; }
.gnode-body { padding: 0 12px 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qty-step { display: inline-flex; align-items: center; gap: 2px; background: rgba(0,0,0,.3); border: 1px solid var(--glass-border); border-radius: 8px; }
.qty-step button { width: 26px; height: 26px; display: grid; place-items: center; color: var(--ink-2); font-weight: 700; border-radius: 7px; }
.qty-step button:hover { background: rgba(255,255,255,.08); color: var(--ink); }
.qty-step .q { min-width: 26px; text-align: center; font-family: var(--mono); font-size: 13px; font-weight: 600; }
.gnode-rate { font-family: var(--mono); font-size: 12px; color: var(--teal-bright); font-variant-numeric: tabular-nums; }
.gnode-kitlist { padding: 0 12px 10px; font-size: 11px; color: var(--ink-3); line-height: 1.6; }

.canvas-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.canvas-empty .inner { text-align: center; color: var(--ink-3); }
.canvas-empty .inner .big { font-size: 15px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.canvas-empty .inner p { font-size: 13px; }

/* gear drawer */
.drawer { width: 264px; flex: none; display: flex; flex-direction: column; border-radius: var(--r-lg); overflow: hidden; }
.drawer-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--glass-border); }
.drawer-head .t { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 9px; }
.drawer-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.ditem {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px;
  background: rgba(255,255,255,.035); border: 1px solid var(--glass-border);
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: border-color .15s, background .15s;
}
.ditem:hover { border-color: var(--glass-border-lit); background: rgba(255,255,255,.06); }
.ditem.depleted { opacity: .4; cursor: not-allowed; }
.ditem .row-thumb { width: 34px; height: 34px; border-radius: 8px; pointer-events: none; }
.ditem .m { flex: 1; min-width: 0; pointer-events: none; }
.ditem .m .t { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ditem .m .s { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.ditem .add { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border: 1px solid var(--teal-line); font-weight: 700; }
.drag-ghost {
  position: fixed; z-index: 100; pointer-events: none; width: 200px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: rgba(16,26,32,.8); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--teal-line); box-shadow: var(--shadow-2);
  display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700;
  transform: translate(-50%, -50%) scale(1.02);
}

/* ---------- colour swatches ---------- */
.swatches { display: flex; gap: 9px; flex-wrap: wrap; padding: 2px 0; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform .12s, border-color .15s, box-shadow .15s; }
.swatch:hover { transform: scale(1.12); }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.swatch.none { background: rgba(255,255,255,.06); border: 2px dashed var(--glass-border-lit); color: var(--ink-3); font-size: 11px; display: grid; place-items: center; }
.swatch.none.sel { border-style: solid; border-color: #fff; }

/* ---------- usage logging ---------- */
.usage-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.usage-days { display: flex; gap: 8px; padding: 14px 16px 10px; overflow-x: auto; border-bottom: 1px solid var(--glass-border); flex: none; }
.uday { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 15px; border-radius: 11px; background: rgba(255,255,255,.04); border: 1px solid var(--glass-border); flex: none; transition: border-color .15s, background .15s; }
.uday:hover { border-color: var(--glass-border-lit); }
.uday.active { background: var(--teal-soft); border-color: var(--teal-line); }
.uday .ud-date { font-size: 12.5px; font-weight: 800; }
.uday.active .ud-date { color: var(--teal-bright); }
.uday .ud-state { font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.usage-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.usage-row { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: var(--r-md); background: linear-gradient(165deg, rgba(30,42,50,.5), rgba(19,28,34,.55)); border: 1px solid var(--glass-border); }
.usage-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(12px + var(--sab)); border-top: 1px solid var(--glass-border); flex-wrap: wrap; }
.uf-left, .uf-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crew-stack { display: inline-flex; }
.crew-stack .avatar { width: 22px; height: 22px; font-size: 9px; margin-left: -6px; border: 1.5px solid var(--bg-2); }
.crew-stack .avatar:first-child { margin-left: 0; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.cal-head .month { font-size: 19px; font-weight: 800; min-width: 190px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.cal-dow { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); text-align: center; padding: 4px 0 8px; }
.cal-cell { min-height: 96px; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 4px; background: var(--glass); border: 1px solid var(--glass-border); }
.cal-cell.other { opacity: .35; }
.cal-cell.today { border-color: var(--teal-line); box-shadow: 0 0 0 1px var(--teal-line); }
.cal-cell .d { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.cal-cell.today .d { color: var(--teal-bright); }
.cal-chip { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: rgba(255,255,255,.06); border: 1px solid var(--glass-border); cursor: pointer; overflow: hidden; }
.cal-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip:hover { border-color: var(--glass-border-lit); }

/* ---------- chart ---------- */
.chart-card { padding: 20px; }
.chart-card .chart-title { font-size: 13px; font-weight: 800; letter-spacing: .02em; margin-bottom: 2px; }
.chart-card .chart-sub { font-size: 12px; color: var(--ink-3); margin-bottom: 14px; }
.chart-svg-wrap { position: relative; overflow-x: auto; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; padding: 7px 11px; border-radius: 9px;
  background: rgba(10,15,18,.92); border: 1px solid var(--glass-border-lit);
  font-size: 12px; white-space: nowrap; transform: translate(-50%, -120%);
  box-shadow: var(--shadow-1); display: none;
}
.chart-tip b { font-family: var(--mono); color: var(--teal-bright); }

/* ---------- modal ---------- */
.modal-veil { position: fixed; inset: 0; z-index: 60; background: rgba(5,8,10,.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: calc(100dvh - 60px); display: flex; flex-direction: column; border-radius: var(--r-lg); background: rgba(16,24,30,.92); animation: pop .2s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { max-width: 760px; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-head h2 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 6px 22px 20px; }

/* ---------- toasts ---------- */
.toast-root { position: fixed; z-index: 80; bottom: calc(20px + var(--sab)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 18px; border-radius: 99px; background: rgba(16,24,30,.9); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--glass-border-lit); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-1); animation: toastin .25s cubic-bezier(.2,.9,.3,1.2); }
@keyframes toastin { from { opacity: 0; transform: translateY(12px); } }

/* ---------- gate (local sign-in) ---------- */
.gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; }
.gate-card { width: 100%; max-width: 400px; padding: 32px 30px; text-align: center; }
.gate-card .brand-mark { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 16px; }
.gate-card h1 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.gate-card .sub { color: var(--ink-3); font-size: 13px; margin: 6px 0 22px; }
.gate-users { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.gate-user { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-md); background: rgba(255,255,255,.04); border: 1px solid var(--glass-border); text-align: left; transition: border-color .15s, background .15s; }
.gate-user:hover { border-color: var(--glass-border-lit); background: rgba(255,255,255,.07); }
.gate-user .m { flex: 1; }
.gate-user .m .t { font-size: 14px; font-weight: 700; }
.gate-user .m .s { font-size: 11.5px; color: var(--ink-3); text-transform: capitalize; }
.pin-row { display: flex; gap: 8px; justify-content: center; margin: 14px 0; }
.pin-row input { width: 46px; height: 52px; text-align: center; font-size: 20px; font-family: var(--mono); background: rgba(0,0,0,.3); border: 1px solid var(--glass-border); border-radius: 11px; color: var(--ink); }
.pin-row input:focus { outline: none; border-color: var(--teal-line); box-shadow: 0 0 0 3px rgba(45,212,191,.12); }

/* ---------- gallery ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 6px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--glass-border); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; }
.photo-cell .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 7px; background: rgba(5,8,10,.7); color: var(--bad); display: grid; place-items: center; font-size: 13px; }
.photo-add { aspect-ratio: 1; border-radius: 10px; border: 1px dashed var(--glass-border-lit); display: grid; place-items: center; color: var(--teal); font-size: 22px; cursor: pointer; background: var(--teal-soft); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  :root { --nav-w: 0px; }
  .view { margin-left: 0; padding: calc(18px + var(--sat)) 16px calc(96px + var(--sab)); }
  .nav { top: auto; left: 10px; right: 10px; bottom: calc(10px + var(--sab)); width: auto; flex-direction: row; align-items: center; padding: 8px 10px; border-radius: 18px; }
  .nav-brand, .nav-foot { display: none; }
  .nav-items { flex-direction: row; justify-content: space-around; width: 100%; overflow-x: auto; }
  .nav-btn { flex-direction: column; gap: 4px; font-size: 9.5px; padding: 7px 10px; flex: none; }
  .nav-btn.active { padding: 6px 9px; }
  .board-top { margin: calc(10px + var(--sat)) 10px 0 10px; }
  .board-body { flex-direction: column; margin: 10px 10px calc(88px + var(--sab)) 10px; }
  .drawer { width: 100%; max-height: 34vh; order: 2; }
  .drawer-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .ditem { min-width: 190px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .cal-cell { min-height: 64px; padding: 5px; }
  .cal-chip span { display: none; }
  .page-title h1 { font-size: 21px; }
}

/* ---------- print (invoices) ---------- */
.print-root { display: none; }
@media print {
  body > *:not(.print-root) { display: none !important; }
  body { background: #fff; }
  .print-root { display: block !important; color: #111; font-family: var(--font); }
  .inv-sheet { max-width: 720px; margin: 0 auto; padding: 24px 8px; font-size: 13px; line-height: 1.5; }
  .inv-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; }
  .inv-top h1 { font-size: 26px; letter-spacing: .02em; }
  .inv-top .co { text-align: right; font-size: 12px; color: #333; }
  .inv-meta { display: flex; gap: 40px; margin-bottom: 24px; }
  .inv-meta .blk .k { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #888; margin-bottom: 3px; }
  .inv-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
  .inv-table th { text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #666; border-bottom: 2px solid #222; padding: 7px 8px; }
  .inv-table td { padding: 8px; border-bottom: 1px solid #ddd; }
  .inv-table .num { text-align: right; font-variant-numeric: tabular-nums; }
  .inv-totals { margin-left: auto; width: 260px; }
  .inv-totals .line { display: flex; justify-content: space-between; padding: 4px 8px; }
  .inv-totals .line.total { border-top: 2px solid #222; font-weight: 800; font-size: 15px; padding-top: 8px; margin-top: 4px; }
  .inv-notes { margin-top: 26px; font-size: 12px; color: #444; }
}
