/* ============================================================
   Grammar Practice — styles
   Light theme, system font, centered ~1100px layout.
   ============================================================ */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1c2733;
  --text-soft: #5b6b7b;
  --text-faint: #8a97a5;
  --border: #dfe5ec;
  --primary: #2f6fed;
  --primary-dark: #1d54c4;
  --primary-soft: #e8f0fe;
  --danger: #d64545;
  --danger-soft: #fbeaea;
  --warning: #b7791f;
  --warning-soft: #fdf3e0;
  --success: #2e9e5b;
  --success-soft: #e6f6ec;
  --purple: #7c5cd6;
  --purple-soft: #f0ebfc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
  --max-w: 1100px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- layout shell ---------- */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

main.container { flex: 1; padding-top: 22px; padding-bottom: 48px; }

/* ---------- header ---------- */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header .container {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  flex-wrap: wrap;
  padding-top: 6px;
  padding-bottom: 6px;
}

.app-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.app-title .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
}

.header-crumb {
  color: var(--text-faint);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.header-spacer { flex: 1; }

.header-user {
  color: var(--text-soft);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { background: #f0f3f7; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-danger { color: var(--danger); border-color: #ecc9c9; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: #eef1f5; color: var(--text); }

.btn-sm { font-size: 13px; padding: 4px 10px; border-radius: 7px; }

.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn-grade {
  flex: 1 1 130px;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 12px;
  border-width: 1.5px;
}

.btn-grade-impossible { background: var(--danger-soft); border-color: #e4a1a1; color: var(--danger); }
.btn-grade-impossible:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-grade-hard { background: var(--warning-soft); border-color: #e5c68f; color: var(--warning); }
.btn-grade-hard:hover { background: var(--warning); border-color: var(--warning); color: #fff; }

.btn-grade-easy { background: var(--success-soft); border-color: #a8d9bd; color: var(--success); }
.btn-grade-easy:hover { background: var(--success); border-color: var(--success); color: #fff; }

.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-soft); }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  width: 100%;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

input[type="file"] { font-size: 13px; color: var(--text-soft); max-width: 100%; }

/* ---------- banner / toast ---------- */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--danger-soft);
  border: 1px solid #e8b7b7;
  color: #8f2f2f;
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  word-break: break-word;
}

.banner .banner-close {
  margin-left: auto;
  border: none;
  background: none;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.banner-info { background: var(--primary-soft); border-color: #bcd4fb; color: #1c4bb5; }
.banner-success { background: var(--success-soft); border-color: #a8d9bd; color: #1e6b3c; }

.toast-wrap {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 40px);
}

.toast {
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
  max-width: 100%;
  word-break: break-word;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- cards & panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.page-subtitle { color: var(--text-soft); margin: 0 0 22px; font-size: 14px; }

/* ---------- login ---------- */
.login-wrap {
  max-width: 430px;
  margin: 8vh auto 0;
}

.login-logo {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 26px;
  box-shadow: var(--shadow-lg);
}

.login-logo h1 { font-size: 22px; margin: 12px 0 2px; }
.login-logo p { margin: 0; color: var(--text-soft); font-size: 14px; }

.login-card { padding: 22px; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin: 18px 0 14px;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.user-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.login-error { margin-top: 14px; }

/* ---------- deck list ---------- */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.deck-card {
  padding: 16px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s, border-color .15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.deck-card:hover { box-shadow: var(--shadow-lg); border-color: #c9d4e2; transform: translateY(-1px); }

.deck-card-top { display: flex; align-items: flex-start; gap: 10px; }

.deck-name {
  font-size: 16px;
  font-weight: 650;
  margin: 0;
  flex: 1;
  word-break: break-word;
}

.deck-langs {
  color: var(--text-soft);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.deck-langs .arrow { color: var(--text-faint); }

.deck-meta {
  display: flex;
  gap: 14px;
  color: var(--text-faint);
  font-size: 13px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: auto;
}

.deck-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.new-deck-card {
  margin-top: 22px;
  padding: 18px;
}

.new-deck-card h2 { font-size: 15px; margin: 0 0 14px; }

/* ---------- deck view / tabs ---------- */
.deck-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.deck-head h1 { font-size: 21px; margin: 0; word-break: break-word; }

.deck-head .sub { color: var(--text-soft); font-size: 14px; width: 100%; }

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin: 14px 0 20px;
  overflow-x: auto;
}

.tab-btn {
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

/* ---------- practice ---------- */
.practice-card { padding: 22px; }

.practice-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px 4px 6px;
  font-size: 13px;
  font-weight: 500;
  max-width: 100%;
}

.item-chip .chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.kind-topic { background: var(--primary-soft); color: var(--primary-dark); }
.kind-template { background: var(--purple-soft); color: var(--purple); }

.direction-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0f3f7;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}

.direction-pill .arrow { color: var(--primary); }

.practice-toolbar .spacer { flex: 1; }

/* exercise text */
.exercise-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ex-line { display: flex; gap: 12px; align-items: baseline; }

.ex-speaker {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  margin-top: 3px;
}

.ex-text {
  font-size: 19px;
  line-height: 1.85;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: pre-wrap;
}

/* reference (revealed) translation */
.ex-ref {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 18px;
  padding: 14px 16px;
  background: var(--success-soft);
  border: 1px solid #bfe3cd;
  border-radius: var(--radius);
}

.ref-line { display: flex; gap: 12px; align-items: baseline; }

.ref-line .ex-speaker { background: #d8eede; color: #1e6b3c; }

.ref-text {
  font-size: 17px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: pre-wrap;
}

.ref-label {
  font-size: 12px;
  font-weight: 700;
  color: #1e6b3c;
  text-transform: uppercase;
  letter-spacing: .7px;
}

/* answer + actions */
.practice-answer { margin-top: 16px; }

.practice-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
}

.grade-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.grade-label {
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 2px;
}

/* loading / empty states */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 52px 20px;
  color: var(--text-soft);
  font-size: 15px;
  text-align: center;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-soft);
}

.empty .empty-icon { font-size: 30px; margin-bottom: 8px; }

.weight-flash {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
}

/* ---------- hints ---------- */
.hint {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.hint-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 11px 14px;
  cursor: pointer;
  text-align: left;
}

.hint-summary:hover { background: #f6f8fa; }

.hint-summary .chev { transition: transform .15s; color: var(--text-faint); font-size: 12px; }
.hint.open .hint-summary .chev { transform: rotate(90deg); }

.hint-summary .hint-tag {
  font-weight: 400;
  color: var(--text-faint);
  font-size: 12px;
  margin-left: auto;
  padding-left: 8px;
}

.hint-body { padding: 2px 14px 13px; }

/* Collapsed by default: the body is only shown when the hint is opened. */
.hint:not(.open) .hint-body { display: none; }

.hint-body:empty { display: none; }

.hint-vocab .hint-summary { color: var(--warning); }
.hint-vocab { border-color: #ecd9b4; background: #fffdf7; }
.hint-vocab .hint-body { background: #fffdf7; }

.vocab-hint-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }

.vocab-hint-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 14px;
  flex-wrap: wrap;
  line-height: 1.6;
}

.vocab-hint-item .vh-surface {
  font-weight: 650;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.vocab-hint-item .vh-lemma { color: var(--text-faint); font-size: 13px; }

.vocab-hint-item .vh-gloss {
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.vocab-hint-item .vh-dash { color: var(--text-faint); }

.grammar-hint-text {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

/* ---------- generic tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.list th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-faint);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.list td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

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

.td-title { font-weight: 600; }

.td-desc {
  color: var(--text-soft);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weight-input {
  width: 72px;
  text-align: right;
}

.share-badge {
  display: inline-block;
  min-width: 52px;
  text-align: center;
  background: #f0f3f7;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.stats-cell { color: var(--text-soft); font-size: 13px; white-space: nowrap; }

.stats-cell .never { color: var(--text-faint); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .grow { flex: 1; }

/* ---------- item form ---------- */
.item-form-card {
  padding: 18px;
  margin-bottom: 18px;
}

.item-form-card h2 { font-size: 16px; margin: 0 0 14px; }

.kind-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.kind-toggle button {
  border: none;
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 18px;
  cursor: pointer;
  color: var(--text-soft);
}

.kind-toggle button.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.kind-toggle button:disabled { opacity: .6; cursor: not-allowed; }
.kind-toggle button:disabled.active { opacity: 1; }

.example-lines { display: flex; flex-direction: column; gap: 10px; }

.example-line-row {
  display: grid;
  grid-template-columns: 26px 96px 1fr 1fr 34px;
  gap: 10px;
  align-items: start;
}

.example-line-row .btn-ghost { padding: 6px; font-size: 15px; }

.example-line-row .btn-remove:hover { color: var(--danger); }

.line-index {
  color: var(--text-faint);
  font-size: 13px;
  text-align: right;
  padding-top: 9px;
}

/* ---------- vocab tab ---------- */
.import-box {
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.import-box .import-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.import-box input[type="file"] { flex: 1; min-width: 220px; }

.import-summary {
  background: var(--primary-soft);
  border: 1px solid #bcd4fb;
  color: #1c4bb5;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
}

.import-summary ul { margin: 8px 0 0; padding-left: 20px; }
.import-summary li { margin: 2px 0; }

.candidates-card { padding: 16px; margin-bottom: 16px; }

.candidates-card h3 { font-size: 15px; margin: 0 0 4px; }

.candidates-card .cand-sub { color: var(--text-soft); font-size: 13px; margin: 0 0 12px; }

.candidate {
  display: flex;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.candidate:last-of-type { border-bottom: none; }

.candidate input[type="checkbox"] { margin-top: 4px; flex-shrink: 0; }

.cand-body { flex: 1; min-width: 0; }

.cand-lines { display: flex; flex-direction: column; gap: 5px; margin: 2px 0 4px; }

.cand-line { font-size: 14px; line-height: 1.6; }

.cand-line .pair {
  overflow-wrap: anywhere;
}

.cand-line .arrow { color: var(--text-faint); margin: 0 6px; }

.cand-tags { color: var(--text-faint); font-size: 12px; }

.tag-pill {
  display: inline-block;
  background: #f0f3f7;
  border-radius: 5px;
  padding: 1px 7px;
  margin-right: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

.vocab-search-row { display: flex; gap: 10px; margin-bottom: 12px; }

.vocab-search-row input { max-width: 320px; }

.vocab-count { color: var(--text-faint); font-size: 13px; align-self: center; }

.show-more-wrap { text-align: center; margin-top: 12px; }

/* ---------- settings ---------- */
.settings-card { padding: 20px; max-width: 560px; }

.settings-card h2 { font-size: 16px; margin: 0 0 16px; }

.danger-zone {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.danger-zone h3 { font-size: 14px; color: var(--danger); margin: 0 0 6px; }

.danger-zone p { color: var(--text-soft); font-size: 13px; margin: 0 0 12px; }

/* ---------- misc ---------- */
.muted { color: var(--text-faint); font-size: 13px; }

.empty-vocab-hint { color: var(--text-faint); font-style: italic; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  border: 0;
}

/* ---------- responsive ---------- */
@media (max-width: 800px) {
  .container { padding: 0 14px; }

  .example-line-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "speaker remove"
      "native native"
      "target target";
  }
  .example-line-row .line-index { display: none; }
  .example-line-row .ex-speaker-input { grid-area: speaker; }
  .example-line-row .btn-remove { grid-area: remove; justify-self: end; }
  .example-line-row .native-input { grid-area: native; }
  .example-line-row .target-input { grid-area: target; }

  .item-chip .chip-title { max-width: 170px; }
  .ex-text { font-size: 17px; }
  .header-crumb { display: none; }
  .td-desc { max-width: 160px; }

  table.list th:nth-child(n+5), table.list td:nth-child(n+5) { white-space: normal; }
}

/* Out-of-vocabulary word marking (inline translation hint) */
.oov {
  border-bottom: 2px dotted var(--danger, #c0392b);
  cursor: help;
  background: rgba(192, 57, 43, 0.07);
  border-radius: 3px;
  padding: 0 2px;
}

/* Bulk selection */
.btn-danger-ghost {
  color: var(--danger);
  border-color: #ecc9c9;
  background: transparent;
}
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.th-check, .td-check { width: 34px; text-align: center; }
.th-check input, .td-check input { cursor: pointer; accent-color: var(--primary); }

tr.row-selected > td { background: rgba(66, 139, 202, 0.07); }

/* Import tab: format documentation table + notes */
.import-docs {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.import-docs th, .import-docs td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.import-docs th { background: #f0f3f7; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-soft); }
.import-docs tr:last-child td { border-bottom: none; }
.import-docs code { background: #eef1f5; border-radius: 4px; padding: 0 4px; }

.import-notes { margin: 0; padding-left: 20px; color: var(--text-soft); font-size: 13px; }
.import-notes li { margin: 3px 0; }
.import-notes code { background: #eef1f5; border-radius: 4px; padding: 0 4px; }

/* Import tab: ordered field list inside the docs table */
.import-docs ol.field-list { margin: 4px 0; padding-left: 18px; }
.import-docs ol.field-list li { margin: 2px 0; }

/* Import review table: category badges + exists state */
.category-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px;
  padding: 2px 8px;
  white-space: nowrap;
}
.cat-vocab { background: #e3f2e8; color: #1c6b3f; }
.cat-topic { background: #e4ecfa; color: #1c4bb5; }
.cat-template { background: #f0e8f8; color: #6b3fa0; }

.exists-pill {
  display: inline-block;
  font-size: 12px;
  color: var(--text-soft);
  background: #f0f3f7;
  border-radius: 5px;
  padding: 2px 8px;
  white-space: nowrap;
}

.import-review .cand-lines { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.import-review .cand-tags { margin-top: 4px; }

.cands-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cands-head h3 { margin: 0; }
.check-all-label { font-size: 13px; color: var(--text-soft); display: inline-flex; gap: 6px; align-items: center; }

/* Frontend build marker (header) */
.version-pill {
  font-size: 11px;
  color: var(--text-faint);
  background: #f0f3f7;
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* Hidden/blurry practice title until reveal */
.item-chip.chip-hidden .chip-title {
  filter: blur(6px);
  user-select: none;
  pointer-events: none;
}

/* Large primary button (Generate exercise) */
.btn-lg { font-size: 16px; padding: 10px 22px; }

/* Vocab hint: out-of-vocab entries are highlighted */
.vocab-hint-item.vh-new .vh-surface { color: var(--danger); font-weight: 700; }

.vh-new-pill {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--danger);
  border-radius: 5px;
  padding: 1px 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* History tab */
.history-table .td-when { white-space: nowrap; font-size: 13px; }
.history-table .td-exercise { max-width: 340px; }
.hist-line {
  font-size: 13px;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.direction-pill-sm {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

.result-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  padding: 2px 9px;
  text-transform: capitalize;
  white-space: nowrap;
}
.res-easy { background: var(--success-soft); color: var(--success); }
.res-hard { background: var(--warning-soft); color: var(--warning); }
.res-impossible { background: var(--danger-soft); color: var(--danger); }
.res-skipped { background: #f0f3f7; color: var(--text-soft); }
.res-pending { background: var(--primary-soft); color: var(--primary-dark); }
