/* ============================================================
   AURUM — Atelier OS (admin/CRM)
   same dark/gold system as the boutique, tuned for density
   ============================================================ */

:root {
  --bg: #0a0908;
  --bg-soft: #0f0d0a;
  --surface: #14110c;
  --surface-2: #1a160f;
  --line: rgba(212, 168, 67, 0.16);
  --line-strong: rgba(212, 168, 67, 0.38);
  --gold: #d4a843;
  --gold-bright: #e8c168;
  --gold-deep: #9a7424;
  --gold-grad: linear-gradient(115deg, #f6e27a 0%, #e8c168 28%, #b4842c 58%, #f0d98c 100%);
  --cream: #f2e9d8;
  --muted: #988c76;
  --faint: #6d6354;
  --rust: #c2654a;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Manrope', sans-serif;
  --font-serif: 'Cormorant Garamond', serif;
  --side-w: 248px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* author display rules (e.g. .field { display:grid }) must never override [hidden] */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

::selection { background: var(--gold); color: #14110c; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2c2517; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }

img { display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; border-radius: 2px; }

.noise {
  position: fixed; inset: -50%; z-index: 90; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.035;
}

/* ---------- shared bits ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  border-radius: 2px; overflow: hidden;
  transition: color 0.3s, border-color 0.3s, opacity 0.3s;
}
.btn span { position: relative; z-index: 1; }
.btn--gold { background: var(--gold-grad); color: #14110c; }
.btn--gold::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.5) 50%, transparent 70%);
  transform: translateX(-110%);
}
.btn--gold:hover::after { transition: transform 0.6s var(--ease-out); transform: translateX(110%); }
.btn--ghost { border: 1px solid var(--line-strong); color: var(--cream); }
.btn--ghost:hover { border-color: var(--gold-bright); color: var(--gold-bright); }
.btn--danger { border: 1px solid rgba(194, 101, 74, 0.5); color: var(--rust); }
.btn--danger:hover { border-color: var(--rust); }
.btn--sm { padding: 8px 14px; font-size: 10px; }

.eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--gold);
}

.serif { font-family: var(--font-serif); font-style: italic; font-weight: 500; }

.field { display: grid; gap: 7px; }
.field__label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--muted);
}
.field__input, .field__select, .field__textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(10, 9, 8, 0.6);
  border: 1px solid var(--line); border-radius: 2px;
  color: var(--cream); font: inherit; font-size: 14px;
  transition: border-color 0.3s;
}
.field__input::placeholder, .field__textarea::placeholder { color: var(--faint); }
.field__input:focus, .field__select:focus, .field__textarea:focus { outline: none; border-color: var(--gold); }
.field__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23988c76' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

.avatar {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--gold-bright); background: var(--surface);
  flex-shrink: 0;
}
.avatar--gold { background: var(--gold-grad); color: #14110c; border: 0; }

/* status + tier badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 2px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase;
  white-space: nowrap;
}
.badge--pending   { border: 1px solid var(--line-strong); color: var(--gold-bright); }
.badge--paid      { background: rgba(212, 168, 67, 0.16); color: var(--gold-bright); }
.badge--fulfilled { background: var(--gold-grad); color: #14110c; }
.badge--refunded  { border: 1px solid rgba(194, 101, 74, 0.45); color: var(--rust); }
.badge--cancelled { border: 1px solid rgba(152, 140, 118, 0.3); color: var(--faint); }
.badge--live      { background: rgba(212, 168, 67, 0.16); color: var(--gold-bright); }
.badge--draft     { border: 1px solid rgba(152, 140, 118, 0.3); color: var(--muted); }
.badge--soldout   { border: 1px solid rgba(194, 101, 74, 0.45); color: var(--rust); }
.badge--circle    { background: var(--gold-grad); color: #14110c; }
.badge--gilded    { background: rgba(212, 168, 67, 0.16); color: var(--gold-bright); }
.badge--guest     { border: 1px solid rgba(152, 140, 118, 0.3); color: var(--muted); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 300;
  transform: translate(-50%, calc(100% + 40px));
  padding: 13px 24px;
  background: rgba(15, 13, 10, 0.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong); border-radius: 2px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold-bright);
  white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
  transition: transform 0.5s var(--ease-out);
  pointer-events: none;
}
.toast.is-on { transform: translate(-50%, 0); }

/* ============================================================
   LOGIN
   ============================================================ */
.login {
  position: fixed; inset: 0; z-index: 100;
  display: grid;
  padding: 24px;
  background:
    radial-gradient(110% 80% at 50% 110%, rgba(212, 168, 67, 0.13), transparent 60%),
    radial-gradient(70% 50% at 50% -10%, rgba(212, 168, 67, 0.05), transparent 60%),
    var(--bg);
  overflow: auto; /* short viewports can scroll to the submit button */
}
.login__halo {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(46% 38% at 50% 52%, rgba(212, 168, 67, 0.07), transparent 70%);
  animation: halo 7s ease-in-out infinite alternate;
}
@keyframes halo { from { opacity: 0.5; } to { opacity: 1; } }
.login__card {
  position: relative;
  margin: auto; /* centered, but never clipped off-screen */
  width: min(420px, 100%);
  display: grid; gap: 18px; justify-items: center;
  padding: clamp(36px, 6vw, 56px) clamp(26px, 5vw, 48px);
  background: rgba(15, 13, 10, 0.78);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(232, 193, 104, 0.25);
}
.login__mark { color: var(--gold-bright); }
.login__title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.4rem, 4.5vw, 1.8rem); line-height: 1.1;
  text-transform: uppercase; text-align: center; letter-spacing: 0.01em;
}
.login__title em {
  display: block;
  font-family: var(--font-serif); font-style: italic; font-weight: 500; text-transform: none;
  font-size: 0.92em;
  background: var(--gold-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.login__sub { font-size: 12px; color: var(--muted); margin-top: -6px; }
.login__card .field { width: 100%; }
.login__submit { width: 100%; margin-top: 6px; padding: 15px 22px; }
.login__note { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); text-align: center; }
.login__switch {
  font-size: 12px; color: var(--muted);
  padding: 4px 8px;
  transition: color 0.25s;
}
.login__switch b { color: var(--gold); font-weight: 700; }
.login__switch:hover, .login__switch:hover b { color: var(--gold-bright); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.app[hidden] { display: none; }

/* ---------- sidebar ---------- */
.side {
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 26px 18px 18px;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  z-index: 60;
}
.side__logo {
  display: flex; align-items: baseline; gap: 8px;
  padding: 0 10px 26px;
  font-family: var(--font-display); font-weight: 800;
  font-size: 16px; letter-spacing: 0.2em;
}
.side__logo svg { color: var(--gold-bright); align-self: center; }
.side__logo em {
  font-family: var(--font-serif); font-style: italic; font-weight: 500;
  font-size: 11px; letter-spacing: 0.04em; color: var(--muted);
}
.side__nav { display: grid; gap: 2px; }
.side__link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px;
  border-radius: 2px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s, background-color 0.25s;
}
.side__link em {
  font-family: var(--font-serif); font-style: italic; font-weight: 500;
  font-size: 11px; letter-spacing: 0.05em; color: var(--faint);
  width: 16px;
}
.side__link::before {
  content: ""; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 2px; background: var(--gold-grad);
  transform: scaleY(0);
  transition: transform 0.35s var(--ease-out);
}
.side__link:hover { color: var(--cream); }
.side__link.is-active { color: var(--gold-bright); background: rgba(212, 168, 67, 0.07); }
.side__link.is-active::before { transform: scaleY(1); }
.side__badge {
  margin-left: auto;
  display: none; place-items: center;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--gold-grad); color: #14110c;
  font-size: 10px; font-weight: 700; letter-spacing: 0;
}
.side__badge.is-on { display: grid; }
.side__foot { margin-top: auto; display: grid; gap: 4px; padding: 10px 2px 0; border-top: 1px solid var(--line); }
.side__store, .side__reset {
  padding: 9px 10px; border-radius: 2px; text-align: left;
  font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s;
}
.side__store:hover { color: var(--gold-bright); }
.side__reset:hover { color: var(--rust); }

/* ---------- topbar ---------- */
.shell { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 16px clamp(18px, 3vw, 36px);
  background: rgba(10, 9, 8, 0.86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top__burger {
  display: none;
  width: 38px; height: 38px;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 2px;
}
.top__burger span { display: block; width: 18px; height: 1.5px; background: var(--cream); }
.top__eyebrow { font-size: 9px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); }
.top__view {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.1;
  text-transform: uppercase; letter-spacing: 0.01em;
}
.top__right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.top__season {
  font-size: 10px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--faint);
}
.top__user {
  display: flex; align-items: center; gap: 10px;
  padding: 4px; border-radius: 2px; cursor: pointer;
  transition: opacity 0.25s;
}
.top__user:hover { opacity: 0.85; }
.top__user-name { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
.top__user-chev {
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.3s var(--ease-out);
}
.usermenu { position: relative; }
.usermenu.is-open .top__user-chev { transform: rotate(225deg) translateY(-2px); }
.usermenu__panel {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 80;
  min-width: 240px;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong); border-radius: 2px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(232, 193, 104, 0.2);
  padding: 6px;
  opacity: 0; transform: translateY(-6px);
  transition: opacity 0.25s, transform 0.3s var(--ease-out);
}
.usermenu.is-open .usermenu__panel { opacity: 1; transform: none; }
.usermenu__head {
  display: grid; gap: 2px;
  padding: 12px 12px 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.usermenu__head b { font-size: 13px; font-weight: 700; }
.usermenu__head span { font-size: 11px; color: var(--muted); word-break: break-all; }
.usermenu__item {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 2px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s, background-color 0.2s;
}
.usermenu__item:hover { color: var(--gold-bright); background: rgba(212, 168, 67, 0.07); }
.usermenu__item--out { color: var(--rust); margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 2px 2px; }
.usermenu__item--out:hover { color: var(--rust); background: rgba(194, 101, 74, 0.08); }

/* ---------- view container ---------- */
.view {
  flex: 1;
  padding: clamp(20px, 3vw, 36px);
  display: grid; gap: clamp(16px, 2vw, 24px);
  align-content: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: clamp(16px, 2.4vw, 26px);
  min-width: 0;
}
.card__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  margin-bottom: 18px;
}
.card__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase;
}
.card__hint { font-size: 11px; color: var(--faint); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.greet { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.greet__title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  text-transform: uppercase; letter-spacing: 0.01em; line-height: 1.05;
}
.greet__title em {
  font-family: var(--font-serif); font-style: italic; font-weight: 500; text-transform: none;
  background: var(--gold-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.greet__date { font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(12px, 1.6vw, 20px); }
.kpi { position: relative; overflow: hidden; }
.kpi__label { font-size: 10px; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); }
.kpi__value {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.45rem, 3vw, 2.5rem); line-height: 1.1;
  white-space: nowrap;
  background: var(--gold-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  margin: 8px 0 6px;
}
.kpi__delta { font-size: 11px; color: var(--muted); }
.kpi__delta b { color: var(--gold-bright); font-weight: 700; }
.kpi__delta.is-down b { color: var(--rust); }

.dash-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: clamp(16px, 2vw, 24px); }
.dash-col { display: grid; gap: clamp(16px, 2vw, 24px); align-content: start; min-width: 0; }

.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font-body); font-size: 9px; letter-spacing: 0.1em; fill: var(--faint); }

.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.legend__item { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.legend__dot { width: 8px; height: 8px; border-radius: 50%; }

.bars { display: grid; gap: 13px; }
.bar { display: grid; gap: 6px; }
.bar__top { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.bar__name { font-weight: 700; letter-spacing: 0.04em; }
.bar__val { color: var(--gold-bright); font-family: var(--font-serif); font-style: italic; font-size: 14px; }
.bar__track { height: 3px; background: rgba(212, 168, 67, 0.1); overflow: hidden; }
.bar__fill { height: 100%; background: var(--gold-grad); transform-origin: left; }

.mini-list { display: grid; }
.mini-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover .mini-row__id { color: var(--gold-bright); }
.mini-row__id { font-weight: 700; font-size: 12px; letter-spacing: 0.06em; transition: color 0.2s; }
.mini-row__sub { font-size: 11px; color: var(--muted); }
.mini-row__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.mini-row__amt { font-family: var(--font-serif); font-style: italic; font-size: 15px; color: var(--gold-bright); }

/* ============================================================
   TABLES (orders / products / customers)
   ============================================================ */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.toolbar .field__input { width: min(320px, 100%); }
.toolbar__search { flex: 0 1 320px; }
.toolbar__spacer { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border-radius: 2px;
  border: 1px solid var(--line);
  font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s, border-color 0.25s, background-color 0.25s;
}
.chip:hover { color: var(--cream); }
.chip.is-on { background: var(--gold-grad); color: #14110c; border-color: transparent; }

.tablewrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px; vertical-align: middle;
}
.table tbody tr { cursor: pointer; transition: background-color 0.2s; }
.table tbody tr:hover { background: rgba(212, 168, 67, 0.05); }
.table .t-id { font-weight: 700; letter-spacing: 0.05em; white-space: nowrap; }
.table .t-num { font-family: var(--font-serif); font-style: italic; font-size: 15px; color: var(--gold-bright); white-space: nowrap; }
.table .t-muted { color: var(--muted); font-size: 12px; }
.table .t-right { text-align: right; }

.cellperson { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cellperson__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cellperson__sub { font-size: 11px; color: var(--muted); white-space: nowrap; }

.thumb {
  width: 44px; height: 52px; object-fit: cover; border-radius: 2px;
  border: 1px solid var(--line);
  filter: sepia(0.12) saturate(0.95) contrast(1.04) brightness(0.92);
}

.stock { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.stock__bar { width: 54px; height: 3px; background: rgba(212, 168, 67, 0.12); overflow: hidden; border-radius: 2px; }
.stock__fill { display: block; height: 100%; background: var(--gold-grad); }
.stock.is-low .stock__fill { background: var(--rust); }
.stock.is-low { color: var(--rust); }

.count-note { font-size: 11px; color: var(--faint); letter-spacing: 0.14em; text-transform: uppercase; }

.empty {
  padding: 60px 20px; text-align: center;
  font-family: var(--font-serif); font-style: italic; font-size: 20px; color: var(--muted);
}

/* ============================================================
   CIRCLE (applications)
   ============================================================ */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: clamp(12px, 1.6vw, 20px); }
.app-card { display: grid; gap: 14px; }
.app-card__head { display: flex; align-items: center; gap: 12px; }
.app-card__name { font-weight: 700; font-size: 14px; }
.app-card__mail { font-size: 11px; color: var(--muted); }
.app-card__date { margin-left: auto; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.app-card__note {
  font-family: var(--font-serif); font-style: italic;
  font-size: 15px; color: var(--muted); line-height: 1.5;
  border-left: 2px solid var(--line-strong); padding-left: 12px;
}
.app-card__actions { display: flex; gap: 8px; }

/* ============================================================
   DRAWER + MODAL
   ============================================================ */
.scrim {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(5, 4, 3, 0.6);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.35s;
}
.scrim.is-on { opacity: 1; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 80;
  width: min(460px, 100vw);
  background: var(--bg-soft);
  border-left: 1px solid var(--line-strong);
  transform: translateX(102%);
  transition: transform 0.5s var(--ease-out);
  box-shadow: -30px 0 90px rgba(0, 0, 0, 0.5);
}
.drawer.is-open { transform: none; }
.drawer__inner { height: 100%; overflow-y: auto; padding: 26px; display: grid; gap: 22px; align-content: start; }
.drawer__head { display: flex; align-items: flex-start; gap: 14px; }
.drawer__title {
  font-family: var(--font-display); font-weight: 800;
  font-size: 1.15rem; text-transform: uppercase; line-height: 1.15;
}
.drawer__sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.drawer__close {
  margin-left: auto;
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 2px;
  display: grid; place-items: center; font-size: 14px; color: var(--muted);
  transition: color 0.25s, border-color 0.25s;
}
.drawer__close:hover { color: var(--gold-bright); border-color: var(--gold-bright); }
.drawer__section { display: grid; gap: 10px; }
.drawer__section > .eyebrow { margin-bottom: 2px; }
.drawer__row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.drawer__row:last-child { border-bottom: 0; }
.drawer__row b { font-weight: 700; }
.drawer__row .t-num { font-family: var(--font-serif); font-style: italic; color: var(--gold-bright); font-size: 15px; }
.drawer__total { display: flex; justify-content: space-between; padding-top: 12px; font-weight: 700; }
.drawer__total .t-num { font-size: 19px; }
.drawer__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.kpi-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi-mini { background: var(--surface); border: 1px solid var(--line); padding: 12px; display: grid; gap: 2px; }
.kpi-mini b {
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem;
  background: var(--gold-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.kpi-mini span { font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); }

.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 2px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}

.note { border-left: 2px solid var(--line-strong); padding: 2px 0 2px 12px; }
.note p { font-family: var(--font-serif); font-style: italic; font-size: 15px; color: var(--cream); }
.note span { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.note-form { display: flex; gap: 8px; }
.note-form .field__input { flex: 1; }

.itemline { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.itemline:last-child { border-bottom: 0; }
.itemline__name { font-weight: 700; font-size: 13px; }
.itemline__sub { font-size: 11px; color: var(--muted); }
.itemline__amt { margin-left: auto; font-family: var(--font-serif); font-style: italic; font-size: 15px; color: var(--gold-bright); white-space: nowrap; }

.modal {
  position: fixed; inset: 0; z-index: 85;
  display: grid; place-items: center; padding: 20px;
  visibility: hidden; opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
}
.modal.is-open { visibility: visible; opacity: 1; }
.modal__card {
  width: min(520px, 100%);
  max-height: 90vh; overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(232, 193, 104, 0.25);
  padding: clamp(22px, 4vw, 34px);
  display: grid; gap: 16px;
  transform: translateY(16px);
  transition: transform 0.4s var(--ease-out);
}
.modal.is-open .modal__card { transform: none; }
.modal__title { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; text-transform: uppercase; }
.modal__grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: min(300px, 84vw);
    transform: translateX(-103%);
    transition: transform 0.45s var(--ease-out);
    box-shadow: 30px 0 90px rgba(0, 0, 0, 0.5);
  }
  .side.is-open { transform: none; }
  .top__burger { display: flex; }
  .top__season { display: none; }
  .top__user-name { display: none; }
}

@media (max-width: 700px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .toolbar .field__input { width: 100%; }
  .toolbar__search { flex-basis: 100%; }
  .modal__grid2 { grid-template-columns: 1fr; }
  .kpi-trio { grid-template-columns: repeat(3, 1fr); }

  /* tables become stacked cards */
  .table { min-width: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); margin-bottom: 10px; padding: 6px 0; background: var(--surface); }
  .table td { border-bottom: 0; padding: 7px 14px; }
  .table td[data-th]::before {
    content: attr(data-th);
    display: block;
    font-size: 9px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase;
    color: var(--faint); margin-bottom: 2px;
  }
  .table .t-right { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
