/* OLLYMEN Store OS — design tokens */
:root {
  /* Surfaces */
  --bg:           oklch(0.962 0.012 76);   /* warm ivory */
  --bg-2:         oklch(0.945 0.013 72);   /* deeper oat */
  --surface:      oklch(0.986 0.008 78);   /* card */
  --surface-2:    oklch(0.975 0.010 76);   /* nested card */
  --surface-3:    oklch(0.955 0.011 74);   /* well */
  --sidebar:      oklch(0.948 0.014 72);
  --sidebar-hover:oklch(0.935 0.015 70);

  /* Ink */
  --ink:          oklch(0.225 0.014 56);   /* charcoal */
  --ink-2:        oklch(0.36  0.014 56);   /* secondary */
  --muted:        oklch(0.52  0.012 60);   /* meta */
  --muted-2:      oklch(0.66  0.012 64);   /* faint */

  /* Lines */
  --line:         oklch(0.885 0.012 72);
  --line-strong:  oklch(0.83  0.014 70);
  --line-soft:    oklch(0.92  0.010 74);

  /* Brand & status */
  --ramen:        oklch(0.46 0.13 27);     /* deep ramen red */
  --ramen-ink:    oklch(0.34 0.10 27);
  --ramen-wash:   oklch(0.94 0.030 30);
  --burnt:        oklch(0.60 0.13 50);     /* burnt orange */
  --burnt-wash:   oklch(0.95 0.030 60);
  --olive:        oklch(0.52 0.09 115);    /* premium olive */
  --olive-ink:    oklch(0.38 0.08 115);
  --olive-wash:   oklch(0.94 0.030 115);

  --success:      oklch(0.54 0.09 150);
  --success-wash: oklch(0.94 0.028 150);
  --warning:      oklch(0.66 0.13 78);
  --warning-wash: oklch(0.95 0.05 85);
  --danger:       oklch(0.52 0.14 28);
  --danger-wash:  oklch(0.95 0.04 30);
  --info:         oklch(0.50 0.06 240);
  --info-wash:    oklch(0.94 0.020 240);

  /* Type */
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
               system-ui, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;

  /* Radius / shadow */
  --r-sm: 6px;
  --r:    9px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 0 oklch(0.86 0.012 70 / 0.6), 0 1px 2px oklch(0.4 0.02 60 / 0.04);
  --shadow:    0 1px 0 oklch(0.86 0.012 70 / 0.7), 0 6px 18px -10px oklch(0.3 0.02 60 / 0.12);
  --shadow-pop:0 8px 30px -10px oklch(0.3 0.02 60 / 0.18), 0 2px 0 oklch(0.86 0.012 70 / 0.7);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  word-break: keep-all;
  overflow-wrap: break-word;
  /* very subtle paper grain + warm light from top-left */
  background-image:
    radial-gradient(1200px 800px at -10% -10%, oklch(0.99 0.012 70 / 0.6), transparent 60%),
    radial-gradient(900px 700px at 110% 0%, oklch(0.94 0.018 50 / 0.4), transparent 55%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.14  0 0 0 0 0.10  0 0 0 0.035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-attachment: fixed;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { outline: none; }
a { color: inherit; text-decoration: none; }

/* numeric / mono */
.mono, .num { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "ss01" 1; letter-spacing: -0.01em; }
.tnum { font-variant-numeric: tabular-nums; }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: oklch(0.85 0.012 70); border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: oklch(0.78 0.014 70); }
*::-webkit-scrollbar-track { background: transparent; }

/* App shell */
.app { display: grid; grid-template-columns: 244px 1fr; height: 100vh; }
.main { display: grid; grid-template-rows: 52px 1fr; min-width: 0; }

/* Sidebar */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.sb-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background:
    radial-gradient(circle at 30% 30%, oklch(0.78 0.13 110), oklch(0.42 0.10 115) 70%);
  display: grid; place-items: center;
  color: oklch(0.98 0.01 90);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  box-shadow: inset 0 0 0 1px oklch(0.30 0.05 110 / 0.4);
}
.sb-title { font-weight: 650; font-size: 13.5px; letter-spacing: -0.01em; }
.sb-title small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: 0.01em; margin-top: 1px; }

.sb-store {
  margin: 10px 10px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  transition: background .12s;
  width: calc(100% - 20px);
}
.sb-store:hover { background: var(--surface-2); }
.sb-store.active { background: var(--surface-2); border-color: var(--line-strong); }
.sb-store .label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.sb-store .name { font-weight: 600; font-size: 13px; }
.sb-store .chev { margin-left: auto; color: var(--muted); display: inline-flex; }

/* Workspace switcher dropdown */
.ws-dropdown {
  position: absolute;
  left: 10px; right: 10px; top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 30;
  animation: ws-down .18s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes ws-down {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.ws-h {
  padding: 8px 10px 6px;
  font-size: 10.5px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ws-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 8px;
  border-radius: 8px;
  text-align: left;
  transition: background .12s;
}
.ws-item:hover { background: var(--surface-2); }
.ws-name {
  font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-sub {
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 4px;
  margin-top: 1px;
  white-space: nowrap;
}
.ws-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--olive);
  color: oklch(0.98 0.01 100);
  display: grid; place-items: center;
  flex: none;
}
.ws-divider { height: 1px; background: var(--line-soft); margin: 4px 4px; }
.ws-action {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.5px; color: var(--ink-2); font-weight: 500;
  transition: background .12s;
}
.ws-action:hover { background: var(--surface-2); color: var(--ink); }

.sb-section { padding: 14px 14px 4px; font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.sb-nav { display: flex; flex-direction: column; padding: 0 8px; gap: 1px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
  white-space: nowrap;
}
.sb-item span { white-space: nowrap; }
.sb-item:hover { background: var(--sidebar-hover); color: var(--ink); }
.sb-item.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--line);
}
.sb-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--bg-2);
  border-radius: 4px;
  padding: 1px 5px;
}
.sb-item.active .count { color: var(--ramen-ink); background: var(--ramen-wash); }

.sb-footer { margin-top: auto; border-top: 1px solid var(--line-soft); padding: 10px; }
.sb-user { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: var(--r-sm); }
.sb-user:hover { background: var(--sidebar-hover); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: oklch(0.85 0.04 50);
  color: var(--ramen-ink);
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px oklch(0.78 0.05 50);
}
.avatar.olive { background: var(--olive-wash); color: var(--olive-ink); box-shadow: inset 0 0 0 1px oklch(0.84 0.04 110); }
.avatar.sm { width: 22px; height: 22px; font-size: 10.5px; }
.avatar.lg { width: 36px; height: 36px; font-size: 13.5px; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  z-index: 5;
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.crumbs .sep { color: var(--muted-2); }
.crumbs strong { color: var(--ink); font-weight: 600; }
.tb-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.demo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-2);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.demo-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--olive); box-shadow: 0 0 0 3px var(--olive-wash); }
.tb-btn {
  height: 30px; padding: 0 9px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px; color: var(--ink-2); font-weight: 500;
  white-space: nowrap;
}
.tb-btn:hover { background: var(--surface-2); color: var(--ink); }
.kbd { font-family: var(--font-mono); font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); }
.tb-search {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px;
  height: 30px;
  width: 320px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
}
.tb-search input { flex: 1; border: 0; background: transparent; }
.tb-search input::placeholder { color: var(--muted-2); }

/* Page layout */
.page { padding: 22px 26px 32px; overflow: auto; min-height: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.page-sub { color: var(--muted); font-size: 13px; }
.page-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.card-h {
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.card-h .t { font-weight: 650; font-size: 13.5px; white-space: nowrap; }
.card-h .sub { color: var(--muted); font-size: 12px; }
.card-b { padding: 14px; }
.card-b.tight { padding: 8px; }
.card-f { padding: 10px 14px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 10px; }

/* Buttons */
.btn {
  height: 32px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  transition: background .12s, transform .04s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(0.5px); }
.btn.primary {
  background: var(--ramen);
  color: oklch(0.98 0.01 60);
  border-color: oklch(0.36 0.13 27);
  box-shadow: inset 0 1px 0 oklch(0.62 0.13 27 / 0.6);
}
.btn.primary:hover { background: oklch(0.43 0.14 27); }
.btn.olive {
  background: var(--olive);
  color: oklch(0.98 0.01 100);
  border-color: oklch(0.40 0.09 115);
  box-shadow: inset 0 1px 0 oklch(0.66 0.10 115 / 0.6);
}
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sidebar-hover); color: var(--ink); }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.lg { height: 44px; padding: 0 18px; font-size: 14px; border-radius: 8px; }
.btn.block { width: 100%; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2);
  border: 1px solid var(--line);
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.badge.live { color: var(--olive-ink); background: var(--olive-wash); border-color: oklch(0.85 0.04 115); }
.badge.live .dot { background: var(--olive); box-shadow: 0 0 0 3px oklch(0.85 0.04 115 / 0.7); }
.badge.opening { color: var(--burnt); background: var(--burnt-wash); border-color: oklch(0.85 0.05 60); }
.badge.opening .dot { background: var(--burnt); }
.badge.scout   { color: var(--info); background: var(--info-wash); border-color: oklch(0.86 0.025 240); }
.badge.scout .dot { background: var(--info); }
.badge.danger  { color: var(--danger); background: var(--danger-wash); border-color: oklch(0.86 0.05 30); }
.badge.danger .dot { background: var(--danger); }
.badge.warn    { color: oklch(0.45 0.10 70); background: var(--warning-wash); border-color: oklch(0.86 0.07 80); }
.badge.warn .dot { background: var(--warning); }
.badge.success { color: var(--success); background: var(--success-wash); border-color: oklch(0.85 0.05 150); }
.badge.success .dot { background: var(--success); }
.badge.neutral { color: var(--ink-2); }
.badge.solid-ramen { background: var(--ramen); color: oklch(0.98 0.01 60); border-color: oklch(0.36 0.13 27); }
.badge.solid-ramen .dot { background: oklch(0.98 0.01 60); }

/* Status pill in tables */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 7px; border-radius: 5px;
  font-size: 11.5px; font-weight: 600; font-family: var(--font-mono);
  white-space: nowrap;
}
.pill.ok   { color: var(--success);  background: var(--success-wash); }
.pill.warn { color: oklch(0.45 0.10 70); background: var(--warning-wash); }
.pill.low  { color: var(--danger);   background: var(--danger-wash); }
.pill.order{ color: var(--ramen);    background: var(--ramen-wash); }

/* Metric tile */
.metric { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.metric .k { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.metric .delta { white-space: nowrap; }
.metric .v { font-family: var(--font-display); font-weight: 600; font-size: 26px; letter-spacing: -0.02em; line-height: 1.1; }
.metric .v .unit { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.metric .delta { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.metric .delta.up { color: var(--success); }
.metric .delta.down { color: var(--danger); }

/* Progress bar */
.bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 999px; transition: width .4s ease; }
.bar > i.olive { background: var(--olive); }
.bar > i.burnt { background: var(--burnt); }
.bar > i.ramen { background: var(--ramen); }
.bar > i.success { background: var(--success); }
.bar.tall { height: 8px; }
.bar.split > i.b1 { background: var(--olive); }
.bar.split > i.b2 { background: var(--burnt); }

/* Animated entry */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise .42s cubic-bezier(.2,.7,.2,1) both; }
.rise.d1 { animation-delay: .04s; } .rise.d2 { animation-delay: .12s; }
.rise.d3 { animation-delay: .20s; } .rise.d4 { animation-delay: .28s; }
.rise.d5 { animation-delay: .36s; } .rise.d6 { animation-delay: .44s; }
.rise.d7 { animation-delay: .52s; } .rise.d8 { animation-delay: .60s; }

/* Pulse — for live dots / status indicators */
@keyframes pulse-olive {
  0%   { box-shadow: 0 0 0 3px oklch(0.85 0.04 115 / 0.6), 0 0 0 0 oklch(0.55 0.10 115 / 0.55); }
  100% { box-shadow: 0 0 0 3px oklch(0.85 0.04 115 / 0.6), 0 0 0 8px oklch(0.55 0.10 115 / 0); }
}
@keyframes pulse-ramen {
  0%   { box-shadow: 0 0 0 0 oklch(0.55 0.13 30 / 0.50); }
  100% { box-shadow: 0 0 0 6px oklch(0.55 0.13 30 / 0); }
}
@keyframes pulse-burnt {
  0%   { box-shadow: 0 0 0 0 oklch(0.60 0.13 50 / 0.50); }
  100% { box-shadow: 0 0 0 6px oklch(0.60 0.13 50 / 0); }
}
.badge.live .dot, .demo-chip .dot { animation: pulse-olive 2.0s ease-out infinite; }
.badge.opening .dot { animation: pulse-burnt 2.0s ease-out infinite; }
.notif .ico.danger { animation: pulse-ramen 2.4s ease-out infinite; }

/* Sheen sweep across "live" status badges — subtle sparkle every few seconds */
@keyframes badge-sheen-live {
  0%, 30%   { background-position: -160% 0, 0 0; }
  72%, 100% { background-position: 260% 0, 0 0; }
}
@keyframes badge-glow-olive {
  0%, 100% { box-shadow: 0 0 0 0 oklch(0.55 0.10 115 / 0); }
  50%      { box-shadow: 0 0 12px -2px oklch(0.55 0.10 115 / 0.35); }
}
.badge.live {
  background:
    linear-gradient(100deg, transparent 38%, oklch(1 0 0 / 0.55) 50%, transparent 62%) -160% 0 / 220% 100% no-repeat,
    var(--olive-wash);
  animation: badge-sheen-live 3.6s ease-in-out infinite, badge-glow-olive 3.6s ease-in-out infinite;
}

@keyframes badge-sheen-open {
  0%, 30%   { background-position: -160% 0, 0 0; }
  72%, 100% { background-position: 260% 0, 0 0; }
}
@keyframes badge-glow-burnt {
  0%, 100% { box-shadow: 0 0 0 0 oklch(0.60 0.13 50 / 0); }
  50%      { box-shadow: 0 0 12px -2px oklch(0.60 0.13 50 / 0.35); }
}
.badge.opening {
  background:
    linear-gradient(100deg, transparent 38%, oklch(1 0 0 / 0.55) 50%, transparent 62%) -160% 0 / 220% 100% no-repeat,
    var(--burnt-wash);
  animation: badge-sheen-open 4.0s ease-in-out infinite .3s, badge-glow-burnt 4.0s ease-in-out infinite .3s;
}

/* "진행 중" peak status pill — gentle amber pulse */
@keyframes pill-warn-glow {
  0%, 100% { box-shadow: inset 0 0 0 0 oklch(0.66 0.13 78 / 0); }
  50%      { box-shadow: inset 0 0 10px 0 oklch(0.66 0.13 78 / 0.20); }
}
.pill.warn { animation: pill-warn-glow 2.4s ease-in-out infinite; }

/* Heartbeat for store-card live tile letter */
@keyframes tile-glow {
  0%, 100% { box-shadow: inset 0 0 0 1px oklch(0.85 0.04 115); }
  50%      { box-shadow: inset 0 0 0 1px oklch(0.85 0.04 115), 0 0 14px -4px oklch(0.55 0.10 115 / 0.4); }
}
.store-card .tile.olive { animation: tile-glow 3.2s ease-in-out infinite; }

/* Sweep / shimmer used on progress bars + login button */
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(180%); }
}
.bar > i { position: relative; overflow: hidden; }
.bar > i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, oklch(1 0 0 / 0.35) 50%, transparent 100%);
  animation: shimmer 2.8s ease-in-out infinite;
  animation-delay: .8s;
}
.bar > i.muted::after { display: none; }

/* Card hover lift — subtle, Linear-like */
.card { transition: transform .14s cubic-bezier(.2,.7,.2,1), box-shadow .18s; }
.store-card.card:hover,
.metric.card:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--shadow);
}

/* Sidebar active indicator slides in */
.sb-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 6px; bottom: 6px; width: 2.5px;
  background: var(--ramen);
  border-radius: 0 3px 3px 0;
  animation: slidein .26s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes slidein {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

/* Checkbox check-in bounce */
.chk { transition: background .15s, border-color .15s, transform .12s; }
.chk:active { transform: scale(.92); }
@keyframes check-pop {
  0%   { transform: scale(.6); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.chk.checked svg { animation: check-pop .22s cubic-bezier(.4, 1.6, .5, 1) both; }

/* Login primary button — subtle sheen sweep */
.btn.primary.lg, .btn.olive.lg { position: relative; overflow: hidden; }
.btn.primary.lg::after, .btn.olive.lg::after {
  content: "";
  position: absolute; top: 0; bottom: 0; width: 60%;
  left: -70%;
  background: linear-gradient(100deg, transparent, oklch(1 0 0 / 0.18), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}
.btn.primary.lg:hover::after, .btn.olive.lg:hover::after {
  animation: sheen 1s ease-out;
}
@keyframes sheen {
  from { left: -70%; }
  to   { left: 130%; }
}

/* Sparkline draw-in */
@keyframes spark-draw {
  to { stroke-dashoffset: 0; }
}
.spark .draw {
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation: spark-draw 1.4s cubic-bezier(.4,.0,.2,1) .15s forwards;
}
.spark .fill { animation: fadein .8s ease-out .6s both; }
@keyframes fadein { from { opacity: 0; } to { opacity: .55; } }

/* Heat cells stagger */
@keyframes heat-pop {
  from { opacity: 0; transform: scale(.6); }
  to   { opacity: 1; transform: scale(1); }
}
.heat .c { animation: heat-pop .35s cubic-bezier(.4,1.4,.5,1) both; }

/* Donut sweep — applied via inline strokeDashoffset transition */
.donut-track { transition: stroke-dashoffset 1.1s cubic-bezier(.2,.7,.2,1); }

/* Activity log row enter */
@keyframes act-slide {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}
.act { animation: act-slide .35s cubic-bezier(.2,.7,.2,1) both; }
.act:nth-child(1) { animation-delay: .04s; }
.act:nth-child(2) { animation-delay: .12s; }
.act:nth-child(3) { animation-delay: .20s; }
.act:nth-child(4) { animation-delay: .28s; }
.act:nth-child(5) { animation-delay: .36s; }
.act:nth-child(6) { animation-delay: .44s; }
.act:nth-child(7) { animation-delay: .52s; }
.act:nth-child(8) { animation-delay: .60s; }

/* Avatar live ring on user */
@keyframes ring-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px oklch(0.84 0.04 110), 0 0 0 0 oklch(0.55 0.10 115 / 0.5); }
  60%      { box-shadow: inset 0 0 0 1px oklch(0.84 0.04 110), 0 0 0 5px oklch(0.55 0.10 115 / 0); }
}
.avatar.olive.live { animation: ring-pulse 2.6s ease-out infinite; }

/* Soft logo mark shimmer (very subtle) */
@keyframes mark-shift {
  0%, 100% { filter: hue-rotate(0deg); }
  50%      { filter: hue-rotate(8deg); }
}
.sb-mark { animation: mark-shift 8s ease-in-out infinite; }

/* Page entry — used on switching views in main */
@keyframes page-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page { animation: page-fade .28s cubic-bezier(.2,.7,.2,1) both; }

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

/* ============== Responsive ============== */

/* Hamburger button — hidden on desktop */
.hamburger { display: none; }

/* Backdrop for sidebar drawer */
.sb-backdrop {
  position: fixed; inset: 0;
  background: oklch(0.2 0.02 50 / 0.45);
  backdrop-filter: blur(2px);
  z-index: 49;
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.sb-backdrop.open { opacity: 1; pointer-events: auto; }

/* Tablet — collapse right rail under main */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; }
  .rpane { border-left: 0; border-top: 1px solid var(--line); }
  .grid.g-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.g-5 { grid-template-columns: repeat(3, 1fr); }
  .tb-search { width: 220px; }
}

/* Mobile — sidebar drawer, single-column stacks */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 282px; z-index: 50;
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.2,.7,.2,1);
    box-shadow: 8px 0 28px -12px oklch(0.2 0.02 50 / 0.3);
  }
  .sidebar.open { transform: translateX(0); }
  .main { grid-template-rows: 52px 1fr; }

  .hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: 8px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-2);
    margin-right: 4px;
  }
  .hamburger:hover { background: var(--surface-2); }

  /* Topbar — compact */
  .topbar { padding: 0 12px; gap: 8px; }
  .crumbs { font-size: 12.5px; min-width: 0; overflow: hidden; }
  .crumbs > span:not(.sep), .crumbs > strong {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 180px;
  }
  .crumbs .crumb-hide { display: none; }
  .tb-search { display: none; }
  .demo-chip { display: none; }
  .tb-tools { gap: 6px; }
  .tb-btn .label-md { display: none; }

  /* Page */
  .page { padding: 16px 14px 32px; }
  .page-h1 { font-size: 20px; }
  .page-sub { font-size: 12.5px; }
  .page-head { gap: 10px; align-items: stretch; }
  .page-right { width: 100%; flex-wrap: wrap; gap: 6px; }
  .page-right .btn, .page-right .tb-btn { flex: 1 1 auto; justify-content: center; }

  /* All layout grids collapse to a single column */
  .grid.g-2, .grid.g-3, .grid.g-4, .grid.g-5 { grid-template-columns: 1fr; }
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Right rail stays stacked below */
  .workspace { grid-template-columns: 1fr; }
  .rpane { border-left: 0; border-top: 1px solid var(--line); }

  /* Sidebar nav still readable in drawer */
  .sb-nav { padding: 0 10px; }

  /* Card density — slightly tighter */
  .card-h { padding: 12px 14px; }
  .card-b { padding: 12px; }

  /* Tables — horizontal scroll inside cards */
  .card-b > table.tbl,
  .card-b table.tbl {
    display: block; overflow-x: auto; white-space: nowrap;
  }
  .tbl th, .tbl td { white-space: nowrap; }

  /* Context strip — 3 cols x 2 rows */
  .card.rise.d1 > div[style*="grid-template-columns: repeat(6"] {
    grid-template-columns: repeat(3, 1fr) !important;
    row-gap: 10px;
  }
  /* Inventory health strip — 3 cols */
  .card.rise.d1 > div[style*="grid-template-columns: repeat(5"] {
    grid-template-columns: repeat(3, 1fr) !important;
    row-gap: 6px;
  }
  .card.rise.d1 > div > div[style*="border-right"] {
    border-right: 0 !important;
    border-bottom: 1px solid var(--line-soft);
  }

  /* Store-card stats — 3-up still readable on phones */
  .store-card .stats { gap: 8px; }
  .store-card .top .title { font-size: 14px; }
  .store-card .meta { font-size: 11.5px; }

  /* Login — stack panels */
  .login-wrap { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .login-side {
    padding: 28px 22px 22px;
    min-height: auto;
  }
  .login-side > div[style] { margin-top: 18px !important; }
  .login-form-wrap { padding: 28px 22px 36px; max-width: 100%; }
  .login-side .login-stats { display: none; }

  /* Phone preview — when shown on a phone, drop the frame and show content native */
  .phone {
    width: 100%; max-width: 380px; margin: 0 auto;
    padding: 0; background: transparent; box-shadow: none; border-radius: 16px;
  }
  .phone .screen { border-radius: 16px; height: auto; min-height: 560px; }
  .phone .notch { display: none; }
  .phone .status { display: none; }

  /* Mobile preview card on dashboard — hide; mobile users get the actual mobile screen anyway */
  .mobile-preview-card { display: none; }

  /* Kanban opening board — horizontal swipe */
  .kanban-scroll {
    display: grid !important;
    grid-auto-flow: column;
    grid-auto-columns: 86%;
    grid-template-columns: none !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px; padding-bottom: 6px;
  }
  .kanban-scroll > * { scroll-snap-align: start; }

  /* Onboarding two-pane → stack; staff list scrollable */
  .onboard-grid { grid-template-columns: 1fr !important; }

  /* Login mobile — replace big tagline with compact one */
  .login-side .tagline-big { font-size: 22px !important; line-height: 1.25 !important; }
}

@media (max-width: 480px) {
  .page-h1 { font-size: 18px; }
  .page-head .page-right { gap: 6px; }
  .topbar { padding: 0 10px; }
  .crumbs > span:not(.sep), .crumbs > strong { max-width: 130px; }

  /* Sidebar drawer compresses to most of screen */
  .sidebar { width: 86vw; max-width: 320px; }

  /* KPI metric font shrink */
  .metric .v { font-size: 22px; }
  .metric { padding: 12px; }

  /* Store-card stats 2-up on small phones */
  .store-card .stats { grid-template-columns: 1fr 1fr; }
  .store-card .stat:nth-child(3) { grid-column: span 2; }

  /* Tabs scroll if needed */
  .tabs { overflow-x: auto; }

  /* Inventory health strip — 3 cols */
  .card.rise.d1 > div[style*="grid-template-columns: repeat(5"] {
    grid-template-columns: repeat(3, 1fr) !important;
    row-gap: 6px;
  }
}

/* Grids */
.grid { display: grid; gap: 14px; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }

/* Tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }

/* Sectioned KV list */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }

/* Misc */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.divider { height: 1px; background: var(--line-soft); margin: 8px 0; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; }
.spacer { flex: 1; }
.hr-v { width: 1px; align-self: stretch; background: var(--line); }

/* Checkbox */
.chk {
  width: 18px; height: 18px;
  border-radius: 5px; border: 1.5px solid var(--line-strong);
  background: var(--surface);
  display: inline-grid; place-items: center;
  flex: none;
  transition: background .12s, border-color .12s;
}
.chk.checked { background: var(--olive); border-color: oklch(0.40 0.09 115); }
.chk.checked svg { stroke: oklch(0.98 0.01 100); }
.chk svg { width: 12px; height: 12px; stroke: transparent; stroke-width: 2.4; fill: none; }

/* Right panel */
.workspace { display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
.rpane {
  border-left: 1px solid var(--line);
  background: var(--bg-2);
  overflow: auto;
}
.rpane-h { padding: 14px 16px 8px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line-soft); }
.rpane-h .t { font-weight: 650; font-size: 13.5px; white-space: nowrap; }
.rpane-section { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.rpane-section h4 { margin: 0 0 8px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; white-space: nowrap; }

/* Notification row */
.notif { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line-soft); }
.notif:last-child { border-bottom: 0; }
.notif .ico { width: 28px; height: 28px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; flex: none; color: var(--ink-2); }
.notif .ico.danger { background: var(--danger-wash); border-color: oklch(0.86 0.05 30); color: var(--danger); }
.notif .ico.warn { background: var(--warning-wash); border-color: oklch(0.86 0.07 80); color: oklch(0.45 0.10 70); }
.notif .ico.olive { background: var(--olive-wash); border-color: oklch(0.85 0.04 115); color: var(--olive-ink); }
.notif .body { font-size: 12.5px; color: var(--ink); flex: 1; min-width: 0; }
.notif .meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* Tag chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 8px; border-radius: 999px; font-size: 11.5px; background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.olive { background: var(--olive-wash); color: var(--olive-ink); border-color: oklch(0.85 0.04 115); }
.chip.ramen { background: var(--ramen-wash); color: var(--ramen-ink); border-color: oklch(0.86 0.04 30); }

/* Store summary card */
.store-card { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.store-card .top { display: flex; align-items: flex-start; gap: 12px; }
.store-card .tile {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--surface-3); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  color: var(--ink);
}
.store-card .tile.olive { background: var(--olive-wash); color: var(--olive-ink); border-color: oklch(0.85 0.04 115); }
.store-card .tile.ramen { background: var(--ramen-wash); color: var(--ramen-ink); border-color: oklch(0.86 0.04 30); }
.store-card .tile.burnt { background: var(--burnt-wash); color: var(--burnt); border-color: oklch(0.86 0.04 60); }
.store-card .title { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-card .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.store-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.store-card .stat .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.store-card .stat .v { font-family: var(--font-display); font-weight: 600; font-size: 18px; }

/* Tag of severity */
.sev { font-family: var(--font-mono); font-size: 11px; padding: 0 6px; border-radius: 4px; font-weight: 600; }
.sev.p1 { color: var(--danger); background: var(--danger-wash); }
.sev.p2 { color: oklch(0.45 0.10 70); background: var(--warning-wash); }
.sev.p3 { color: var(--ink-2); background: var(--bg-2); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 4px; }
.tab {
  padding: 8px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--muted);
  position: relative;
  border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; }
.tab.active::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px;
  background: var(--ramen); border-radius: 2px;
}
.tab .cnt { margin-left: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); background: var(--bg-2); padding: 0 5px; border-radius: 4px; }
.tab.active .cnt { color: var(--ramen-ink); background: var(--ramen-wash); }

/* Phone frame for mobile preview */
.phone {
  width: 320px;
  border-radius: 36px;
  background: oklch(0.16 0.012 60);
  padding: 10px;
  box-shadow: 0 30px 70px -30px oklch(0.2 0.02 50 / 0.45), 0 8px 20px -10px oklch(0.2 0.02 50 / 0.25), inset 0 0 0 1px oklch(0.30 0.012 60);
}
.phone .screen {
  border-radius: 28px;
  background: var(--bg);
  overflow: hidden;
  height: 640px;
  position: relative;
  display: flex; flex-direction: column;
}
.phone .notch {
  width: 90px; height: 22px; border-radius: 0 0 14px 14px;
  background: oklch(0.16 0.012 60);
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  z-index: 5;
}
.phone .status {
  height: 30px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 18px 0;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
}

/* Section header inside content */
.sec-h { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.sec-h .t { font-size: 14px; font-weight: 650; white-space: nowrap; }
.sec-h .sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-h .spacer { flex: 1; }

/* Login page */
.login-wrap {
  height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-side {
  background: linear-gradient(170deg, oklch(0.35 0.04 60) 0%, oklch(0.22 0.025 50) 100%);
  color: oklch(0.96 0.012 80);
  padding: 44px 52px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}
.login-side::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(700px 500px at 80% 20%, oklch(0.55 0.10 60 / 0.30), transparent 60%),
    radial-gradient(500px 400px at 10% 90%, oklch(0.55 0.10 115 / 0.25), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.95  0 0 0 0 0.88  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  pointer-events: none;
}
.login-side > * { position: relative; z-index: 1; }
.login-form-wrap {
  padding: 60px 70px;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 540px; margin: 0 auto; width: 100%;
}
.input {
  height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  width: 100%;
  color: var(--ink);
}
.input:focus { border-color: var(--ramen); box-shadow: 0 0 0 3px var(--ramen-wash); }
.input-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; display: block; }

/* Small icon button */
.iconbtn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--ink-2);
  border: 1px solid transparent;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }

/* Sparkline */
.spark { width: 100%; height: 36px; }

/* Heatcell / dotchart */
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; }
.heat .c { aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); }
.heat .c.l1 { background: oklch(0.92 0.04 60); }
.heat .c.l2 { background: oklch(0.85 0.07 50); }
.heat .c.l3 { background: oklch(0.72 0.11 40); }
.heat .c.l4 { background: oklch(0.55 0.13 30); }

/* Activity item */
.act { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.act:last-child { border-bottom: 0; }
.act .when { width: 60px; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); flex: none; padding-top: 2px; }
.act .rail { width: 8px; display: flex; justify-content: center; padding-top: 6px; flex: none; }
.act .rail .nd { width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-2); }
.act .rail .nd.ramen { border-color: var(--ramen); }
.act .rail .nd.olive { border-color: var(--olive); background: var(--olive); }
.act .rail .nd.warn { border-color: var(--warning); }
.act .body { flex: 1; font-size: 13px; }
.act .body .t { font-weight: 600; }
.act .body .m { color: var(--muted); font-size: 12px; margin-top: 2px; }
.act .body .chips { margin-top: 6px; }

/* ============================================================
   MOBILE OVERRIDES — appended at end so they win over base rules
   The earlier @media block is preserved for backward compat;
   these rules take precedence due to source order.
   ============================================================ */

/* Hide helper for elements that should be desktop-only */
.only-desktop { display: initial; }
.only-mobile  { display: none !important; }

/* Mobile-only brand header on login (shown via media query) */
.login-mobile-brand { display: none; }

@media (max-width: 1180px) {
  .grid.g-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.g-5 { grid-template-columns: repeat(3, 1fr); }
  .tb-search { width: 200px; }
  .workspace { grid-template-columns: 1fr; }
  .workspace > .rpane { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 820px) {
  /* --- App shell --- */
  .app { grid-template-columns: 1fr !important; height: 100dvh; }

  /* Sidebar becomes a drawer */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: min(86vw, 320px); z-index: 60;
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.2,.7,.2,1);
    box-shadow: 8px 0 28px -12px oklch(0.15 0.02 50 / 0.35);
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sb-backdrop { z-index: 55; }

  /* Hamburger visible */
  .hamburger {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: 8px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-2);
    margin-right: 2px; flex: none;
  }
  .hamburger:hover { background: var(--surface-2); }

  /* --- Topbar --- */
  .topbar { padding: 0 12px; gap: 8px; height: 52px; }
  .crumbs { font-size: 12.5px; min-width: 0; overflow: hidden; flex: 1; }
  .crumbs > span:not(.sep), .crumbs > strong {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 220px;
  }
  .crumbs .crumb-hide { display: none; }
  .tb-search { display: none !important; }
  .demo-chip { display: none !important; }
  .tb-tools { gap: 4px; flex: none; }
  .tb-btn { padding: 0 8px; }
  .tb-btn .label-md { display: none; }

  /* --- Page --- */
  .page {
    padding: 14px 12px 80px;
    overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    min-height: 0;
  }
  .page-h1 { font-size: 20px; }
  .page-sub { font-size: 12.5px; }
  .page-head { gap: 10px; align-items: stretch; flex-wrap: wrap; margin-bottom: 14px; }
  .page-head > div:first-child { width: 100%; }
  .page-right {
    width: 100%; flex-wrap: wrap; gap: 6px;
    margin-left: 0;
  }
  .page-right .btn, .page-right .tb-btn {
    flex: 1 1 calc(50% - 3px); min-width: 0; justify-content: center;
    height: 36px; padding: 0 10px; font-size: 12.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .page-right .btn > span:not(.unit),
  .page-right .tb-btn > span:not(.unit) { overflow: hidden; text-overflow: ellipsis; }

  /* --- All grids collapse to single column --- */
  .grid.g-2, .grid.g-3, .grid.g-4, .grid.g-5 {
    grid-template-columns: 1fr !important;
  }
  /* Inline grid-template-columns on any element collapses */
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Inline grids without .grid class — caught by attribute selectors */
  /* repeat(3,...) → 1 col (cell groups inside cards become rows) */
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
  }
  /* repeat(4..6,...) → 2 cols (denser strips like context bar) */
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns: repeat(6"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  /* Asymmetric 2-col grids (X.Yfr 1fr) → 1 col */
  [style*="grid-template-columns: 1.5fr"],
  [style*="grid-template-columns: 1.45fr"],
  [style*="grid-template-columns: 1.4fr"],
  [style*="grid-template-columns: 1.1fr"],
  [style*="grid-template-columns: 1.05fr"],
  [style*="grid-template-columns: 320px"],
  [style*="grid-template-columns: 1fr 1.1fr"],
  [style*="grid-template-columns: 1fr 1fr 1.4fr"] {
    grid-template-columns: 1fr !important;
  }
  /* "1fr 1fr 1fr" three-up tight grid (login demo, etc) → 1 col */
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* But keep .stats grid intact at 3-up inside store cards */
  .store-card .stats { grid-template-columns: repeat(3, 1fr) !important; gap: 8px; }

  /* --- Workspace (Dashboard) — page scrolls then rpane below --- */
  .workspace {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }
  .workspace > .page {
    overflow: visible !important;
    height: auto !important;
    min-height: 0;
    padding: 14px 12px 18px;
    flex: none;
  }
  .workspace > .rpane {
    border-left: 0;
    border-top: 1px solid var(--line);
    overflow: visible !important;
    height: auto !important;
    padding-bottom: 60px;
  }

  /* --- Cards --- */
  .card-h { padding: 12px 12px; flex-wrap: wrap; row-gap: 6px; }
  .card-h .t { font-size: 13px; }
  .card-b { padding: 12px; }
  .card-b.tight { padding: 8px; }

  /* Tables — horizontal scroll inside cards */
  .card-b > table.tbl,
  .card > .card-b table.tbl,
  .page > .card table.tbl {
    display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap; max-width: 100%;
  }
  .tbl th, .tbl td { white-space: nowrap; }
  .tbl th { padding: 8px 10px; font-size: 10.5px; }
  .tbl td { padding: 9px 10px; font-size: 12.5px; }

  /* Login — fully stack, hide brand panel */
  .login-wrap {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: 100dvh;
    display: block !important;
  }
  .login-side { display: none !important; }
  .login-form-wrap {
    padding: 28px 20px 36px !important;
    max-width: 100% !important;
    margin: 0 !important;
    width: 100% !important;
    min-height: 100dvh;
  }
  .login-mobile-brand { display: flex !important; }

  /* --- Phone frame: collapse to native mobile (no double-frame) --- */
  .phone {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 12px !important;
  }
  .phone .screen {
    border-radius: 12px !important;
    height: auto !important;
    min-height: 0 !important;
    background: var(--surface) !important;
    border: 1px solid var(--line);
  }
  .phone .notch { display: none !important; }
  .phone .status { display: none !important; }

  /* Mobile preview card on dashboard — hide; not useful on phone */
  .mobile-preview-card { display: none !important; }

  /* Mobile-only hide helper for admin-side panels rendered alongside the phone */
  .hide-on-mobile { display: none !important; }

  /* --- Kanban (Opening board) — horizontal swipe --- */
  .kanban-scroll {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-auto-columns: 88% !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px; padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-scroll > * { scroll-snap-align: start; min-width: 0; }

  /* --- Onboarding two-pane → stack --- */
  .onboard-grid { grid-template-columns: 1fr !important; }

  /* Right-pane sections tighter on mobile */
  .rpane-section { padding: 12px 14px; }

  /* Notif row — wrap action buttons better */
  .notif { gap: 10px; }
  .notif .body .meta { word-break: break-word; }

  /* Activity items — narrower when */
  .act .when { width: 48px; font-size: 11px; }

  /* KV list collapse */
  .kv { grid-template-columns: 100px 1fr; gap: 4px 10px; font-size: 12.5px; }

  /* --- Tweaks panel — keep on mobile but cap width --- */
  .tweaks-panel,
  [data-tweaks-panel],
  .tweaks {
    max-width: calc(100vw - 24px) !important;
  }
}

@media (max-width: 480px) {
  .page { padding: 12px 10px 80px; }
  .page-h1 { font-size: 18px; }
  .topbar { padding: 0 10px; gap: 6px; }
  .crumbs > span:not(.sep), .crumbs > strong { max-width: 150px; font-size: 12px; }

  /* Sidebar drawer */
  .sidebar { width: 86vw; max-width: 320px; }

  /* KPI metric tighter */
  .metric { padding: 12px; }
  .metric .v { font-size: 22px; }
  .metric .k { font-size: 10.5px; }

  /* Store card stats — 2-up at very small widths */
  .store-card .stats { grid-template-columns: 1fr 1fr !important; }
  .store-card .stats .stat:nth-child(3) { grid-column: span 2; }
  .store-card .title { font-size: 14px; }
  .store-card .meta { font-size: 11.5px; }

  /* Tabs scroll if needed */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs .tab { white-space: nowrap; flex: none; }

  /* Card-h chips can wrap */
  .card-h { gap: 6px; }

  /* Tighter scrollbar on phones */
  *::-webkit-scrollbar { width: 4px; height: 4px; }
}
