/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:    #1798d3;
  --brand-dk: #1277aa;
  --bg:       #f5f7f9;
  --surface:  #ffffff;
  --border:   #dde1e7;
  --text:     #1a2533;
  --muted:    #6b7a8d;
  --success:  #2bae62;
  --error:    #c0157b;
  --font:     'Segoe UI', system-ui, sans-serif;
  --radius:   6px;
}

.hidden { display: none !important; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Top nav ──────────────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--brand);
  color: #fff;
  padding: 0 16px;
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.nav-brand {
  font-weight: 700;
  font-size: 15px;
  margin-right: 24px;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-links a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: 0 14px;
  height: 48px;
  display: flex;
  align-items: center;
  font-size: 13px;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
}

.nav-links a:hover  { color: #fff; }
.nav-links a.active { color: #fff; border-bottom-color: #fff; font-weight: 600; }

.nav-logout {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius);
}
.nav-logout:hover { color: #fff; background: rgba(255,255,255,.15); }

/* ── Content area ─────────────────────────────────────────────── */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ── Page header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  font-weight: 500;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}

.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary  { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dk); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); }

.btn-ghost { background: transparent; color: var(--brand); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: rgba(23,152,211,.08); }

/* ── Status bar ───────────────────────────────────────────────── */
.status-bar {
  padding: 8px 14px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 13px;
}
.status-bar.hidden     { display: none; }
.status-info           { background: #e8f4fb; color: var(--brand-dk); }
.status-success        { background: #e6f7ee; color: #1a7a45; }
.status-error          { background: #fce8f3; color: var(--error); }

/* ── TT table ─────────────────────────────────────────────────── */
.tt-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tt-table {
  width: 100%;
  border-collapse: collapse;
}

.tt-table th {
  background: #f0f4f8;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.tt-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}

.tt-table tbody tr:last-child td { border-bottom: none; }

.tt-table tbody tr:hover { background: #f8fafc; }

.col-check { width: 36px; }

.pupil-name { font-weight: 500; }

.tt-badge {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.cell-input {
  width: 72px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--font);
  text-align: center;
}
.cell-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(23,152,211,.2);
}

.score-cell { font-weight: 600; color: var(--muted); }

.tt-save-row {
  display: flex;
  justify-content: flex-end;
  padding: 12px 0;
}

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state p { margin-bottom: 8px; }
.empty-state code {
  font-size: 12px;
  background: #f0f4f8;
  padding: 2px 6px;
  border-radius: 3px;
}
.hint { font-size: 12px; }

/* ── Login ────────────────────────────────────────────────────── */
.login-body {
  background: var(--brand);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

.login-logo { font-size: 40px; margin-bottom: 12px; }

.login-card h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.login-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.login-error {
  background: #fce8f3;
  color: var(--error);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  margin-bottom: 12px;
}
.login-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(23,152,211,.2);
}

.login-btn {
  width: 100%;
  padding: 10px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.login-btn:hover { background: var(--brand-dk); }

/* ── Alert ────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-error   { background: #fce8f3; color: var(--error); }
.alert-success { background: #e6f7ee; color: #1a7a45; }
.alert-info    { background: #e8f4fb; color: var(--brand-dk); }

/* ── TT badge variants ──────────────────────────────────────────────── */
.tt-badge--x  { background: var(--brand); }
.tt-badge--xd { background: #c0157b; }   /* pink = multiply + divide stage */

.next-label { color: var(--muted); font-size: 13px; }

/* ── TT table: compact columns ──────────────────────────────────────── */
.tt-table-wrap { max-width: 560px; }

.tt-table .col-check { width: 36px; }
.tt-table th:nth-child(2),
.tt-table td:nth-child(2) { width: 180px; }   /* name */
.tt-table th:nth-child(3),
.tt-table td:nth-child(3) { width: 90px; }    /* stage */
.tt-table th:nth-child(4),
.tt-table td:nth-child(4) { width: 90px; }    /* next */

/* ── Stat cards ──────────────────────────────────────────────────────── */
.stat-row { display:flex; gap:12px; margin-bottom:20px; flex-wrap:wrap; }
.stat-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px 20px; flex:1; min-width:100px; text-align:center; }
.stat-num  { font-size:28px; font-weight:800; color:var(--brand); }
.stat-lbl  { font-size:12px; color:var(--muted); margin-top:2px; }

/* ── Sections ────────────────────────────────────────────────────────── */
.section-block  { margin-bottom:24px; }
.section-title  { font-size:15px; font-weight:700; margin-bottom:4px; }
.section-caption{ font-size:12px; color:var(--muted); margin-bottom:8px; }
.chart-wrap     { background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:16px; height:200px; }

/* ── Progress bars in mastery table ─────────────────────────────────── */
.num-col  { text-align:right; min-width:70px; }
.prog-cell{ position:relative; height:22px; background:#f0f4f8; border-radius:3px;
  overflow:hidden; min-width:60px; display:flex; align-items:center; }
.prog-fill{ position:absolute; left:0; top:0; bottom:0; background:var(--brand); opacity:.25; }
.prog-fill--phase { position:absolute; left:0; top:0; bottom:0; width:inherit; background:#c0157b; opacity:.25; }
.prog-fill--ks    { position:absolute; left:0; top:0; bottom:0; background:#2bae62; opacity:.25; }
.prog-cell span   { position:relative; z-index:1; font-size:12px; font-weight:600;
  color:var(--text); padding:0 6px; }

/* ── Group pills ─────────────────────────────────────────────────────── */
.group-pill { font-size:11px; font-weight:600; padding:2px 8px; border-radius:99px; }
.group-main     { background:#e8f4fb; color:var(--brand-dk); }
.group-revision { background:#fef3cd; color:#7a4f00; }

/* ── Spelling Bee ────────────────────────────────────────────────────── */
.bee-meta { display:flex; gap:16px; font-size:13px; color:var(--muted);
  margin-bottom:12px; flex-wrap:wrap; align-items:center; }
.bee-meta strong, .bee-meta em { color:var(--text); }
.bee-hint { margin-left:auto; font-style:italic; }

.bee-list { display:flex; flex-direction:column; gap:1px;
  background:var(--border); border-radius:var(--radius); overflow:hidden; max-width:860px; }

.bee-row { display:grid; grid-template-columns:130px 1fr 140px;
  gap:0; align-items:center; background:var(--surface);
  border-left:4px solid var(--brand); min-height:44px; }
.bee-row--rev { border-left-color:#c0157b; }

.bee-name { padding:6px 10px; font-weight:600; font-size:13px;
  display:flex; flex-direction:column; gap:2px; }
.rev-badge { font-size:10px; font-weight:700; color:#c0157b; }

.bee-words { padding:6px 8px; display:flex; flex-wrap:wrap; gap:5px; }

.word-pill { padding:5px 10px; border-radius:99px; border:1px solid #cbd5e1;
  background:#f8fafc; font-size:13px; font-weight:500; cursor:pointer;
  transition:background .12s, color .12s, border-color .12s;
  touch-action:manipulation; }
.word-pill--on { background:#059669; border-color:#059669; color:#fff; font-weight:700; }
.word-pill:hover:not(.word-pill--on) { background:#e8f4fb; border-color:var(--brand); }
.no-words { font-size:12px; color:var(--muted); font-style:italic; }

.bee-rule { padding:6px 10px; }
.conf-label { display:flex; align-items:center; gap:6px; font-size:12px;
  color:var(--muted); cursor:pointer; white-space:nowrap; }
.conf-check { width:14px; height:14px; cursor:pointer; }

.bee-save-row { display:flex; align-items:center; gap:12px; padding:14px 0; }
.save-hint { font-size:13px; color:var(--muted); }
.prog-fill--all { position:absolute; left:0; top:0; bottom:0; width:inherit; background:#e57d24; opacity:.25; }
.nav-sep { color: var(--border); margin: 0 2px; }

/* ── Nav dropdown ────────────────────────────────────────────────────── */
.nav-dropdown { position:relative; }
.nav-dropdown-toggle { cursor:pointer; user-select:none; }
.dropdown-menu {
  display:none; position:absolute; top:100%; left:0;
  background:#fff; border:1px solid var(--border); border-radius:var(--radius);
  min-width:180px; box-shadow:0 4px 16px rgba(0,0,0,.12); z-index:200; overflow:hidden;
}
.dropdown-menu a {
  display:block; padding:10px 14px; font-size:13px; color:var(--text);
  text-decoration:none; border-bottom:1px solid #f0f2f5;
}
.dropdown-menu a:last-child { border-bottom:none; }
.dropdown-menu a:hover, .dropdown-menu a.active { background:#f0f8ff; color:var(--brand); }
.nav-dropdown:hover .dropdown-menu { display:block; }
.nav-dropdown.active > .nav-dropdown-toggle { color:#fff; border-bottom:3px solid #fff; }

/* ── Nav items (match existing pattern) ─────────────────────────────── */
.nav-item {
  color:rgba(255,255,255,.85); text-decoration:none; padding:0 12px;
  height:48px; display:flex; align-items:center; font-size:13px;
  border-bottom:3px solid transparent; transition:color .15s,border-color .15s;
  white-space:nowrap;
}
.nav-item:hover, .nav-item.active { color:#fff; border-bottom-color:#fff; }
.nav-item.active { font-weight:600; }

/* ── Class selector dropdown ─────────────────────────────────────────── */
.cls-select {
  padding:6px 10px; border:1px solid var(--border); border-radius:var(--radius);
  font-size:13px; font-family:var(--font); background:var(--surface);
  color:var(--text); cursor:pointer;
}
.cls-select:focus { outline:none; border-color:var(--brand); }

/* ── Stub pages ──────────────────────────────────────────────────────── */
.stub-card {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:32px; max-width:560px;
}
.stub-desc   { font-size:14px; color:var(--text); margin-bottom:16px; line-height:1.6; }
.stub-badge  { display:inline-block; background:#fef9e7; border:1px solid #f0c040;
  color:#856400; border-radius:99px; padding:4px 12px; font-size:12px;
  font-weight:600; margin-bottom:16px; }
.stub-coming { font-size:13px; color:var(--muted); }

/* ── Home Learning ───────────────────────────────────────────────────── */
.hl-meta { display:flex; gap:16px; font-size:13px; color:var(--muted); margin-bottom:16px; flex-wrap:wrap; }
.hl-meta strong, .hl-meta em { color:var(--text); }

.hl-form-wrap { background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:24px; max-width:700px; display:flex;
  flex-direction:column; gap:16px; }

.hl-field { display:flex; flex-direction:column; gap:4px; }
.hl-label { font-size:13px; font-weight:600; color:var(--text); }
.req  { color:var(--error); }
.opt  { font-weight:400; color:var(--muted); }
.hl-input { padding:9px 12px; border:1px solid var(--border); border-radius:var(--radius);
  font-size:14px; font-family:var(--font); width:100%; }
.hl-input:focus { outline:none; border-color:var(--brand); box-shadow:0 0 0 2px rgba(23,152,211,.2); }
.hl-textarea { resize:vertical; min-height:72px; }
.hl-hint { font-size:12px; color:var(--muted); margin:0; }

.hl-generate-row { display:flex; align-items:center; gap:16px; padding-top:4px; }
.btn-lg { padding:11px 20px; font-size:14px; }

.hl-progress { display:flex; align-items:center; gap:10px; font-size:13px; color:var(--muted); }
.hl-spinner { width:18px; height:18px; border:2px solid var(--border);
  border-top-color:var(--brand); border-radius:50%; animation:spin .8s linear infinite; flex-shrink:0; }
@keyframes spin { to { transform:rotate(360deg); } }

.hl-results { margin-top:20px; background:var(--surface); border:1px solid var(--border);
  border-left:4px solid var(--success); border-radius:var(--radius); padding:20px; max-width:700px; }
.hl-downloads { display:flex; gap:10px; margin:12px 0 10px; flex-wrap:wrap; }
.hl-results-meta { font-size:12px; color:var(--muted); margin:0; }

/* ── Bee filter bar ──────────────────────────────────────────────────── */
.bee-filters    { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.filter-group   { display:flex; align-items:center; gap:6px; }
.filter-label   { font-size:12px; color:rgba(255,255,255,.7); font-weight:500;
                  white-space:nowrap; padding-right:2px; }
.filter-sep     { width:1px; height:24px; background:rgba(255,255,255,.3); margin:0 4px; }

/* ── Settings ─────────────────────────────────────────────────────────── */
.settings-wrap    { max-width:600px; display:flex; flex-direction:column; gap:20px; }
.settings-section { background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:20px; }
.settings-heading { font-size:14px; font-weight:700; margin-bottom:14px;
  color:var(--text); border-bottom:1px solid var(--border); padding-bottom:8px; }
.settings-row     { display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.settings-row:last-child { margin-bottom:0; }
.settings-label   { font-size:13px; color:var(--muted); min-width:130px; }
.settings-save-row{ padding:4px 0; }

.nav-version { font-size:10px; font-weight:400; opacity:.6; margin-left:4px; }

/* ── Rules page ─────────────────────────────────────────────────── */

.rules-page { max-width: 1200px; margin: 0 auto; padding: 20px 16px; }

.rules-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 12px;
}
.rules-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rules-search {
  width: 220px; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; outline: none;
}
.rules-search:focus { border-color: var(--brand); }

/* Confidence legend */
.confidence-legend {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 14px;
  margin-bottom: 16px; font-size: 12px;
}
.legend-label { font-weight: 600; color: var(--text); margin-right: 4px; }
.legend-hint  { color: var(--muted); margin-left: 4px; }

/* Stage sections */
.stage-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
}
.stage-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; cursor: pointer; user-select: none;
  background: var(--surface); transition: background .15s;
}
.stage-header:hover { background: #f0f5fa; }
.stage-title  { font-weight: 600; font-size: 14px; flex: 1; }
.stage-count  { font-size: 12px; color: var(--muted); }
.stage-chevron { font-size: 12px; color: var(--muted); width: 14px; }
.stage-body   { padding: 12px 16px 16px; }

/* Rule grid */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

/* Rule cards */
.rule-card, .custom-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  transition: box-shadow .15s;
}
.rule-card:hover, .custom-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,.1); }

.rule-card-header {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.rule-ref {
  font-size: 10px; font-weight: 700; color: #fff;
  background: var(--brand); border-radius: 3px;
  padding: 1px 5px; white-space: nowrap; flex-shrink: 0;
}
.custom-ref { background: #7c5cbf; }
.rule-title-text {
  font-size: 12px; font-weight: 600; color: var(--text);
  flex: 1; line-height: 1.3;
}
.rule-type-badge {
  display: inline-block; font-size: 10px; background: #e8f0fe;
  color: #1a73e8; border-radius: 3px; padding: 1px 5px;
  margin-bottom: 5px;
}

/* Confidence dots */
.conf-dots {
  font-size: 11px; cursor: pointer; padding: 2px 4px;
  border-radius: 3px; flex-shrink: 0; white-space: nowrap;
  transition: background .15s;
}
.conf-dots:hover { background: rgba(0,0,0,.06); }
.conf-0 { color: #aaa; }
.conf-1 { color: #e53e3e; }
.conf-2 { color: #d97706; }
.conf-3 { color: #2bae62; }
.conf-badge { font-size: 11px; padding: 2px 6px; border-radius: 3px; }
.conf-badge.conf-0 { color:#888; background:#f0f0f0; }
.conf-badge.conf-1 { color:#c53030; background:#fff5f5; }
.conf-badge.conf-2 { color:#b7791f; background:#fffbeb; }
.conf-badge.conf-3 { color:#276749; background:#f0fff4; }

/* Word pills (rules tab — smaller than bee pills) */
.rule-words { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rule-word-pill {
  font-size: 11px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 1px 7px; color: var(--text);
}

/* Custom card actions */
.custom-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 13px; padding: 2px 5px; border-radius: 3px;
  color: var(--muted); transition: background .15s, color .15s;
}
.btn-icon:hover { background: #e8f0fe; color: var(--brand); }
.btn-icon-del:hover { background: #fff5f5; color: var(--error); }

/* Rule explanation */
.rule-explanation {
  font-size: 11px; color: var(--muted); margin-bottom: 5px;
  line-height: 1.4;
}

.empty-msg { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}
.modal-box {
  background: var(--surface); border-radius: 8px;
  width: 480px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; }
.modal-close {
  background: none; border: none; font-size: 18px;
  cursor: pointer; color: var(--muted); line-height: 1;
}
.modal-body { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border);
}
.form-label { font-size: 12px; font-weight: 600; color: var(--text); }
.label-hint { font-weight: 400; color: var(--muted); }
.required    { color: var(--error); }
.form-input  { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; font-family: var(--font); }
.form-input:focus { outline: none; border-color: var(--brand); }
.form-textarea { resize: vertical; min-height: 72px; }
.words-row { display: flex; gap: 8px; align-items: center; }
.words-row .form-input { flex: 1; }
.btn-sm { padding: 7px 12px; font-size: 12px; white-space: nowrap; }
.suggest-status { font-size: 12px; color: var(--muted); }
.suggest-status.suggest-ok { color: var(--success); }
.modal-error { font-size: 12px; color: var(--error); }

/* ── Rule card collapsible detail ──────────────────────────────── */
.rule-card-header { cursor: pointer; }
.rule-card-right  { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.rule-chevron     { font-size: 10px; color: var(--muted); flex-shrink: 0; transition: transform .15s; }
.rule-detail      { margin-top: 6px; }
.rule-detail.hidden { display: none; }

/* ── Custom badge compact (✏ icon only, same size as S1·1) ─────── */
.custom-ref { font-size: 13px; padding: 1px 6px; min-width: 0; }

/* Rule card header: title takes remaining space, right side shrinks */
.rule-card-header { flex-wrap: nowrap; min-width: 0; }
.rule-title-text  { min-width: 0; overflow: hidden; }
.custom-actions   { flex-shrink: 0; }

/* Explanation text: muted, shown when loaded */
.rule-expl-text:empty { display: none; }

/* ── TT badge colours — all WFA brand blue ─────────────────────── */
.tt-badge { color: #fff; font-weight: 700; background: #1798d3; }

/* ── Print tab ─────────────────────────────────────────────────── */
.print-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.print-card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.print-card-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}
.print-card-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.print-card-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.print-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.print-variant-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.print-variant-select {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  background: #fff;
}
.print-spinner {
  font-size: 13px;
  color: var(--muted);
}
.print-spinner::after {
  content: '⏳ Generating…';
}

/* ── Print tab — word options collapsible ───────────────────────── */
.print-word-options {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.print-word-options summary {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  background: var(--bg);
  list-style: none;
}
.print-word-options summary::-webkit-details-marker { display: none; }
.print-word-options[open] summary {
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.print-word-options-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.print-opt {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}
.print-textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  resize: vertical;
  box-sizing: border-box;
}
.print-textarea:focus {
  outline: none;
  border-color: var(--brand);
}

/* ── Word Assessment ────────────────────────────────────────────── */
.wa-sections {
  display: flex; gap: 16px; margin: 10px 0 4px;
  flex-wrap: wrap;
}
.wa-check {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer;
}
.wa-check input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--brand); }
.wa-upload-row {
  display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; flex-wrap: wrap;
}
.wa-file-input {
  font-size: 13px; padding: 6px; border: 1px solid var(--border);
  border-radius: var(--radius); font-family: var(--font); flex: 1; min-width: 0;
}
.wa-results-title {
  font-size: 14px; font-weight: 700; margin: 14px 0 8px; color: var(--text);
}
.wa-results-table {
  width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 4px;
}
.wa-results-table th {
  background: var(--brand); color: #fff; font-weight: 600;
  padding: 6px 10px; text-align: left; border: 1px solid var(--border);
}
.wa-results-table td {
  padding: 5px 10px; border: 1px solid var(--border);
}
.wa-results-table tbody tr:nth-child(even) td { background: var(--surface); }
.wa-flagged {
  font-size: 12px; color: var(--warning, #b45309); margin-top: 8px;
  padding: 6px 10px; background: #fffbeb; border-radius: var(--radius);
  border: 1px solid #fcd34d;
}
.status-ok { background: #f0fdf4; color: #166534; border: 1px solid #86efac; border-radius: var(--radius); padding: 8px 12px; }
.status-error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; border-radius: var(--radius); padding: 8px 12px; }
