:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #dfe4ef;
  --text: #1a2234;
  --muted: #68718a;
  --brand: #3641bc;
  --brand-soft: #eef0fc;
  --ok: #1a7f52;
  --ok-soft: #e7f5ee;
  --warn: #9a6400;
  --warn-soft: #fdf3e2;
  --err: #b4232b;
  --err-soft: #fdecec;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root { color-scheme: light; }

/* Dark: chosen with the toggle, or the system's choice when nothing was chosen. */
:root[data-theme="dark"] {
    --bg: #11141c;
    --surface: #181c26;
    --border: #2a3040;
    --text: #e8ebf2;
    --muted: #9aa3b8;
    --brand: #7b85ee;
    --brand-soft: #1e2340;
    --ok: #4cc38a;
    --ok-soft: #14301f;
    --warn: #e0a243;
    --warn-soft: #332611;
    --err: #f2707a;
    --err-soft: #371a1d;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11141c;
    --surface: #181c26;
    --border: #2a3040;
    --text: #e8ebf2;
    --muted: #9aa3b8;
    --brand: #7b85ee;
    --brand-soft: #1e2340;
    --ok: #4cc38a;
    --ok-soft: #14301f;
    --warn: #e0a243;
    --warn-soft: #332611;
    --err: #f2707a;
    --err-soft: #371a1d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

/* `hidden` must win over the display rules below (.modal, .toast, .row …). */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1 { font-size: 17px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 4px; }
h3 { font-size: 13px; margin: 18px 0 8px; text-transform: uppercase;
     letter-spacing: .04em; color: var(--muted); }
p { margin: 0 0 10px; }
code { font-family: var(--mono); font-size: .92em; background: var(--brand-soft);
       padding: 1px 5px; border-radius: 4px; }

/* ── shell: left menu + content ───────────────────────── */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 14px; background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px;
         color: var(--text); text-decoration: none; }
.brand b { display: block; font-size: 16px; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 12px; }
.dot { width: 30px; height: 30px; border-radius: 9px; flex: none;
       background: linear-gradient(135deg, var(--brand), #7b85ee); }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-label { margin: 16px 10px 4px; font-size: 11px; font-weight: 700;
              text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600;
  position: relative;
}
.menu-item small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.menu-item .ico { font-size: 19px; width: 26px; text-align: center; flex: none; }
.menu-item:hover { background: var(--bg); }
.menu-item.is-active { background: var(--brand-soft); color: var(--brand); }
.menu-item .badge-soon { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 8px; }
.sidebar-foot .pill { display: block; text-align: center; overflow: hidden;
                      text-overflow: ellipsis; white-space: nowrap; }

.content { padding: 28px 32px 90px; max-width: 1280px; width: 100%; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 26px; letter-spacing: -.01em; }
.page-head p { color: var(--muted); font-size: 15px; margin: 6px 0 0; }

.badge-soon { font-style: normal; font-size: 10px; font-weight: 700;
              text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px;
              border-radius: 99px; background: var(--warn-soft); color: var(--warn);
              vertical-align: middle; }

/* ── tiles ────────────────────────────────────────────── */
.tiles { display: grid; gap: 14px; margin-bottom: 14px; }
.tiles-2 { grid-template-columns: repeat(2, 1fr); }
.home-group { margin: 22px 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #5b6472); }
.home-group small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 8px; font-size: 13px; }
.briefing textarea { width: 100%; min-height: 96px; }
.briefing .row { margin-top: 10px; align-items: center; gap: 12px; }
.briefing .brief-notes { margin: 10px 0 0; padding-left: 18px; }
.briefing .brief-done { margin-top: 10px; }
label.is-filled input, label.is-filled textarea, label.is-filled select { box-shadow: 0 0 0 2px rgba(124, 58, 237, .35); }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tiles-4 { grid-template-columns: repeat(4, 1fr); }
.tile {
  display: flex; flex-direction: column; gap: 8px; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px; color: var(--text); text-decoration: none;
  font: inherit; transition: transform .12s, box-shadow .12s, border-color .12s;
}
a.tile, button.tile { cursor: pointer; }
a.tile:hover, button.tile:hover {
  transform: translateY(-2px); border-color: var(--brand);
  box-shadow: 0 8px 22px rgba(30, 40, 90, .10);
}
.tile h2 { font-size: 16px; margin: 4px 0 0; }
.tile p { color: var(--muted); margin: 0; flex: 1; }
.tile-lg { padding: 26px; min-height: 210px; }
.tile-lg h2 { font-size: 19px; }
.tile-go { color: var(--brand); font-weight: 600; margin-top: 6px; }
.tile.is-soon { background: var(--bg); }
.tile-ico { display: grid; place-items: center; width: 46px; height: 46px;
            border-radius: 12px; font-size: 22px; font-weight: 700; }
.tile .meta { font-size: 12px; color: var(--muted); }
.c-blue { background: var(--brand-soft); color: var(--brand); }
.c-green { background: var(--ok-soft); color: var(--ok); }
.c-amber { background: var(--warn-soft); color: var(--warn); }
.c-violet { background: #f1eafd; color: #7b3fd0; }
.c-red { background: var(--err-soft); color: var(--err); }
:root[data-theme="dark"] .c-violet { background: #2a1f45; color: #b794f4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .c-violet { background: #2a1f45; color: #b794f4; } }

.callout { background: var(--brand-soft); border-color: transparent; }
.callout a { color: var(--brand); font-weight: 600; }

/* "What to do here" box: the one-sentence explanation on every page */
.guide {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--brand-soft); border-radius: 12px; padding: 14px 18px;
  margin-bottom: 14px; border-left: 4px solid var(--brand);
}
.guide b { flex: none; color: var(--brand); }
.guide p { margin: 0; }
ul.plain { margin: 8px 0 0; padding-left: 18px; }
ul.plain li { margin-bottom: 6px; }

/* ── importer step tiles ──────────────────────────────── */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
         margin-bottom: 18px; }
.step {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.step small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.step b {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 50%; background: var(--bg); color: var(--muted);
  border: 1px solid var(--border);
}
.step:hover { border-color: var(--brand); }
.step.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft);
                  background: var(--brand-soft); }
.step.is-active b { background: var(--brand); color: #fff; border-color: var(--brand); }
.step.is-done b { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }

.nav-foot { display: flex; justify-content: space-between; margin-top: 18px; }

@media (max-width: 1100px) {
  .tiles-4 { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap;
             align-items: center; gap: 8px; padding: 10px 14px; }
  .brand { padding: 0; }
  .menu { flex-direction: row; flex-wrap: wrap; }
  .menu-label, .menu-item small, .sidebar-foot { display: none; }
  .content { padding: 18px 16px 70px; }
  .tiles-3, .tiles-2 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2.tight { gap: 8px; margin-bottom: 12px; }
.grid-2 > .card { margin-bottom: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 16px; align-items: flex-start;
               justify-content: space-between; flex-wrap: wrap; }
.send-row { margin: 14px 0; gap: 20px; }

@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── controls ─────────────────────────────────────────── */
label { display: block; margin-bottom: 10px; font-size: 12px;
        font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text);
  font: inherit; font-weight: 400;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
select { cursor: pointer; }

button { font: inherit; cursor: pointer; border-radius: 7px; padding: 8px 14px;
         border: 1px solid transparent; font-weight: 500; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--brand); color: #fff; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.ghost:hover:not(:disabled) { background: var(--bg); }
.link { background: none; border: 0; color: var(--brand); padding: 0;
        text-decoration: underline; }
.check { display: flex; align-items: center; gap: 7px; margin: 0;
         font-weight: 500; color: var(--text); cursor: pointer; }
.check input { margin: 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.hint { font-size: 12px; color: var(--muted); margin: -4px 0 12px; }
.note { font-size: 13px; margin: 10px 0 0; min-height: 1em; }
.note.err { color: var(--err); }
.note.ok { color: var(--ok); }

.pill { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px;
        text-transform: uppercase; letter-spacing: .03em; }
.pill-off { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.pill-on { background: var(--ok-soft); color: var(--ok); }
.tag { font-size: 11px; font-family: var(--mono); padding: 2px 7px;
       border-radius: 5px; background: var(--bg); color: var(--muted);
       border: 1px solid var(--border); }
.tag-req { background: var(--brand-soft); color: var(--brand);
           border-color: transparent; font-weight: 600; }
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag-err { background: var(--err-soft); color: var(--err); border-color: transparent; }

/* ── entity list ──────────────────────────────────────── */
.entity-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
               gap: 8px; }
.entity {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  background: var(--bg);
}
.entity b { font-size: 13px; }
.entity .path { font-family: var(--mono); font-size: 11px; color: var(--muted);
                display: block; margin: 2px 0 6px; word-break: break-all; }

/* ── dropzone ─────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; background: var(--bg);
  transition: border-color .15s, background .15s;
}
.dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone p { margin: 0 0 4px; }
.dz-ico { font-size: 34px; }

/* ── tables ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border);
              border-radius: 8px; margin-top: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border);
         white-space: nowrap; max-width: 280px; overflow: hidden;
         text-overflow: ellipsis; }
th { background: var(--bg); font-weight: 600; font-size: 11px;
     position: sticky; top: 0; }
th.req { color: var(--brand); }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); }

/* ── collapsible blocks ───────────────────────────────── */
details.block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 10px;
}
details.block > summary {
  padding: 13px 18px; cursor: pointer; display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap; list-style: none;
}
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary::before {
  content: "▸"; color: var(--muted); font-size: 11px; transition: transform .15s;
}
details.block[open] > summary::before { transform: rotate(90deg); }
details.block > summary:hover { background: var(--bg); border-radius: var(--radius); }
details.block .body { padding: 0 18px 16px; }
.sum-title { font-weight: 600; }
.sum-spacer { flex: 1; }

/* ── mapping rules ────────────────────────────────────── */
.rule {
  display: grid; grid-template-columns: 190px 1fr auto; gap: 10px;
  align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--border);
}
.rule:last-child { border-bottom: 0; }
.rule-name { font-family: var(--mono); font-size: 12px; }
.rule-src { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rule-src select, .rule-src input[type=text] { margin: 0; width: auto;
  min-width: 150px; flex: 1; padding: 5px 8px; font-size: 12px; }
.rule-note { font-size: 11px; color: var(--muted); grid-column: 1 / -1;
             margin: -4px 0 4px; padding-left: 190px; }
.rule-missing .rule-name { color: var(--err); }
@media (max-width: 760px) {
  .rule { grid-template-columns: 1fr; }
  .rule-note { padding-left: 0; }
}

/* ── issues ───────────────────────────────────────────── */
.issue { display: grid; grid-template-columns: 70px 1fr 60px; gap: 10px;
         padding: 8px 0; border-bottom: 1px solid var(--border); align-items: start; }
.issue:last-child { border-bottom: 0; }
.issue .samples { font-size: 11px; color: var(--muted); font-family: var(--mono);
                  margin-top: 3px; }
.issue .count { text-align: right; font-variant-numeric: tabular-nums;
                color: var(--muted); font-size: 12px; }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
                gap: 8px; margin-top: 10px; }
.stat { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
        background: var(--bg); }
.stat .n { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase;
           letter-spacing: .03em; }
.stat.err .n { color: var(--err); }
.stat.warn .n { color: var(--warn); }
.stat.ok .n { color: var(--ok); }

.bar { height: 6px; border-radius: 3px; background: var(--border);
       overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--brand); }

/* ── toast + modal ────────────────────────────────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface); padding: 10px 18px;
  border-radius: 8px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  max-width: 80vw;
}
.modal { position: fixed; inset: 0; background: rgba(10,13,20,.55);
         display: grid; place-items: center; z-index: 70; padding: 24px; }
.modal-box { background: var(--surface); border-radius: var(--radius);
             padding: 18px; max-width: 820px; width: 100%; max-height: 80vh;
             display: flex; flex-direction: column; }
.modal-box h3 { margin: 0; text-transform: none; letter-spacing: 0;
                color: var(--text); font-size: 15px; }
.modal-box pre { overflow: auto; background: var(--bg); padding: 12px;
                 border-radius: 8px; font-family: var(--mono); font-size: 12px;
                 margin: 12px 0 0; }

.spinner { display: inline-block; width: 13px; height: 13px; margin-right: 7px;
           border: 2px solid currentColor; border-right-color: transparent;
           border-radius: 50%; animation: spin .7s linear infinite;
           vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.subblock { border-left: 2px solid var(--border); padding-left: 12px;
            margin: 12px 0 14px; }
.subblock h3 { margin: 0 0 6px; }

.rule-hint { color: var(--err); }

.picker { display: flex; align-items: center; gap: 6px; margin: 0; }
.picker select { width: auto; margin: 0; padding: 3px 6px; font-size: 12px; }

/* ── academy ──────────────────────────────────────────── */
.crumbs { font-size: 13px; margin-bottom: 10px; }
.crumbs a { color: var(--brand); text-decoration: none; font-weight: 600; }
.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); transition: width .2s; }
.chapter { max-width: 880px; }
.chapter h2 { font-size: 20px; margin: 26px 0 8px; }
.chapter h3 { margin-top: 20px; }
.chapter p, .chapter li { font-size: 15px; }
.chapter ul, .chapter ol { padding-left: 20px; }
.chapter li { margin-bottom: 6px; }
.eli5 { background: var(--ok-soft); border-left: 4px solid var(--ok); border-radius: 12px;
        padding: 14px 18px; margin: 14px 0; }
.eli5 b { color: var(--ok); }
.eli5 p { margin: 4px 0 0; }
.warnbox { background: var(--warn-soft); border-left: 4px solid var(--warn);
           border-radius: 12px; padding: 14px 18px; margin: 14px 0; }
.warnbox b { color: var(--warn); }
.warnbox p { margin: 4px 0 0; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.compare .card { margin: 0; }
.compare h3 { margin-top: 0; }
.timeline { list-style: none; padding: 0 !important; margin: 14px 0; }
.timeline li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px;
               align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .n { display: grid; place-items: center; width: 30px; height: 30px;
               border-radius: 50%; background: var(--brand-soft); color: var(--brand);
               font-weight: 700; font-size: 13px; }
.timeline .n.tool { background: var(--ok); color: #fff; }
.timeline small { color: var(--muted); display: block; }
.checklist { list-style: none; padding: 0 !important; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; margin: 0;
                   padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
                   margin-bottom: 6px; font-size: 14px; font-weight: 500;
                   color: var(--text); cursor: pointer; background: var(--surface); }
.checklist input { margin-top: 3px; }
.checklist label:has(input:checked) { background: var(--ok-soft); text-decoration: line-through;
                                      color: var(--muted); }
.chapter-nav { display: flex; justify-content: space-between; margin-top: 30px; gap: 10px; }
.tile.is-done { border-color: var(--ok); }
.tile .done-mark { color: var(--ok); font-weight: 700; font-size: 12px; }

/* ── fixing problems ─────────────────────────────────── */
.fixbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
          background: var(--ok-soft); border: 1px solid var(--ok); border-radius: 12px;
          padding: 12px 16px; margin-bottom: 14px; }
.fixbar .grow { flex: 1; }
.fixpanel { background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
            padding: 12px; margin: 8px 0 4px; }
.fixrow { display: grid; grid-template-columns: minmax(120px, 1.2fr) 70px minmax(110px, 1fr)
          minmax(150px, 1.4fr) 1.4fr; gap: 8px; align-items: center; padding: 5px 0;
          border-bottom: 1px dashed var(--border); font-size: 12px; }
.fixrow:last-child { border-bottom: 0; }
.fixrow select, .fixrow input[type=text] { margin: 0; padding: 4px 7px; font-size: 12px; }
.fixrow.is-pending input[type=text] { outline: 2px solid var(--ok); }
.fixrow .was { color: var(--muted); font-family: var(--mono); overflow: hidden;
               text-overflow: ellipsis; white-space: nowrap; }
.fixhead { font-weight: 700; color: var(--muted); font-size: 11px;
           text-transform: uppercase; letter-spacing: .04em; }
.fixtools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.fixtools input[type=text] { margin: 0; width: 200px; padding: 5px 8px; }
.issue .count { text-align: right; }
.issue .actions { grid-column: 2 / -1; }
@media (max-width: 760px) { .fixrow { grid-template-columns: 1fr 1fr; } .compare { grid-template-columns: 1fr; } }

/* ── projects ────────────────────────────────────────── */
.project-chip { display: block; width: 100%; text-align: left; margin-bottom: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
  color: var(--text); }
.project-chip:hover { border-color: var(--brand); }
.project-chip small { display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }
.project-chip b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backend-info { margin: 8px 2px 0; font-size: 11px; color: var(--muted); text-align: center; }
.small-box { max-width: 460px; }
.small-box h3 { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 17px; margin: 0 0 6px; }
.pm-item { padding: 5px 0; border-bottom: 1px solid var(--border); align-items: center; }
textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit;
  border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text);
  font-weight: 400; resize: vertical; }
input[type=number] { display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text);
  font: inherit; font-weight: 400; }

/* ── demo data studio ───────────────────────────────── */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.studio-card { margin-bottom: 14px; }
.studio-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.studio-head .tile-ico { width: 38px; height: 38px; font-size: 16px; flex: none; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.field-grid .wide, .field-grid > .rule-box { grid-column: 1 / -1; }
.field-hint { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 1px; }
.rule-box { background: var(--brand-soft); border-radius: 10px; padding: 10px 14px; margin: 4px 0 0; font-size: 13px; }
.check.is-off { color: var(--muted); }
/* The side column spans the whole form, so the card can travel down with the page
   and stops where the form (and the grid) ends, right above the result. */
.studio-side { align-self: stretch; }
#studio-summary { position: sticky; top: 20px; }   /* its parent is the full-height column */
.studio-side .sticky { max-height: calc(100vh - 40px); overflow-y: auto; }
.sum-list > div { display: flex; justify-content: space-between; padding: 5px 0;
  border-bottom: 1px dashed var(--border); font-size: 13px; }
.sum-list span { color: var(--muted); }
button.big { width: 100%; padding: 12px; font-size: 15px; }
@media (max-width: 1100px) { .studio { grid-template-columns: 1fr; }
  #studio-summary { position: static; } }
@media (max-width: 640px) { .field-grid { grid-template-columns: 1fr; } }

/* ── rules editor ───────────────────────────────────── */
.rules-bar { margin-bottom: 8px; align-items: flex-end; }
.rules-bar .grow { flex: 1; min-width: 220px; margin: 0; }
details.rule-group > summary .muted { margin-left: 6px; }
details.rule-group.is-off > summary .sum-title { color: var(--muted); text-decoration: line-through; }
details.rule-group.is-off .body { opacity: .5; }
.lane-grid input { width: 70px; padding: 4px 6px; margin: 0; font-size: 12px; }
.lane-grid th, .lane-grid td { white-space: nowrap; }
label.mini { font-size: 11px; display: block; margin: 0 8px 0 0; }
label.mini input { width: 70px; }
.group-row { margin-bottom: 6px; }
.group-row input[type=text] { width: 190px; margin: 0; }

.help { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  margin-left: 6px; border-radius: 50%; background: var(--border); color: var(--muted);
  font-size: 11px; font-weight: 700; cursor: help; vertical-align: middle; }
.help:hover, .help:focus { background: #7c3aed; color: #fff; outline: none; }
.help-pop { display: none; position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 8px); transform: translateX(-30%);
  width: 280px; padding: 10px 12px; border-radius: 8px; background: #1f2937; color: #fff; font-size: 12px; font-weight: 400;
  line-height: 1.45; text-align: left; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.help:hover .help-pop, .help:focus .help-pop { display: block; }

/* ── "AI is thinking" orb ─────────────────────────────── */
.thinking { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.thinking canvas { flex: none; }
.thinking-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.thinking-text b { font-size: 15px; }
.thinking-step { color: var(--muted, #5b6472); font-size: 13px; animation: thinking-fade .5s ease; }
.thinking.is-compact { padding: 0; border: 0; background: none; gap: 10px; }
.thinking.is-compact .thinking-text b { font-size: 13px; }
@keyframes thinking-fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

.briefing [data-beam] { border-radius: 10px; }
.briefing [data-beam] textarea { display: block; border-radius: 10px; }
.briefing [data-beam] { margin-top: 4px; }
.briefing [data-beam] textarea { margin-top: 0; }
.briefing [data-beam] textarea:focus { outline: none; }  /* the beam is the focus indicator */

/* line icons (icons.js) */
.svg-ico, [data-icon] { display: inline-grid; place-items: center; line-height: 0; }
.menu-item .ico svg { width: 20px; height: 20px; }
.tile-ico svg, .tile-ico .svg-ico svg { width: 22px; height: 22px; }
.studio-head .tile-ico svg { width: 18px; height: 18px; }
.dz-ico { display: block; color: var(--muted); }
.dz-ico svg { width: 36px; height: 36px; }

/* AI assistance in the importer */
.ai-switch { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 12px 0 0; padding: 10px 14px; }
.ai-switch.is-off { opacity: .7; }
.fixrow.is-ai input[type=text] { border-color: #7c3aed; background: var(--brand-soft); }
.ai-fixnote { margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; background: var(--brand-soft); font-size: 13px; }
.ai-explain ol { margin: 8px 0 0; padding-left: 20px; }
.ai-explain li { margin: 4px 0; }
/* The library's light theme is very quiet; a white card wants a bit more. */
.briefing [data-beam="light"] { --beam-stroke-opacity: 3; --beam-inner-opacity: 1.8; --beam-bloom-opacity: 1.6; }

/* theme toggle */
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.brand-row .brand { flex: 1; min-width: 0; }
.theme-toggle { flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.theme-toggle svg { display: block; }

/* ── administration ───────────────────────────────────── */
.admin-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px; align-items: end; }
.admin-form label.check { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
.admin-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.admin-actions input { max-width: 190px; }
.pill-warn { background: var(--brand-soft); color: var(--brand); }

/* ── voice input ──────────────────────────────────────── */
.voice { display: inline-flex; align-items: center; gap: 6px; background: var(--surface);
         border: 1px solid var(--border); color: var(--text); }
.voice:hover:not(:disabled) { border-color: var(--brand); }
.voice.is-recording { border-color: var(--err); color: var(--err); animation: voice-pulse 1.4s ease-in-out infinite; }
.voice-time { font-family: var(--mono); font-size: 12px; }
@keyframes voice-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--err) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .voice.is-recording { animation: none; } }
