/* =========================================================
   BUREAU — mobile-first design system
   Obsidian + electric cyan. 44px+ touch targets everywhere.
   Bottom navigation on small screens, sidebar on ≥ 880px.
   ========================================================= */

:root {
  /* Surfaces */
  --bg:        #050505;
  --bg-1:      #0a0a0a;
  --bg-2:      #0d0d0d;
  --bg-3:      #131313;
  --bg-4:      #1a1a1a;
  --bg-glass:  rgba(13, 13, 13, 0.7);

  /* Ink */
  --ink-100:   #f0eeee;
  --ink-200:   #c4c7c7;
  --ink-300:   #8e9192;
  --ink-400:   #5f5e5e;
  --ink-500:   #2a2a2a;

  /* Borders */
  --rule:      rgba(255,255,255,0.08);
  --rule-2:    rgba(255,255,255,0.16);
  --rule-3:    rgba(255,255,255,0.28);

  /* Accents */
  --cyan:      #00f2ff;
  --cyan-2:    #74f5ff;
  --cyan-soft: rgba(116,245,255,0.12);
  --cyan-glow: rgba(0,242,255,0.35);
  --amber:     #ffb86b;
  --red:       #ff2e4d;
  --red-glow:  rgba(255,46,77,0.35);
  --green:     #4ade80;
  --green-glow:rgba(74,222,128,0.35);

  /* Type */
  --f-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Layout */
  --nav-h-mobile: 64px;
  --header-h-mobile: 60px;
  --max-w: 1480px;

  /* Safe-area for iOS */
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --safe-left: env(safe-area-inset-left, 0);
  --safe-right: env(safe-area-inset-right, 0);
}

/* -------- Base -------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink-100);
  font-family: var(--f-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  background-image:
    radial-gradient(ellipse at 85% -5%, rgba(0,242,255,0.08), transparent 55%),
    radial-gradient(ellipse at 15% 105%, rgba(0,242,255,0.05), transparent 55%);
  /* background-attachment: fixed is expensive on mobile — only on desktop */
}
@media (min-width: 880px) {
  body { background-attachment: fixed; }
}

::selection { background: var(--cyan); color: var(--bg); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* Visually hidden helper */
.sr { position: absolute; left: -9999px; }

/* -------- Type -------- */
.display-1 { font-weight: 800; font-size: 32px; letter-spacing: -0.025em; line-height: 1; }
.display-2 { font-weight: 700; font-size: 26px; letter-spacing: -0.02em; line-height: 1.05; }
.h1 { font-weight: 700; font-size: 22px; letter-spacing: -0.015em; line-height: 1.2; }
.h2 { font-weight: 700; font-size: 17px; letter-spacing: -0.005em; line-height: 1.3; }
.h3 { font-weight: 600; font-size: 14px; letter-spacing: 0; line-height: 1.4; }

.label   { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.22em; color: var(--ink-300); }
.label-sm{ font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.28em; color: var(--ink-300); }

.mono { font-family: var(--f-mono); letter-spacing: 0; }
.data { font-family: var(--f-mono); font-feature-settings: 'tnum' 1, 'zero' 1; font-weight: 500; }

.ink-2 { color: var(--ink-200); }
.ink-3 { color: var(--ink-300); }
.ink-4 { color: var(--ink-400); }
.cy    { color: var(--cyan); }
.am    { color: var(--amber); }
.gr    { color: var(--green); }
.rd    { color: var(--red); }
.glow  { text-shadow: 0 0 16px var(--cyan-glow); }

@media (min-width: 880px) {
  .display-1 { font-size: 56px; letter-spacing: -0.035em; }
  .display-2 { font-size: 40px; }
  .h1 { font-size: 28px; }
  .h2 { font-size: 19px; }
}

/* -------- App shell -------- */
.app {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h-mobile) + var(--safe-bottom));
  display: flex;
  flex-direction: column;
}

/* Top app bar (mobile) */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: rgba(5, 5, 5, 0.92);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
@media (min-width: 880px) {
  .top-bar {
    background: rgba(5, 5, 5, 0.78);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
  }
}
.top-bar .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-bar .brand {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  background: rgba(0,242,255,0.06);
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0,242,255,0.15) inset;
}
.top-bar .brand .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan-glow); }
.top-bar .titles { min-width: 0; }
.top-bar .titles .t {
  font-size: 16px; font-weight: 700; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-bar .titles .s {
  font-size: 10px; color: var(--ink-300);
  text-transform: uppercase; letter-spacing: 0.22em;
  margin-top: 2px;
}
.top-bar .right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px;
  background: transparent; border: 1px solid var(--rule-2);
  color: var(--ink-200);
  display: grid; place-items: center;
  cursor: pointer;
  border-radius: 0;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.icon-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.icon-btn:active { background: rgba(0,242,255,0.08); }
.icon-btn .material-symbols-outlined { font-size: 20px; }

/* Content area */
.content {
  flex: 1;
  padding: 16px;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
}

/* Bottom navigation (mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  padding-bottom: var(--safe-bottom);
  background: rgba(5, 5, 5, 0.96);
  border-top: 1px solid var(--rule-2);
  display: grid;
  grid-template-columns: repeat(var(--nav-cols, 4), 1fr);
}
@media (min-width: 880px) {
  .bottom-nav {
    background: rgba(5, 5, 5, 0.92);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
  }
}
.bottom-nav::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: 0.5;
}
.bottom-nav a {
  height: var(--nav-h-mobile);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: var(--ink-300);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: none;
  border-top: 2px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  position: relative;
}
.bottom-nav a:active { background: rgba(0,242,255,0.06); }
.bottom-nav a.active {
  color: var(--cyan);
  border-top-color: var(--cyan);
  background: linear-gradient(180deg, rgba(0,242,255,0.06), transparent 80%);
}
.bottom-nav a .material-symbols-outlined { font-size: 22px; }
.bottom-nav a.active .material-symbols-outlined { filter: drop-shadow(0 0 8px var(--cyan-glow)); }

/* Desktop layout: sidebar replaces bottom-nav */
@media (min-width: 880px) {
  .app {
    flex-direction: row;
    padding-bottom: 0;
  }
  .top-bar { display: none; }
  .top-bar.desktop-show { display: flex; }
  .content {
    padding: 32px clamp(24px, 4vw, 56px) 56px;
  }
  .bottom-nav {
    position: sticky;
    top: 0;
    bottom: auto; left: auto; right: auto;
    z-index: 10;
    width: 232px;
    flex-shrink: 0;
    height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto auto auto 1fr auto;
    border-top: none;
    border-right: 1px solid var(--rule-2);
    padding: 24px 0 16px;
    background: linear-gradient(180deg, rgba(0,242,255,0.02), transparent 30%);
  }
  .bottom-nav::before {
    top: auto; bottom: 0; left: 0; right: 0; height: 1px;
  }
  .bottom-nav .nav-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px 22px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 12px;
  }
  .bottom-nav .nav-brand .b {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--cyan); background: rgba(0,242,255,0.06);
    display: grid; place-items: center;
    box-shadow: 0 0 14px rgba(0,242,255,0.15) inset;
  }
  .bottom-nav .nav-brand .b .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan-glow); }
  .bottom-nav .nav-brand .name { font-size: 14px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; }
  .bottom-nav .nav-brand .sub { font-size: 9px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--cyan-2); margin-top: 4px; }
  .bottom-nav a {
    height: auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--ink-300);
    border-top: none;
    border-left: 2px solid transparent;
  }
  .bottom-nav a.active {
    background: linear-gradient(90deg, rgba(0,242,255,0.08), transparent 90%);
    border-left-color: var(--cyan);
    border-top-color: transparent;
    color: var(--cyan);
  }
  .bottom-nav a .material-symbols-outlined { font-size: 20px; }
  .bottom-nav .nav-foot {
    margin-top: auto;
    padding: 16px 20px 0;
    border-top: 1px solid var(--rule);
    font-size: 11px; color: var(--ink-300);
    display: flex; flex-direction: column; gap: 8px;
  }
  .bottom-nav .nav-foot .you { color: var(--ink-100); font-weight: 500; font-size: 13px; }
  .bottom-nav .nav-foot .em { font-family: var(--f-mono); font-size: 11px; color: var(--ink-300); word-break: break-all; }
  .bottom-nav .nav-foot button {
    margin-top: 8px;
    background: transparent;
    border: 1px solid var(--rule-2);
    color: var(--ink-300);
    padding: 10px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.22em;
    cursor: pointer;
    transition: all 0.18s ease;
  }
  .bottom-nav .nav-foot button:hover { color: var(--cyan); border-color: var(--cyan); }
}

/* On desktop hide elements that are only useful on mobile */
.mobile-only { display: block; }
.desktop-only { display: none; }
@media (min-width: 880px) {
  .mobile-only { display: none; }
  .desktop-only { display: block; }
}

/* -------- Page header -------- */
.page-h {
  margin: 8px 0 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.page-h .eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.32em;
  color: var(--cyan);
}
.page-h .eyebrow::before {
  content: ''; width: 24px; height: 1px; background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan-glow);
}
.page-h h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(30px, 8vw, 56px);
  letter-spacing: -0.025em;
  line-height: 0.95;
  text-transform: uppercase;
}
.page-h h1 em {
  font-style: normal;
  color: var(--cyan);
  font-weight: 300;
  text-shadow: 0 0 22px var(--cyan-glow);
}
.page-h .sub {
  font-size: 13px;
  color: var(--ink-300);
  letter-spacing: 0.02em;
}
@media (min-width: 880px) {
  .page-h { margin: 0 0 28px; }
}

/* -------- Cards / panels --------
   backdrop-filter is GPU-heavy on mobile; we skip it < 880px and use a
   solid-ish bg instead. Same visual weight, much better paint. */
.card {
  background: var(--bg-3);
  border: 1px solid var(--rule-2);
  border-radius: 0;
  padding: 18px;
  position: relative;
}
@media (min-width: 880px) {
  .card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
  }
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.20), transparent);
  pointer-events: none;
}
.card.cyan-edge { border-color: var(--cyan); }
.card.cyan-edge::before { background: var(--cyan); box-shadow: 0 0 12px var(--cyan-glow); opacity: 0.8; }
@media (min-width: 880px) { .card { padding: 22px; } }

/* Stacked vertical gap utility */
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }
.stack-lg > * + * { margin-top: 20px; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 600px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* -------- Stats / tiles -------- */
.tile {
  padding: 16px;
  background: rgba(13,13,13,0.5);
  border: 1px solid var(--rule);
  position: relative;
}
.tile .k {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.26em;
  color: var(--ink-300);
  display: flex; align-items: center; gap: 6px;
}
.tile .k .pdot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan-glow);
  animation: pulse 2.2s ease-in-out infinite;
}
.tile .v {
  font-family: var(--f-mono);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink-100);
  margin-top: 8px;
  line-height: 1;
}
.tile .v.cy { color: var(--cyan); text-shadow: 0 0 14px var(--cyan-glow); }
.tile .v.am { color: var(--amber); }
.tile .delta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-300);
}
@media (min-width: 880px) {
  .tile { padding: 22px; }
  .tile .v { font-size: 36px; }
}

/* -------- Status pills -------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid currentColor;
  background: rgba(0,0,0,0.4);
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.22em;
  white-space: nowrap;
}
.pill .d { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.pill.cy { color: var(--cyan); border-color: rgba(0,242,255,0.4); background: rgba(0,242,255,0.06); }
.pill.am { color: var(--amber); border-color: rgba(255,184,107,0.4); background: rgba(255,184,107,0.06); }
.pill.gr { color: var(--green); border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.06); }
.pill.rd { color: var(--red); border-color: rgba(255,46,77,0.4); background: rgba(255,46,77,0.06); }
.pill.ghost { color: var(--ink-300); border-color: var(--rule-2); background: transparent; }

/* -------- Buttons -------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 14px 18px;
  min-height: 48px;
  border: 1px solid var(--cyan);
  background: transparent;
  color: var(--cyan);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.22em;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  position: relative;
}
.btn:hover { background: rgba(0,242,255,0.08); box-shadow: 0 0 20px var(--cyan-glow); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--cyan);
  color: var(--bg);
  border-color: var(--cyan);
}
.btn-primary:hover { background: var(--cyan-2); border-color: var(--cyan-2); box-shadow: 0 0 24px var(--cyan-glow); }
.btn-ghost {
  border-color: var(--rule-2);
  color: var(--ink-200);
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); background: transparent; box-shadow: 0 0 16px var(--cyan-glow); }
.btn-danger { border-color: rgba(255,46,77,0.4); color: var(--red); }
.btn-danger:hover { background: var(--red); color: var(--bg); box-shadow: 0 0 18px var(--red-glow); }
.btn-block { width: 100%; }
.btn-sm { padding: 10px 14px; min-height: 40px; font-size: 11px; letter-spacing: 0.2em; }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--cyan);
  animation: spin 0.7s linear infinite;
  opacity: 0.9;
}
.btn-primary.is-loading::after { color: var(--bg); }

/* Keyboard-focus rings (accessibility) — distinct from mouse hover */
.btn:focus-visible, .input:focus-visible, .textarea:focus-visible,
.select:focus-visible, .icon-btn:focus-visible, .link:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 18px var(--cyan-glow);
}

/* Disabled inputs (e.g. locked order fields) read as inert, not just dim */
.input:disabled, .textarea:disabled, .select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: rgba(0,0,0,0.2);
  border-color: var(--rule);
}

.link {
  background: transparent; border: none; padding: 6px 0;
  color: var(--ink-200);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.18s ease;
}
.link:hover { color: var(--cyan); }
.link.cy { color: var(--cyan); }
.link.danger { color: var(--red); }

/* -------- Inputs (mobile-first) -------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.28em;
  color: var(--ink-300);
}
.input, .textarea, .select {
  width: 100%;
  min-height: 48px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--rule-2);
  color: var(--ink-100);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(0,242,255,0.18) inset;
}
.input.mono, .textarea.mono { font-family: var(--f-mono); letter-spacing: 0.05em; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }

.input-icon { position: relative; }
.input-icon .input { padding-left: 44px; }
.input-icon .ic {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-300);
  pointer-events: none;
  font-size: 20px;
}

.input-currency {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--rule-2);
  padding: 0 14px;
  min-height: 48px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input-currency:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(0,242,255,0.18) inset;
}
.input-currency .s { color: var(--ink-300); font-family: var(--f-mono); margin-right: 6px; font-size: 16px; }
.input-currency input {
  background: transparent; border: none; outline: none;
  color: var(--ink-100);
  font-family: var(--f-mono); font-size: 18px; font-weight: 500;
  text-align: right;
  width: 100%;
  padding: 12px 0;
  -webkit-appearance: none;
  appearance: none;
}
.input-currency input::-webkit-inner-spin-button,
.input-currency input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-currency input[type="number"] { -moz-appearance: textfield; }

/* Form rows */
.form-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 600px) {
  .form-row.two { grid-template-columns: 1fr 1fr; }
  .form-row.three { grid-template-columns: 1fr 1fr 1fr; }
}

/* -------- Order block (mobile-friendly) -------- */
.order {
  background: var(--bg-3);
  border: 1px solid var(--rule-2);
  position: relative;
  overflow: hidden;
  /* Skip rendering off-screen cards — huge paint win for long lists */
  content-visibility: auto;
  contain-intrinsic-size: 1px 280px;
}
.order .prog {
  height: 2px;
  background: var(--bg-3);
  position: relative;
  overflow: hidden;
}
.order .prog .fill {
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  transition: width 0.45s ease;
}
.order.is-held .prog .fill { background: var(--amber); box-shadow: 0 0 10px rgba(255,184,107,0.45); }
.order.is-cancelled .prog .fill { background: var(--red); }
.order.is-fulfilled .prog .fill { background: var(--green); box-shadow: 0 0 10px var(--green-glow); }

.order-head {
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.order-head:active { background: rgba(0,242,255,0.04); }
.order-head .top-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.order-head .id {
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  color: var(--ink-200); letter-spacing: 0.04em;
}
.order-head .ttl {
  font-size: 17px; font-weight: 700; letter-spacing: -0.005em;
  color: var(--ink-100); line-height: 1.25;
}
.order-head .meta-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-300);
}
.order-head .meta-row .material-symbols-outlined { font-size: 14px; vertical-align: -2px; margin-right: 3px; color: var(--ink-400); }
.order-head .price-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 4px;
}
.order-head .price-row .k {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.28em; color: var(--ink-300);
}
.order-head .price-row .v {
  font-family: var(--f-mono); font-size: 22px; font-weight: 500;
  color: var(--cyan); text-shadow: 0 0 14px var(--cyan-glow);
  letter-spacing: -0.02em;
}
.order-head .price-row .v.am { color: var(--amber); font-family: var(--f-sans); font-size: 13px; text-transform: uppercase; letter-spacing: 0.18em; text-shadow: none; font-weight: 700; }
.order-head .price-row .v .s { color: var(--ink-400); margin-right: 4px; opacity: 0.7; }
@media (min-width: 880px) {
  .order-head { padding: 22px; }
  .order-head .ttl { font-size: 21px; }
  .order-head .price-row .v { font-size: 28px; }
}

/* Item cards inside an order */
.items-mini {
  padding: 0 16px 16px;
  display: grid; gap: 8px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .items-mini { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .items-mini { grid-template-columns: 1fr 1fr 1fr; } }
.item-card {
  background: rgba(5,5,5,0.5);
  border: 1px solid var(--rule);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.item-card .top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.item-card .ico {
  width: 32px; height: 32px;
  background: var(--bg-3); border: 1px solid var(--rule-2);
  display: grid; place-items: center;
  color: var(--ink-200);
  flex-shrink: 0;
}
.item-card .name {
  font-size: 13px; font-weight: 600;
  color: var(--ink-100); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-card .domain {
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--ink-300);
  word-break: break-all;
}
.item-card .foot {
  padding-top: 10px; border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline;
}
.item-card .foot .k {
  font-size: 8.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.26em; color: var(--ink-300);
}
.item-card .foot .v {
  font-family: var(--f-mono); font-size: 15px; font-weight: 500; color: var(--ink-100);
}
.item-card .foot .v .s { color: var(--ink-400); opacity: 0.7; margin-right: 3px; }
.item-card .foot .v.am {
  font-family: var(--f-sans); font-size: 9.5px; color: var(--amber); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.24em;
}

/* -------- List rows -------- */
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}
.row:last-child { border-bottom: none; }
.row .row-title { font-size: 14px; font-weight: 600; color: var(--ink-100); }
.row .row-sub { font-size: 12px; color: var(--ink-300); margin-top: 3px; }
.row .row-amt { font-family: var(--f-mono); font-size: 15px; color: var(--ink-100); }
.row .row-amt.in { color: var(--green); }
.row .row-amt.out { color: var(--amber); }

/* -------- Feed / timeline -------- */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.feed-item:last-child { border-bottom: none; }
.feed-item .when {
  font-family: var(--f-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--ink-300);
  padding-top: 2px;
}
.feed-item .body { font-size: 13px; color: var(--ink-200); line-height: 1.5; }
.feed-item .body strong { color: var(--ink-100); font-weight: 600; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px;
  background: var(--rule-2);
}
.timeline .item {
  position: relative;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.timeline .item:last-child { border-bottom: none; }
.timeline .item::before {
  content: ''; position: absolute; left: -22px; top: 18px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--ink-300);
}
.timeline .item.recent::before {
  background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan-glow);
}
.timeline .item .when {
  font-family: var(--f-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.2em; color: var(--ink-300);
}
.timeline .item .body {
  margin-top: 4px; font-size: 13px; color: var(--ink-200); line-height: 1.5;
}

/* -------- Empty state -------- */
.empty {
  text-align: center;
  padding: 48px 20px;
  border: 1px dashed var(--rule-2);
  background: rgba(13,13,13,0.4);
}
.empty .material-symbols-outlined { font-size: 44px; color: var(--cyan); opacity: 0.5; }
.empty h3 { margin: 14px 0 6px; font-size: 18px; font-weight: 700; }
.empty p { font-size: 13px; color: var(--ink-300); margin: 0 0 20px; }

/* -------- Toast -------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h-mobile) + var(--safe-bottom) + 16px);
  transform: translateX(-50%) translateY(8px);
  background: var(--bg-1);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 12px 18px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.22em;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 0 28px var(--cyan-glow), 0 10px 30px rgba(0,0,0,0.6);
  max-width: calc(100vw - 32px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast[data-kind="warn"] { color: var(--amber); border-color: var(--amber); box-shadow: 0 0 28px rgba(255,184,107,0.35); }
#toast[data-kind="error"] { color: var(--red); border-color: var(--red); box-shadow: 0 0 28px var(--red-glow); }
@media (min-width: 880px) {
  #toast { bottom: 24px; }
}

/* -------- Sheet / modal (mobile-friendly) -------- */
.sheet-back {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 99;
  display: none;
}
.sheet-back.show { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: var(--bg-1);
  border-top: 1px solid var(--cyan);
  box-shadow: 0 0 32px var(--cyan-glow);
  padding: 20px 16px calc(20px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(.2,.7,.2,1);
  max-height: 88vh;
  overflow-y: auto;
  display: none;
}
.sheet.show { display: block; transform: translateY(0); }
.sheet .grabber {
  width: 36px; height: 4px;
  background: var(--rule-2);
  border-radius: 4px;
  margin: 0 auto 14px;
}
@media (min-width: 880px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    width: min(520px, 90vw);
    border: 1px solid var(--cyan);
    padding: 28px;
    max-height: 80vh;
  }
  .sheet.show { transform: translate(-50%, -50%) scale(1); }
  .sheet .grabber { display: none; }
}

/* -------- Sticky form footer (mobile) --------
   For long forms (new-order, edit sheet) — keeps the primary action
   reachable above the keyboard / bottom-nav without scrolling. */
.form-footer {
  position: sticky;
  bottom: calc(var(--nav-h-mobile) + var(--safe-bottom) + 8px);
  z-index: 5;
  margin: 16px -16px -18px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(5,5,5,0) 0, rgba(5,5,5,0.95) 30%);
  border-top: 1px solid var(--rule);
}
.form-footer .btn { width: 100%; }
@media (min-width: 880px) {
  .form-footer {
    position: static;
    margin: 16px 0 0;
    padding: 16px 0 0;
    background: transparent;
  }
}

/* Tighter chip variant for inline tags */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--rule-2);
  background: rgba(0,0,0,0.3);
  color: var(--ink-200);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.04em;
}
.chip.cy { color: var(--cyan); border-color: rgba(0,242,255,0.4); background: rgba(0,242,255,0.06); }

/* -------- Misc helpers -------- */
.flex { display: flex; }
.flex-1 { flex: 1; min-width: 0; }
.row-x { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.text-right { text-align: right; } .text-center { text-align: center; }
.w-full { width: 100%; }
.between { justify-content: space-between; }
.center { justify-content: center; align-items: center; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; }
.opacity-70 { opacity: 0.7; }

/* Hides number-input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Material Symbols defaults */
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; vertical-align: middle; }

/* -------- Animations + reduced-motion -------- */
@keyframes pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes rise  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade  { from { opacity: 0; } to { opacity: 1; } }

.pulse-soft { animation: pulse 2.2s ease-in-out infinite; }
.fade-rise { animation: rise 0.5s cubic-bezier(.2,.7,.2,1) both; }
.stagger > * { animation: rise 0.5s cubic-bezier(.2,.7,.2,1) both; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .18s; }
.stagger > *:nth-child(5) { animation-delay: .24s; }
.stagger > *:nth-child(6) { animation-delay: .30s; }
.stagger > *:nth-child(7) { animation-delay: .36s; }
.stagger > *:nth-child(8) { animation-delay: .42s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fade-rise, .stagger > * { opacity: 1 !important; transform: none !important; }
}

/* -------- Loading skeleton for first paint -------- */
.skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
  border-radius: 0;
}
.skel-card { height: 200px; border: 1px solid var(--rule); }
.skel-line { height: 14px; margin: 8px 0; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* -------- Offline / connection banner -------- */
.banner-offline {
  position: fixed;
  top: calc(var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-110%);
  z-index: 200;
  background: var(--bg-1);
  border: 1px solid var(--amber);
  color: var(--amber);
  padding: 8px 14px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.22em;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: transform 0.3s ease;
  display: flex; align-items: center; gap: 8px;
}
.banner-offline.show { transform: translateX(-50%) translateY(8px); }
.banner-offline .material-symbols-outlined { font-size: 14px; }

/* -------- Code chip (access codes) -------- */
.code-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono);
  font-size: 14px; font-weight: 600;
  color: var(--cyan);
  background: rgba(0,242,255,0.06);
  border: 1px dashed rgba(0,242,255,0.5);
  padding: 6px 12px;
  letter-spacing: 0.12em;
  cursor: pointer;
}
.code-chip:hover { background: rgba(0,242,255,0.12); }
.code-chip .material-symbols-outlined { font-size: 14px; color: var(--ink-300); }
