/* Mathilens Client Desk — white theme with blue accents.
   Layout: fixed white sidebar + scrolling work area; collapses to a top bar on phones.
   Always light, even when the computer uses dark mode. */

:root {
  /* Blue scale (50 → 950) */
  --blue-50:  #eef5ff;
  --blue-100: #d9e8ff;
  --blue-200: #bcd6ff;
  --blue-300: #8ebcff;
  --blue-400: #5996fd;
  --blue-500: #3372f8;
  --blue-600: #1d55ed;
  --blue-700: #1641d6;
  --blue-800: #1836ad;
  --blue-900: #1a3389;
  --blue-950: #0c1a45;

  /* Theme tokens (light) */
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f7f9fe;
  --border: #dce4f2;
  --text: #0f1a33;
  --muted: #5a6985;
  --accent: var(--blue-600);
  --accent-hover: var(--blue-700);
  --accent-soft: var(--blue-50);
  --accent-text: var(--blue-700);
  --focus: var(--blue-400);
  --sidebar-bg: #ffffff;
  --sidebar-text: #44526e;
  --sidebar-hover: var(--surface-2);
  --sidebar-active: var(--blue-50);

  /* Status colours */
  --st-new-bg: var(--blue-100);       --st-new-fg: var(--blue-800);
  --st-progress-bg: #fff1d6;          --st-progress-fg: #8a5200;
  --st-closed-bg: #e8ecf3;            --st-closed-fg: #4a566c;
  --st-active-bg: #dcf5e7;            --st-active-fg: #12663b;
  --danger: #c8283c;
  --danger-soft: #fde8eb;

  --shadow: 0 1px 2px rgb(15 26 51 / 0.06), 0 4px 16px rgb(15 26 51 / 0.05);
  --radius: 10px;

  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, 'Courier New', monospace;
  color-scheme: light;
}


*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.65rem; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 600; }
a { color: var(--accent-text); }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 0.86em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.02rem; color: var(--text); }
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.brand-text small { font-family: var(--font-body); font-size: 0.74rem; font-weight: 500; color: var(--accent-text); letter-spacing: 0.04em; text-transform: uppercase; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-800));
  color: #fff; font-weight: 700; font-size: 1rem;
}
.brand-lg { font-size: 1.2rem; }

/* ---------- Login ---------- */
.login {
  min-height: 100%; display: grid; place-items: center;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--blue-500) 22%, transparent), transparent 45%),
    radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--blue-800) 25%, transparent), transparent 50%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; display: grid; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 32px 28px; box-shadow: var(--shadow);
}
.login-card p { margin: 0; }

/* ---------- Shell ---------- */
.shell {
  display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%;
  background: linear-gradient(90deg, var(--sidebar-bg) 239px, var(--border) 239px 240px, var(--bg) 240px);
}
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
}
.sidebar .brand { padding: 0 8px; }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none; font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: 0.85; }
.nav a:hover { background: var(--sidebar-hover); color: var(--accent-text); }
.nav a.active { background: var(--sidebar-active); color: var(--accent-text); box-shadow: inset 3px 0 0 var(--accent); }
.nav-count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: var(--blue-500); color: #fff; font-size: 0.75rem; text-align: center; font-variant-numeric: tabular-nums;
}
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 0 8px; }
.user-chip { font-size: 0.85rem; color: var(--sidebar-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main {
  min-width: 0;
  padding: 20px max(16px, 2vw) 28px;
  display: grid; gap: 14px; align-content: start;
  outline: none;
}
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head p { margin: 4px 0 0; }
.crumb { font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--accent-text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font: 500 0.9rem/1.2 var(--font-body); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--blue-300); color: var(--accent-text); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; padding: 11px 14px; }
.btn-ghost-dark { background: var(--surface); border-color: var(--border); color: var(--sidebar-text); }
.btn-ghost-dark:hover { background: var(--sidebar-hover); color: var(--accent-text); border-color: var(--blue-300); }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: 9px 9px 0 0; }
.panel-head h2 { font-size: 1rem; }
.panel-body { padding: 14px; display: grid; gap: 12px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  display: grid; gap: 4px; padding: 16px 18px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.stat:hover { border-color: var(--blue-300); }
.stat-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 500; }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-note { font-size: 0.82rem; color: var(--muted); }
.stat.is-hot { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-900); }
.stat.is-hot .stat-label, .stat.is-hot .stat-note { color: var(--blue-700); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.tab {
  padding: 6px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font: 500 0.86rem var(--font-body); cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--accent-text); box-shadow: 0 1px 2px rgb(15 26 51 / 0.12); }
.search { flex: 1 1 220px; max-width: 360px; margin-left: auto; }

/* ---------- Forms ---------- */
.field { display: grid; align-content: start; gap: 4px; font-size: 0.86rem; font-weight: 500; color: var(--muted); min-width: 0; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 400 0.95rem/1.4 var(--font-body);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-400); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-400) 30%, transparent); }
textarea { min-height: 110px; resize: vertical; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 0.8rem; font-weight: 400; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 0.88rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left; font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: 0; }
td .sub { display: block; color: var(--muted); font-size: 0.82rem; }
.cell-strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.empty { padding: 40px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 4px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 0.86rem; color: var(--muted); }
.pager-btns { display: flex; gap: 6px; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-new, .pill-lead { background: var(--st-new-bg); color: var(--st-new-fg); }
.pill-in_progress { background: var(--st-progress-bg); color: var(--st-progress-fg); }
.pill-closed, .pill-inactive { background: var(--st-closed-bg); color: var(--st-closed-fg); }
.pill-active { background: var(--st-active-bg); color: var(--st-active-fg); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.78rem; color: var(--muted); text-transform: capitalize; }

/* ---------- Detail pages ---------- */
.stack { display: grid; gap: 14px; min-width: 0; }
.detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 18px; margin: 0; font-size: 0.92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.message { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; max-width: 70ch; }
.linked { display: grid; gap: 8px; }
.linked a {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: inherit;
}
.linked a:hover { border-color: var(--blue-300); background: var(--accent-soft); }

/* ---------- Toast & dialog ---------- */
.toast {
  position: fixed; bottom: max(20px, env(safe-area-inset-bottom, 0px)); right: max(20px, env(safe-area-inset-right, 0px)); z-index: 50;
  padding: 11px 16px; border-radius: 9px; background: var(--blue-950); color: #fff;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); font-size: 0.9rem; max-width: calc(100vw - 40px);
}
.toast.is-error { background: var(--danger); }
.dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(420px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgb(0 0 0 / 0.3);
}
.dialog::backdrop { background: rgb(5 11 24 / 0.55); }
.dialog form { display: grid; gap: 10px; padding: 22px; }
.dialog p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Answers ---------- */
.answers { display: grid; gap: 16px; margin: 0; }
.answers dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.answers dd { margin: 0; }
.tag-plain { text-transform: none; }
.form-filter { width: auto; min-width: 160px; padding: 7px 10px; font-size: 0.88rem; }

/* ---------- Forms ---------- */
.key-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); white-space: nowrap; }
.key-lg { font-size: 0.95rem; padding: 6px 10px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; color: var(--text); }
.check input { width: 17px; height: 17px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.btn-sm { padding: 5px 10px; font-size: 0.82rem; }
.field-label { font-size: 0.86rem; font-weight: 500; color: var(--muted); }

/* ---------- Form editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
.editor-side { min-width: 0; }
.editor .panel { border-color: #cfdaeb; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pair .panel-body { align-content: start; }
.sec-title { display: flex; align-items: center; gap: 9px; }
.sec-ico {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px;
  background: var(--blue-100); color: var(--accent-text);
}
.sec-ico svg { width: 15px; height: 15px; fill: currentColor; }
.sec-title + .panel-sub { margin: 0 0 0 35px; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.title-row .pill { font-family: var(--font-body); font-size: 0.78rem; }
.panel-sub { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Status switch */
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; color: var(--text); font-weight: 400; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; width: 40px; height: 22px; flex: none; border-radius: 999px;
  background: #c9d3e3; transition: background 0.15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgb(15 26 51 / 0.25); transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* How will the website send it? */
.mode-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mode-option {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.mode-option:hover { border-color: var(--blue-300); }
.mode-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.mode-option input { width: 17px; height: 17px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.mode-option > span { display: grid; gap: 4px; font-size: 0.93rem; }
.mode-option .muted { font-size: 0.85rem; line-height: 1.45; }

/* Field builder: one compact row per field */
.fb-list { display: grid; gap: 6px; }
.fb-row {
  display: grid; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
}
.fb-row:hover { border-color: #cbd7ea; }
.fb-row:focus-within { border-color: var(--blue-300); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-200) 35%, transparent); }
.fb-main {
  display: grid; align-items: center; gap: 10px;
  grid-template-columns: 26px minmax(0, 1fr) 140px auto auto;
  grid-template-areas: "num label type req actions";
}
.fb-num {
  grid-area: num; align-self: start; margin-top: 7px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.fb-label { grid-area: label; position: relative; min-width: 0; }
.fb-label input { font-weight: 500; padding-right: 130px; }
.fb-key { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); max-width: 116px; pointer-events: none; font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-key code { font-family: var(--font-mono); color: var(--accent-text); }
.fb-main select { grid-area: type; align-self: start; }
.fb-req { grid-area: req; align-self: start; padding-top: 9px; white-space: nowrap; }
.fb-actions { grid-area: actions; align-self: start; display: flex; gap: 4px; padding-top: 3px; }
.fb-options, .fb-extra { margin-left: 36px; }
.fb-options textarea { min-height: 0; }
.fb-extra { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.fb-row .field-error { margin: 0 0 0 36px; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--muted);
  font-size: 0.9rem; line-height: 1; cursor: pointer;
}
.icon-btn:hover:not(:disabled) { color: var(--accent-text); border-color: var(--blue-300); background: var(--accent-soft); }
.icon-btn[aria-expanded="true"] { color: var(--accent-text); border-color: var(--blue-300); background: var(--accent-soft); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-danger:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* Lists of emails / websites */
.list-editor { display: grid; gap: 8px; justify-items: start; }
.list-rows { display: grid; gap: 8px; width: 100%; }
.list-row { display: flex; gap: 8px; align-items: center; }
.list-row input { flex: 1; min-width: 0; }
.list-row .icon-btn { width: 40px; height: 40px; flex: none; }
.hint { margin: 0; font-size: 0.82rem; font-weight: 400; color: var(--muted); line-height: 1.45; }
.check .hint { display: block; }
input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* Save bar stays in view at the bottom of the screen */
.save-bar {
  position: sticky; bottom: max(12px, env(safe-area-inset-bottom, 0px)); z-index: 5;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 10px 12px 10px 16px; border: 1px solid var(--border); border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgb(15 26 51 / 0.1);
}
.save-state { margin-right: auto; font-size: 0.86rem; color: var(--muted); }
.save-state.is-dirty { color: var(--st-progress-fg); font-weight: 500; }
.save-state.is-dirty::before { content: "● "; }

/* Add to your website */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.86rem; line-height: 1.45; overflow-wrap: anywhere; }
.check-icon {
  width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%;
  font-size: 0.72rem; font-weight: 700;
}
.checklist .is-ok .check-icon { background: var(--st-active-bg); color: var(--st-active-fg); }
.checklist .is-warn { color: var(--st-progress-fg); }
.checklist .is-warn .check-icon { background: var(--st-progress-bg); color: var(--st-progress-fg); }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; font-size: 0.9rem; }
.steps li::marker { color: var(--accent-text); font-weight: 600; }
.steps-code li { padding-left: 4px; }
.steps-code li > .copy-block, .steps-code li > .field-label { margin-top: 0; }
.copy-block { display: grid; gap: 6px; min-width: 0; }
.copy-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.copy-head .field-label { line-height: 1.35; }
.copy-head .btn { flex: none; }
.code {
  margin: 0; padding: 10px 12px; border-radius: 8px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--blue-900);
  font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.6;
}
.key-cell { display: inline-flex; align-items: center; gap: 8px; }
.more { border-top: 1px solid var(--border); padding-top: 12px; }
.more summary { cursor: pointer; font-size: 0.88rem; color: var(--accent-text); font-weight: 500; }
.more[open] summary { margin-bottom: 10px; }
.more .hint { margin-top: 6px; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.note { margin: 0; font-size: 0.86rem; color: var(--muted); overflow-wrap: anywhere; }
.note-warn { padding: 10px 12px; border-radius: 8px; background: var(--st-progress-bg); color: var(--st-progress-fg); }
.note code, .hint code, .field-label code { font-family: var(--font-mono); font-size: 0.85em; color: var(--accent-text); }
.preview-box { padding: 18px; border-radius: 9px; border: 1px dashed var(--border); background: var(--surface-2); color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor-side { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 960px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px;
    border-right: 0; border-bottom: 1px solid var(--border);
    padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  }
  .sidebar .brand { padding: 0; }
  .nav { order: 3; width: 100%; grid-auto-flow: column; grid-auto-columns: minmax(0, auto); justify-content: space-between; gap: 2px; }
  .nav a { justify-content: center; padding: 8px 6px; font-size: 0.86rem; gap: 5px; }
  .nav a svg { display: none; }
  .nav a.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .nav-count { margin-left: 0; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; grid-auto-flow: column; align-items: center; }
  .user-chip { display: none; }
  .main { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .shell { background: var(--bg); }
  .mode-choice, .pair { grid-template-columns: minmax(0, 1fr); }
  .fb-main {
    grid-template-columns: 26px minmax(0, 1fr) auto;
    grid-template-areas: "num label label" ". type req" ". actions actions";
  }
  .fb-req { padding-top: 0; align-self: center; }
  .fb-options, .fb-extra { margin-left: 0; }
  .fb-extra { grid-template-columns: minmax(0, 1fr); }
  .fb-row .field-error { margin-left: 0; }
  .save-bar { padding: 10px; }
  .save-state { display: none; }
  .search { max-width: none; margin-left: 0; }
  .hide-sm { display: none; }
}

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