/* Panel v2 — premium dark, touch-first. Shares the black + metal accents of nargesdavarifard.com. */

:root {
  --font-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --bg: #0c0b0a;
  --bg-deep: #080706;
  --surface: #151311;
  --surface-2: #1b1815;
  --surface-3: #221e1a;
  --field: #100e0c;
  --fg: #f4ede2;
  --muted: #b2a895;
  --faint: #8a8173;
  --hair: rgba(255, 255, 255, 0.06);

  --accent: #d4b06a;
  --accent-2: #f0dca6;
  --accent-ink: #e2c483;
  --accent-soft: rgba(212, 176, 106, 0.12);
  --accent-glow: rgba(212, 176, 106, 0.28);
  --line: rgba(212, 176, 106, 0.14);
  --line-strong: rgba(212, 176, 106, 0.3);
  --on-accent: #12100d;

  --ok: #8fd19e;
  --ok-soft: rgba(143, 209, 158, 0.12);
  --warn: #f0b85c;
  --warn-soft: rgba(240, 184, 92, 0.13);
  --danger: #f08a7a;
  --danger-soft: rgba(240, 138, 122, 0.12);
  --info: #9cc3ec;
  --info-soft: rgba(156, 195, 236, 0.12);

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --side-w: 284px;
  --tabbar-h: 68px;
}

.accent-gold { --accent: #d4b06a; --accent-2: #f0dca6; --accent-ink: #e2c483; --accent-soft: rgba(212, 176, 106, 0.12); --accent-glow: rgba(212, 176, 106, 0.28); --line: rgba(212, 176, 106, 0.14); --line-strong: rgba(212, 176, 106, 0.3); }
.accent-copper { --accent: #c98a5e; --accent-2: #f0c9a6; --accent-ink: #dda07a; --accent-soft: rgba(201, 138, 94, 0.13); --accent-glow: rgba(201, 138, 94, 0.3); --line: rgba(201, 138, 94, 0.16); --line-strong: rgba(201, 138, 94, 0.34); }
.accent-champagne { --accent: #e0cf9e; --accent-2: #f6ead0; --accent-ink: #e8d9ad; --accent-soft: rgba(224, 207, 158, 0.12); --accent-glow: rgba(224, 207, 158, 0.26); --line: rgba(224, 207, 158, 0.14); --line-strong: rgba(224, 207, 158, 0.3); }
.accent-brass { --accent: #c8a860; --accent-2: #e6cf8f; --accent-ink: #d6b872; --accent-soft: rgba(200, 168, 96, 0.12); --accent-glow: rgba(200, 168, 96, 0.28); --line: rgba(200, 168, 96, 0.14); --line-strong: rgba(200, 168, 96, 0.3); }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 520px at 100% -10%, var(--accent-soft), transparent 65%),
    radial-gradient(700px 500px at -10% 110%, rgba(255, 255, 255, 0.025), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent-ink); text-underline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--accent); color: var(--on-accent); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; }
.icon--sm { width: 16px; height: 16px; }
.icon--xs { width: 13px; height: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- App shell ---------- */

.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  height: 100dvh;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.005)), var(--bg-deep);
  overflow-y: auto;
  scrollbar-width: thin;
}

.side__brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 6px; color: var(--fg); text-decoration: none; }
.mark { width: 40px; height: 40px; flex: none; color: var(--accent); }
.side__title { display: block; font-family: var(--font-display); font-size: 24px; font-weight: 500; line-height: 1; }
.side__sub { display: block; margin-top: 3px; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); }

.side__nav { display: grid; gap: 2px; align-content: start; flex: 1; }
.nav-heading { margin: 16px 12px 6px; font-size: 10.5px; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; color: var(--faint); }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--fg); }
.nav-link[aria-current="page"] { background: linear-gradient(90deg, var(--accent-soft), rgba(255, 255, 255, 0.02)); color: var(--fg); }
.nav-link[aria-current="page"] .icon { color: var(--accent); }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.nav-link--quiet { min-height: 38px; font-size: 14px; }

.side__foot { padding-top: 14px; border-top: 1px solid var(--hair); }
.account { display: flex; align-items: center; gap: 12px; padding: 4px 8px 10px; }
.account__text { min-width: 0; }
.account__name { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account__role { display: block; font-size: 12.5px; color: var(--faint); }
.account__actions form { margin: 0; }

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, var(--surface-3), var(--surface));
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
}

/* Business switcher */
.switcher { position: relative; display: block; text-decoration: none; color: inherit; }
.switcher summary { list-style: none; }
.switcher summary::-webkit-details-marker { display: none; }
.switcher__current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  cursor: pointer;
  transition: border-color 0.2s;
}
.switcher__current:hover, .switcher[open] .switcher__current { border-color: var(--line-strong); }
.switcher__text { display: grid; min-width: 0; flex: 1; }
.switcher__label { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--faint); }
.switcher__name { font-family: var(--font-display); font-size: 19px; font-weight: 500; line-height: 1.15; overflow-wrap: anywhere; }
.switcher__chev { color: var(--muted); transition: transform 0.25s var(--ease); }
.switcher[open] .switcher__chev { transform: rotate(180deg); }
.switcher__menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
.switcher__item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border-radius: 12px; color: var(--fg); text-decoration: none; }
.switcher__item:hover { background: rgba(255, 255, 255, 0.05); }
.switcher__item--all { color: var(--muted); }
.logo-icon { width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }

/* Logo badges */
.logo { display: grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: #0b0a09; box-shadow: inset 0 0 0 1px var(--line-strong); }
.logo--sm { width: 36px; height: 36px; }
.logo--md { width: 48px; height: 48px; }
.logo--lg { width: 112px; height: 112px; box-shadow: 0 0 0 1px var(--line-strong), 0 20px 50px -20px var(--accent-glow); }
.logo img { width: 100%; }
.logo--nb-coffee { background: radial-gradient(circle at 50% 40%, #fbf6f0, #efe4d8 72%); box-shadow: 0 0 0 1px rgba(201, 138, 94, 0.6); }
.logo--nb-coffee img { width: 86%; }
.logo--lg.logo--nb-coffee { box-shadow: 0 0 0 1px rgba(201, 138, 94, 0.6), 0 0 0 6px var(--surface), 0 0 0 7px rgba(201, 138, 94, 0.35), 0 20px 50px -20px rgba(201, 138, 94, 0.4); }

/* Main column */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { width: 100%; max-width: 1280px; padding: 34px clamp(18px, 3.4vw, 44px) 72px; }

.tabbar { display: none; }

/* ---------- Page head ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 26px; }
.page-head__text { min-width: 0; flex: 1 1 320px; }
.eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 500; letter-spacing: 0.26em; text-transform: uppercase; color: var(--accent-ink); }
.title { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: clamp(32px, 3.6vw, 46px); line-height: 1.05; letter-spacing: -0.005em; }
.page-head__sub, .page-head > .muted, .page-head .muted { margin: 8px 0 0; max-width: 48rem; color: var(--muted); }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; color: var(--muted); font-size: 14px; text-decoration: none; }
.back:hover { color: var(--fg); }

.section { margin-top: 34px; }
.section__title { margin: 30px 0 14px; font-family: var(--font-display); font-weight: 500; font-size: 26px; }

/* ---------- Cards ---------- */

.card {
  position: relative;
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 40%), var(--surface);
  box-shadow: var(--shadow);
}
.card--narrow { max-width: 460px; margin-inline: auto; }
.card--form { max-width: 860px; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card__title { margin: 0 0 4px; font-family: var(--font-display); font-weight: 500; font-size: 24px; line-height: 1.2; }
.card > .muted:last-child { margin-bottom: 0; }

.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 16px; margin: 0; }
.row__icon { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.row__main { flex: 1; min-width: 0; }
.row__main p { margin: 0; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.split .card { margin: 0; }

/* ---------- KPIs ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "label icon" "value value" "hint hint";
  column-gap: 12px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 55%), var(--surface);
  color: var(--fg);
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.25s, transform 0.35s var(--ease);
}
a.kpi:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.kpi__icon { grid-area: icon; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.kpi__label { grid-area: label; font-size: 13px; color: var(--muted); }
.kpi__value { grid-area: value; margin-top: 6px; font-size: clamp(24px, 2.2vw, 32px); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; white-space: nowrap; }
.kpi__hint { grid-area: hint; font-size: 12px; color: var(--faint); }
.kpi--warn .kpi__icon { background: var(--warn-soft); color: var(--warn); }
.kpi--warn .kpi__value { color: var(--warn); }
.kpi--danger .kpi__icon { background: var(--danger-soft); color: var(--danger); }
.kpi--danger .kpi__value { color: var(--danger); }

/* ---------- Toolbar, search, chips ---------- */

.toolbar { display: flex; gap: 10px; margin: 4px 0 14px; }
.search { position: relative; flex: 1; display: block; }
.search .icon { position: absolute; left: 16px; top: 50%; translate: 0 -50%; color: var(--faint); pointer-events: none; }
.search input { padding-left: 46px; min-height: 52px; border-radius: 16px; font-size: 16px; }

.chips { display: flex; gap: 8px; margin: 0 -4px 18px; padding: 2px 4px 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}
.chip span { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); font-size: 12px; text-align: center; }
.chip:hover { color: var(--fg); border-color: var(--line); }
.chip[aria-current="true"] { border-color: var(--line-strong); background: var(--accent-soft); color: var(--fg); }
.chip[aria-current="true"] span { background: var(--accent); color: var(--on-accent); }
.filter-note { margin: -6px 0 16px; font-size: 14px; color: var(--muted); }

/* ---------- Stock items ---------- */

.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.item {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 50%), var(--surface);
  overflow: hidden;
  transition: border-color 0.25s, transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.item:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.item--low { border-color: rgba(240, 184, 92, 0.28); }
.item--out { border-color: rgba(240, 138, 122, 0.32); background: linear-gradient(180deg, rgba(240, 138, 122, 0.06), rgba(255, 255, 255, 0) 60%), var(--surface); }
.item__main { display: grid; gap: 8px; padding: 18px 18px 16px; color: var(--fg); text-decoration: none; flex: 1; }
.item__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.item__cat { font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__name { font-size: 18px; font-weight: 500; line-height: 1.25; }
.item__qty { color: var(--muted); }
.item__qty strong { font-size: 30px; font-weight: 500; color: var(--fg); letter-spacing: -0.01em; }
.item--low .item__qty strong { color: var(--warn); }
.item--out .item__qty strong { color: var(--danger); }
.item__meta { font-size: 12.5px; color: var(--faint); }
.item__actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--hair); }
.mini-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; transition: background-color 0.2s, color 0.2s; }
.mini-btn + .mini-btn { border-left: 1px solid var(--hair); }
.mini-btn--in:hover { background: var(--ok-soft); color: var(--ok); }
.mini-btn--out:hover { background: var(--accent-soft); color: var(--accent-ink); }

progress.level { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
progress.level::-webkit-progress-bar { background: rgba(255, 255, 255, 0.07); border-radius: 999px; }
progress.level::-webkit-progress-value { background: linear-gradient(90deg, var(--ok), #b6e4c0); border-radius: 999px; }
progress.level::-moz-progress-bar { background: linear-gradient(90deg, var(--ok), #b6e4c0); border-radius: 999px; }
progress.level--low::-webkit-progress-value { background: linear-gradient(90deg, #e09a3c, var(--warn)); }
progress.level--low::-moz-progress-bar { background: linear-gradient(90deg, #e09a3c, var(--warn)); }
progress.level--out::-webkit-progress-value { background: var(--danger); }
progress.level--out::-moz-progress-bar { background: var(--danger); }

/* ---------- Item detail ---------- */

.detail { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.detail .card { margin: 0; }
.stat__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat__label { font-size: 13px; color: var(--muted); }
.stat__qty { margin: 6px 0 14px; color: var(--muted); font-size: 20px; }
.stat__qty strong { font-size: clamp(46px, 6vw, 64px); font-weight: 500; line-height: 1; color: var(--fg); letter-spacing: -0.02em; }
.stat--low .stat__qty strong { color: var(--warn); }
.stat--out .stat__qty strong { color: var(--danger); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 20px 0 0; }
.facts dt { font-size: 12px; color: var(--faint); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.stat__notes { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); color: var(--muted); font-size: 14px; }

/* Movement type picker */
.move-form { container-type: inline-size; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
@container (min-width: 560px) { .segmented { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.segment { position: relative; cursor: pointer; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment__box {
  --tone: var(--accent);
  --tone-soft: var(--accent-soft);
  display: grid;
  gap: 2px;
  height: 100%;
  padding: 14px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: var(--field);
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.segment--in .segment__box { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.segment--waste .segment__box { --tone: var(--danger); --tone-soft: var(--danger-soft); }
.segment--count .segment__box { --tone: var(--info); --tone-soft: var(--info-soft); }
.segment__box .icon { color: var(--faint); margin-bottom: 6px; }
.segment__label { font-weight: 500; }
.segment__hint { font-size: 12px; color: var(--faint); line-height: 1.3; }
.segment:hover .segment__box { border-color: var(--line); }
.segment input:checked + .segment__box { border-color: var(--tone); background: var(--tone-soft); box-shadow: inset 0 0 0 1px var(--tone); }
.segment input:checked + .segment__box .icon { color: var(--tone); }
.segment input:focus-visible + .segment__box { outline: 2px solid var(--accent); outline-offset: 2px; }

.lbl-count { display: none; }
.move-form:has(input[name="kind"][value="count"]:checked) .lbl-move { display: none; }
.move-form:has(input[name="kind"][value="count"]:checked) .lbl-count { display: inline; }
.move-form:has(input[name="kind"]:not([value="in"]):checked) .cost-field { display: none; }

.stepper { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--field); overflow: hidden; }
.stepper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stepper input { flex: 1; min-width: 0; min-height: 60px; border: 0; border-radius: 0; background: transparent; box-shadow: none !important; text-align: center; font-size: 26px; font-weight: 500; }
.stepper__unit { display: flex; align-items: center; padding-right: 12px; color: var(--muted); font-size: 15px; }
.stepper__btn { display: grid; place-items: center; width: 60px; flex: none; border: 0; background: rgba(255, 255, 255, 0.03); color: var(--fg); cursor: pointer; transition: background-color 0.2s; }
.stepper__btn:hover { background: var(--accent-soft); color: var(--accent-ink); }
.stepper__btn:active { background: var(--accent-glow); }
.input-affix { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--field); overflow: hidden; }
.input-affix input { border: 0; background: transparent; box-shadow: none !important; }
.input-affix span { padding: 0 14px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.input-affix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Movement history */
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline__row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--hair); }
.timeline__row:last-child { border-bottom: 0; }
.timeline__icon { --tone: var(--accent); --tone-soft: var(--accent-soft); display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--tone-soft); color: var(--tone); }
.timeline__row--in .timeline__icon { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.timeline__row--waste .timeline__icon { --tone: var(--danger); --tone-soft: var(--danger-soft); }
.timeline__row--count .timeline__icon { --tone: var(--info); --tone-soft: var(--info-soft); }
.timeline__main { display: grid; min-width: 0; flex: 1; }
.timeline__title { font-weight: 500; }
.timeline__title a { color: var(--fg); text-decoration: none; }
.timeline__title a:hover { text-decoration: underline; }
.timeline__meta { font-size: 13px; color: var(--faint); }
.timeline__meta em { font-style: normal; color: var(--muted); }
.timeline__balance { display: grid; text-align: right; font-weight: 500; white-space: nowrap; }
.timeline__balance span { font-size: 11px; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.delta { margin-left: 6px; font-weight: 500; white-space: nowrap; }
.delta--up { color: var(--ok); }
.delta--down { color: var(--danger); }
.section .timeline, .card .timeline { margin-top: 2px; }
.section > .timeline { padding: 6px 18px; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--surface); }

/* Dashboard alerts */
.alert-list { display: grid; margin: 0; padding: 0; list-style: none; }
.alert-list__row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; min-height: 52px; padding: 0 4px; border-bottom: 1px solid var(--hair); color: var(--fg); text-decoration: none; }
.alert-list li:last-child .alert-list__row { border-bottom: 0; }
.alert-list__row:hover .alert-list__name { text-decoration: underline; }
.alert-list__qty { color: var(--muted); white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot--low { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.dot--out { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.calm { display: flex; align-items: center; gap: 10px; margin: 6px 0; color: var(--ok); }

/* ---------- Tiles & business cards ---------- */

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 55%), var(--surface);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.25s, transform 0.35s var(--ease);
}
.tile:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.tile__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 6px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); }
.tile__name { font-family: var(--font-display); font-size: 23px; font-weight: 500; }
.tile__text { font-size: 14px; color: var(--muted); }

.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.biz-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 22px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: radial-gradient(120% 80% at 50% 0%, var(--accent-soft), transparent 60%), var(--surface);
  color: var(--fg);
  text-align: center;
  text-decoration: none;
  transition: border-color 0.3s, transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.biz-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 40px 70px -40px var(--accent-glow); }
.biz-card .logo { margin-bottom: 14px; }
.biz-card__kind { font-size: 11px; font-weight: 500; letter-spacing: 0.26em; text-transform: uppercase; color: var(--accent-ink); }
.biz-card__name { font-family: var(--font-display); font-size: 28px; font-weight: 500; line-height: 1.15; }
.biz-card__role { color: var(--muted); font-size: 14px; }
.biz-card__go { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; padding: 8px 16px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }

/* ---------- Tables ---------- */

.table-wrap { margin-bottom: 18px; overflow-x: auto; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { padding: 13px 16px; text-align: left; font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--hair); white-space: nowrap; background: rgba(255, 255, 255, 0.015); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-inactive td { opacity: 0.55; }

details.actions summary { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--accent-ink); list-style: none; }
details.actions summary::-webkit-details-marker { display: none; }
details.actions summary::after { content: "▾"; font-size: 11px; }
details.actions[open] { min-width: 280px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 12px 0 0; }
.inline-form--grow { flex-wrap: nowrap; align-items: center; margin: 0; flex: 1; }
.inline-form--grow input { flex: 1; min-width: 0; }

.rows { display: grid; margin: 0 0 14px; padding: 0; list-style: none; }
.rows__item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.rows__item form { margin: 0; }
.add-row { padding-top: 4px; }

/* ---------- Forms ---------- */

.form { display: grid; gap: 18px; margin-top: 16px; }
.form--grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); align-items: start; }
.form__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.field { display: grid; gap: 7px; }
.field > span:first-child { font-size: 13px; font-weight: 500; color: var(--muted); }
.field small { color: var(--faint); font-size: 12.5px; }
.field--inline { gap: 4px; }
.field--inline > span:first-child { font-size: 12px; }
.field--wide { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--field);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder { color: var(--faint); }
select { cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 38px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inline-form input, .inline-form select { min-height: 42px; padding: 8px 12px; font-size: 15px; }

.check { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; accent-color: var(--accent); flex: none; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.perm-group { margin: 0; padding: 12px 16px; border: 1px solid var(--hair); border-radius: 14px; background: rgba(255, 255, 255, 0.015); }
.perm-group legend { padding: 0 6px; font-size: 11px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-ink); }
.role-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.role-head .field { flex: 1 1 260px; }
.role-help { margin-top: 18px; }
.role-help summary { cursor: pointer; color: var(--accent-ink); }
.role-help ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); }
.role-help li { margin: 4px 0; }

.danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--hair); }
.danger-zone p { margin: 2px 0 0; }

/* ---------- Buttons, badges, flash ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--fg);
  font-weight: 500;
  font-size: 14.5px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s, box-shadow 0.25s;
}
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn--primary { border-color: transparent; background: linear-gradient(135deg, var(--accent-2), var(--accent) 55%); color: var(--on-accent); box-shadow: 0 12px 30px -14px var(--accent-glow); }
.btn--primary:hover { transform: translateY(-1px); background: linear-gradient(135deg, var(--accent-2), var(--accent) 45%); box-shadow: 0 18px 36px -14px var(--accent-glow); border-color: transparent; }
.btn--small { min-height: 38px; padding: 0 14px; font-size: 13.5px; }
.btn--lg { min-height: 56px; font-size: 16px; border-radius: 14px; }
.btn--block { width: 100%; }
.btn--danger { border-color: rgba(240, 138, 122, 0.4); color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); background: var(--danger-soft); }

.icon-btn { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--hair); border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { border-color: var(--line-strong); color: var(--fg); }
.icon-btn--danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.badge--active { border-color: rgba(143, 209, 158, 0.4); color: var(--ok); background: var(--ok-soft); }
.badge--pending { color: var(--accent-ink); background: var(--accent-soft); }
.badge--low { border-color: rgba(240, 184, 92, 0.4); color: var(--warn); background: var(--warn-soft); }
.badge--out { border-color: rgba(240, 138, 122, 0.4); color: var(--danger); background: var(--danger-soft); }

.flash { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; padding: 13px 16px; border: 1px solid; border-radius: 14px; font-weight: 500; }
.flash--ok { border-color: rgba(143, 209, 158, 0.35); background: var(--ok-soft); color: var(--ok); }
.flash--error { border-color: rgba(240, 138, 122, 0.4); background: var(--danger-soft); color: var(--danger); }
.flash--info { border-color: var(--line-strong); background: var(--accent-soft); color: var(--fg); font-weight: 400; }

.empty { display: grid; justify-items: center; gap: 6px; padding: 56px 24px; border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.012); text-align: center; }
.empty__icon { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 8px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); }
.empty__icon .icon { width: 26px; height: 26px; }
.empty__title { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 500; }
.empty__text { max-width: 30rem; margin: 0 0 12px; color: var(--muted); }

/* ---------- Login & error pages ---------- */

.bare { overflow-x: hidden; }
.bare__glow {
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(30% 30% at 30% 30%, rgba(212, 176, 106, 0.22), transparent 70%),
    radial-gradient(28% 26% at 72% 70%, rgba(201, 138, 94, 0.16), transparent 70%),
    radial-gradient(20% 20% at 70% 25%, rgba(224, 207, 158, 0.1), transparent 70%);
  filter: blur(10px);
  animation: drift 24s var(--ease) infinite alternate;
}
@keyframes drift { from { transform: translate3d(-2%, -2%, 0) scale(1); } to { transform: translate3d(2%, 2%, 0) scale(1.08); } }
.bare__main { display: grid; align-content: center; justify-items: stretch; gap: 26px; min-height: 100vh; min-height: 100dvh; padding: 32px 18px; }
.bare__brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--font-display); font-size: 26px; font-weight: 500; }
.bare__brand .mark { width: 48px; height: 48px; }
.bare .card--narrow {
  width: 100%;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  background: rgba(22, 20, 17, 0.62);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 40px 100px -40px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.bare .card--narrow .title { font-size: 38px; }
.bare__foot { margin: 0; text-align: center; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); }
.login .btn--block { min-height: 54px; margin-top: 4px; font-size: 16px; }

/* ---------- Tablet & phone: top bar + bottom tabs ---------- */

@media (max-width: 1099px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--hair);
    background: rgba(12, 11, 10, 0.78);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
  }
  .topbar .switcher { flex: 1; min-width: 0; }
  .topbar .switcher__current { padding: 7px 10px; border-radius: 14px; }
  .topbar .switcher__label { display: none; }

  .content { padding: 22px 16px calc(var(--tabbar-h) + 36px + env(safe-area-inset-bottom)); }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    display: flex;
    justify-content: space-around;
    gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--hair);
    background: rgba(12, 11, 10, 0.86);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
  }
  .tab {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    max-width: 120px;
    border-radius: 14px;
    color: var(--faint);
    font-size: 11.5px;
    text-decoration: none;
    cursor: pointer;
    list-style: none;
  }
  .tab::-webkit-details-marker { display: none; }
  .tab .icon { width: 24px; height: 24px; }
  .tab[aria-current="page"], .more[open] > .tab { color: var(--accent-ink); }
  .tab[aria-current="page"]::before { content: ""; position: absolute; top: -7px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
  /* A backdrop-filter would trap the fixed sheet inside the bar, so drop it while the sheet is open. */
  .tabbar:has(.more[open]) { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgb(12, 11, 10); }
  .more { display: flex; flex: 1; max-width: 120px; }
  .more > .tab { width: 100%; }
  .more[open]::before { content: ""; position: fixed; inset: 0; z-index: -1; background: rgba(0, 0, 0, 0.55); }
  .sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    max-height: 82dvh;
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-radius: 26px 26px 0 0;
    background: var(--surface-2);
    box-shadow: 0 -30px 80px rgba(0, 0, 0, 0.6);
    overflow-y: auto;
    animation: sheet-in 0.35s var(--ease);
  }
  @keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
  .sheet__handle { width: 44px; height: 5px; margin: 0 auto 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.18); }
  .sheet__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .sheet__item { display: grid; justify-items: center; gap: 6px; padding: 14px 6px; border: 1px solid var(--hair); border-radius: 16px; background: var(--surface); color: var(--fg); font-size: 13px; text-align: center; text-decoration: none; }
  .sheet__item .icon { width: 24px; height: 24px; color: var(--accent); }
  .sheet__item[aria-current="page"] { border-color: var(--line-strong); background: var(--accent-soft); }
  .sheet__list { display: grid; gap: 4px; }
  .sheet__account { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--hair); }
  .sheet .nav-heading { margin: 16px 4px 8px; }

  .detail { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .page-head { margin-bottom: 20px; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi__icon { width: 34px; height: 34px; border-radius: 10px; }
  .kpi__value { font-size: 22px; }
  .items { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .timeline__row { gap: 10px; }
  .timeline__icon { width: 36px; height: 36px; }
  .toolbar .btn { display: none; }
  .bare .card--narrow { padding: 26px 22px; }
  .alert-list__row { grid-template-columns: auto 1fr auto; }
  .alert-list__row .badge { display: none; }
}

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