/* ═══════════════════════════════════════════════════════════════
   ATSSC Language Tools — Unified Design System  v2.0
   theme.css  —  shared across all tools
   ═══════════════════════════════════════════════════════════════ */

/* ─── Font ─── */
/* Uses installed system fonts; no external font request. */500;600;700;800&display=swap');

/* ─── Light-Mode Tokens ─── */
:root {
  /* Header gradient */
  --grad-header: linear-gradient(135deg, #0d1b5e 0%, #1a3fbf 52%, #4f72f7 100%);
  /* Action gradients */
  --grad-primary: linear-gradient(135deg, #1e40af 0%, #6366f1 100%);
  --grad-green:   linear-gradient(135deg, #065f46 0%, #059669 100%);
  --grad-bar:     linear-gradient(90deg,  #3b82f6 0%, #818cf8 100%);

  /* Surfaces */
  --bg:       #eef2fb;
  --surface:  #ffffff;
  --surface-2:#f4f6fd;
  --surface-3:#e8edf9;

  /* Text */
  --text-1:   #0f172a;
  --text-2:   #1e293b;
  --text-3:   #475569;
  --text-4:   #94a3b8;

  /* Brand shades */
  --blue-900: #0d1b5e;
  --blue-700: #1e40af;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-200: #bfdbfe;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;
  --indigo:   #6366f1;
  --purple:   #7c3aed;
  --purple-100:#ede9fe;
  --green-700:#065f46;
  --green-600:#059669;
  --green-100:#d1fae5;
  --amber-600:#d97706;
  --amber-100:#fef3c7;
  --red-600:  #dc2626;
  --red-100:  #fee2e2;

  /* Borders */
  --border:        #e2e8f0;
  --border-strong: #c2cfe0;
  --border-focus:  var(--blue-500);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
  --shadow-sm: 0 1px 4px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 16px rgba(15,23,42,.09), 0 2px 6px rgba(15,23,42,.05);
  --shadow-lg: 0 12px 36px rgba(15,23,42,.13), 0 4px 12px rgba(15,23,42,.06);
  --shadow-focus: 0 0 0 3px rgba(59,130,246,.22);

  /* Geometry */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-pill: 9999px;

  /* Motion */
  --t: .14s ease;
}

/* ─── Dark-Mode Tokens ─── */
[data-theme="dark"] {
  --grad-header: linear-gradient(135deg, #04091c 0%, #0b1d52 52%, #162d8a 100%);

  --bg:       #07101e;
  --surface:  #0e1929;
  --surface-2:#121f35;
  --surface-3:#182742;

  --text-1:   #e8f0ff;
  --text-2:   #b8cae0;
  --text-3:   #7a90ad;
  --text-4:   #3d5068;

  --blue-100: #1c3366;
  --blue-50:  #111e42;
  --purple-100:#1c1046;
  --green-100:#042b1c;
  --amber-100:#291803;
  --red-100:  #260505;

  --border:        #1a2d45;
  --border-strong: #243d5a;
  --border-focus:  #60a5fa;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 36px rgba(0,0,0,.6);
  --shadow-focus: 0 0 0 3px rgba(96,165,250,.22);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light dark; }
[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ─── Site Header ─── */
.site-header {
  background: var(--grad-header);
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  /* subtle bottom glow line */
  box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 4px 20px rgba(13,27,94,.4);
}

.site-header .header-icon {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-md);
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.site-header .header-title { flex: 1; min-width: 0; }
.site-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.site-header .header-sub {
  font-size: .84rem;
  opacity: .75;
  margin-top: 2px;
  font-weight: 400;
}

/* ─── Dark Toggle Button ─── */
.dark-toggle {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-pill);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  transition: background var(--t);
}
.dark-toggle:hover { background: rgba(255,255,255,.24); }
.dark-toggle svg { display: block; }
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none;  }

/* ─── Language Toggle Button ─── */
.lang-toggle {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-pill);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  flex-shrink: 0;
  transition: background var(--t);
  font-family: inherit;
  line-height: 1;
}
.lang-toggle:hover { background: rgba(255,255,255,.24); }

/* ─── Back / Header Badge ─── */
.header-badge {
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-sm);
  color: #fff;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .3px;
  padding: 6px 13px;
  text-decoration: none;
  transition: background var(--t);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.header-badge:hover { background: rgba(255,255,255,.24); }

/* ─── Footer ─── */
footer {
  text-align: center;
  color: var(--text-4);
  font-size: .78rem;
  padding: 22px 16px 26px;
  border-top: 1px solid var(--border);
}

footer .version-stamp {
  display: block;
  margin-top: 6px;
  font-size: .72rem;
  letter-spacing: .02em;
}

/* ─── Run Report ─── */
.report-panel {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.report-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2, #f7f8fc);
  border: none;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-1);
  text-align: left;
}
.report-toggle:hover { background: var(--blue-50, #eff6ff); }
.report-toggle .arrow { margin-left: auto; transition: transform .2s; }
.report-toggle[aria-expanded="true"] .arrow { transform: rotate(180deg); }
.report-body {
  display: none;
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.report-body.open { display: block; }
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.report-stat {
  background: var(--surface-2, #f7f8fc);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
}
.report-stat .rs-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-2, #718096);
  margin-bottom: 4px;
}
.report-stat .rs-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
}
.report-stat .rs-value.cost { color: var(--blue-700, #1d4ed8); }
.report-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2, #718096);
  margin: 14px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}
.report-table th, .report-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.report-table th {
  font-weight: 600;
  color: var(--text-2, #718096);
  font-size: .76rem;
  text-transform: uppercase;
  background: var(--surface-2, #f7f8fc);
}
.report-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.rev-item {
  background: var(--surface-2, #f7f8fc);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: .82rem;
}
.rev-src { color: var(--text-2, #718096); margin-top: 4px; }
.rev-tgt { color: var(--text-1); margin-top: 3px; }
.rev-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 9999px;
  font-size: .68rem;
  font-weight: 700;
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rev-badge.changed   { background: #c6f6d5; color: #22543d; }
.rev-badge.glossary  { background: #bee3f8; color: #2c5282; }
.rev-badge.typography { background: #fefcbf; color: #744210; }
.rev-badge.untranslated { background: #fed7d7; color: #9b2c2c; }
.rev-badge.tag       { background: #e9d8fd; color: #553c9a; }

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-header {
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header h2 {
  font-size: .94rem;
  font-weight: 600;
  color: var(--text-2);
}
.card-body { padding: 20px; }

/* ─── Step Number ─── */
.step-num {
  background: var(--grad-primary);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  transition: all var(--t);
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.4;
}

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30,64,175,.3);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(30,64,175,.42); }
.btn-primary:disabled { background: var(--border-strong); color: var(--text-4); box-shadow: none; cursor: not-allowed; }

.btn-green {
  background: var(--grad-green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(6,95,70,.3);
}
.btn-green:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(6,95,70,.4); }
.btn-green:disabled { background: var(--border-strong); color: var(--text-4); box-shadow: none; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--blue-600);
  border: 1.5px solid var(--blue-500);
}
.btn-outline:hover { background: var(--blue-50); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }

.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-danger { background: linear-gradient(135deg, #b91c1c, #dc2626); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

/* ─── Form Elements ─── */
label {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-3);
  display: block;
  margin-bottom: 6px;
}
input[type=text],
input[type=password],
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 9px 13px;
  font-size: .93rem;
  outline: none;
  transition: border var(--t), box-shadow var(--t);
  font-family: inherit;
  background: var(--surface);
  color: var(--text-1);
  appearance: auto;
}
input[type=text]:focus,
input[type=password]:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
textarea { resize: vertical; min-height: 80px; }

/* ─── Layout Row ─── */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 200px; }

/* ─── Drop Zone ─── */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  background: var(--surface-2);
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.drop-zone p   { color: var(--text-3); font-size: .9rem; }
.drop-zone strong { color: var(--blue-600); }
.drop-zone svg { opacity: .3; margin-bottom: 12px; display: block; margin-left: auto; margin-right: auto; }

/* ─── File Chip ─── */
.file-chip {
  display: inline-flex;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--r-pill);
  padding: 4px 13px;
  font-size: .8rem;
  color: var(--blue-700);
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}
.file-chip .rm { cursor: pointer; color: var(--red-600); font-weight: 700; font-size: 1rem; }

/* ─── Alerts ─── */
.alert {
  border-radius: var(--r-md);
  padding: 11px 15px;
  font-size: .85rem;
  margin-top: 12px;
}
.alert-info    { background: var(--blue-50);  border: 1px solid var(--blue-200);  color: var(--blue-700); }
.alert-error   { background: var(--red-100);  border: 1px solid #fca5a5;          color: var(--red-600);  }
.alert-success { background: var(--green-100);border: 1px solid #6ee7b7;          color: var(--green-700);}
.alert-warn    { background: var(--amber-100);border: 1px solid #fcd34d;          color: var(--amber-600);}

/* ─── Log Box ─── */
.log-box {
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  font-size: .75rem;
  line-height: 1.8;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 12px;
  border: 1px solid var(--border);
}
.log-time { color: var(--text-4); }
.log-ok   { color: var(--green-600); }
.log-warn { color: #b45309; }
.log-err  { color: var(--red-600); }
.log-info { color: var(--blue-600); }
.log-dim  { color: var(--text-4); }

/* ─── Progress Bar ─── */
.progress-bar-bg {
  background: var(--surface-3);
  border-radius: var(--r-pill);
  height: 8px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar-fill {
  background: var(--grad-bar);
  height: 100%;
  width: 0%;
  border-radius: var(--r-pill);
  transition: width .35s ease;
}

/* ─── Tables ─── */
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--text-3);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover td { background: var(--surface-2); }
tbody td { padding: 8px 10px; vertical-align: middle; color: var(--text-1); }
tbody tr.sel td { background: var(--blue-50); }
/* Models without context caching are blocked (too costly on large glossaries). */
tbody tr.disabled-row td { opacity: .5; }
tbody tr.disabled-row:hover td { background: transparent; }
.tag {
  display: inline-block; border-radius: var(--r-pill); padding: 1px 8px;
  font-size: .7rem; font-weight: 700; vertical-align: middle;
  background: #e9d8fd; color: #553c9a;
}

/* ─── Status Badges ─── */
.badge-ready, .badge-ok {
  background: var(--green-100); color: var(--green-700);
  border-radius: var(--r-pill); padding: 2px 10px;
  font-size: .75rem; font-weight: 700;
}
.badge-warn {
  background: var(--amber-100); color: var(--amber-600);
  border-radius: var(--r-pill); padding: 2px 10px;
  font-size: .75rem; font-weight: 700;
}
.badge-err {
  background: var(--red-100); color: var(--red-600);
  border-radius: var(--r-pill); padding: 2px 10px;
  font-size: .75rem; font-weight: 700;
}
.lang-tag {
  background: var(--purple);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 2px 8px;
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: .3px;
}

/* ─── Toggle Row (tab-switch) ─── */
.toggle-row {
  display: flex;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  overflow: hidden;
  width: fit-content;
}
.toggle-row button {
  padding: 8px 20px;
  border: none;
  background: var(--surface);
  cursor: pointer;
  font-size: .86rem;
  font-weight: 600;
  color: var(--text-3);
  transition: all var(--t);
  font-family: inherit;
}
.toggle-row button + button { border-left: 1px solid var(--border); }
.toggle-row button.active { background: var(--grad-primary); color: #fff; }

/* ─── Misc utilities ─── */
.hidden { display: none !important; }

.hint {
  font-size: .78rem;
  color: var(--text-4);
  margin-top: 6px;
  line-height: 1.55;
}

code {
  background: var(--surface-3);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: .84em;
  color: var(--text-2);
}

.reveal-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue-600);
  font-size: .84rem;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
}

.prompt-box {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: .75rem;
  line-height: 1.65;
  max-height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-2);
  margin-top: 10px;
}

.opt-summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--blue-600);
  font-size: .85rem;
  list-style: none;
  user-select: none;
}
.opt-summary::-webkit-details-marker { display: none; }
.opt-summary::before { content: '▸ '; font-size: .7rem; vertical-align: middle; }
details[open] > .opt-summary::before { content: '▾ '; }

/* ─── Help Tooltip ─── */
.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: .7rem;
  font-weight: 700;
  cursor: help;
  margin-left: 6px;
  position: relative;
  flex-shrink: 0;
}
.help:hover::after {
  content: attr(data-help);
  position: absolute;
  left: 50%;
  top: 130%;
  transform: translateX(-50%);
  background: var(--text-1);
  color: var(--surface);
  padding: 8px 12px;
  border-radius: var(--r-md);
  font-size: .73rem;
  font-weight: 400;
  line-height: 1.5;
  width: 260px;
  z-index: 30;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

/* ─── Dark-mode script helper (used inline) ─── */
/* JS reads localStorage 'aw-theme' → sets data-theme on <html> */

/* ═══════════════════════════════════════════════════════════════
   Tribunal Profile Panel (slide-out)
   ═══════════════════════════════════════════════════════════════ */

.tribunal-badge {
  background: rgba(255,255,255,.14);
  border: 1.5px solid rgba(255,255,255,.22);
  border-radius: var(--r-pill);
  color: #fff;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
  padding: 6px 14px;
  font-family: inherit;
  transition: all var(--t);
  white-space: nowrap;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  line-height: 1.3;
}
.tribunal-badge:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.4); }
.tribunal-badge.active { background: rgba(255,255,255,.22); border-color: rgba(34,211,238,.5); box-shadow: 0 0 14px rgba(34,211,238,.3); }
.tribunal-badge-icon { font-size: .9rem; flex-shrink: 0; }
.tribunal-badge-name { font-size: .78rem; }
.tribunal-badge-clear {
  font-size: .68rem;
  opacity: 0;
  transition: opacity var(--t);
  margin-left: 1px;
  cursor: pointer;
  line-height: 1;
}
.tribunal-badge:hover .tribunal-badge-clear { opacity: .7; }
.tribunal-badge-clear:hover { opacity: 1 !important; color: #fca5a5; }

.tribunal-panel {
  position: fixed; inset: 0; z-index: 1000;
  pointer-events: none; visibility: hidden; transition: visibility 0s .3s;
}
.tribunal-panel.open { pointer-events: auto; visibility: visible; transition: visibility 0s 0s; }

.tribunal-panel-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45); opacity: 0; transition: opacity .25s ease;
}
.tribunal-panel.open .tribunal-panel-backdrop { opacity: 1; }

.tribunal-panel-body {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 92vw;
  background: var(--surface); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; overflow: hidden;
}
.tribunal-panel.open .tribunal-panel-body { transform: translateX(0); }

.tribunal-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); flex-shrink: 0;
}
.tribunal-panel-header h2 { font-size: 1.05rem; font-weight: 700; color: var(--text-1); }
.tribunal-panel-close {
  background: none; border: none; font-size: 1.6rem; color: var(--text-3);
  cursor: pointer; padding: 0 4px; line-height: 1; font-family: inherit;
}
.tribunal-panel-close:hover { color: var(--text-1); }

.tribunal-panel-content { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }

.tribunal-active-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--blue-50); border: 1px solid var(--blue-100);
  border-radius: var(--r-md); padding: 10px 14px;
}
.tribunal-active-name { font-weight: 700; font-size: .9rem; color: var(--blue-700); }

.tribunal-panel-content label { font-size: .75rem; margin-bottom: 3px; font-weight: 600; color: var(--text-3); }
.tribunal-panel-content select,
.tribunal-panel-content input[type=text],
.tribunal-panel-content input[type=password] { font-size: .8rem; padding: 6px 8px; }
.tribunal-panel-content .btn-sm { font-size: .72rem; padding: 4px 10px; }

/* Panel layout primitives */
.panel-field { margin-bottom: 10px; }
.panel-field label { display: block; margin-bottom: 3px; }
.panel-row { display: flex; align-items: center; gap: 6px; }
.panel-row-wrap { flex-wrap: wrap; }
.panel-arrow { color: var(--text-4); font-size: .75rem; flex-shrink: 0; }
.panel-select-sm { font-size: .76rem !important; padding: 4px 6px !important; width: auto; min-width: 70px; }
.panel-input-sm { font-size: .76rem !important; padding: 4px 6px !important; width: 60px; }
.panel-msg { font-size: .73rem; margin-top: 4px; color: var(--text-4); }
.panel-msg.error { color: var(--red-600); }
.panel-msg.success { color: var(--green-600); }
.panel-staged { font-size: .72rem; color: var(--amber-600); font-weight: 600; }
.panel-auto-label { font-size: .68rem; color: var(--text-4); width: 55px; flex-shrink: 0; }
.panel-auto-value { font-size: .72rem; color: var(--text-3); }
.panel-auto-value.ready { color: var(--green-600); font-weight: 600; }
.panel-upload-btn { cursor: pointer; font-size: .72rem !important; }
.panel-upload-sm { cursor: pointer; font-size: .7rem; color: var(--text-4); padding: 0 2px; }
.panel-upload-sm:hover { color: var(--blue-600); }
.panel-action-sm { background: none; border: none; cursor: pointer; font-size: .7rem; color: var(--text-4); padding: 0 3px; font-family: inherit; }
.panel-action-sm:hover { color: var(--red-600); }

/* Panel sections */
.panel-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.panel-section:first-of-type { border-top: none; margin-top: 8px; }
.panel-section-title { font-size: .8rem; font-weight: 700; color: var(--text-2); margin-bottom: 2px; }
.panel-section-hint { font-size: .7rem; color: var(--text-4); margin-bottom: 8px; line-height: 1.4; }
.panel-status { font-size: .72rem; color: var(--text-4); }
.panel-status.ready { color: var(--green-600); font-weight: 600; }

/* Compact resource rows */
.panel-resource-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--border);
  font-size: .76rem;
}
.panel-resource-row:last-child { border-bottom: none; }
.panel-resource-icon { flex-shrink: 0; font-size: .85rem; }
.panel-resource-label { width: 130px; flex-shrink: 0; font-weight: 600; color: var(--text-2); font-size: .76rem; }
.panel-resource-lang { display: flex; align-items: center; gap: 6px; flex: 1; }
.panel-lang-tag { font-size: .65rem; font-weight: 700; background: var(--surface-3); border-radius: 3px; padding: 1px 5px; color: var(--text-3); }

.panel-prefs-editor { margin-top: 6px; padding: 8px; background: var(--surface-2); border-radius: var(--r-sm); }
.panel-prefs-editor textarea { font-size: .76rem; min-height: 50px; margin-bottom: 4px; }

.panel-textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--r-md);
  padding: 6px 8px; font-size: .76rem; font-family: inherit;
  background: var(--surface); color: var(--text-1); resize: vertical; min-height: 50px;
}

.tmx-bucket-chip {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 2px 7px; margin: 2px 4px 2px 0;
  font-size: .7rem;
}
.tmx-bucket-chip button { background: none; border: none; cursor: pointer; color: var(--text-4); font-size: .7rem; padding: 0; font-family: inherit; }
.tmx-bucket-chip button:hover { color: var(--red-600); }
.tmx-bucket-chip button.tmx-bucket-dl { margin-left: 2px; }
.tmx-bucket-chip button.tmx-bucket-dl:hover { color: var(--blue-600); }
.tmx-bucket-chip button.tmx-bucket-dl.disabled { opacity: .35; cursor: not-allowed; }
.tmx-bucket-chip button.tmx-bucket-dl.disabled:hover { color: var(--text-4); }

.alert-success { background: var(--green-100); color: var(--green-700); border: 1px solid var(--green-600); border-radius: var(--r-sm); padding: 6px 10px; font-size: .73rem; }
.alert-error { background: var(--red-100); color: var(--red-600); border: 1px solid var(--red-600); border-radius: var(--r-sm); padding: 6px 10px; font-size: .73rem; }
.alert-warn { background: var(--amber-100); color: var(--amber-600); border: 1px solid var(--amber-600); border-radius: var(--r-sm); padding: 6px 10px; font-size: .73rem; }
