/* Direction N — static mockup stylesheet.
   One token set drives light and dark; logical properties keep RTL and LTR identical. */

/* ---------- Tokens ----------
   Neutrals are plain zinc greys (no brand tint), as in the reference dashboards.
   Green is reserved for the brand: primary buttons, selection, links and positive state. */
:root {
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;

  --frame: #f4f4f5;      /* outer frame + sidebar */
  --bg: #ffffff;         /* content area */
  --panel: #ffffff;      /* cards (separated by a border, not by fill) */
  --panel-2: #fafafa;
  --sunken: #f4f4f5;
  --line: #e4e4e7;
  --line-soft: #f0f0f2;
  --line-strong: #e4e4e7;
  --link: #1d4ed8;
  --text: #09090b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;

  --accent: #1b8354;
  --accent-hover: #166a45;
  --accent-soft: #ecf7f1;
  --accent-text: #146c43;
  --on-accent: #ffffff;
  --focus: #25935f;

  --ok-bg: #ecfdf3;   --ok-fg: #15803d;   --ok-dot: #22c55e;
  --warn-bg: #fff4ea; --warn-fg: #c2410c; --warn-dot: #f97316;
  --bad-bg: #fef1f1;  --bad-fg: #b91c1c;  --bad-dot: #ef4444;
  --info-bg: #eef4ff; --info-fg: #1d4ed8; --info-dot: #3b82f6;
  --violet-bg: #f5effe; --violet-fg: #7e22ce; --violet-dot: #a855f7;
  --pink-bg: #fdf0f7; --pink-fg: #be185d; --pink-dot: #ec4899;
  --mute-bg: #f4f4f5; --mute-fg: #52525b; --mute-dot: #a1a1aa;
  --chip: #f4f4f5; --chip-line: #e4e4e7; --track: #f4f4f5; --track-line: #e4e4e7;

  --shadow-sm: 0 1px 2px rgb(9 9 11 / 0.05);
  --shadow-md: 0 4px 14px rgb(9 9 11 / 0.07), 0 1px 3px rgb(9 9 11 / 0.05);
  --shadow-lg: 0 18px 48px rgb(9 9 11 / 0.14);

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --side: 264px;
  --top: 56px;
  --ctl: 36px;
  --row: 52px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --frame: #161617; --bg: #1c1c1e; --panel: #222224; --panel-2: #262628; --sunken: #2a2a2d;
    --line: #303034; --line-soft: #29292c; --line-strong: #3a3a3f; --text: #f2f2f3; --text-2: #cfcfd4; --muted: #9b9ba3; --faint: #6c6c74;
    --accent: #2fb06e; --accent-hover: #27975e; --accent-soft: rgb(47 176 110 / 0.16);
    --accent-text: #5fd598; --on-accent: #ffffff; --focus: #5fd598;
    --ok-bg: rgb(47 176 110 / 0.16); --ok-fg: #5fd598; --ok-dot: #22c55e;
    --warn-bg: rgb(249 115 22 / 0.16); --warn-fg: #fdab6c; --warn-dot: #f97316;
    --bad-bg: rgb(239 68 68 / 0.16); --bad-fg: #fb8a8a; --bad-dot: #ef4444;
    --info-bg: rgb(59 130 246 / 0.18); --info-fg: #8ab8ff; --info-dot: #3b82f6;
    --violet-bg: rgb(168 85 247 / 0.18); --violet-fg: #d0a2ff; --violet-dot: #a855f7;
    --pink-bg: rgb(236 72 153 / 0.17); --pink-fg: #f79ac9; --pink-dot: #ec4899;
    --mute-bg: rgb(255 255 255 / 0.08); --mute-fg: #d4d4d8; --mute-dot: #a1a1aa;
    --chip: #2a2a2d; --chip-line: #36363a; --track: #18181a; --track-line: #303034;
    --link: #8ab8ff;
    --shadow-sm: none;
    --shadow-md: 0 6px 18px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 20px 50px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --frame: #161617; --bg: #1c1c1e; --panel: #222224; --panel-2: #262628; --sunken: #2a2a2d;
    --line: #303034; --line-soft: #29292c; --line-strong: #3a3a3f; --text: #f2f2f3; --text-2: #cfcfd4; --muted: #9b9ba3; --faint: #6c6c74;
    --accent: #2fb06e; --accent-hover: #27975e; --accent-soft: rgb(47 176 110 / 0.16);
    --accent-text: #5fd598; --on-accent: #ffffff; --focus: #5fd598;
    --ok-bg: rgb(47 176 110 / 0.16); --ok-fg: #5fd598; --ok-dot: #22c55e;
    --warn-bg: rgb(249 115 22 / 0.16); --warn-fg: #fdab6c; --warn-dot: #f97316;
    --bad-bg: rgb(239 68 68 / 0.16); --bad-fg: #fb8a8a; --bad-dot: #ef4444;
    --info-bg: rgb(59 130 246 / 0.18); --info-fg: #8ab8ff; --info-dot: #3b82f6;
    --violet-bg: rgb(168 85 247 / 0.18); --violet-fg: #d0a2ff; --violet-dot: #a855f7;
    --pink-bg: rgb(236 72 153 / 0.17); --pink-fg: #f79ac9; --pink-dot: #ec4899;
    --mute-bg: rgb(255 255 255 / 0.08); --mute-fg: #d4d4d8; --mute-dot: #a1a1aa;
    --chip: #2a2a2d; --chip-line: #36363a; --track: #18181a; --track-line: #303034;
    --link: #8ab8ff;
    --shadow-sm: none;
    --shadow-md: 0 6px 18px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 20px 50px rgb(0 0 0 / 0.6);
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 22px;
  color: var(--text);
  background: var(--frame);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.xs { width: 14px; height: 14px; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- App frame ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; background: var(--bg); margin-block: 8px; margin-inline-end: 8px; min-height: calc(100vh - 16px); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }

/* Sidebar */
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px;
  background: var(--frame);
  overflow-y: auto;
}
.ws {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); box-shadow: var(--shadow-sm); text-align: start;
}
.ws:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
.logo {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: 9px; background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 15px;
}
.ws-name { font-weight: 600; line-height: 18px; }
.ws-sub { font-size: 12px; line-height: 16px; color: var(--muted); }
.ws .grow { min-width: 0; flex: 1; }
.ws .ws-name, .ws .ws-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; height: var(--ctl);
  margin-block: 8px 6px; padding-inline: 10px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  color: var(--muted); text-align: start;
}
.search-btn span { flex: 1; }
kbd {
  font-family: var(--font); font-size: 11px; line-height: 18px; padding-inline: 6px;
  border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--panel-2);
}

.nav-label { padding: 14px 10px 4px; font-size: 12px; font-weight: 600; color: var(--faint); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding-inline: 10px;
  border-radius: var(--r-sm); color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--sunken); color: var(--text); }
.nav a[aria-current="page"] { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.nav a[aria-current="page"] .ic { color: var(--accent); }
.nav a .ic { color: var(--muted); }
.nav .count {
  margin-inline-start: auto; min-width: 22px; height: 20px; padding-inline: 6px;
  display: grid; place-items: center; border-radius: 6px;
  font-size: 12px; font-weight: 600; background: var(--chip); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--chip-line);
}
.nav .count.hot { background: var(--warn-bg); color: var(--warn-fg); }

.await {
  margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel);
}
.await h4 { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; padding-inline: 2px; }
.await a { display: flex; align-items: center; gap: 8px; padding: 6px 2px; font-size: 13px; color: var(--text-2); border-radius: 6px; }
.await a:hover { color: var(--text); }
.await .d { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--warn-dot); }
.await .d.bad { background: var(--bad-dot); }
.await a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.setup {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-weight: 500;
}
.setup .grow { flex: 1; }
.setup .num { color: var(--muted); font-size: 13px; }
.ring-sm { --p: 66; width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0);
  -webkit-mask: radial-gradient(circle, transparent 6px, #000 6.5px); mask: radial-gradient(circle, transparent 6px, #000 6.5px); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); }
.me:hover { background: var(--sunken); }
.me .grow { min-width: 0; flex: 1; line-height: 18px; }
.me small { display: block; font-size: 12px; color: var(--muted); }

.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; font-size: 12px; font-weight: 600;
  background: var(--sunken); color: var(--text-2); border: 1px solid var(--line);
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar[class*=" c"] { border-color: transparent; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); }
.avatar.c1 { --c: #3466d0; } .avatar.c2 { --c: #c0601f; } .avatar.c3 { --c: #1f8a55; } .avatar.c4 { --c: #7a52dc; } .avatar.c5 { --c: #a87200; }
:root[data-theme="dark"] .avatar.c1 { --c: #8db0f5; } :root[data-theme="dark"] .avatar.c2 { --c: #f2a46c; } :root[data-theme="dark"] .avatar.c3 { --c: #74d6a6; } :root[data-theme="dark"] .avatar.c4 { --c: #b9a2ff; } :root[data-theme="dark"] .avatar.c5 { --c: #f0c35a; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px; height: var(--top); padding-inline: 28px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  border-start-start-radius: 16px; border-start-end-radius: 16px;
}
.crumb { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 13px; }
.crumb a:hover { color: var(--text); }
.crumb [aria-current] { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb .ic { color: var(--faint); }
.top .tools { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  position: relative; display: grid; place-items: center; width: var(--ctl); height: var(--ctl);
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--sunken); color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad-dot); box-shadow: 0 0 0 2px var(--bg); }
.icon-btn.bordered { border: 1px solid var(--line); background: var(--panel); }
.menu-btn { display: none; }
.lang-btn { width: auto; padding-inline: 10px; gap: 6px; display: flex; font-size: 13px; font-weight: 600; }

/* ---------- Page anatomy ---------- */
.page { width: 100%; max-width: 1280px; margin-inline: auto; padding: 24px 28px 96px; display: flex; flex-direction: column; gap: 20px; }
.page.narrow { max-width: 860px; }

.ph { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ph-title { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 360px; }
.tile {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 11px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--accent);
}
.tile.sm { width: 32px; height: 32px; border-radius: 9px; }
.tile.green { background: var(--ok-bg); border-color: transparent; color: var(--ok-fg); box-shadow: none; }
.tile.amber { background: var(--warn-bg); border-color: transparent; color: var(--warn-fg); box-shadow: none; }
.tile.red { background: var(--bad-bg); border-color: transparent; color: var(--bad-fg); box-shadow: none; }
.tile.blue { background: var(--info-bg); border-color: transparent; color: var(--info-fg); box-shadow: none; }
.tile.violet { background: var(--violet-bg); border-color: transparent; color: var(--violet-fg); box-shadow: none; }
.ph h1 { font-size: 22px; line-height: 30px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ph .lead { color: var(--muted); margin-top: 2px; }
.ph-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Buttons — order is always: overflow ⋯, secondary…, primary (primary at the inline end). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl); padding-inline: 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-weight: 500; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--panel-2); border-color: color-mix(in srgb, var(--line) 60%, var(--muted)); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--sunken); }
.btn.danger { color: var(--bad-fg); }
.btn.sm { height: 30px; padding-inline: 10px; font-size: 13px; border-radius: var(--r-sm); }
.btn.icon { width: var(--ctl); padding: 0; }
.btn.sm.icon { width: 30px; }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding-inline: 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--mute-bg); color: var(--mute-fg); box-shadow: inset 0 0 0 1px var(--chip-line);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--mute-dot); }
.pill.plain::before { display: none; }
.pill.ok { box-shadow: none; background: var(--ok-bg); color: var(--ok-fg); } .pill.ok::before { background: var(--ok-dot); }
.pill.warn { box-shadow: none; background: var(--warn-bg); color: var(--warn-fg); } .pill.warn::before { background: var(--warn-dot); }
.pill.bad { box-shadow: none; background: var(--bad-bg); color: var(--bad-fg); } .pill.bad::before { background: var(--bad-dot); }
.pill.info { box-shadow: none; background: var(--info-bg); color: var(--info-fg); } .pill.info::before { background: var(--info-dot); }
.pill.violet { box-shadow: none; background: var(--violet-bg); color: var(--violet-fg); } .pill.violet::before { background: var(--violet-fg); }
.tag { display: inline-flex; align-items: center; height: 24px; padding-inline: 9px; border-radius: 7px; font-size: 12px; font-weight: 500; background: var(--chip); color: var(--text); border: 1px solid var(--chip-line); white-space: nowrap; }

/* Toolbar: tabs on the start side, view controls on the end side */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .end { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--track); border: 1px solid var(--track-line); }
.seg button, .seg a {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: 12px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-weight: 500; white-space: nowrap;
}
.seg button:hover, .seg a:hover { color: var(--text); }
.seg [aria-selected="true"], .seg [aria-current="page"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); font-weight: 600; }
.seg [aria-selected="true"] .n, .seg [aria-current="page"] .n { color: var(--accent-text); }
.seg .n { font-size: 12px; color: var(--faint); }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding-inline: 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--text-2); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-sm);
}
.chip-btn:hover { background: var(--panel-2); }
.chip-btn.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); color: var(--accent-text); }
.chip-btn.on b { color: var(--accent-text); }
.chip-btn b { font-weight: 600; color: var(--text); }
.input {
  display: flex; align-items: center; gap: 8px; height: var(--ctl); padding-inline: 10px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--muted);
}
.input input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--text); }
.input.lg { height: 44px; font-size: 15px; }
.input:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; min-height: 56px; }
.panel-h h2 { font-size: 15px; line-height: 22px; font-weight: 600; }
.panel-h .sub { color: var(--muted); font-size: 13px; }
.panel-h .end { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.panel-b { padding: 0 18px 18px; }
.panel-b.flush { padding: 0; }
.panel-f { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 13px; }
.panel-f .end { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.link { color: var(--accent-text); font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }

.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.cols-wide { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* Stat cards */
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.stat-h { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 500; font-size: 13px; }
.stat-v { display: flex; align-items: baseline; gap: 8px; }
.stat-v strong { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-v small { font-size: 12px; color: var(--muted); }
.delta { font-size: 12px; font-weight: 600; color: var(--ok-fg); }
.delta.down { color: var(--bad-fg); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 28px; }
.bars i { flex: 1; min-width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 30%, transparent); }
.bars i.on { background: var(--accent); }
.bars.amber i { background: color-mix(in srgb, var(--warn-dot) 30%, transparent); }
.bars.amber i.on { background: var(--warn-dot); }

/* Phase rail */
.rail { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding: 6px; }
.rail-step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); min-width: 0; }
.rail-step .mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none; border: 1.5px solid var(--line); color: var(--faint); font-size: 12px; font-weight: 600; background: var(--panel); margin-top: 1px; }
.rail-step.done .mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rail-step.now { background: var(--accent-soft); }
.rail-step.now .mark { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.rail-step b { display: block; font-weight: 600; font-size: 13px; line-height: 20px; }
.rail-step span { display: block; font-size: 12px; line-height: 17px; color: var(--muted); }
.rail-step.now b { color: var(--accent-text); }

/* Lists */
.list { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-soft); min-width: 0; }
.row-item:hover { background: var(--panel-2); }
.row-item .grow { min-width: 0; flex: 1; }
.row-item .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .s { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sep-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); display: inline-block; }

.date-tile { width: 44px; flex: none; text-align: center; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--panel); }
.date-tile small { display: block; font-size: 11px; line-height: 18px; background: var(--sunken); color: var(--muted); font-weight: 600; }
.date-tile b { display: block; font-size: 16px; line-height: 24px; font-weight: 700; }

/* Ring + meter */
.ring { --p: 66; position: relative; width: 132px; height: 132px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--sunken) 0); display: grid; place-items: center; }
.ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--panel); }
.ring > div { position: relative; text-align: center; }
.ring strong { display: block; font-size: 26px; line-height: 30px; font-weight: 700; }
.ring small { font-size: 12px; color: var(--muted); }
.meter { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter.amber i { background: var(--warn-dot); }
.meter-row { display: flex; align-items: center; gap: 10px; }
.meter-row .meter { flex: 1; }
.legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-row i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.legend-row b { margin-inline-start: auto; font-weight: 600; }

/* Week chart */
.chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; align-items: end; height: 140px; padding-top: 8px; }
.chart .col { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.chart .col i { display: block; border-radius: 4px 4px 2px 2px; background: var(--accent); }
.chart .col i.plan { background: var(--sunken); border: 1px dashed var(--line); }
.chart-x { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; font-size: 11px; color: var(--faint); text-align: center; margin-top: 6px; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th {
  height: 40px; padding-inline: 12px; text-align: start; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.tbl th:first-child { padding-inline-start: 18px; }
.tbl th:last-child { padding-inline-end: 18px; }
.tbl td { height: var(--row); padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl td:first-child { padding-inline-start: 18px; }
.tbl td:last-child { padding-inline-end: 18px; }
.tbl tbody tr:hover td { background: var(--panel-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .w-check { width: 44px; }
.tbl .w-act { width: 52px; text-align: end; }
.tbl .end { text-align: end; }
.tbl .group td { height: 38px; background: var(--chip); font-size: 12px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--line-soft); }
.tbl .group td .n { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding-inline: 5px; border-radius: 5px; background: var(--panel); border: 1px solid var(--line); font-size: 11px; margin-inline-start: 6px; }
.tbl tr.sel td { background: var(--accent-soft); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { display: block; font-weight: 600; line-height: 20px; white-space: nowrap; }
.who small { display: block; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.check { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; vertical-align: middle; }

/* Key-facts table (label | value) */
.facts { display: grid; grid-template-columns: 180px minmax(0, 1fr); }
.facts > div { padding: 12px 18px; border-top: 1px solid var(--line-soft); min-height: 48px; display: flex; align-items: center; gap: 8px; }
.facts > div:nth-child(odd) { color: var(--muted); background: var(--panel-2); border-inline-end: 1px solid var(--line-soft); }
.facts > div:nth-child(-n+2) { border-top: 0; }

/* Lifecycle steps */
.steps { display: flex; align-items: center; gap: 0; padding: 14px 18px; overflow-x: auto; }
.step { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--muted); }
.step .mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); font-size: 12px; font-weight: 600; background: var(--panel); }
.step.done { color: var(--text-2); }
.step.done .mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step.now { color: var(--text); font-weight: 600; }
.step.now .mark { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.step-line { flex: 1; min-width: 24px; height: 1.5px; background: var(--line); margin-inline: 12px; }
.step-line.done { background: var(--accent); }

/* Notice (one per page, state only) */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-lg); background: var(--info-bg); color: var(--info-fg); }
.notice.warn { background: var(--warn-bg); color: var(--warn-fg); }
.notice.ok { background: var(--ok-bg); color: var(--ok-fg); }
.notice .grow { flex: 1; min-width: 0; }
.notice b { display: block; font-weight: 600; }
.notice p { color: var(--text-2); font-size: 13px; }
.notice .btn { margin-inline-start: auto; }

/* Timeline */
.tl { list-style: none; margin: 0; padding: 4px 18px 18px; display: flex; flex-direction: column; }
.tl li { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; inset-inline-start: 13px; top: 30px; bottom: 2px; width: 1.5px; background: var(--line-soft); }
.tl li:last-child::before { display: none; }
.tl .grow { flex: 1; min-width: 0; padding-top: 3px; }
.tl p { font-size: 13px; line-height: 20px; }
.tl small { font-size: 12px; color: var(--muted); }

/* Content blocks */
.prose { color: var(--text-2); line-height: 26px; }
.ol { list-style: none; counter-reset: n; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ol li { counter-increment: n; display: flex; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-soft); }
.ol li::before { content: counter(n, arabic-indic); display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 7px; background: var(--sunken); color: var(--muted); font-size: 12px; font-weight: 600; }
[lang="en"] .ol li::before { content: counter(n); }
.ol .grow { flex: 1; min-width: 0; }
.ol b { font-weight: 600; display: block; }
.file { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line-soft); }
.file .grow { flex: 1; min-width: 0; }
.file b { display: block; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file small { color: var(--muted); font-size: 12px; }

/* ---------- Forms ---------- */
.form-group { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; padding-block: 24px; border-top: 1px solid var(--line); }
.form-group:first-of-type { border-top: 0; padding-top: 4px; }
.form-group > header h2 { font-size: 15px; font-weight: 600; line-height: 22px; }
.form-group > header p { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 20px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 16px; padding: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 500; font-size: 13px; display: flex; gap: 4px; align-items: center; }
.field label .req { color: var(--bad-fg); }
.field label .opt { color: var(--faint); font-weight: 400; }
.field .help { font-size: 12px; line-height: 18px; color: var(--muted); }
.field .err { font-size: 12px; line-height: 18px; color: var(--bad-fg); display: flex; gap: 6px; align-items: center; }
.control {
  height: 40px; width: 100%; padding-inline: 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); color: var(--text); outline: 0; box-shadow: var(--shadow-sm);
}
.control::placeholder { color: var(--faint); }
.control:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
.control.invalid { border-color: var(--bad-dot); box-shadow: 0 0 0 3px var(--bad-bg); }
select.control { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-size: 5px 5px; background-repeat: no-repeat; background-position: left 16px center, left 11px center; }
[dir="ltr"] select.control { background-position: right 11px center, right 16px center; }
.choice { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.choice label { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding-inline: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); font-weight: 500; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.choice input { accent-color: var(--accent); margin: 0; }
.sugg { display: flex; gap: 6px; flex-wrap: wrap; }
.sugg button { height: 26px; padding-inline: 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; color: var(--text-2); }
.sugg button:hover { border-color: var(--accent); color: var(--accent-text); }

.setting { display: flex; gap: 16px; align-items: center; padding: 16px 20px; border-top: 1px solid var(--line-soft); }
.setting:first-child { border-top: 0; }
.setting .grow { flex: 1; min-width: 0; }
.setting b { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.setting p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { appearance: none; margin: 0; width: 100%; height: 100%; border-radius: 999px; background: var(--line); cursor: pointer; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: inset-inline-start 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { inset-inline-start: 19px; }

/* Sticky bars */
.savebar {
  position: sticky; bottom: 16px; z-index: 15; display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 16px; padding-inline-start: 16px; margin-top: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.savebar .state { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 500; }
.savebar .state { min-width: 0; }
.savebar .state span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.savebar .state i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--warn-dot); }
.savebar .end { margin-inline-start: auto; display: flex; gap: 8px; }
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; padding-inline-start: 16px; border-radius: var(--r-lg); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); }
.bulkbar .btn { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 25%, transparent); box-shadow: none; }
.bulkbar .btn:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }
.bulkbar .end { margin-inline-start: auto; display: flex; gap: 6px; }
.pager { display: flex; gap: 4px; align-items: center; }
.pager .btn { min-width: 30px; padding-inline: 8px; }
.pager .btn[aria-current] { background: var(--chip); border-color: var(--chip-line); font-weight: 700; }

/* Menus */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 40; min-width: 220px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); display: none;
}
.menu.open { display: block; }
.menu a, .menu button { white-space: nowrap; display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding-inline: 10px; border: 0; border-radius: 7px; background: transparent; text-align: start; font-size: 13px; color: var(--text-2); }
.menu a:hover, .menu button:hover { background: var(--sunken); color: var(--text); }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 6px 0; }
.menu .danger { color: var(--bad-fg); }


/* ---------- Area tabs (one row under the page header, links between sibling pages) ---------- */
.area-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-top: -4px; }
.area-tabs::-webkit-scrollbar { display: none; }
.area-tabs a { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding-inline: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.area-tabs a:hover { color: var(--text); }
.area-tabs a[aria-current="page"] { color: var(--text); font-weight: 600; }
.area-tabs a[aria-current="page"]::after { content: ""; position: absolute; inset-inline: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.area-tabs .count { min-width: 20px; height: 18px; padding-inline: 5px; display: inline-grid; place-items: center; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--warn-bg); color: var(--warn-fg); }

/* ---------- Section layout: a sub-navigation beside the content (School, Account, Settings) ---------- */
.with-subnav { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.subnav { position: sticky; top: calc(var(--top) + 16px); display: flex; flex-direction: column; gap: 1px; }
.subnav h3 { padding: 12px 10px 4px; font-size: 12px; font-weight: 600; color: var(--faint); }
.subnav h3:first-child { padding-top: 0; }
.subnav a { display: flex; align-items: center; gap: 10px; height: 34px; padding-inline: 10px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; }
.subnav a:hover { background: var(--sunken); color: var(--text); }
.subnav a[aria-current="page"] { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.subnav a[aria-current="page"] .ic { color: var(--accent); }
.subnav a .ic { color: var(--muted); }
.subnav a .pill { margin-inline-start: auto; height: 20px; font-size: 11px; padding-inline: 7px; }

/* ---------- Hub cards ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.hub-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; transition: border-color 0.15s, box-shadow 0.15s; }
.hub-card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); box-shadow: var(--shadow-md); }
.hub-card-h { display: flex; align-items: center; gap: 10px; }
.hub-card-h b { font-weight: 600; flex: 1; min-width: 0; }
.hub-card p { color: var(--muted); font-size: 13px; line-height: 20px; }
.hub-card-f { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.hub-card-f .end { margin-inline-start: auto; display: flex; gap: 6px; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.section-title h2 { font-size: 16px; font-weight: 600; }
.section-title p { color: var(--muted); font-size: 13px; }
.section-title .end { margin-inline-start: auto; }

/* ---------- Document frame (chrome only; renderers stay untouched — RULES R2) ---------- */
.doc-stage { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; display: flex; justify-content: center; overflow: auto; }
.paper { width: 100%; max-width: 620px; aspect-ratio: 1 / 1.414; background: #fff; color: #1b1b1b; border-radius: 4px; box-shadow: var(--shadow-md); padding: 6% 7%; display: flex; flex-direction: column; gap: 10px; font-size: 12px; }
.paper .ph-line { height: 9px; border-radius: 3px; background: #e7e9e8; }
.paper .ph-line.w60 { width: 60%; } .paper .ph-line.w40 { width: 40%; } .paper .ph-line.w80 { width: 80%; }
.paper .ph-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 1.5px solid #cfd4d1; margin-bottom: 6px; }
.paper .ph-head b { font-size: 14px; }
.paper .ph-table { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #cfd4d1; margin-top: 6px; }
.paper .ph-table i { height: 22px; border-inline-end: 1px solid #e1e4e2; border-bottom: 1px solid #e1e4e2; }
.paper .ph-table i.h { background: #eef1ef; }
.paper .ph-note { margin-top: auto; text-align: center; color: #8a918d; font-size: 11px; }

/* ---------- Guided task stepper ---------- */
.wizard { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.vsteps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; position: sticky; top: calc(var(--top) + 16px); }
.vsteps li { position: relative; display: flex; gap: 12px; padding-bottom: 22px; }
.vsteps li:last-child { padding-bottom: 0; }
.vsteps li::before { content: ""; position: absolute; inset-inline-start: 11px; top: 26px; bottom: 2px; width: 1.5px; background: var(--line); }
.vsteps li:last-child::before { display: none; }
.vsteps li.done::before { background: var(--accent); }
.vsteps .mark { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1.5px solid var(--line); background: var(--panel); font-size: 12px; font-weight: 600; color: var(--muted); }
.vsteps .done .mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.vsteps .now .mark { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.vsteps b { display: block; font-weight: 600; font-size: 13px; line-height: 22px; }
.vsteps .now b { color: var(--accent-text); }
.vsteps small { display: block; color: var(--muted); font-size: 12px; line-height: 18px; }
.step-actions { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); }
.step-actions .end { margin-inline-start: auto; display: flex; gap: 8px; }

/* Option cards (radio cards) */
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.opt input { accent-color: var(--accent); margin: 3px 0 0; }
.opt b { display: block; font-weight: 600; }
.opt small { display: block; color: var(--muted); font-size: 12px; line-height: 18px; margin-top: 2px; }

/* Upload */
.drop { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px; border: 1.5px dashed var(--chip-line); border-radius: var(--r-lg); background: var(--panel-2); text-align: center; color: var(--muted); }
.drop b { color: var(--text); font-weight: 600; }

/* Empty state */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 16px; text-align: center; }
.empty .tile { width: 48px; height: 48px; border-radius: 14px; }
.empty b { font-size: 15px; font-weight: 600; }
.empty p { color: var(--muted); max-width: 380px; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal > .dow { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--line); }
.cal > .day { min-height: 104px; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); border-inline-end: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal > .day:nth-child(7n) { border-inline-end: 0; }
.cal > .day.out { background: var(--panel-2); color: var(--faint); }
.cal > .day.today .d { background: var(--accent); color: var(--on-accent); }
.cal .d { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; font-weight: 600; }
.cal .d small { font-size: 10px; color: var(--faint); font-weight: 500; }
.cal .dh { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal .dh small { font-size: 10px; color: var(--faint); }
.ev { display: block; padding: 2px 6px; border-radius: 5px; font-size: 11px; line-height: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--info-bg); color: var(--info-fg); }
.ev.ok { background: var(--ok-bg); color: var(--ok-fg); }
.ev.warn { background: var(--warn-bg); color: var(--warn-fg); }
.ev.bad { background: var(--bad-bg); color: var(--bad-fg); }
.ev.mute { background: var(--mute-bg); color: var(--mute-fg); }
.ev.band { border-radius: 0; margin-inline: -8px; padding-inline: 8px; }

/* ---------- Timetable grid ---------- */
.tt { display: grid; grid-template-columns: 90px repeat(7, minmax(110px, 1fr)); min-width: 880px; }
.tt > div { padding: 8px; border-bottom: 1px solid var(--line-soft); border-inline-end: 1px solid var(--line-soft); min-height: 64px; }
.tt > .h { min-height: 0; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); border-bottom-color: var(--line); }
.tt > .rowh { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--panel-2); display: flex; flex-direction: column; justify-content: center; }
.tt > .rowh small { font-weight: 400; color: var(--muted); }
.slot { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 7px; font-size: 12px; line-height: 16px; background: var(--chip); border: 1px solid var(--chip-line); }
.slot b { font-weight: 600; }
.slot small { color: var(--muted); }
.slot.act { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent-text); }
.slot.act small { color: var(--accent-text); opacity: 0.8; }
.slot.free { background: transparent; border-style: dashed; color: var(--faint); align-items: center; justify-content: center; min-height: 46px; }

/* ---------- Board (follow-up week) ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.lane { background: var(--sunken); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lane-h { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-weight: 600; font-size: 13px; }
.lane-h .pill { margin-inline-start: auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm); }
.card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.card b { font-weight: 600; font-size: 13px; line-height: 20px; }
.card .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.card .foot { display: flex; align-items: center; gap: 6px; }
.card .foot .end { margin-inline-start: auto; }

/* ---------- Sheet (side panel) ---------- */
.sheet-demo { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 70; width: 440px; max-width: 100vw; background: var(--panel); border-inline-end: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.sheet-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.sheet-h h2 { font-size: 16px; font-weight: 600; flex: 1; }
.sheet-b { padding: 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; flex: 1; }
.sheet-f { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line-soft); }
.sheet-scrim { position: fixed; inset: 0; z-index: 65; background: rgb(0 0 0 / 0.3); }
textarea.control { height: auto; min-height: 112px; padding-block: 10px; resize: vertical; line-height: 22px; }

/* Misc */
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv small { color: var(--muted); font-size: 12px; }
.kv b { font-weight: 600; }
.inline-stats { display: flex; gap: 24px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line-soft); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; padding: 0 18px 18px; }
.photo { aspect-ratio: 4 / 3; border-radius: var(--r); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--sunken)), color-mix(in srgb, var(--info-dot) 18%, var(--sunken))); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.photo.poster { aspect-ratio: 4 / 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--text); }
.req { color: var(--bad-fg); }
.field label .opt { display: inline; padding: 0; border: 0; background: none; border-radius: 0; box-shadow: none; }
.stack-av { display: inline-flex; }
.stack-av .avatar + .avatar { margin-inline-start: -8px; box-shadow: 0 0 0 2px var(--panel); }
.diff-del { background: var(--bad-bg); color: var(--bad-fg); text-decoration: line-through; padding-inline: 4px; border-radius: 4px; }
.diff-add { background: var(--ok-bg); color: var(--ok-fg); padding-inline: 4px; border-radius: 4px; }
.hbar { display: grid; grid-template-columns: 140px minmax(0, 1fr) 40px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.hbar .meter { height: 8px; }
.hbar b { text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; }
.code-lg { font-size: 20px; }
.code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; letter-spacing: 0.04em; direction: ltr; unicode-bidi: isolate; }



/* ---------- Dashboard patterns (reference-led: Deals table, Library cards, OpenPanel analytics) ---------- */
/* Summary chip beside the h1: "12 programs · 6 to review" */
.sum { display: inline-flex; align-items: center; height: 26px; padding-inline: 10px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); background: var(--chip); box-shadow: inset 0 0 0 1px var(--chip-line); white-space: nowrap; }
.hint { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hint .d { width: 7px; height: 7px; border-radius: 50%; background: var(--warn-dot); }

/* Coloured tags (field / type), like the Deals industry chips */
.tag.t-blue { background: var(--info-bg); color: var(--info-fg); border-color: transparent; }
.tag.t-green { background: var(--ok-bg); color: var(--ok-fg); border-color: transparent; }
.tag.t-amber { background: var(--warn-bg); color: var(--warn-fg); border-color: transparent; }
.tag.t-red { background: var(--bad-bg); color: var(--bad-fg); border-color: transparent; }
.tag.t-violet { background: var(--violet-bg); color: var(--violet-fg); border-color: transparent; }

/* Item chip in a table's first column: small icon square + name */
.item { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.item .sq { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); }
.item .sq .ic { width: 14px; height: 14px; }
.item span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Group header row with a total on the inline end */
.tbl .group td .tot { float: inline-end; font-weight: 600; color: var(--text-2); }
.tbl .group td .gd { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-inline-end: 8px; background: var(--mute-dot); vertical-align: middle; }
.tbl .group td .gd.warn { background: var(--warn-dot); } .tbl .group td .gd.bad { background: var(--bad-dot); }
.tbl .group td .gd.info { background: var(--info-dot); } .tbl .group td .gd.ok { background: var(--ok-dot); }
.tbl .add-row td { height: 40px; color: var(--muted); font-size: 13px; }

/* Compact analytics table with data bars behind each row (OpenPanel) */
.dtbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtbl th { height: 34px; padding-inline: 14px; text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line-soft); }
.dtbl th.n, .dtbl td.n { text-align: end; width: 64px; font-variant-numeric: tabular-nums; }
.dtbl td { position: relative; height: 38px; padding-inline: 14px; border-bottom: 1px solid var(--line-soft); }
.dtbl tr:last-child td { border-bottom: 0; }
.dtbl tr.bar { background: linear-gradient(to var(--bar-dir, left), color-mix(in srgb, var(--accent) 9%, transparent) var(--w), transparent var(--w)); }
[dir="ltr"] .dtbl tr.bar { --bar-dir: right; }
.dtbl tr.bar.amber { background: linear-gradient(to var(--bar-dir, left), color-mix(in srgb, var(--warn-dot) 13%, transparent) var(--w), transparent var(--w)); }
.dtbl .lbl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dtbl .lbl span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Hero metric (OpenPanel "Unique visitors") */
.hero-metric { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.hero-metric .k { color: var(--text-2); font-weight: 500; }
.hero-metric .v { font-size: 48px; line-height: 52px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-metric .v small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-inline-start: 6px; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 72px; }
.spark i { flex: 1; border-radius: 3px 3px 1px 1px; background: var(--accent); min-height: 3px; }
.spark i.plan { background: var(--track); box-shadow: inset 0 0 0 1px var(--track-line); }

/* Hero card internals */
.hero-metric .link { margin-inline-start: auto; }
.grid.eq { align-items: stretch; }
.panel:has(> .dtbl) { overflow: hidden; }
.hero-metric .chart-x.w18 { grid-template-columns: repeat(18, minmax(0, 1fr)); gap: 4px; margin-top: -4px; }
.hero-metric .inline-stats { padding: 14px 0 0; }
.bulkbar { position: sticky; bottom: 16px; z-index: 15; }

/* Feed (latest activity list, OpenPanel event stream) */
.feed { display: flex; flex-direction: column; }
.feed a { display: flex; gap: 10px; align-items: flex-start; padding: 12px 18px; border-top: 1px solid var(--line-soft); }
.feed a:hover { background: var(--panel-2); }
.feed small { display: block; color: var(--muted); font-size: 12px; line-height: 18px; }
.feed b { display: block; font-weight: 600; font-size: 13px; line-height: 20px; }
.feed .when { margin-inline-start: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }

/* Library-style stat card: icon + label row, then value + caption */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.kpi-h { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text-2); }
.kpi-v { display: flex; flex-direction: column; gap: 2px; }
.kpi-v strong { font-size: 22px; line-height: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-v small { color: var(--muted); font-size: 12px; }
.kpi .link { margin-inline-start: auto; }

/* Chevron list rows (Library "Group" list) */
.chev-list a { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-soft); }
.chev-list a:hover { background: var(--panel-2); }
.chev-list .grow { min-width: 0; flex: 1; }
.chev-list b { display: block; font-weight: 600; }
.chev-list small { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }


/* =====================================================================
   Components v2 — matched to the reference dashboards (Library, Deals, Shopify, OpenPanel)
   ===================================================================== */

/* Buttons: white, 1px border, soft shadow; icons muted; one green primary */
.btn { height: 36px; padding-inline: 12px; border-radius: 10px; border-color: var(--line); font-weight: 500; font-size: 13.5px; box-shadow: 0 1px 2px rgb(9 9 11 / 0.04); }
.btn .ic { color: var(--muted); }
.btn.primary .ic, .bulkbar .btn .ic { color: inherit; }
.btn:hover { background: var(--panel-2); border-color: var(--line); }
.btn.primary { box-shadow: 0 1px 2px rgb(9 9 11 / 0.12), inset 0 1px 0 rgb(255 255 255 / 0.12); }
.btn.sm { height: 30px; padding-inline: 10px; border-radius: 8px; font-size: 13px; }
.btn.ghost { box-shadow: none; border-color: transparent; }
.icon-btn { border-radius: 10px; }
.icon-btn.bordered, .top .icon-btn { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 1px 2px rgb(9 9 11 / 0.04); width: 34px; height: 34px; }
.top .lang-btn { width: auto; }
.top .tools { gap: 6px; }

/* Filter / sort chips = small outline buttons ("New group", "Order by: most recent") */
.chip-btn { height: 34px; padding-inline: 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text-2); box-shadow: 0 1px 2px rgb(9 9 11 / 0.04); }
.chip-btn .ic { color: var(--muted); }
.chip-btn b { color: var(--text); font-weight: 600; }
.chip-btn.on { border-color: var(--line); background: var(--panel); color: var(--text-2); }
.chip-btn.on b { color: var(--text); }

/* Segmented tabs ("All | Group | Database") */
.seg { padding: 3px; gap: 2px; border-radius: 10px; background: var(--track); border: 1px solid var(--track-line); }
.seg button, .seg a { height: 30px; padding-inline: 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.seg button:hover, .seg a:hover { color: var(--text); }
.seg [aria-selected="true"], .seg [aria-current="page"] { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(9 9 11 / 0.08), 0 0 0 1px var(--line); }
.seg .n { color: var(--faint); font-weight: 500; }
.seg [aria-selected="true"] .n, .seg [aria-current="page"] .n { color: var(--muted); }

/* Area tabs use the same segmented control, so every tab row in the app looks the same */
.area-tabs { display: inline-flex; align-self: flex-start; max-width: 100%; gap: 2px; padding: 3px; margin-top: 0; border: 1px solid var(--track-line); border-radius: 10px; background: var(--track); }
.area-tabs a { height: 30px; padding-inline: 12px; border-radius: 8px; color: var(--muted); }
.area-tabs a[aria-current="page"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgb(9 9 11 / 0.08), 0 0 0 1px var(--line); }
.area-tabs a[aria-current="page"]::after { display: none; }
.area-tabs .count { background: var(--warn-bg); color: var(--warn-fg); border-radius: 6px; }

/* Status badge ("● Active"): surface fill, 1px border, coloured dot + coloured text */
.pill { height: 24px; padding-inline: 8px; gap: 6px; border-radius: 7px; font-size: 12px; font-weight: 500; background: var(--panel); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
.pill::before { width: 6px; height: 6px; background: var(--mute-dot); }
.pill.ok, .pill.warn, .pill.bad, .pill.info, .pill.violet { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.pill.ok { color: var(--ok-fg); } .pill.ok::before { background: var(--ok-dot); }
.pill.warn { color: var(--warn-fg); } .pill.warn::before { background: var(--warn-dot); }
.pill.bad { color: var(--bad-fg); } .pill.bad::before { background: var(--bad-dot); }
.pill.info { color: var(--info-fg); } .pill.info::before { background: var(--info-dot); }
.pill.violet { color: var(--violet-fg); } .pill.violet::before { background: var(--violet-dot); }
.pill.plain { padding-inline: 8px; }

/* Category tag ("Negotiation", "Technology"): tinted fill, coloured text, no border */
.tag { height: 24px; padding-inline: 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--panel); color: var(--text-2); border: 1px solid var(--line); }
.tag.t-blue, .tag.t-green, .tag.t-amber, .tag.t-red, .tag.t-violet, .tag.t-pink { border-color: transparent; }
.tag.t-blue { background: var(--info-bg); color: var(--info-fg); }
.tag.t-green { background: var(--ok-bg); color: var(--ok-fg); }
.tag.t-amber { background: var(--warn-bg); color: var(--warn-fg); }
.tag.t-red { background: var(--bad-bg); color: var(--bad-fg); }
.tag.t-violet { background: var(--violet-bg); color: var(--violet-fg); }
.tag.t-pink { background: var(--pink-bg); color: var(--pink-fg); }
.sum { height: 24px; padding-inline: 8px; border-radius: 7px; font-size: 12px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); }
.nav .count { border-radius: 6px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); }
.nav .count.hot { background: var(--warn-bg); color: var(--warn-fg); box-shadow: none; }

/* Small icon squares: solid colour, white glyph (Library stat cards) */
.tile.sm.green, .tile.sm.amber, .tile.sm.red, .tile.sm.blue, .tile.sm.violet { color: #fff; border: 0; box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.08); }
.tile.sm.green { background: var(--ok-dot); } .tile.sm.amber { background: var(--warn-dot); } .tile.sm.red { background: var(--bad-dot); }
.tile.sm.blue { background: var(--info-dot); } .tile.sm.violet { background: var(--violet-dot); }
.tile.sm { width: 28px; height: 28px; border-radius: 8px; }
.tile.sm .ic { width: 15px; height: 15px; }
.kpi-h .tile.sm, .stat-h .tile.sm { width: 24px; height: 24px; border-radius: 7px; }
.kpi-h .tile.sm .ic, .stat-h .tile.sm .ic { width: 14px; height: 14px; }

/* Cards: white on white, separated by a border (Library) */
.panel { border-radius: 14px; box-shadow: 0 1px 2px rgb(9 9 11 / 0.03); }
.panel-h h2 { font-size: 15px; font-weight: 600; }
.kpi-v strong, .stat-v strong { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: 0; }
.hero-metric .v { font-weight: 600; }

/* Tables: rounded grey header bar inside the card, thin row dividers (Library "Database") */
.panel .tbl-wrap { padding-inline: 10px; }
.panel > .tbl-wrap:first-child { padding-top: 10px; }
.tbl th { height: 38px; background: var(--sunken); border-bottom: 0; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.tbl th:first-child { border-start-start-radius: 9px; border-end-start-radius: 9px; padding-inline-start: 12px; }
.tbl th:last-child { border-start-end-radius: 9px; border-end-end-radius: 9px; padding-inline-end: 12px; }
.tbl td:first-child { padding-inline-start: 12px; }
.tbl td:last-child { padding-inline-end: 12px; }
.tbl tbody tr:hover td { background: var(--panel-2); }
/* Group row (Deals): dot · label · count, no grey band */
.tbl .group td { height: 40px; background: transparent; color: var(--text); font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line-soft); }
.tbl .group td .n { background: var(--sunken); border: 0; border-radius: 6px; color: var(--muted); }
.tbl .add-row td { height: 38px; }
.dtbl th { color: var(--muted); font-weight: 500; }

/* Key-facts table */
.facts > div:nth-child(odd) { background: transparent; }

/* Inputs */
.input, .control { border-radius: 10px; border-color: var(--line); box-shadow: 0 1px 2px rgb(9 9 11 / 0.04); }
.input { height: 34px; }

/* Avatars: neutral letter circles (Deals owner column) */
.avatar[class*=" c"] { background: var(--sunken); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
.avatar.lg[class*=" c"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }

/* Item chip square (Deals record icon) */
.item .sq { background: var(--violet-dot); color: #fff; }

/* Page header tile: neutral outline square */
.ph .tile:not(.sm) { background: var(--panel); border: 1px solid var(--line); color: var(--text-2); box-shadow: 0 1px 2px rgb(9 9 11 / 0.04); }

/* Sidebar items (Library: grey selected pill, no border) */
.nav a[aria-current="page"] { background: color-mix(in srgb, var(--text) 7%, transparent); box-shadow: none; }
.nav a[aria-current="page"] .ic { color: var(--text); }
.subnav a[aria-current="page"] { background: color-mix(in srgb, var(--text) 6%, transparent); box-shadow: none; }
.subnav a[aria-current="page"] .ic { color: var(--text); }
.ws, .search-btn, .await, .setup { box-shadow: none; }


/* =====================================================================
   Studio (owner-chosen direction C, 2026-10-10) — Shopify app-page language
   ===================================================================== */
.page { padding: 32px 40px 96px; gap: 28px; max-width: 1180px; }
.page.narrow { max-width: 920px; }
.panel { border-radius: 16px; box-shadow: none; }
.panel-h { padding: 16px 20px; }
.panel-h h2 { font-size: 16px; }
.panel-b { padding: 0 20px 20px; }

/* Page header: big icon square, large title, status chip, actions on the end aligned to the bottom */
.ph { align-items: flex-end; gap: 20px; }
.ph-title { align-items: flex-end; gap: 16px; }
.ph .tile:not(.sm), .ph .logo, .ph .avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 24px; }
.ph .tile:not(.sm) .ic { width: 26px; height: 26px; }
.ph .tile:not(.sm) { background: var(--panel); border: 1px solid var(--line); color: var(--text); box-shadow: none; }
.ph h1 { font-size: 26px; line-height: 34px; font-weight: 600; gap: 12px; }
.ph .lead { font-size: 15px; line-height: 24px; margin-top: 4px; }

/* Buttons: outline on the surface; one solid green primary */
.btn { background: transparent; border-color: var(--line-strong); box-shadow: none; color: var(--text); height: 38px; padding-inline: 14px; font-size: 14px; }
.btn:hover { background: var(--sunken); border-color: var(--line-strong); }
.btn .ic { color: var(--text-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: none; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.sm { height: 32px; }
.chip-btn, .top .icon-btn { background: transparent; border-color: var(--line-strong); box-shadow: none; }
.input, .control { background: var(--bg); border-color: var(--line-strong); box-shadow: none; }

/* Status badge = tinted chip (Shopify "Connected"); no dot, no border */
.pill { height: 26px; padding-inline: 10px; border-radius: 7px; font-size: 12.5px; font-weight: 500; box-shadow: none; background: var(--mute-bg); color: var(--mute-fg); }
.pill::before { display: none; }
.pill.ok, .pill.warn, .pill.bad, .pill.info, .pill.violet { box-shadow: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.bad { background: var(--bad-bg); color: var(--bad-fg); }
.pill.info { background: var(--info-bg); color: var(--info-fg); }
.pill.violet { background: var(--violet-bg); color: var(--violet-fg); }
.sum { background: var(--chip); box-shadow: none; height: 26px; border-radius: 7px; font-size: 12.5px; }
.tag { background: var(--chip); border-color: transparent; }

/* Label / value sections (Shopify "Data sync") */
.facts { grid-template-columns: 280px minmax(0, 1fr); }
.facts > div { padding: 16px 20px; min-height: 56px; border-top: 1px solid var(--line); }
.facts > div:nth-child(odd) { background: transparent; color: var(--text-2); border-inline-end: 1px solid var(--line); }
.facts a { text-decoration: underline; text-underline-offset: 4px; }

/* Data links inside sections are underlined in the link colour */
.u-link { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

/* Tables keep the rounded header bar */
.tbl th { background: var(--sunken); }
.tbl .group td .n { background: var(--chip); }

/* Settings rows (Shopify "Tool permissions") */
.setting { padding: 18px 20px; }
.setting b { font-weight: 500; }

/* Studio home building blocks */
.studio { max-width: 920px; margin-inline: auto; width: 100%; display: flex; flex-direction: column; gap: 28px; }
.studio-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.studio-head .logo { width: 64px; height: 64px; border-radius: 16px; font-size: 28px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08); }
.studio-head h1 { font-size: 28px; line-height: 36px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.studio-head p { color: var(--muted); font-size: 15px; margin-top: 4px; }
.studio-head .acts { margin-inline-start: auto; display: flex; gap: 10px; }
.status-ok { display: inline-flex; align-items: center; height: 26px; padding-inline: 10px; border-radius: 7px; background: var(--ok-bg); color: var(--ok-fg); font-size: 13px; font-weight: 500; }
.banner { border-radius: 20px; padding: 44px 24px; display: grid; place-items: center;
  background:
    radial-gradient(60% 120% at 15% 20%, rgb(230 240 200 / 0.95), transparent 60%),
    radial-gradient(50% 120% at 85% 80%, rgb(170 220 205 / 0.95), transparent 60%),
    radial-gradient(40% 80% at 60% 10%, rgb(250 235 200 / 0.9), transparent 70%),
    linear-gradient(120deg, #dfeccf, #bfe1d6); }
.banner .prompt { display: flex; align-items: center; gap: 12px; max-width: 760px; width: 100%; padding: 8px; padding-inline-end: 8px; border-radius: 999px; background: #18181a; color: #f2f2f3; font-size: 15px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.22); }
.banner .prompt .chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: 12px; border-radius: 999px; background: rgb(47 176 110 / 0.22); color: #6ee0a6; font-weight: 600; font-size: 13px; white-space: nowrap; }
.banner .prompt .t { flex: 1; min-width: 0; }
.banner .prompt .go { width: 34px; height: 34px; border-radius: 50%; background: #2fb06e; color: #fff; display: grid; place-items: center; flex: none; }
.s-title { font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.kv-card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--panel); }
.kv-card .r { display: grid; grid-template-columns: 280px minmax(0, 1fr); border-top: 1px solid var(--line); }
.kv-card .r:first-child { border-top: 0; }
.kv-card .r > div { padding: 16px 20px; display: flex; align-items: center; gap: 12px; }
.kv-card .r > div:first-child { color: var(--text-2); border-inline-end: 1px solid var(--line); }
.kv-card .r > div:first-child .ic { color: var(--muted); }
.kv-card .r a { text-decoration: underline; text-underline-offset: 4px; font-weight: 500; }
.list-card { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow: hidden; }
.list-card > .r { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list-card > .r:first-child { border-top: 0; }
.list-card .r .m { color: var(--muted); font-size: 13px; margin-inline-start: auto; white-space: nowrap; }
.list-card .r a.u { color: var(--link); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.nested { margin: 0 20px 18px; padding: 18px 20px; border-radius: 14px; background: var(--sunken); display: flex; flex-direction: column; gap: 16px; }
.nested h3 { font-size: 15px; font-weight: 600; }
.nested .opt-row { display: flex; align-items: center; gap: 16px; }
.nested .opt-row .grow { flex: 1; min-width: 0; }
.nested .opt-row b { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.nested .opt-row p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ok-badge { width: 16px; height: 16px; border-radius: 5px; background: #22c55e; color: #fff; display: inline-grid; place-items: center; }
.ok-badge .ic { width: 11px; height: 11px; stroke-width: 3; }


/* =====================================================================
   Studio consistency layer — every page uses Home's structure
   (title outside, card below; one width; same header; same row rhythm)
   ===================================================================== */
.page, .page.narrow { max-width: 1040px; }
.studio { max-width: none; }

/* One header for every page (same as Home's studio-head) */
.ph .tile:not(.sm), .ph .logo, .ph .avatar.lg, .studio-head .logo { width: 64px; height: 64px; border-radius: 16px; font-size: 28px; }
.ph .tile:not(.sm) .ic { width: 28px; height: 28px; }
.ph h1, .studio-head h1 { font-size: 28px; line-height: 36px; font-weight: 600; }
.ph .lead, .studio-head p { font-size: 15px; color: var(--muted); }

/* Section = title outside + bordered card(s) below (Shopify "Data sync" / "Stores") */
.panel:has(> .panel-h) { background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.panel:has(> .panel-h) > .panel-h { padding: 0 0 12px; min-height: 0; }
.panel:has(> .panel-h) > .panel-h h2 { font-size: 17px; font-weight: 600; }
.panel:has(> .panel-h) > :not(.panel-h) { background: var(--panel); border-inline: 1px solid var(--line); }
.panel:has(> .panel-h) > .panel-h + * { border-top: 1px solid var(--line); border-start-start-radius: 16px; border-start-end-radius: 16px; }
.panel:has(> .panel-h) > :last-child { border-bottom: 1px solid var(--line); border-end-start-radius: 16px; border-end-end-radius: 16px; }
.panel:has(> .panel-h) > .tbl-wrap { padding: 10px; }
.panel:has(> .panel-h) > .panel-b { padding: 20px; }
.panel:has(> .panel-h) > .tl { padding: 18px 20px; }
.panel:has(> .panel-h) > .photo-grid { padding: 16px; }
.panel:has(> .panel-h) > .dtbl { border-collapse: separate; border-spacing: 0; overflow: hidden; }
.panel:has(> .panel-h) > .list > .row-item:first-child,
.panel:has(> .panel-h) > .ol > li:first-child,
.panel:has(> .panel-h) > .chev-list > a:first-child,
.panel:has(> .panel-h) > .feed > a:first-child { border-top: 0; }
.panel:has(> .panel-h) > .panel-f { border-top: 1px solid var(--line); padding: 12px 20px; }
.panel:has(> .panel-h) > .setting + .setting, .panel:has(> .panel-h) > .file + .file { border-top: 1px solid var(--line); }

/* Same row rhythm as Home's lists */
.row-item, .chev-list a, .file, .ol li, .feed a { padding: 16px 20px; }
.row-item { border-top-color: var(--line); }
.ol li, .file, .chev-list a, .feed a { border-top-color: var(--line); }

/* Stat cards: quiet Studio cards */
.panel.stat, .panel.kpi { padding: 18px 20px; border-radius: 16px; }
.stat-h, .kpi-h { color: var(--text-2); font-size: 13.5px; }

/* Form groups: title outside, card below — matches the section rule */
.form-group { border-top: 0; padding-block: 0; }
.form-group + .form-group { margin-top: 8px; }
.form-group > header h2 { font-size: 17px; }

/* Hub cards and boards share the card radius */
.hub-card, .card, .lane, .doc-stage, .notice { border-radius: 16px; }

/* Banner can sit on any hub page */
.page > .banner { margin-top: -4px; }


/* ---------- Scrollbars (thin, quiet, theme-aware) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- Checkbox & radio (custom, theme-aware) ---------- */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer;
  width: 18px; height: 18px; display: inline-grid; place-content: center; vertical-align: middle;
  border: 1.5px solid var(--line-strong); background: var(--bg); transition: background 0.12s, border-color 0.12s;
}
input[type="checkbox"] { border-radius: 5px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::after { content: ""; width: 10px; height: 10px; transform: scale(0); transition: transform 0.12s; background: var(--on-accent);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 26%, 86% 12%, 38% 72%); }
input[type="radio"]::after { content: ""; width: 8px; height: 8px; border-radius: 50%; transform: scale(0); transition: transform 0.12s; background: var(--on-accent); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after, input[type="radio"]:checked::after { transform: scale(1); }
input[type="checkbox"]:indeterminate { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:indeterminate::after { clip-path: none; height: 2px; transform: scale(1); }
input[type="checkbox"]:hover:not(:checked), input[type="radio"]:hover:not(:checked) { border-color: var(--muted); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.check { width: 18px; height: 18px; }
/* Switch keeps its own look */
.switch input { width: 100%; height: 100%; border: 0; border-radius: 999px; display: block; background: var(--line-strong); }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transform: none; clip-path: none; transition: inset-inline-start 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: none; inset-inline-start: 19px; }
@media (prefers-reduced-motion: reduce) { input[type="checkbox"], input[type="radio"], input::after { transition: none; } }


/* ---------- Consistency pass 2 ---------- */
/* Every KPI row is one connected strip (like Home's "This term" card) */
.grid:has(> .panel.stat), .grid:has(> .panel.kpi) { gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.grid > .panel.stat, .grid > .panel.kpi { border: 0; border-radius: 0; background: var(--panel); padding: 18px 20px; gap: 10px; justify-content: flex-start; }
.stat-h, .kpi-h { color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.stat-h .tile.sm, .kpi-h .tile.sm { width: auto !important; height: auto !important; background: transparent !important; color: var(--muted) !important; box-shadow: none !important; border: 0 !important; }
.stat-h .tile.sm .ic, .kpi-h .tile.sm .ic { width: 16px; height: 16px; }
.stat-v strong, .kpi-v strong { font-size: 22px; line-height: 28px; font-weight: 600; }
.stat .meter, .stat .bars { margin-top: 2px; }
.stat > small.muted { font-size: 12px; }

/* Selection bar matches the cards */
.bulkbar { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-strong); box-shadow: var(--shadow-md); border-radius: 14px; }
.bulkbar .btn { color: var(--text); border-color: var(--line-strong); }
.bulkbar .btn:hover { background: var(--sunken); }
.bulkbar b .n { color: var(--accent-text); }

/* Label/value tables scale with their card */
.facts, .kv-card .r { grid-template-columns: minmax(110px, 34%) minmax(0, 1fr); }
.facts > div { min-width: 0; flex-wrap: wrap; }

/* Forms: section title above its card, like every other section */
.form-group { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.form-group > header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.form-group > header p { margin-top: 0; }
.form-group + .form-group { margin-top: 12px; }
.fields { padding: 20px; gap: 18px 16px; }
.with-subnav .form-group > .panel, .page.narrow .form-group > .panel { width: 100%; }

/* Card grids share the list rhythm */
.hub-grid { gap: 12px; }
.hub-card { padding: 18px 20px; border-color: var(--line); box-shadow: none; gap: 12px; }
.hub-card:hover { border-color: var(--line-strong); box-shadow: none; background: var(--panel-2); }
.hub-card-h b { font-size: 15px; }
.hub-card-f { border-top-color: var(--line); padding-top: 12px; }
.section-title h2 { font-size: 17px; font-weight: 600; }
.section-title { margin-bottom: -12px; }

/* Wizard / tool side panels use the same card */
.vsteps .mark { width: 26px; height: 26px; }
.notice { padding: 14px 18px; }


/* =====================================================================
   Actions kit (pairs with assets/actions.js)
   ===================================================================== */
/* Dialog */
dialog.dlg { padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--panel); color: var(--text); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); }
dialog.dlg::backdrop { background: rgb(0 0 0 / 0.5); backdrop-filter: blur(2px); }
dialog.dlg[open] { display: flex; flex-direction: column; animation: dlg-in 0.16s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(0.985); } to { opacity: 1; transform: none; } }
.dlg-h { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 8px; }
.dlg-h .grow { flex: 1; min-width: 0; }
.dlg-h h2 { font-size: 18px; line-height: 26px; font-weight: 600; }
.dlg-h p { color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 22px; }
.dlg-b { padding: 12px 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.dlg-f { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px 18px; }
.dlg.wide { width: min(760px, calc(100vw - 32px)); }
.dlg .tile.red { background: var(--bad-bg); color: var(--bad-fg); border: 0; }
.btn.danger-solid { background: var(--bad-dot); border-color: var(--bad-dot); color: #fff; font-weight: 600; }
.btn.danger-solid:hover { filter: brightness(0.95); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* Sheet = dialog docked to the inline start, full height */
dialog.dlg.sheet { margin: 0; inset-block: 0; inset-inline-start: 0; inset-inline-end: auto; height: 100vh; max-height: 100vh; width: min(460px, 100vw); border-radius: 0; border-block: 0; border-inline-start: 0; }
dialog.dlg.sheet[open] { animation: sheet-in 0.2s ease-out; }
@keyframes sheet-in { from { transform: translateX(var(--sheet-from, 24px)); opacity: 0; } to { transform: none; opacity: 1; } }
[dir="rtl"] dialog.dlg.sheet { --sheet-from: 24px; } [dir="ltr"] dialog.dlg.sheet { --sheet-from: -24px; }
dialog.dlg.sheet .dlg-b { flex: 1; }
dialog.dlg.sheet .dlg-f { border-top: 1px solid var(--line); }
dialog.dlg.sheet .dlg-h { border-bottom: 1px solid var(--line); padding-bottom: 16px; }

/* Toasts */
.toasts { position: fixed; z-index: 100; inset-block-end: 20px; inset-inline-start: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
[dir="rtl"] .toasts { transform: translateX(50%); }
.toast { pointer-events: auto; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 500; font-size: 14px; box-shadow: var(--shadow-lg); animation: toast-in 0.18s ease-out; }
.toast.ok { background: var(--accent); color: var(--on-accent); }
.toast.bad { background: var(--bad-dot); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: 0.22s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Upload */
.drop { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { display: none; }
.files { display: flex; flex-direction: column; gap: 6px; }
.files:empty { display: none; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.file-row .grow { flex: 1; min-width: 0; }
.file-row b { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row small { color: var(--muted); font-size: 12px; }

/* Signature pad */
.sig { display: flex; flex-direction: column; gap: 8px; }
canvas.sigpad { width: 100%; height: 180px; border: 1.5px dashed var(--line-strong); border-radius: 14px; background: var(--bg); color: var(--text); touch-action: none; cursor: crosshair; }
canvas.sigpad.signed { border-style: solid; border-color: var(--accent); }

.field label .link { margin-inline-start: auto; font-weight: 500; }
.row-check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }

/* Wizard panes, disclosure */
.step-pane[hidden] { display: none !important; }
details.disc { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
details.disc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 16px 20px; font-weight: 600; }
details.disc > summary::-webkit-details-marker { display: none; }
details.disc > summary::after { content: ""; margin-inline-start: auto; width: 8px; height: 8px; border-inline-end: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s; }
details.disc[open] > summary::after { transform: rotate(-135deg); }
details.disc > .disc-b { padding: 0 20px 18px; display: flex; flex-direction: column; gap: 12px; }
[role=tabpanel][hidden] { display: none !important; }
.err[hidden] { display: none !important; }

/* =====================================================================
   Public & auth layouts (no app shell)
   ===================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; background:
    radial-gradient(60% 50% at 15% 10%, rgb(47 176 110 / 0.18), transparent 70%),
    radial-gradient(50% 50% at 90% 90%, rgb(59 130 246 / 0.12), transparent 70%), var(--frame); }
.auth-top, .pub-top { display: flex; align-items: center; gap: 10px; padding: 16px 24px; }
.auth-top .brand, .pub-top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.auth-top .tools, .pub-top .tools { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.auth-main { display: grid; place-items: center; padding: 24px 16px 48px; }
.auth-card { min-width: 0; width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 20px; box-shadow: var(--shadow-md); }
.auth-card.wide { width: min(640px, 100%); }
.auth-card h1 { font-size: 24px; line-height: 32px; font-weight: 600; }
.auth-card .lead { color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.auth-card .seg { width: 100%; } .auth-card .seg > * { flex: 1; justify-content: center; }
.auth-card .btn.primary.block, .btn.block { width: 100%; height: 42px; }
.auth-alt { text-align: center; color: var(--muted); font-size: 14px; }
.auth-foot, .pub-foot { padding: 18px 24px; color: var(--faint); font-size: 12.5px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.state-ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; }
.state-ic .ic { width: 26px; height: 26px; }
.state-ic.ok { background: var(--ok-bg); color: var(--ok-fg); } .state-ic.warn { background: var(--warn-bg); color: var(--warn-fg); }
.state-ic.bad { background: var(--bad-bg); color: var(--bad-fg); } .state-ic.info { background: var(--info-bg); color: var(--info-fg); }
.pub { min-height: 100vh; background: var(--frame); display: flex; flex-direction: column; }
.pub-top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.pub-top nav { display: flex; gap: 4px; margin-inline-start: 24px; }
.pub-top nav a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.pub-top nav a:hover, .pub-top nav a[aria-current] { background: var(--sunken); color: var(--text); }
.pub-main { flex: 1; width: 100%; max-width: 1120px; margin-inline: auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.pub-foot { border-top: 1px solid var(--line); background: var(--bg); }
.hero { padding: 56px 0 24px; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.hero h1 { font-size: 44px; line-height: 54px; font-weight: 700; letter-spacing: -0.01em; max-width: 760px; }
.hero p { color: var(--muted); font-size: 18px; line-height: 30px; max-width: 640px; }
.price { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.price small { font-size: 14px; color: var(--muted); font-weight: 500; }
@media (max-width: 640px) {
  .auth-card { padding: 20px; border-radius: 16px; }
  .auth-card .seg { overflow-x: auto; } .auth-card .seg > * { flex: 1 0 auto; padding-inline: 10px; }
  .pub-top { padding-inline: 16px; } .pub-top .tools > .btn:not(.primary) { display: none; }
  .hero h1 { font-size: 30px; line-height: 40px; }
  .pub-top nav { display: none; }
  .pub-main { padding: 20px 16px 48px; }
  dialog.dlg.sheet { width: 100vw; }
}

/* =====================================================================
   Round 3 integration — components requested by the portal batches
   ===================================================================== */
/* Dialog/sheet wrapping its parts in a form */
dialog.dlg > form { display: contents; }
.dlg-b .fields { padding: 0; }
.dlg .facts, .dlg .kv-card .r { grid-template-columns: minmax(90px, 38%) minmax(0, 1fr); }
.dlg .facts > div, .dlg .kv-card .r > div { padding: 12px 14px; min-height: 0; }
/* Menus near the bottom of a scroll box open upward */
.menu-wrap.up .menu { top: auto; bottom: calc(100% + 6px); }
/* Hub card that is not a link: no hover lift */
.hub-card:not(a):hover { background: var(--panel); border-color: var(--line); }
/* Unread rows */
.row-item.unread .t { font-weight: 600; color: var(--text); }
.row-item.unread { position: relative; }
.row-item.unread::before { content: ""; position: absolute; inset-inline-start: 7px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); }
/* Clickable calendar events */
button.ev { width: 100%; border: 0; text-align: start; font: inherit; font-size: 11px; cursor: pointer; }
button.ev:hover { filter: brightness(0.96); }
/* Empty state with two actions */
.empty .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
/* Neutral selection bar */
.savebar.neutral .state i { background: var(--accent); }
/* Native validation after interaction */
.control:user-invalid { border-color: var(--bad-dot); box-shadow: 0 0 0 3px var(--bad-bg); }
.field:has(.control:user-invalid) .help { color: var(--bad-fg); }
/* Price */
.price { display: inline-flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.price b { font-size: 22px; line-height: 28px; font-weight: 700; color: var(--text); }
.price small { color: var(--muted); font-size: 12px; }
/* Live preview frame */
.preview { background: var(--sunken); border: 1px dashed var(--line-strong); border-radius: 16px; padding: 24px; display: grid; place-items: center; overflow: hidden; }
.preview .auth-card { pointer-events: none; }
/* Wizard inside the auth layout */
.wizard.in-auth { width: min(920px, 100%); }
.auth-main:has(> .wizard) { place-items: start center; }
/* Public anchors clear the sticky bar */
.pub-section, .pub-main [id] { scroll-margin-top: 80px; }
/* Store toggle */
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent-text); }

@media (prefers-reduced-motion: reduce) { dialog.dlg[open], .toast { animation: none; } }

/* ---------- Phone nav ---------- */
.bottom-nav { display: none; }
.scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-main, .cols-wide { grid-template-columns: minmax(0, 1fr); }
  .rail { grid-template-columns: repeat(5, minmax(140px, 1fr)); overflow-x: auto; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60; width: 288px; max-width: 86vw;
    transform: translateX(var(--off)); transition: transform 0.22s ease; box-shadow: var(--shadow-lg);
  }
  [dir="rtl"] .side { --off: 105%; }
  [dir="ltr"] .side { --off: -105%; }
  body.drawer-open .side { --off: 0; }
  body.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgb(0 0 0 / 0.35); }
  .menu-btn { display: grid; }
  .main { margin: 0; border: 0; border-radius: 0; min-height: 100vh; box-shadow: none; }
  .top { border-radius: 0; }
  .top { padding-inline: 12px; }
  .page { padding: 16px 16px 120px; gap: 20px; }
  .form-group { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .with-subnav, .wizard { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; scrollbar-width: none; }
  .subnav h3 { display: none; }
  .subnav a { flex: none; border: 1px solid var(--line); background: var(--panel); }
  .vsteps { position: static; flex-direction: row; gap: 8px; overflow-x: auto; }
  .vsteps li { padding-bottom: 0; }
  .vsteps li::before { display: none; }
  .vsteps li:not(.now) small, .vsteps li:not(.now) b { display: none; }
  .sheet-demo { width: 100vw; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
    background: var(--panel); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); padding-block: 4px; border-radius: 8px; }
  .bottom-nav a[aria-current="page"] { color: var(--accent-text); }
  .savebar { bottom: 76px; }
  @media (prefers-reduced-motion: reduce) { .side { transition: none; } }
}
@media (max-width: 640px) {
  .cols-4, .cols-3, .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .cols-4.keep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ph-title { flex-basis: 100%; }
  .ph-actions { width: 100%; }
  .ph-actions .btn.primary { flex: 1; }
  .hide-sm { display: none !important; }
  .toolbar .end { margin-inline-start: 0; width: 100%; }
  .toolbar .end .input { flex: 1; }
  .seg { max-width: 100%; overflow-x: auto; }
  .fields { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts > div:nth-child(odd) { border-inline-end: 0; padding-bottom: 2px; min-height: 0; background: transparent; font-size: 12px; }
  .facts > div:nth-child(even) { border-top: 0; padding-top: 0; }
  .stat-v strong { font-size: 24px; }
  .rail { grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .rail-step:not(.now) { display: none; }
  .panel-h { flex-wrap: wrap; }
  .steps .step:not(.now) > span:not(.mark) { display: none; }
  .crumb > :not(:last-child) { display: none; }
  .ph .tile:not(.sm), .ph .logo, .ph .avatar.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 20px; }
  .ph h1, .studio-head h1 { font-size: 22px; line-height: 30px; }
  .ph .tile:not(.sm), .ph .logo, .ph .avatar.lg, .studio-head .logo { width: 48px; height: 48px; border-radius: 13px; font-size: 22px; }
  .row-item, .chev-list a, .file, .ol li, .feed a { padding: 14px 16px; }
  .kv-card .r { grid-template-columns: minmax(0, 1fr); }
  .studio-head .acts { margin-inline-start: 0; width: 100%; }
  .studio-head h1 { font-size: 22px; line-height: 30px; }
  .kv-card .r > div:first-child { border-inline-end: 0; padding-bottom: 0; }
  .banner { padding: 24px 12px; }
  .banner .prompt { font-size: 13px; }
  .area-tabs { display: flex; overflow-x: auto; }
  .panel .tbl-wrap { padding-inline: 0; }
  .hero-metric .v { font-size: 38px; line-height: 44px; }
  .tbl .group td .tot { float: none; margin-inline-start: auto; }
  .hint { white-space: normal; }
  .cal > .dow { padding: 6px 2px; text-align: center; font-size: 11px; }
  .cal > .day { min-height: 64px; padding: 4px; }
  .cal .ev { font-size: 0; height: 6px; padding: 0; }
  .doc-stage { padding: 12px; }
  .hbar { grid-template-columns: 96px minmax(0, 1fr) 32px; }
  .board { grid-template-columns: repeat(4, 82vw); }

  /* Tables become record cards */
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody { display: block; }
  .tbl.cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
  .tbl.cards td { display: inline-flex; align-items: center; gap: 6px; height: auto; padding: 0; border: 0; order: 3; font-size: 13px; }
  .tbl.cards td[data-label]::before { content: attr(data-label); color: var(--faint); font-size: 12px; }
  .tbl.cards td.w-check { order: 0; width: auto; }
  .tbl.cards td.lead-cell { order: 1; flex: 1 1 calc(100% - 90px); min-width: 0; }
  .tbl.cards td.lead-cell:last-child, .tbl.cards td.lead-cell:first-child:not(:has(~ .w-act)) { flex-basis: 100%; }
  .tbl.cards td.w-act { order: 2; width: auto; }
  .tbl.cards td .meter-row .meter { width: 64px; flex: none; }
  .tbl.cards td.hide-card { display: none; }
  .tbl.cards tr.group { display: block; padding: 0; }
  .tbl.cards tr.group td { display: flex; padding: 8px 16px; height: auto; }
  .tbl.cards tbody tr:hover td { background: transparent; }
  .bulkbar .label-sm { display: none; }
}
