/* The NEW design of the panels (Master Admin → Default settings → Panel design = New).
 * Loaded AFTER the classic stylesheet (app/public/assets/style.css, never edited) and only when the new design is
 * chosen; <html> then carries data-design="new". Every rule here starts with html[data-design="new"], so this file
 * cannot change the old look even if it is loaded by mistake (tests/design.test.ts checks every rule).
 * Source of truth for the look: the locked previews (A1–A5, A7, controls kit, A1 dark) in docs/ui-redesign/previews/.
 * Copied to web/public/assets/ by tools/sync-css.ts at build time.
 *
 * Step 2 (this file today): 1. colours (light + dark)  2. page, cards, text  3. the controls kit on the classes the
 * pages already use  4. the frame: sidebar with headings, "×" logo, top line (markup: web/src/NewShell.tsx).
 * The page layouts themselves (A1–A5, A7) come one by one in step 3.
 */

/* ── 1. Colours. Dark follows the same data-theme switch as the old design. ── */
html[data-design="new"] { --design: new; --r-card: 14px; --r-ctl: 10px; }
html[data-design="new"][data-theme="light"] {
  --bg: #f4f6fb; --card: #ffffff; --card2: #f7f9fd; --border: #e7ebf3;
  --text: #1c2333; --muted: #5f6b85; --faint: #9aa5bd;
  --side: #ffffff; --line: #eef1f7; --soft: #f1f4fa; --ink2: #475069;
  --ctl: #dde2ec; --ctl-strong: #c3cad8; --ctl-off: #f1f4fa; --switch-off: #cfd6e4;
  --on-blue: #ffffff; --blue-hover: #1d4ed8;
  --blue-soft: #eaf1ff; --blue-ink: #1d4ed8; --blue-ring: #bfd3ff;
  --green-soft: #e7f6ec; --green-ink: #15803d; --ok-text: #14532d;
  --red-soft: #fde8ec; --red-ink: #be123c; --bad-text: #881337; --red-line: #f6c9d3;
  --amber-soft: #fdf0e1; --amber-ink: #9a5b00;
  --violet-soft: #f3edff; --violet-ink: #6d28d9;
  --seg: #eef1f7; --seg-on: #ffffff; --seg-shadow: 0 1px 2px rgba(28,35,51,.12);
  --shadow: none; --pop-shadow: 0 20px 60px rgba(28,35,51,.18);
}
html[data-design="new"][data-theme="dark"] {
  --bg: #0b0f19; --card: #141a28; --card2: #101522; --border: #222b3f;
  --text: #e6eaf4; --muted: #93a0bc; --faint: #5b6780;
  --side: #101522; --line: #222b3f; --soft: #1b2335; --ink2: #b4bfd6;
  --ctl: #2a3450; --ctl-strong: #3a4666; --ctl-off: #1b2335; --switch-off: #3a4666;
  --on-blue: #0b0f19; --blue-hover: #6f9afa;
  --blue-soft: rgba(79,131,247,.18); --blue-ink: #b5cbff; --blue-ring: rgba(79,131,247,.45);
  --green-soft: rgba(47,191,104,.15); --green-ink: #5fd08f; --ok-text: #8fe0b0;
  --red-soft: rgba(244,81,123,.15); --red-ink: #ff8fab; --bad-text: #ffb1c4; --red-line: rgba(244,81,123,.4);
  --amber-soft: rgba(240,161,60,.16); --amber-ink: #f5bd6f;
  --violet-soft: rgba(161,125,245,.16); --violet-ink: #c3a8ff;
  --seg: #1b2335; --seg-on: #2a3450; --seg-shadow: none;
  --shadow: none; --pop-shadow: 0 20px 60px rgba(0,0,0,.5);
}

/* ── 2. Page, text, cards ── */
html[data-design="new"] body { font-size: 14px; line-height: 1.5; }
html[data-design="new"] a:hover { color: var(--blue-hover); }
html[data-design="new"] a:focus-visible,
html[data-design="new"] button:focus-visible,
html[data-design="new"] input:focus-visible,
html[data-design="new"] select:focus-visible,
html[data-design="new"] textarea:focus-visible { outline: 3px solid var(--blue-ring); outline-offset: 2px; }
html[data-design="new"] .page-head { align-items: center; margin-bottom: 16px; }
html[data-design="new"] .page-title { font-size: 22px; }
html[data-design="new"] .page-sub { font-weight: 500; }
html[data-design="new"] .section-title { font-size: 15px; margin-bottom: 12px; }
html[data-design="new"] .card { border-radius: var(--r-card); padding: 18px 20px; box-shadow: none; }
html[data-design="new"] .stat { border-radius: var(--r-card); box-shadow: none; }
html[data-design="new"] .stat-label { font-weight: 600; }
html[data-design="new"] .stat-value { font-size: 22px; margin-top: 2px; }
html[data-design="new"] .stat-hint { font-weight: 500; }
html[data-design="new"] .srow { border-radius: 12px; box-shadow: none; }
html[data-design="new"] .kv { border-bottom: 1px solid var(--soft); }
html[data-design="new"] .kv:last-child { border-bottom: none; }
html[data-design="new"] .cat-row { border-bottom: 1px solid var(--soft); }
html[data-design="new"] .cat-row:last-child { border-bottom: none; }
html[data-design="new"] .tbl th { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; }
html[data-design="new"] .tbl td { border-bottom: 1px solid var(--soft); }
html[data-design="new"] .tbl tr:last-child td { border-bottom: none; }
html[data-design="new"] .code { border-radius: 6px; }
html[data-design="new"] .help-box { box-shadow: var(--pop-shadow); }
html[data-design="new"] .empty svg { color: var(--ctl-strong); }

/* ── 3. Controls kit (Controls preview) on the existing class names ── */
/* buttons: .btn = primary, .btn-ghost = secondary, .btn-sm = small */
html[data-design="new"] .btn {
  height: 40px; padding: 0 16px; border-radius: var(--r-ctl); border: 1.5px solid var(--blue);
  background: var(--blue); color: var(--on-blue); font-size: 13.5px; font-weight: 700; box-shadow: none;
}
html[data-design="new"] .btn:hover { filter: none; background: var(--blue-hover); border-color: var(--blue-hover); color: var(--on-blue); }
html[data-design="new"] .btn-ghost { background: var(--card); color: var(--text); border-color: var(--ctl); }
html[data-design="new"] .btn-ghost:hover { background: var(--soft); border-color: var(--ctl-strong); color: var(--text); }
html[data-design="new"] .btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
html[data-design="new"] .btn:disabled,
html[data-design="new"] .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
html[data-design="new"] .icon-btn { width: 36px; height: 36px; min-width: 36px; border-radius: var(--r-ctl); color: var(--ink2); }
html[data-design="new"] .icon-btn:hover { background: var(--soft); border-color: var(--ctl); color: var(--text); }

/* inputs */
html[data-design="new"] .input,
html[data-design="new"] .select,
html[data-design="new"] textarea.input {
  height: 42px; border: 1.5px solid var(--ctl); border-radius: var(--r-ctl); padding: 0 12px; font-size: 14px; font-weight: 500;
}
html[data-design="new"] textarea.input { height: auto; padding: 10px 12px; }
html[data-design="new"] .input:focus,
html[data-design="new"] .select:focus,
html[data-design="new"] textarea.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-ring); outline: none; }
html[data-design="new"] .input:disabled,
html[data-design="new"] .select:disabled { background: var(--ctl-off); color: var(--faint); cursor: not-allowed; }
html[data-design="new"] .input.tl-bad,
html[data-design="new"] .select.tl-bad { border-color: var(--red); }
html[data-design="new"] select.select,
html[data-design="new"] select.input {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b869e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
html[data-design="new"] .inline-form .input { height: 34px; }
html[data-design="new"] .field label { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 0; margin-bottom: 6px; }
html[data-design="new"] .field .hint { color: var(--muted); }

/* checkbox: 20 px, rounded, blue tick; mixed; disabled */
html[data-design="new"] input[type="checkbox"],
html[data-design="new"] .check-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; min-width: 20px; margin: 0; flex: none;
  border: 1.5px solid var(--ctl-strong); border-radius: 6px; background-color: var(--card);
  background-repeat: no-repeat; background-position: center; cursor: pointer; vertical-align: middle;
}
html[data-design="new"] input[type="checkbox"]:checked {
  background-color: var(--blue); border-color: var(--blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
html[data-design="new"] input[type="checkbox"]:indeterminate {
  background-color: var(--blue); border-color: var(--blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.6' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
}
html[data-design="new"] input[type="checkbox"]:disabled { background-color: var(--ctl-off); border-color: var(--ctl); cursor: not-allowed; }
html[data-design="new"] input[type="checkbox"]:checked:disabled { background-color: var(--ctl-strong); border-color: var(--ctl-strong); }

/* switch (a checkbox that says role="switch"): green when on */
html[data-design="new"] input[type="checkbox"][role="switch"] {
  width: 44px; height: 26px; min-width: 44px; border: 0; border-radius: 999px; background-color: var(--switch-off);
  background-image: radial-gradient(circle, #fff 0 10px, transparent 10.5px); background-size: 26px 26px; background-position: left center;
  transition: background-position .15s, background-color .15s;
}
html[data-design="new"] input[type="checkbox"][role="switch"]:checked { background-color: var(--green); background-position: right center; }

/* radio: 20 px ring, thick blue ring when chosen */
html[data-design="new"] input[type="radio"],
html[data-design="new"] .tl-b input[type="radio"] {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; min-width: 20px; margin: 0; flex: none;
  border: 1.5px solid var(--ctl-strong); border-radius: 50%; background: var(--card); cursor: pointer; vertical-align: middle;
}
html[data-design="new"] input[type="radio"]:checked { border: 6px solid var(--blue); }
html[data-design="new"] input[type="radio"]:disabled { background: var(--ctl-off); border-color: var(--ctl); cursor: not-allowed; }
html[data-design="new"] .check-row { min-height: 40px; font-weight: 600; }

/* chips and status badges: soft background, darker word of the same colour */
html[data-design="new"] .chip { padding: 4px 10px; font-size: 12px; font-weight: 700; background: var(--blue-soft); color: var(--blue-ink); }
html[data-design="new"] .chip.green { background: var(--green-soft); color: var(--green-ink); }
html[data-design="new"] .chip.violet { background: var(--violet-soft); color: var(--violet-ink); }
html[data-design="new"] .chip.amber { background: var(--amber-soft); color: var(--amber-ink); }
html[data-design="new"] .chip.red { background: var(--red-soft); color: var(--red-ink); }
html[data-design="new"] .chip.neutral { background: var(--soft); color: var(--ink2); border: 0; }
html[data-design="new"] .badge { font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; padding: 4px 10px; }
html[data-design="new"] .badge.paid { background: var(--green-soft); color: var(--green-ink); }
html[data-design="new"] .badge.unpaid { background: var(--soft); color: var(--ink2); }
html[data-design="new"] .badge.invalid { background: var(--red-soft); color: var(--red-ink); }
html[data-design="new"] .role-pill { background: var(--blue-soft); color: var(--blue-ink); }
html[data-design="new"] .kw-chip { background: var(--soft); border-color: transparent; }
html[data-design="new"] .tag-req { background: var(--amber-soft); color: var(--amber-ink); }
html[data-design="new"] .tag-opt { background: var(--soft); color: var(--ink2); border: 0; }

/* alerts */
html[data-design="new"] .alert { border-radius: 12px; padding: 12px 14px; font-size: 13px; font-weight: 600; }
html[data-design="new"] .alert.ok { background: var(--green-soft); color: var(--ok-text); }
html[data-design="new"] .alert.bad { background: var(--red-soft); color: var(--bad-text); }
html[data-design="new"] .impersonation-bar { background: var(--amber-soft); color: var(--amber-ink); }

/* tabs: one grey strip, the chosen tab is the white piece */
html[data-design="new"] .tabs { display: inline-flex; max-width: 100%; gap: 2px; padding: 4px; background: var(--seg); border-radius: 12px; }
html[data-design="new"] .tabs a { padding: 7px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
html[data-design="new"] .tabs a:hover { color: var(--text); }
html[data-design="new"] .tabs a.active { background: var(--seg-on); color: var(--text); box-shadow: var(--seg-shadow); }

/* pager */
html[data-design="new"] .pager a,
html[data-design="new"] .pager span { min-width: 38px; height: 38px; padding: 0 12px; border-radius: var(--r-ctl); border-color: var(--ctl); font-size: 13px; }
html[data-design="new"] .pager .cur { background: var(--blue); color: var(--on-blue); }

/* Rule Studio pieces that are controls */
html[data-design="new"] .tl-n { color: var(--on-blue); }
html[data-design="new"] .tl-say { color: var(--green-ink); }
html[data-design="new"] .rule-way { border-width: 1.5px; }

/* ── 4. The frame: sidebar with headings, "×" logo, top line (web/src/NewShell.tsx) ── */
html[data-design="new"] .nd-app { display: flex; align-items: flex-start; min-height: 100dvh; }
html[data-design="new"] .nd-side {
  position: sticky; top: 0; z-index: 60; width: 248px; flex: none; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  display: flex; flex-direction: column; padding: 16px 12px; background: var(--side); border-right: 1px solid var(--border);
}
html[data-design="new"] .nd-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; color: var(--text); min-width: 0; }
html[data-design="new"] .nd-brand:hover { color: var(--text); }
html[data-design="new"] .nd-logo {
  width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
html[data-design="new"] .nd-brand-text { display: flex; flex-direction: column; min-width: 0; }
html[data-design="new"] .nd-brand-name { font-size: 15px; font-weight: 800; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-design="new"] .nd-brand-who { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-design="new"] .nd-nav { flex: 1; display: flex; flex-direction: column; }
html[data-design="new"] .nd-group { display: flex; flex-direction: column; gap: 1px; }
html[data-design="new"] .nd-grp { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 4px; }
html[data-design="new"] .nd-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-height: 36px; border-radius: 9px;
  color: var(--ink2); font-size: 13.5px; font-weight: 600;
}
html[data-design="new"] .nd-item svg { width: 18px; height: 18px; flex: none; stroke-width: 1.8; }
html[data-design="new"] .nd-item span { flex: 1; min-width: 0; }
html[data-design="new"] .nd-item:hover { background: var(--soft); color: var(--text); }
html[data-design="new"] .nd-item.active { background: var(--blue-soft); color: var(--blue-ink); }
html[data-design="new"] .nd-main { flex: 1; min-width: 0; min-height: 100dvh; display: flex; flex-direction: column; }
html[data-design="new"] .nd-top {
  position: sticky; top: 0; z-index: 50; height: 64px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: var(--side); border-bottom: 1px solid var(--border);
}
html[data-design="new"] .nd-crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--muted); }
html[data-design="new"] .nd-crumb b { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-design="new"] .nd-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
html[data-design="new"] .nd-menu { display: none; }
html[data-design="new"] .nd-scrim { display: none; }
/* z-index auto: the classic .container is its own layer (z-index 1), which would put a pop-up of the page UNDER the
   sidebar and the top line */
html[data-design="new"] .nd-main > .container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 20px 28px 60px; z-index: auto; }
@media (max-width: 1023px) {
  html[data-design="new"] .nd-side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 200; width: min(280px, 86vw);
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: none;
  }
  html[data-design="new"] .nd-open .nd-side { transform: none; box-shadow: var(--pop-shadow); }
  html[data-design="new"] .nd-open .nd-scrim { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(15,23,42,.5); }
  html[data-design="new"] .nd-menu { display: flex; }
  html[data-design="new"] .nd-top { height: 56px; padding: 0 14px; gap: 10px; }
  html[data-design="new"] .nd-crumb span { display: none; }
  html[data-design="new"] .nd-crumb b { font-size: 15px; font-weight: 800; }
  html[data-design="new"] .nd-item { min-height: 44px; }
  html[data-design="new"] .nd-main > .container { padding: 16px 14px 48px; }
}
@media (max-width: 480px) {
  html[data-design="new"] .card { padding: 14px; }
  html[data-design="new"] .page-title { font-size: 19px; }
}

/* ── 5. Pieces the new page layouts share (web/src/pages/new/kit.tsx) ── */
html[data-design="new"] .nd-sub { font-size: 12px; color: var(--muted); }
html[data-design="new"] .nd-soft { color: var(--ink2); }
html[data-design="new"] .nd-grow { flex: 1; }
html[data-design="new"] .nd-foot { margin-top: 10px; }
html[data-design="new"] .nd-h { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 800; margin-bottom: 8px; }
html[data-design="new"] .nd-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
/* the tones: a soft background with the darker word of the same colour */
html[data-design="new"] .nd-t-blue { background: var(--blue-soft); color: var(--blue-ink); }
html[data-design="new"] .nd-t-green { background: var(--green-soft); color: var(--green-ink); }
html[data-design="new"] .nd-t-amber { background: var(--amber-soft); color: var(--amber-ink); }
html[data-design="new"] .nd-t-violet { background: var(--violet-soft); color: var(--violet-ink); }
html[data-design="new"] .nd-t-red { background: var(--red-soft); color: var(--red-ink); }
html[data-design="new"] .nd-t-grey { background: var(--soft); color: var(--muted); }
html[data-design="new"] .nd-ink-green { color: var(--green-ink); }
html[data-design="new"] .nd-ink-blue { color: var(--blue-ink); }
html[data-design="new"] .nd-ink-amber { color: var(--amber-ink); }
html[data-design="new"] .nd-ink-red { color: var(--red-ink); }
html[data-design="new"] .nd-fill-blue { background: var(--blue); }
html[data-design="new"] .nd-fill-green { background: var(--green); }
html[data-design="new"] .nd-fill-amber { background: var(--amber); }
html[data-design="new"] .nd-fill-violet { background: var(--violet); }
html[data-design="new"] .nd-fill-red { background: var(--red); }
html[data-design="new"] .nd-fill-grey { background: var(--ctl-strong); }
/* the grey strip of choices */
html[data-design="new"] .nd-seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; gap: 2px; padding: 3px; background: var(--seg); border-radius: 10px; }
html[data-design="new"] .nd-seg a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
html[data-design="new"] .nd-seg a:hover { color: var(--text); }
html[data-design="new"] .nd-seg a.on { background: var(--seg-on); color: var(--text); box-shadow: var(--seg-shadow); }
/* the numbered square, the pill */
html[data-design="new"] .nd-rank { width: 22px; height: 22px; flex: none; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
html[data-design="new"] .nd-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
/* number cards */
html[data-design="new"] .nd-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
html[data-design="new"] .nd-kpi { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); }
html[data-design="new"] .nd-kpi-text { min-width: 0; }
html[data-design="new"] .nd-kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); }
html[data-design="new"] .nd-kpi-value { font-size: 22px; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
html[data-design="new"] .nd-ki { width: 38px; height: 38px; flex: none; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
html[data-design="new"] .nd-ki svg { stroke-width: 1.8; }
/* the ring: --p = how full (0–100), --s = its size */
html[data-design="new"] .nd-ring {
  --s: 52px; width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--ring) calc(var(--p) * 1%), var(--line) 0);
}
html[data-design="new"] .nd-r-green { --ring: var(--green); }
html[data-design="new"] .nd-r-blue { --ring: var(--blue); }
html[data-design="new"] .nd-r-amber { --ring: var(--amber); }
html[data-design="new"] .nd-r-grey { --ring: var(--ctl-strong); }
html[data-design="new"] .nd-ring-in {
  width: calc(var(--s) * .74); height: calc(var(--s) * .74); border-radius: 50%; background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; line-height: 1.1;
}
/* the thin bar at the end of a row */
html[data-design="new"] .nd-meter { height: 7px; min-width: 70px; background: var(--line); border-radius: 4px; overflow: hidden; }
html[data-design="new"] .nd-meter > div { height: 100%; border-radius: 4px; }
/* tables inside the new cards */
html[data-design="new"] .nd-tbl th { font-size: 10.5px; padding: 7px 8px; }
html[data-design="new"] .nd-tbl td { padding: 8px; font-size: 12.5px; vertical-align: middle; }
html[data-design="new"] .nd-tbl th:first-child,
html[data-design="new"] .nd-tbl td:first-child { padding-left: 0; }
html[data-design="new"] .nd-tbl th:last-child,
html[data-design="new"] .nd-tbl td:last-child { padding-right: 0; }
html[data-design="new"] .nd-c-rank { width: 30px; }
html[data-design="new"] .nd-c-meter { width: 90px; }
html[data-design="new"] .nd-grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
html[data-design="new"] .nd-card-amber { border-color: color-mix(in srgb, var(--amber) 35%, var(--border)); }
html[data-design="new"] .nd-note { font-size: 12.5px; background: var(--card2); border-radius: 10px; padding: 8px 12px; }

/* ── 6. Smart Analytics (preview A4) ── */
html[data-design="new"] .nd-split { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 12px; }
html[data-design="new"] .nd-split .nd-h { margin-bottom: 0; }
html[data-design="new"] .nd-split-main { flex: 1 1 260px; min-width: 0; }
html[data-design="new"] .nd-share { display: flex; height: 22px; border-radius: 8px; overflow: hidden; background: var(--line); }
html[data-design="new"] .nd-share > div { background: var(--green); }
html[data-design="new"] .nd-share-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; margin-top: 6px; }
@media (min-width: 900px) {
  html[data-design="new"] .nd-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  html[data-design="new"] .nd-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── 7. Student profile (preview A1) ── */
html[data-design="new"] .nd-plain { font-weight: 500; }
html[data-design="new"] .nd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
html[data-design="new"] .nd-kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--soft); font-size: 13px; }
html[data-design="new"] .nd-kv:last-child { border-bottom: 0; }
html[data-design="new"] .nd-kv > span:first-child { color: var(--muted); min-width: 0; }
html[data-design="new"] .nd-kv > b { text-align: right; overflow-wrap: anywhere; }
html[data-design="new"] .nd-prof { display: flex; flex-direction: column; gap: 16px; padding: 20px 22px; margin-bottom: 14px; }
html[data-design="new"] .nd-prof-top { display: flex; align-items: center; gap: 16px; }
html[data-design="new"] .nd-avatar { width: 56px; height: 56px; flex: none; border-radius: 16px; background: var(--blue-soft); color: var(--blue-ink); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }
html[data-design="new"] .nd-prof-main { flex: 1; min-width: 0; }
html[data-design="new"] .nd-prof-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
html[data-design="new"] .nd-prof-name .profile-name { font-size: 22px; }
html[data-design="new"] .nd-prof-line { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; font-size: 13px; color: var(--muted); }
html[data-design="new"] .nd-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; border-top: 1px solid var(--line); padding-top: 16px; }
html[data-design="new"] .nd-stats > div { padding: 0 16px; border-left: 1px solid var(--line); min-width: 0; }
html[data-design="new"] .nd-stat-value { font-size: 20px; font-weight: 800; margin-top: 2px; line-height: 1.3; overflow-wrap: anywhere; }
html[data-design="new"] .nd-cols3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
html[data-design="new"] .nd-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
html[data-design="new"] .nd-course { padding: 8px 0; border-bottom: 1px solid var(--soft); }
html[data-design="new"] .nd-course:last-child { border-bottom: 0; }
html[data-design="new"] .nd-course-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
html[data-design="new"] .nd-course-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-design="new"] .nd-meter-wide { height: 6px; margin: 6px 0 4px; }
html[data-design="new"] .nd-activity { padding: 16px 20px; }
html[data-design="new"] .nd-activity-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
html[data-design="new"] .nd-activity-head .nd-h { margin-bottom: 0; font-size: 15px; }
html[data-design="new"] .nd-day { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 4px; }
html[data-design="new"] .nd-ev { display: grid; grid-template-columns: 64px 30px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--soft); }
html[data-design="new"] .nd-ev-time { font-size: 12px; color: var(--muted); padding-top: 6px; }
html[data-design="new"] .nd-ev-ico { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
html[data-design="new"] .nd-ev-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 13.5px; font-weight: 700; }
html[data-design="new"] .nd-ev-detail { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
html[data-design="new"] .nd-ev-amount { font-size: 13px; font-weight: 700; color: var(--green-ink); padding-top: 6px; font-variant-numeric: tabular-nums; }
html[data-design="new"] .nd-intent { display: flex; align-items: center; gap: 16px; }
html[data-design="new"] .nd-ring-big { font-size: 24px; line-height: 1; }
html[data-design="new"] .nd-intent .nd-ring-in span { font-size: 11px; font-weight: 600; color: var(--muted); }
html[data-design="new"] .nd-intent-course { font-size: 15px; font-weight: 800; color: var(--blue-ink); margin-top: 2px; overflow-wrap: anywhere; }
html[data-design="new"] .nd-seq { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--soft); font-size: 12.5px; }
html[data-design="new"] .nd-seq:last-child { border-bottom: 0; }
@media (min-width: 700px) {
  html[data-design="new"] .nd-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  html[data-design="new"] .nd-stats > div:first-child { border-left: 0; padding-left: 0; }
}
@media (min-width: 900px) {
  html[data-design="new"] .nd-cols3 { grid-template-columns: 320px minmax(0, 1fr); }
  html[data-design="new"] .nd-cols3 > .nd-col:last-child { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  html[data-design="new"] .nd-cols3 > .nd-col:last-child > * { flex: 1 1 280px; }
}
@media (min-width: 1340px) {
  html[data-design="new"] .nd-cols3 { grid-template-columns: 320px minmax(0, 1fr) 300px; }
  html[data-design="new"] .nd-cols3 > .nd-col:last-child { grid-column: auto; flex-direction: column; flex-wrap: nowrap; }
  html[data-design="new"] .nd-cols3 > .nd-col:last-child > * { flex: none; }
}
@media (max-width: 520px) {
  html[data-design="new"] .nd-ev { grid-template-columns: 30px minmax(0, 1fr) auto; }
  html[data-design="new"] .nd-ev-time { grid-column: 1 / -1; padding-top: 0; }
}

/* ── 8. Students list (preview A2); the list card is used by other lists too ── */
html[data-design="new"] .nd-kpi-link { color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
html[data-design="new"] .nd-kpi-link:hover { border-color: var(--ctl-strong); color: var(--text); }
html[data-design="new"] .nd-kpi-link.on { border-color: var(--blue); background: var(--blue-soft); }
html[data-design="new"] .nd-listcard { padding: 0; overflow: hidden; }
html[data-design="new"] .nd-listbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
html[data-design="new"] .nd-listbar .select { height: 36px; font-size: 13px; }
html[data-design="new"] .nd-search { display: flex; align-items: center; gap: 8px; flex: 1 1 240px; max-width: 360px; height: 36px; padding: 0 10px; border: 1.5px solid var(--ctl); border-radius: var(--r-ctl); color: var(--muted); background: var(--card); }
html[data-design="new"] .nd-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-ring); }
html[data-design="new"] .nd-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
html[data-design="new"] .nd-list th { padding: 10px 14px; }
html[data-design="new"] .nd-list td { padding: 10px 14px; font-size: 13px; vertical-align: middle; }
html[data-design="new"] .nd-list tbody tr:hover { background: var(--card2); }
html[data-design="new"] .nd-who { display: flex; align-items: center; gap: 10px; min-width: 180px; color: var(--text); }
html[data-design="new"] .nd-ini { width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--blue-soft); color: var(--blue-ink); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
html[data-design="new"] .nd-who-text { display: flex; flex-direction: column; min-width: 0; }
html[data-design="new"] .nd-who-name { font-weight: 700; }
html[data-design="new"] .nd-who:hover .nd-who-name { color: var(--blue-ink); }
html[data-design="new"] .nd-listfoot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
html[data-design="new"] .nd-listfoot .off { opacity: .45; pointer-events: none; }

/* ── 9. Rules list (preview A3) ── */
html[data-design="new"] .nd-hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
html[data-design="new"] .nd-k { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
html[data-design="new"] .nd-danger { color: var(--red-ink); border-color: var(--red-line); }
html[data-design="new"] .nd-danger:hover { color: var(--red-ink); border-color: var(--red); background: var(--red-soft); }
html[data-design="new"] .nd-seg button { border: 0; background: transparent; font: inherit; cursor: pointer; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
html[data-design="new"] .nd-seg button:hover { color: var(--text); }
html[data-design="new"] .nd-seg button.on { background: var(--seg-on); color: var(--text); box-shadow: var(--seg-shadow); }
/* the switch as a button (a form's submit button that says role="switch") */
html[data-design="new"] .nd-switch { position: relative; width: 44px; height: 26px; flex: none; padding: 0; border: 0; border-radius: 999px; background: var(--switch-off); cursor: pointer; transition: background .15s; }
html[data-design="new"] .nd-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
html[data-design="new"] .nd-switch.on { background: var(--green); }
html[data-design="new"] .nd-switch.on::after { left: 21px; }
html[data-design="new"] .nd-num { width: 30px; height: 30px; flex: none; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; background: var(--soft); color: var(--ink2); }
html[data-design="new"] .nd-num.on { background: var(--blue); color: var(--on-blue); }
html[data-design="new"] .nd-rules { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
html[data-design="new"] .nd-rulelist tbody tr { cursor: pointer; }
html[data-design="new"] .nd-rulelist tbody tr.on { background: var(--blue-soft); }
html[data-design="new"] .nd-rulelist tbody tr.nd-off .nd-rule-cell { opacity: .6; }
html[data-design="new"] .nd-rulelist th:first-child { width: 52px; }
html[data-design="new"] .nd-rulelist th:nth-child(2) { width: 60px; }
html[data-design="new"] .nd-rule-cell { min-width: 220px; }
html[data-design="new"] .nd-rule-name { display: block; max-width: 100%; padding: 0; border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--text); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
html[data-design="new"] .nd-rule-name:hover { color: var(--blue-ink); }
html[data-design="new"] .nd-chips-tight { gap: 6px; margin-top: 4px; }
html[data-design="new"] .nd-rulepanel { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
html[data-design="new"] .nd-rulepanel-top { display: flex; align-items: center; gap: 8px; }
html[data-design="new"] .nd-rulepanel-name { font-size: 16px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
html[data-design="new"] .nd-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
html[data-design="new"] .nd-box .nd-k { margin-bottom: 2px; }
html[data-design="new"] .nd-box-text { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
html[data-design="new"] .nd-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
html[data-design="new"] .nd-tiles > div { display: flex; flex-direction: column; min-width: 0; background: var(--card2); border-radius: 10px; padding: 8px 10px; }
html[data-design="new"] .nd-tiles span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
html[data-design="new"] .nd-tiles b { font-size: 16px; overflow-wrap: anywhere; }
html[data-design="new"] .nd-coupon { display: flex; flex-direction: column; gap: 6px; margin: 0; }
html[data-design="new"] .nd-rulepanel-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html[data-design="new"] .nd-rulepanel-btns > span:empty { display: none; }
@media (min-width: 1280px) {
  html[data-design="new"] .nd-rules { grid-template-columns: minmax(0, 1fr) 340px; }
  html[data-design="new"] .nd-rules > div:last-child { position: sticky; top: 78px; max-height: calc(100dvh - 92px); overflow-y: auto; scrollbar-width: thin; border-radius: var(--r-card); }
}

/* ── 10. Hot Leads (preview A5) ── */
html[data-design="new"] .nd-ink-grey { color: var(--muted); }
html[data-design="new"] .nd-t-dark { background: var(--text); color: var(--card); }
html[data-design="new"] .nd-pill-link:hover { color: inherit; filter: brightness(.96); }
html[data-design="new"] .nd-legend { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
html[data-design="new"] .nd-legend span { display: inline-flex; align-items: center; gap: 5px; }
html[data-design="new"] .nd-legend i { width: 10px; height: 10px; border-radius: 50%; }
html[data-design="new"] .nd-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0 0 12px; }
html[data-design="new"] .nd-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
html[data-design="new"] .nd-f > span { font-size: 11px; font-weight: 700; color: var(--muted); }
html[data-design="new"] .nd-f .select,
html[data-design="new"] .nd-f .input { height: 34px; font-size: 12.5px; border-radius: 999px; }
html[data-design="new"] .nd-f-wide { flex: 1 1 220px; max-width: 320px; }
html[data-design="new"] .nd-f-wide .select { width: 100%; }
html[data-design="new"] .nd-f-switch { display: inline-flex; align-items: center; gap: 8px; height: 34px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
html[data-design="new"] .nd-leads td { font-size: 12.5px; }
html[data-design="new"] .nd-contact { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 4px 0 0 42px; font-size: 11.5px; color: var(--muted); }
html[data-design="new"] .nd-lead-course { max-width: 200px; overflow-wrap: anywhere; }
html[data-design="new"] .nd-ve { font-size: 12px; white-space: nowrap; }
html[data-design="new"] .nd-detail-btn { height: 28px; margin-top: 4px; font-size: 11.5px; }
html[data-design="new"] .nd-leads .nd-ring-in { font-size: 12.5px; }
html[data-design="new"] .nd-lead-top { display: flex; align-items: center; gap: 12px; }
html[data-design="new"] .nd-ring-mid { font-size: 20px; line-height: 1; }
html[data-design="new"] .nd-lead-top .nd-ring-in span { font-size: 10px; font-weight: 600; color: var(--muted); }
html[data-design="new"] .nd-lead-word { font-size: 12.5px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
html[data-design="new"] .nd-intent-word { font-size: 16px; font-weight: 800; margin-top: 2px; }
html[data-design="new"] .nd-leaddetail { font-size: 12.5px; }

/* ── 11. Rule Studio (preview A7) — the page's own markup (pages/RuleStudio.tsx), laid out anew:
      the steps as one card, "Preview and lock" as a card of its own on the right ── */
html[data-design="new"] #presets label { font-size: 14px; }
html[data-design="new"] #studio { background: transparent; border: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
html[data-design="new"] #studio > #st-fields,
html[data-design="new"] #studio > #step-preview { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); min-width: 0; }
html[data-design="new"] #studio > #step-preview { padding: 16px 18px; }
html[data-design="new"] #studio .tl-step { grid-template-columns: 30px minmax(0, 1fr); gap: 14px; }
html[data-design="new"] #st-fields > .tl-step { padding: 16px 20px; border-bottom: 1px solid var(--line); }
html[data-design="new"] #st-fields > .tl-step:last-child { border-bottom: 0; }
html[data-design="new"] #studio .tl-step::before { display: none; }
html[data-design="new"] #studio .tl-n { width: 30px; height: 30px; border-radius: 10px; font-size: 13px; background: var(--blue); color: var(--on-blue); }
html[data-design="new"] #studio .tl-b { padding-top: 3px; }
html[data-design="new"] #studio .tl-t { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 14.5px; }
html[data-design="new"] #studio .tl-say { font-size: 12.5px; font-weight: 600; color: var(--blue-ink); background: var(--blue-soft); border-radius: 10px; padding: 7px 10px; margin-top: 10px; }
html[data-design="new"] #studio .tl-say:empty { display: none; }
html[data-design="new"] #studio .tl-courses { border-color: var(--line); border-radius: 12px; }
html[data-design="new"] #studio .tl-preview { border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 12px; }
html[data-design="new"] #studio .tl-locked { opacity: .65; }
html[data-design="new"] #studio .check-row { min-height: 36px; }
html[data-design="new"] .info-btn { width: 20px; height: 20px; border: 1.5px solid var(--ctl-strong); background: var(--card); font: 800 11px/1 var(--font); font-style: normal; }
html[data-design="new"] .rule-ways { gap: 12px; }
html[data-design="new"] .rule-way { border-radius: var(--r-card); }
html[data-design="new"] .rule-way.main { background: var(--blue-soft); box-shadow: none; }
@media (min-width: 1240px) {
  html[data-design="new"] #studio { grid-template-columns: minmax(0, 1fr) 360px; }
  html[data-design="new"] #studio > #step-preview { position: sticky; top: 78px; max-height: calc(100dvh - 92px); overflow-y: auto; scrollbar-width: thin; grid-template-columns: minmax(0, 1fr); }
  html[data-design="new"] #studio > #step-preview > .tl-n { width: 26px; height: 26px; font-size: 12px; }
  html[data-design="new"] #studio > #step-preview .tl-lines th { display: block; width: auto; padding: 6px 0 0; }
  html[data-design="new"] #studio > #step-preview .tl-lines td { display: block; padding: 0 0 4px; }
  html[data-design="new"] #studio > #step-preview .tl-lines tr { display: block; }
}
@media (max-width: 520px) {
  html[data-design="new"] #st-fields > .tl-step { padding: 14px; gap: 10px; }
}
