/* ==========================================================================
   Survival-gothic theme: night backdrop, parchment panels, ink outlines, wood bars.
   All artwork is drawn with CSS / inline SVG (no external images or fonts).
   Text colour tokens are re-scoped on paper surfaces, so the same classes work
   on the dark page and on parchment.
   ========================================================================== */
:root {
  --night: #17110b;
  --night-2: #221910;
  --wood: #3b2a1b;
  --wood-2: #2a1d12;
  --wood-hi: #5a4029;
  --ink: #2b1d12;
  --ink-soft: #5c4631;
  --paper: #e9dab5;
  --paper-2: #dcc797;
  --paper-3: #cdb37c;
  --cream: #f1e2bb;
  --tan: #b9a47c;
  --gold: #e3b54d;
  --blood: #8f2c1d;
  --blood-hi: #b5452c;
  --moss: #4d6a28;
  --ochre: #9a5d12;
  --slate: #34566a;

  /* tokens used by components; on the dark page by default */
  --text: var(--cream);
  --muted: var(--tan);
  --link: var(--gold);
  --primary: var(--blood);
  --ok: #9cc25a;
  --warn: #e9a640;
  --danger: #ff8a6b;

  --font-hand: "Xingkai SC", "STXingkai", "华文行楷", "Kaiti SC", "STKaiti", "KaiTi", "楷体", serif;
  --font-body: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --wobble: 255px 14px 225px 14px / 14px 225px 14px 255px;
  --wobble-sm: 12px 3px 14px 4px / 4px 13px 3px 12px;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .17 0 0 0 0 .11 0 0 0 0 .05 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --scribble: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='8' viewBox='0 0 60 8'%3E%3Cpath d='M1 5c6-3 10 1 16-1s9-3 15-1 10 2 16 0 8-1 11 0' fill='none' stroke='%23e3b54d' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* paper surfaces flip the text tokens to ink */
.card, .modal, .banner, .paper {
  --text: var(--ink);
  --muted: #6f5a3f;
  --link: var(--blood);
  --ok: var(--moss);
  --warn: var(--ochre);
  --danger: #a32a17;
  color: var(--text);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--night); }
body {
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 90% 55% at 50% -8%, rgba(227, 140, 60, 0.16), transparent 70%),
    radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.6) 100%),
    var(--noise),
    linear-gradient(180deg, var(--night-2), var(--night));
  background-attachment: fixed;
}
::selection { background: var(--blood); color: var(--cream); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-style: wavy; text-underline-offset: 3px; }
:focus-visible { outline: 2px dashed var(--gold); outline-offset: 2px; }
[v-cloak] { display: none; }
* { scrollbar-color: var(--wood-hi) var(--wood-2); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--wood-2); }
::-webkit-scrollbar-thumb { background: var(--wood-hi); border-radius: 6px; border: 2px solid var(--wood-2); }

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.between { justify-content: space-between; }
.hide-sm { }
@media (max-width: 640px) { .hide-sm { display: none !important; } }
.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; }

/* ---------------------------------------------------------------- paper */
.card, .modal, .banner, .paper { position: relative; isolation: isolate; }
.card::before, .modal::before, .banner::before, .paper::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background:
    var(--noise),
    radial-gradient(ellipse at 50% 40%, var(--paper) 35%, var(--paper-2) 80%, var(--paper-3) 100%);
  box-shadow: inset 0 0 22px rgba(110, 70, 25, 0.45), 0 4px 0 rgba(0, 0, 0, 0.35), 0 10px 24px rgba(0, 0, 0, 0.35);
  filter: url(#ds-rough);
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background:
    repeating-linear-gradient(178deg, rgba(0, 0, 0, 0) 0 9px, rgba(0, 0, 0, 0.13) 9px 11px, rgba(255, 220, 160, 0.03) 11px 13px),
    linear-gradient(180deg, var(--wood-hi), var(--wood) 45%, var(--wood-2));
  border-bottom: 3px solid #120c07;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}
.topbar::after { /* nail heads */
  content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 4px; pointer-events: none;
  background: radial-gradient(circle, #1a120b 1.5px, transparent 2px) 14px 0 / 160px 4px repeat-x;
  opacity: 0.7;
}
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 0 16px; height: 62px; display: flex; align-items: center; gap: 14px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font: 25px/1 var(--font-hand); color: var(--cream); letter-spacing: 1px;
  text-shadow: 0 2px 0 #120c07, 0 0 14px rgba(227, 140, 60, 0.35);
}
.brand:hover { text-decoration: none; color: #fff1cf; }
.brand .fire { width: 32px; height: 32px; display: inline-flex; }
.brand .fire svg { width: 100%; height: 100%; overflow: visible; }
.fire .smoke { display: none; }
.fire .flame { transform-origin: 16px 22px; animation: flicker 1.6s ease-in-out infinite alternate; }
.fire.out .flame { display: none; }
.fire.out .smoke { display: inline; animation: drift 3s ease-in-out infinite; }
@keyframes flicker {
  0% { transform: scale(1, 1) rotate(-2deg); filter: brightness(1); }
  40% { transform: scale(0.94, 1.06) rotate(2deg); filter: brightness(1.15); }
  100% { transform: scale(1.04, 0.95) rotate(-1deg); filter: brightness(0.95); }
}
@keyframes drift { 0% { opacity: 0.2; transform: translateY(2px); } 50% { opacity: 0.8; } 100% { opacity: 0; transform: translateY(-4px); } }

.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px 8px; color: #d8c69c; white-space: nowrap; font: 17px var(--font-hand);
}
.nav a .ico { width: 18px; height: 18px; opacity: 0.8; }
.nav a:hover { color: var(--cream); text-decoration: none; }
.nav a.active { color: var(--gold); background: var(--scribble) center bottom / 60px 8px repeat-x; }
@media (max-width: 1340px) {
  .nav a { padding: 6px 7px 8px; font-size: 16px; }
  .nav a .ico { display: none; }
  .wallet-tag { display: none; }
}
.page { max-width: 1120px; margin: 0 auto; padding: 22px 16px 70px; }

.purse {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 6px;
  background: rgba(0, 0, 0, 0.35); border: 2px solid #120c07; border-radius: var(--wobble);
  color: var(--gold); font: 17px var(--font-hand); white-space: nowrap;
}
.purse:hover { text-decoration: none; color: #ffd77a; }
.wallet-tag { color: var(--tan); font-size: 13px; white-space: nowrap; }
.coin {
  display: inline-block; width: 16px; height: 16px; flex: none; vertical-align: -2px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe7a0, var(--gold) 55%, #a8741a);
  border: 2px solid var(--ink); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

/* bottom bar on phones: crafting-tab style */
.mobile-nav { display: none; }
@media (max-width: 760px) {
  .topbar .nav { display: none; }
  .topbar-inner { height: 56px; gap: 10px; }
  .brand { font-size: 21px; }
  .brand .fire { width: 26px; height: 26px; flex: none; }
  .brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
  .topbar-inner { gap: 6px; }
  .topbar-inner > .grow { flex: 1 0 0; }
  .topbar .btn.sm { padding: 3px 8px 4px; }
  .purse { padding: 2px 9px 2px 5px; font-size: 15px; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; gap: 4px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, var(--wood-hi), var(--wood) 40%, var(--wood-2));
    border-top: 3px solid #120c07; box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.5);
  }
  .mobile-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px 4px;
    color: #cdb98d; font: 13px var(--font-hand); border: 2px solid transparent; border-radius: 10px;
  }
  .mobile-nav a .ico { width: 22px; height: 22px; }
  .mobile-nav a:hover { text-decoration: none; }
  .mobile-nav a.active {
    color: var(--gold); border-color: #120c07;
    background: radial-gradient(circle at 50% 30%, rgba(227, 181, 77, 0.22), rgba(0, 0, 0, 0.35));
    box-shadow: inset 0 0 0 1px rgba(227, 181, 77, 0.35);
  }
  .page { padding-bottom: 104px; }
}

/* ---------------------------------------------------------------- headings & text blocks */
.card { padding: 16px 18px; }
.card-title { font: 20px/1.3 var(--font-hand); margin: 0 0 10px; color: var(--ink); }
.section-title {
  font: 30px/1.2 var(--font-hand); margin: 4px 0 16px; color: var(--cream); letter-spacing: 2px;
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(227, 140, 60, 0.25);
}
.section-title::after {
  content: ""; display: block; width: 120px; height: 8px; margin-top: 4px; background: var(--scribble) left / 60px 8px repeat-x; opacity: 0.85;
}
.row-wrap > .section-title::after, .row > .section-title::after { display: none; }
.card .section-title, .modal .section-title { color: var(--ink); text-shadow: none; }

.banner { padding: 11px 16px 11px 44px; margin-bottom: 16px; font-size: 15px; }
.banner::after { /* ink badge on the left */
  content: "i"; position: absolute; left: 13px; top: 11px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid currentColor; display: grid; place-items: center; font: bold 14px/1 Georgia, serif;
}
.banner.warn { color: #7a3d08; }
.banner.warn::after, .banner.danger::after { content: "!"; }
.banner.warn::before { background: var(--noise), radial-gradient(ellipse at 50% 40%, #eed6a0 30%, #ddb873 100%); }
.banner.danger { color: #8e1f10; }
.banner.danger::before { background: var(--noise), radial-gradient(ellipse at 50% 40%, #ecc9b0 30%, #d69a7c 100%); }
.banner.ok { color: #3b5419; }
.banner.ok::after { content: "✓"; font-size: 13px; }
.banner.ok::before { background: var(--noise), radial-gradient(ellipse at 50% 40%, #e2e3b4 30%, #c3c784 100%); }
.banner.small { font-size: 13px; padding: 8px 12px 8px 40px; }
.banner.small::after { top: 8px; left: 11px; width: 20px; height: 20px; }
.empty { text-align: center; color: var(--muted); padding: 44px 10px; font: 18px var(--font-hand); }
.card.empty:not(.loading)::after {
  content: ""; display: block; width: 44px; height: 44px; margin: 10px auto 0; opacity: 0.55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M16 17c-6 6-9 14-6 20 2 4 8 5 14 5s12-1 14-5c3-6 0-14-6-20z' fill='none' stroke='%232b1d12' stroke-width='2.4' stroke-linejoin='round'/%3E%3Cpath d='M18 16l-4-7 7 3 3-5 3 5 7-3-4 7M16.5 17c4 2.2 11 2.2 15 0' fill='none' stroke='%232b1d12' stroke-width='2.4' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 16px 7px; font: 17px/1.25 var(--font-hand); color: var(--ink); cursor: pointer; white-space: nowrap;
  background: linear-gradient(180deg, #efe1bd, #d2b985);
  border: 2px solid var(--ink); border-radius: var(--wobble);
  box-shadow: 0 3px 0 var(--ink), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px) rotate(-0.6deg); filter: brightness(1.05); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.5); }
.btn .ico { width: 18px; height: 18px; }
.btn.primary {
  color: #f8e9c3; text-shadow: 0 1px 0 #3a0f08;
  background: linear-gradient(180deg, var(--blood-hi), var(--blood) 60%, #6b1f13);
  box-shadow: 0 3px 0 var(--ink), inset 0 1px 0 rgba(255, 200, 160, 0.35);
}
.btn.danger { color: #8e1f10; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text); }
.btn.ghost:hover:not(:disabled) { border-color: currentColor; transform: none; }
.btn.sm { padding: 3px 11px 4px; font-size: 15px; }
.btn.block { width: 100%; }
.topbar .btn.ghost { color: #d8c69c; }

.input, select.input, textarea.input {
  width: 100%; padding: 8px 11px; font: 15px var(--font-body); color: var(--ink); outline: none;
  background: rgba(255, 248, 228, 0.72); border: 2px solid var(--ink-soft); border-radius: var(--wobble-sm);
  box-shadow: inset 0 2px 4px rgba(90, 60, 25, 0.25);
}
.input::placeholder { color: #9a8664; }
.input:focus { border-color: var(--ink); background: #fffaea; box-shadow: inset 0 2px 4px rgba(90, 60, 25, 0.2), 0 0 0 3px rgba(227, 181, 77, 0.45); }
.input.sm { padding: 3px 8px; font-size: 14px; }
.input.mono { font-family: var(--font-mono); }
select.input { appearance: auto; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); }
label.field > span { color: var(--text); font: 17px var(--font-hand); }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.check input, input[type="checkbox"] { accent-color: var(--blood); width: 16px; height: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 13px 4px; font: 16px var(--font-hand); color: #d8c69c; cursor: pointer;
  background: rgba(0, 0, 0, 0.3); border: 2px solid #4d3925; border-radius: var(--wobble);
}
.chip:hover { color: var(--cream); border-color: var(--wood-hi); }
.chip.active { color: #f8e9c3; background: linear-gradient(180deg, var(--blood-hi), var(--blood)); border-color: var(--ink); box-shadow: 0 2px 0 #000; }
.card .chip { color: var(--ink); background: rgba(255, 248, 228, 0.5); border-color: var(--ink-soft); }
.card .chip.active { color: #f8e9c3; background: linear-gradient(180deg, var(--blood-hi), var(--blood)); border-color: var(--ink); }

.stepper { display: inline-flex; align-items: center; border: 2px solid var(--ink); border-radius: var(--wobble-sm); overflow: hidden; background: rgba(255, 248, 228, 0.7); }
.stepper button { border: 0; width: 32px; height: 34px; cursor: pointer; color: var(--ink); font: bold 18px Georgia, serif; background: linear-gradient(180deg, #e2cd9c, #c9ae75); }
.stepper button:hover { filter: brightness(1.08); }
.stepper input { width: 60px; border: 0; text-align: center; height: 34px; background: transparent; color: var(--ink); font: 16px var(--font-mono); outline: none; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-block; padding: 0 9px 1px; font-size: 13px; line-height: 1.6; white-space: nowrap;
  color: var(--muted); border: 1.5px solid currentColor; border-radius: var(--wobble-sm); background: rgba(255, 255, 255, 0.12);
}
.badge.ok { color: var(--ok); background: rgba(120, 160, 60, 0.14); }
.badge.warn { color: var(--warn); background: rgba(230, 150, 50, 0.15); }
.badge.danger { color: var(--danger); background: rgba(200, 60, 40, 0.13); }
.badge.info { color: #34566a; background: rgba(60, 100, 130, 0.13); }
.topbar .badge.info, .side nav .badge.info { color: #9fc3d6; }

/* ---------------------------------------------------------------- materials (inventory items) */
.shelf-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.shelf-head .section-title { margin: 0; }
.shelf-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.search { position: relative; max-width: 280px; flex: 1 1 200px; }
.search .input { padding-left: 34px; }
.search .ico { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); width: 18px; height: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px 16px; }
.product, .item { display: flex; flex-direction: column; gap: 10px; }
.item:nth-child(3n + 1)::before { transform: rotate(-0.35deg); }
.item:nth-child(3n + 2)::before { transform: rotate(0.3deg); }
.item-head { display: flex; gap: 12px; align-items: center; }
.item-name { font: 22px/1.2 var(--font-hand); color: var(--ink); }
.slot {
  position: relative; width: 70px; height: 70px; flex: none; display: grid; place-items: center;
  border-radius: 12px; border: 3px solid var(--ink);
  background: radial-gradient(circle at 50% 42%, #5a4630, #2c2016 70%, #1c140d);
  box-shadow: inset 0 0 0 3px #7a5f3e, inset 0 0 14px rgba(0, 0, 0, 0.7), 0 2px 0 rgba(0, 0, 0, 0.4);
}
.slot-icon { width: 52px; height: 52px; display: block; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45)); }
.slot-icon svg { width: 100%; height: 100%; display: block; }
.item:hover .slot-icon { animation: bob 0.9s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-3px) rotate(3deg); } }
.item.soldout .slot-icon { filter: grayscale(0.85) brightness(0.65); }
.stamp {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-14deg);
  padding: 0 6px; font: 17px/1.3 var(--font-hand); color: #b3311c; white-space: nowrap;
  border: 2px solid #b3311c; border-radius: 4px; background: rgba(240, 220, 180, 0.82);
  box-shadow: 0 0 0 1px rgba(240, 220, 180, 0.8);
}
.item-desc { font-size: 14px; color: var(--muted); }
.price { display: inline-flex; align-items: baseline; gap: 5px; font: 24px/1.1 var(--font-hand); color: var(--ink); }
.price .coin { align-self: center; }
.price small { font: 13px var(--font-body); color: var(--muted); }
.item-foot { border-top: 1.5px dashed rgba(43, 29, 18, 0.35); padding-top: 10px; margin-top: auto; }
.item-foot .row { flex-wrap: wrap; }
.item-foot .stepper { flex: none; }
.item-foot .stepper input { width: 48px; }
.item-foot .btn.grow { flex: 1 1 112px; padding-left: 10px; padding-right: 10px; }

/* legacy avatar (still used by admin lists if any) */
.avatar { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font: 20px var(--font-hand); flex: none; background: var(--wood); color: var(--cream); border: 2px solid var(--ink); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font: 16px var(--font-hand); color: var(--ink-soft); padding: 7px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
table.t td { padding: 8px 10px; border-bottom: 1.5px dashed rgba(43, 29, 18, 0.3); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: rgba(143, 44, 29, 0.08); }

/* ---------------------------------------------------------------- delivery steps */
.steps { display: flex; gap: 0; margin: 8px 0 4px; overflow-x: auto; padding-bottom: 2px; }
.step { flex: 1; min-width: 72px; text-align: center; position: relative; font: 15px var(--font-hand); color: var(--muted); padding-top: 28px; }
.step::before {
  content: ""; position: absolute; top: 4px; left: 50%; width: 18px; height: 18px; margin-left: -9px; z-index: 1;
  border-radius: 50% 45% 52% 48%; border: 2px solid var(--ink-soft); background: var(--paper);
}
.step::after {
  content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 3px;
  background: repeating-linear-gradient(90deg, var(--ink-soft) 0 6px, transparent 6px 11px);
  opacity: 0.6;
}
.step:first-child::after { display: none; }
.step.done { color: var(--ink); }
.step.done::before { background: var(--ink-soft); border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--paper-2); }
.step.done::after { background: var(--ink); opacity: 0.9; height: 3px; }
.step.now { color: var(--blood); }
.step.now::before {
  width: 22px; height: 22px; margin-left: -11px; top: 2px; border-color: var(--ink);
  background: radial-gradient(circle at 50% 60%, #f6c84c, #e8742a 55%, var(--blood));
  animation: ember 1.2s ease-in-out infinite alternate;
}
.step.now::after { background: var(--ink); opacity: 0.9; }
.step.bad { color: #a32a17; }
.step.bad::before { background: #a32a17; border-color: var(--ink); }
@keyframes ember { from { box-shadow: 0 0 4px 1px rgba(232, 116, 42, 0.5); } to { box-shadow: 0 0 12px 4px rgba(232, 116, 42, 0.75); } }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 18px; border-left: 2px dashed var(--ink-soft); position: relative; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--blood); border: 2px solid var(--ink); }

/* ---------------------------------------------------------------- modal + toast */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(20, 12, 5, 0.55), rgba(5, 3, 1, 0.88));
  animation: fade 0.15s ease-out;
}
.modal { width: 100%; max-width: 440px; padding: 22px 22px 20px; max-height: 90vh; overflow: auto; animation: unroll 0.2s ease-out; }
.modal::before { border-width: 3px; }
.modal.wide { max-width: 660px; }
.modal h3 { margin: 0 0 14px; font: 26px/1.2 var(--font-hand); text-align: center; color: var(--ink); }
.modal h3::after { content: ""; display: block; width: 110px; height: 8px; margin: 6px auto 0; background: var(--scribble) center / 60px 8px repeat-x; filter: brightness(0.35) sepia(1); }
@keyframes fade { from { opacity: 0; } }
@keyframes unroll { from { opacity: 0; transform: scaleY(0.92) translateY(-8px); } }

.toasts { position: fixed; top: 74px; left: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: 460px; padding: 8px 18px 9px; pointer-events: auto; text-align: center;
  font: 18px/1.4 var(--font-hand); color: var(--cream); text-shadow: 0 1px 0 #000;
  background: rgba(20, 13, 7, 0.92); border: 2px solid #8a6a3a; border-radius: var(--wobble);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); animation: rise 0.2s ease-out;
}
.toast.error { border-color: #b5452c; color: #ffc2a8; }
.toast.ok { border-color: #7d9a3c; color: #e4f0b8; }
@keyframes rise { from { opacity: 0; transform: translateY(-8px); } }

.captcha { display: flex; gap: 8px; align-items: center; }
.captcha img { height: 42px; cursor: pointer; flex: none; border: 2px solid var(--ink); border-radius: var(--wobble-sm); }

/* ---------------------------------------------------------------- cart / layouts / stats */
.cart-fab { position: relative; }
.cart-fab .count {
  position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 4px;
  font: bold 12px/16px var(--font-mono); text-align: center; color: #fff1cf;
  background: var(--blood); border: 2px solid var(--ink); border-radius: 50%;
}
.layout-2 { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
@media (max-width: 860px) { .layout-2 { grid-template-columns: 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.kpi .label { color: var(--muted); font: 16px var(--font-hand); }
.kpi .value { font: 32px/1.2 var(--font-hand); color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .value.mono { font-family: var(--font-mono); }
.kpi .sub { color: var(--muted); font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .bar i { display: block; width: 100%; max-width: 26px; min-height: 2px; border: 2px solid var(--ink); border-bottom: 0; border-radius: 6px 4px 0 0; background: linear-gradient(180deg, var(--blood-hi), var(--blood)); }
.bars .bar span { font-size: 11px; color: var(--muted); }

/* ---------------------------------------------------------------- admin shell */
.side { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.side nav {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 10px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 12px, rgba(0, 0, 0, 0.12) 12px 14px),
    linear-gradient(90deg, var(--wood-2), var(--wood) 60%, var(--wood-hi));
  border-right: 3px solid #120c07; box-shadow: 6px 0 18px rgba(0, 0, 0, 0.45);
}
.side nav .brand { font-size: 22px; margin: 2px 6px 14px; display: flex; }
.side nav a:not(.brand) { display: block; padding: 6px 12px 7px; margin-bottom: 3px; color: #d8c69c; font: 17px var(--font-hand); border: 2px solid transparent; border-radius: var(--wobble); }
.side nav a:not(.brand):hover { color: var(--cream); text-decoration: none; border-color: #4d3925; }
.side nav a.active { color: var(--ink) !important; background: linear-gradient(180deg, #efe1bd, #d2b985); border-color: var(--ink) !important; box-shadow: 0 2px 0 #000; }
.side main { padding: 20px 22px 70px; min-width: 0; }
@media (max-width: 760px) {
  .side { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side nav { position: static; height: auto; display: flex; flex-wrap: wrap; align-items: center; overflow-x: visible; gap: 6px; border-right: 0; border-bottom: 3px solid #120c07; padding: 8px 10px; }
  .side nav a:not(.brand) { white-space: nowrap; margin: 0; padding: 4px 10px 5px; font-size: 15px; }
  .side nav .brand { display: none; }
  .side main { padding: 16px 16px 70px; }
}
.secret-box { padding: 10px; word-break: break-all; background: rgba(255, 248, 228, 0.55); border: 2px dashed var(--ink-soft); border-radius: var(--wobble-sm); }

.foot { text-align: center; color: #7d6a4c; font: 14px var(--font-hand); padding: 8px 16px 26px; }
@media (max-width: 760px) { .foot { padding-bottom: 96px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
