/* Tools page additions — re-uses base styles from styles.css */

/* ============================================================ */
/* Hub layout: top nav + tabbed panels                          */
/* ============================================================ */
body.hub {
  margin: 0;
  background: var(--paper, #fafaf7);
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink, #1c1c1a);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hub-top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 22px;
  background: var(--ink, #1c1c1a);
  color: #fff;
  border-bottom: 1px solid #000;
}
.hub-brand { display: flex; align-items: center; gap: 11px; }
.hub-brand .mark {
  width: 30px; height: 30px;
  background: linear-gradient(180deg, #1c8b7a 0%, #117565 100%);
  border-radius: 7px;
  display: grid; place-items: center;
}
.hub-brand h1 {
  margin: 0;
  font: 600 16px/1.1 "Fraunces", serif;
  color: #fff;
}
.hub-brand .sub {
  font: 400 11px/1 "IBM Plex Mono", monospace;
  color: #aab2af;
}

.hub-tabs {
  flex: 1;
  display: flex;
  gap: 2px;
  justify-content: center;
}
.hub-tabs .tab {
  background: transparent;
  border: 0;
  color: #aab2af;
  font: 500 13px/1 "IBM Plex Sans", sans-serif;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
}
.hub-tabs .tab:hover { color: #fff; background: rgba(255,255,255,0.06); }
.hub-tabs .tab.active {
  color: #fff;
  background: rgba(28, 139, 122, 0.22);
  box-shadow: inset 0 0 0 1px rgba(28, 139, 122, 0.55);
}

.hub-meta { display: flex; gap: 8px; align-items: center; }
.hub-meta .pill {
  font: 500 11px/1 "IBM Plex Mono", monospace;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #c9d1cf;
  border: 1px solid rgba(255,255,255,0.1);
}

.hub-main {
  flex: 1;
  display: flex;
  position: relative;
  min-height: 0;
}
.hub-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.hub-panel.active { display: flex; flex-direction: column; }

/* Workbook iframe occupies the full viewport below the top bar */
#workbook-frame {
  border: 0;
  width: 100%;
  height: 100%;
  flex: 1;
  display: block;
  background: var(--paper, #fafaf7);
}

/* ============================================================ */
/* Per-panel left sub-nav (mirrors workbook page sidebar)       */
/* Used inside Translate / TTS / Chat / Marketing / Admin       */
/* ============================================================ */
.panel-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.panel-side {
  background: var(--ink, #1c1c1a);
  color: #d7dae0;
  border-right: 1px solid var(--ink-line, #2a2f37);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-side .brand {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--ink-line, #2a2f37);
}
.panel-side .brand .ttl {
  font: 500 14px/1.2 "Fraunces", serif;
  color: #fff;
}
.panel-side .brand .sub {
  display: block;
  margin-top: 4px;
  font: 500 10px/1 "IBM Plex Mono", monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8b919b;
}
.panel-side .nav {
  padding: 12px 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.panel-side .nav .lbl {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #6c727c;
  padding: 0 10px;
  margin: 6px 0 6px;
}
.panel-side .nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 8px;
  color: #c3c8d0;
  font: 500 13px/1 "IBM Plex Sans", sans-serif;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.panel-side .nav a svg { width: 15px; height: 15px; opacity: .8; flex: 0 0 auto; }
.panel-side .nav a:hover { background: #222933; color: #fff; }
.panel-side .nav a.active { background: #232c37; color: #fff; }
.panel-side .nav a.active svg { opacity: 1; color: var(--teal-2, #1c8b7a); }
.panel-side .side-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--ink-line, #2a2f37);
  font-size: 11px;
  color: #7c828c;
  line-height: 1.45;
}
.panel-body {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
/* Sub-nav section switcher: only the .active [data-section] is visible.
   Targets section AND div nodes (admin uses both). */
.panel-body [data-section] { display: none; }
.panel-body [data-section].active { display: block; }
.panel-body .section-h {
  font: 600 14px/1.2 "IBM Plex Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-2, #696964);
  margin: 0 0 12px;
}

@media (max-width: 820px) {
  .panel-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .panel-side { border-right: 0; border-bottom: 1px solid var(--ink-line, #2a2f37); }
  .panel-side .nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .panel-side .nav .lbl { display: none; }
  .panel-side .side-foot { display: none; }
}


/* ============================================================ */
/* Inside-panel content (translate / tts / chat / marketing)    */
/* ============================================================ */

.panel {
  padding: 22px 28px;
  max-width: 980px;
  width: 100%;
  box-sizing: border-box;
}
.panel h2 {
  font: 600 22px/1.2 "Fraunces", serif;
  margin: 0 0 6px 0;
}
.muted { color: var(--ink-2, #696964); font-size: 13px; }
.muted code {
  background: var(--paper-2, #f1efe9);
  padding: 1px 6px;
  border-radius: 4px;
  font: 500 12px/1 "IBM Plex Mono", monospace;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  align-items: flex-start;
}
.form-row label,
label.block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font: 500 11px/1.2 "IBM Plex Sans", sans-serif;
  color: var(--ink-2, #696964);
  text-transform: uppercase;
  letter-spacing: .05em;
  flex: 1 1 180px;
}
label.block { display: block; margin-top: 12px; }
label.block textarea,
label.block input { margin-top: 5px; display: block; }

.form-row input,
.form-row select,
label.block input,
label.block textarea {
  border: 1px solid var(--line, #e4e2db);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  font: 400 14px/1.4 "IBM Plex Sans", sans-serif;
  color: var(--ink, #1c1c1a);
  width: 100%;
  text-transform: none;
  letter-spacing: 0;
  box-sizing: border-box;
}
label.block textarea, .form-row textarea {
  resize: vertical;
  font-family: "IBM Plex Sans", sans-serif;
}

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

.results {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}
.result-card {
  border: 1px solid var(--line, #e4e2db);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}
.result-card .lang {
  font: 600 12px/1 "IBM Plex Mono", monospace;
  text-transform: uppercase;
  color: var(--teal, #117565);
  margin-bottom: 6px;
}
.result-card .body { font: 400 14px/1.55 "IBM Plex Sans", sans-serif; }
.result-card .meta {
  margin-top: 6px;
  font: 400 11px/1.2 "IBM Plex Mono", monospace;
  color: var(--ink-2, #696964);
}
.result-card.err { border-color: #f1c4c4; background: #fdf5f5; }

/* ----------------------------------------------------------------- */
/* Translate · Protected glossary                                     */
/* ----------------------------------------------------------------- */
.glossary-body .gloss-cat { margin: 14px 0 22px; }
.glossary-body .gloss-cat h4 {
  font: 600 12px/1.2 "IBM Plex Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-2, #696964);
  margin: 0 0 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.glossary-body .gloss-cat h4 .count {
  font: 400 11px/1 var(--mono, "IBM Plex Mono", monospace);
  color: var(--ink-2, #8a8a85);
  letter-spacing: 0;
}
.glossary-body .gloss-add {
  display: flex;
  gap: 6px;
  margin: 4px 0 10px;
  align-items: center;
}
.glossary-body .gloss-input {
  flex: 1;
  min-width: 0;
  font: 400 12px/1.4 var(--mono, "IBM Plex Mono", monospace);
  padding: 6px 10px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 6px;
  background: var(--paper, #fff);
  color: var(--ink, #1a1a18);
  outline: none;
}
.glossary-body .gloss-input:focus {
  border-color: var(--teal, #268383);
  box-shadow: 0 0 0 2px rgba(38, 131, 131, .18);
}
.glossary-body .gloss-input:disabled { opacity: .6; cursor: wait; }
.glossary-body .gloss-add-btn {
  font: 600 11px/1 "IBM Plex Sans", sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 7px 14px;
  border: 1px solid var(--teal, #268383);
  background: var(--teal, #268383);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
}
.glossary-body .gloss-add-btn:hover { background: #1f6e6e; }
.glossary-body .badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.glossary-body .badge-row .b {
  font: 400 11px/1.3 var(--mono, "IBM Plex Mono", monospace);
  padding: 3px 8px;
  border-radius: 6px;
  background: #f0efe9;
  color: #5d6058;
  border: 1px solid var(--line, #e4e2db);
}
.glossary-body .badge-row .b.removable {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 8px;
}
.glossary-body .badge-row .b.removable .rm {
  background: none;
  border: 0;
  color: var(--ink-2, #8a8a85);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 5px;
  border-radius: 4px;
}
.glossary-body .badge-row .b.removable .rm:hover {
  color: #7b2615;
  background: #f4e7e4;
}
.glossary-body .gloss-err {
  display: none;
  background: #fbeae6;
  border: 1px solid #e5b5ac;
  color: #7b2615;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.result-pre {
  margin-top: 14px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 10px;
  padding: 14px 16px;
  background: #fff;
  font: 400 13px/1.55 "IBM Plex Sans", sans-serif;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 500px;
  overflow: auto;
  min-height: 40px;
}

/* Chat-specific */
.chat-box {
  margin-top: 14px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 200px;
}
.bubble {
  max-width: 78%;
  padding: 9px 12px;
  border-radius: 10px;
  font: 400 14px/1.5 "IBM Plex Sans", sans-serif;
  white-space: pre-wrap;
}
.bubble.user {
  align-self: flex-end;
  background: #e3f5f2;
  color: var(--ink, #1c1c1a);
}
.bubble.bot {
  align-self: flex-start;
  background: var(--paper-2, #f1efe9);
  color: var(--ink, #1c1c1a);
}
.chat-input { align-items: flex-end; }
.chat-input textarea {
  flex: 1;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 8px;
  padding: 9px 11px;
  font-family: "IBM Plex Sans", sans-serif;
  resize: vertical;
}

/* Sub-tabs inside marketing panel */
.sub-tabs {
  margin-top: 14px;
  display: flex;
  gap: 4px;
}
.sub-tab {
  border: 1px solid var(--line, #e4e2db);
  border-radius: 999px;
  background: #fff;
  padding: 6px 14px;
  font: 500 12px/1 "IBM Plex Sans", sans-serif;
  cursor: pointer;
  color: var(--ink-2, #696964);
}
.sub-tab.active {
  background: var(--ink, #1c1c1a);
  color: #fff;
  border-color: var(--ink, #1c1c1a);
}

audio { width: 100%; margin-top: 12px; }

/* ============================================================ */
/* Target-language checkbox picker (collapsible)                */
/* ============================================================ */
.lang-picker {
  margin-top: 16px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.lang-picker-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.lang-picker-toggle:hover { background: var(--paper-2, #f1efe9); }
.lang-picker-title {
  font: 500 11px/1.2 "IBM Plex Sans", sans-serif;
  color: var(--ink-2, #696964);
  text-transform: uppercase;
  letter-spacing: .05em;
  flex: 0 0 auto;
}
.lang-picker-summary {
  flex: 1;
  font: 500 12px/1 "IBM Plex Mono", monospace;
  color: var(--ink, #1c1c1a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lang-picker-toggle .chev {
  width: 16px; height: 16px;
  color: var(--ink-2, #696964);
  transition: transform .15s;
  flex: 0 0 auto;
}
.lang-picker:not(.collapsed) .lang-picker-toggle .chev { transform: rotate(180deg); }
.lang-picker-body {
  display: grid;
  gap: 8px;
  padding: 0 14px 12px;
  border-top: 1px solid var(--line, #e4e2db);
}
.lang-picker.collapsed .lang-picker-body { display: none; }
.lang-picker-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  font: 500 12px/1 "IBM Plex Sans", sans-serif;
  color: var(--ink-2, #696964);
  padding-top: 10px;
}
.lang-picker-actions .sep { color: #c9c7bf; }
.lang-picker-actions .link {
  background: transparent;
  border: 0;
  padding: 2px 4px;
  color: var(--teal, #117565);
  cursor: pointer;
  font: inherit;
}
.lang-picker-actions .link:hover { text-decoration: underline; }

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px 10px;
}
.lang-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: 400 13px/1.2 "IBM Plex Sans", sans-serif;
  color: var(--ink, #1c1c1a);
  user-select: none;
  transition: border-color .15s, background .15s;
}
.lang-chip:hover { border-color: #c9c7bf; }
.lang-chip input { margin: 0; accent-color: var(--teal, #117565); }
.lang-chip .code {
  font: 600 11px/1 "IBM Plex Mono", monospace;
  color: var(--ink-2, #696964);
  background: var(--paper-2, #f1efe9);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}
.lang-chip:has(input:checked) {
  border-color: var(--teal, #117565);
  background: #effaf7;
}
.lang-chip:has(input:checked) .code {
  background: var(--teal, #117565);
  color: #fff;
}

/* ============================================================ */
/* Cost chip — surfaces per-call USD spend                      */
/* ============================================================ */
.cost-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: #f1f7f5;
  border: 1px solid #cfe5dd;
  font: 500 11px/1 "IBM Plex Mono", monospace;
  color: var(--ink, #1c1c1a);
  white-space: nowrap;
}
.cost-chip .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal, #117565);
}
.cost-chip .usd  { font-weight: 600; }
.cost-chip .toks { color: var(--ink-2, #696964); font-weight: 400; }

/* ============================================================ */
/* AI-quality chip — Claude-judged score per response           */
/* NOT a calibrated probability. Three colour bands             */
/* (>=85 green, 60-84 amber, <60 red).                          */
/* ============================================================ */
.conf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f7f5;
  border: 1px solid #cfe5dd;
  color: var(--ink, #1c1c1a);
  font: 600 11px/1 "IBM Plex Mono", monospace;
  white-space: nowrap;
  cursor: help;
  position: relative;
}
.conf-chip .conf-label { font-weight: 500; color: var(--ink-2, #696964); }
.conf-chip .conf-num   { font-weight: 700; }
.conf-chip.conf--loading {
  background: #f3f3f1;
  border-color: #e0e0d8;
  color: var(--ink-2, #696964);
  font-weight: 500;
}
.conf-chip.conf--err {
  background: #fff;
  border-color: #e7d2cf;
  color: #8a4a40;
  font-weight: 500;
}
.conf-chip.conf--high {
  background: #ecf6ef;
  border-color: #b5dbc3;
  color: #1f5b32;
}
.conf-chip.conf--mid {
  background: #fff7e6;
  border-color: #f0d49a;
  color: #7a4d00;
}
.conf-chip.conf--low {
  background: #fdecec;
  border-color: #f1bcbc;
  color: #8a2424;
}
.conf-chip .conf-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 260px;
  max-width: 360px;
  background: #1c1c1a;
  color: #e8e8e3;
  padding: 10px 12px;
  border-radius: 8px;
  font: 400 11px/1.45 "Inter", system-ui, sans-serif;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-out;
  z-index: 50;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.conf-chip:hover .conf-tip { opacity: 1; }
.conf-chip .conf-tip strong { color: #fff; }
.conf-chip .conf-tip .conf-disclaim {
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.12);
  color: #b0b0a8;
  font-style: italic;
}
.conf-chip .conf-tip ul {
  margin: 6px 0 0;
  padding-left: 16px;
}
.conf-chip .conf-tip li { margin-top: 3px; }
.conf-chip .conf-tip li.fail { color: #f4b8b0; }
.conf-chip .conf-tip li.pass { color: #b0e0c1; }

/* Logout / user pill control */
.hub-meta .user-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: #c9d1cf;
  font: 500 11px/1 "IBM Plex Mono", monospace;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.hub-meta .user-btn:hover { color: #fff; }
.hub-tabs .tab[hidden] { display: none; }

/* ============================================================ */
/* Admin dashboard                                              */
/* ============================================================ */
.kpi-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 12px;
  padding: 14px 16px;
}
.kpi-card .label {
  font: 500 10px/1.2 "IBM Plex Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-2, #696964);
}
.kpi-card .value {
  margin-top: 6px;
  font: 600 24px/1.1 "Fraunces", serif;
  color: var(--ink, #1c1c1a);
}
.kpi-card .sub {
  margin-top: 4px;
  font: 400 11px/1.2 "IBM Plex Mono", monospace;
  color: var(--ink-2, #696964);
}

.admin-section {
  margin-top: 22px;
}
.admin-section h3 {
  margin: 0 0 8px;
  font: 600 14px/1.2 "IBM Plex Sans", sans-serif;
  color: var(--ink, #1c1c1a);
  text-transform: uppercase;
  letter-spacing: .05em;
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 10px;
  overflow: hidden;
  font: 400 13px/1.4 "IBM Plex Sans", sans-serif;
}
table.admin-table th,
table.admin-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line, #e4e2db);
}
table.admin-table th {
  font: 600 11px/1 "IBM Plex Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-2, #696964);
  background: var(--paper-2, #f1efe9);
}
table.admin-table tbody tr:last-child td { border-bottom: 0; }
table.admin-table td.num,
table.admin-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.admin-table td.mono { font-family: "IBM Plex Mono", monospace; }

/* Daily-trend bar chart                                          */
.daily-bars {
  padding: 4px 0 0;
}
.daily-bars.has-bars { padding: 0; }

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 16px 8px;
  background: linear-gradient(180deg, #fbfbf8 0%, #ffffff 100%);
  border: 1px solid var(--line, #e4e2db);
  border-radius: 10px;
}
.bar-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px dashed #e4e2db;
}
.bch-summary { display: flex; align-items: baseline; gap: 10px; }
.bch-total {
  font: 600 20px/1.1 "IBM Plex Sans", sans-serif;
  color: var(--ink, #1c1c1a);
  letter-spacing: -.01em;
}
.bch-sub {
  font: 400 12px/1.2 "IBM Plex Mono", monospace;
  color: var(--ink-2, #696964);
}
.bch-peak {
  font: 500 12px/1.2 "IBM Plex Sans", sans-serif;
  color: var(--teal, #117565);
  background: #f3faf8;
  border: 1px solid #cfe6df;
  padding: 6px 10px;
  border-radius: 6px;
}
.bch-peak b { font-weight: 600; }

.bar-chart-cols {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 200px;
  padding: 0 2px;
}
.bar-col {
  flex: 1 1 0;
  min-width: 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  position: relative;
}
.bar-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
}
.bar-fill {
  background: linear-gradient(180deg, #2aa18d 0%, #117565 100%);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: filter .12s;
}
.bar-col:hover .bar-fill {
  filter: brightness(1.1);
}
.bar-col.peak .bar-fill {
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
}
.bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font: 500 10px/1 "IBM Plex Mono", monospace;
  color: var(--ink-2, #696964);
  background: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--line, #e4e2db);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
  z-index: 2;
}
.bar-col:hover .bar-value,
.bar-col.peak .bar-value {
  opacity: 1;
}
.bar-col.peak .bar-value {
  color: #b45309;
  border-color: #f3c89b;
}

.bar-date {
  margin-top: 8px;
  font: 500 11px/1.2 "IBM Plex Mono", monospace;
  color: var(--ink-2, #696964);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-chart--rotate .bar-date {
  transform: rotate(-45deg);
  transform-origin: center top;
  margin-top: 14px;
  height: 28px;
}
.bar-chart--rotate .bar-chart-cols {
  margin-bottom: 18px; /* room for the rotated labels */
}
.bar-col.peak .bar-date {
  color: #b45309;
  font-weight: 600;
}


/* ============================================================ */
/* Login page                                                   */
/* ============================================================ */
.login-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #1c1c1a 0%, #0f3a36 100%);
  display: grid;
  place-items: center;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink, #1c1c1a);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 36px 36px 28px;
  width: min(440px, 92vw);
  box-shadow: 0 20px 80px rgba(0,0,0,0.4);
}
.login-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.login-brand .login-mark {
  width: 42px; height: 42px;
  background: linear-gradient(180deg, #1c8b7a 0%, #117565 100%);
  border-radius: 10px;
  display: grid; place-items: center;
}
.login-brand h1 {
  margin: 0;
  font: 600 22px/1.1 "Fraunces", serif;
  color: var(--ink, #1c1c1a);
}
.login-brand span {
  font: 400 11px/1.2 "IBM Plex Mono", monospace;
  color: var(--ink-2, #696964);
}
.login-intro {
  font: 400 13px/1.5 "IBM Plex Sans", sans-serif;
  color: var(--ink-2, #696964);
  margin: 0 0 22px;
}
.login-card form label {
  display: block;
  font: 500 11px/1.2 "IBM Plex Sans", sans-serif;
  color: var(--ink-2, #696964);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 12px;
}
.login-card form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 8px;
  padding: 10px 12px;
  font: 400 14px/1.4 "IBM Plex Sans", sans-serif;
  color: var(--ink, #1c1c1a);
  background: #fff;
  box-sizing: border-box;
}
.login-card form input:focus {
  outline: 0;
  border-color: var(--teal, #117565);
  box-shadow: 0 0 0 3px rgba(28, 139, 122, 0.18);
}
.login-card button.primary {
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  font: 600 14px/1 "IBM Plex Sans", sans-serif;
  border-radius: 8px;
  border: 0;
  background: var(--ink, #1c1c1a);
  color: #fff;
  cursor: pointer;
}
.login-card button.primary:hover { background: #000; }
.login-err {
  margin-top: 12px;
  font: 500 12px/1.2 "IBM Plex Sans", sans-serif;
  color: #b54a4a;
  background: #fdf2f0;
  border: 1px solid #f1c4c4;
  padding: 8px 12px;
  border-radius: 6px;
}
.login-foot {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font: 400 11px/1.3 "IBM Plex Sans", sans-serif;
  color: var(--ink-2, #696964);
}
.login-foot a {
  color: var(--teal, #117565);
  text-decoration: none;
  font-weight: 500;
}
.login-foot a:hover { text-decoration: underline; }

/* ============================================================ */
/* v=12 additions: form hints, copy button, markdown output     */
/* ============================================================ */

/* Small descriptive text under inputs (e.g. Rate / Pitch on VO) */
label > small.hint {
  display: block;
  margin-top: 4px;
  font: 400 11px/1.4 "IBM Plex Sans", sans-serif;
  color: var(--ink-2, #696964);
  text-transform: none;
  letter-spacing: 0;
}
label > small.hint b {
  color: var(--ink, #1c1c1a);
  font-weight: 600;
}
/* A label that includes a hint needs more room so the help text doesn't
   wrap into 4-5 tiny lines beside a number input. */
.form-row label:has(> small.hint) {
  flex: 1 1 280px;
}

/* Translate result card: head row with language + copy button */
.result-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.result-card .card-head .lang { margin-bottom: 0; }

/* Generic copy-to-clipboard button (translate cards + marketing) */
.copy-btn {
  font: 600 10px/1 "IBM Plex Mono", monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--teal, #117565);
  background: #f3faf8;
  border: 1px solid #cfe6df;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.copy-btn:hover {
  background: var(--teal, #117565);
  color: #fff;
  border-color: var(--teal, #117565);
}
.copy-btn.ok {
  background: #117565;
  color: #fff;
  border-color: #117565;
}

/* Marketing markdown output container */
.result-md {
  margin-top: 14px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 10px;
  padding: 16px 20px;
  background: #fff;
  font: 400 14px/1.6 "IBM Plex Sans", sans-serif;
  color: var(--ink, #1c1c1a);
  max-height: 560px;
  overflow: auto;
  min-height: 40px;
}
.result-md:empty {
  display: none;
}
.result-md .md-h {
  font-family: "IBM Plex Sans", sans-serif;
  line-height: 1.25;
  margin: 18px 0 10px;
  color: var(--ink, #1c1c1a);
  font-weight: 600;
}
.result-md .md-h:first-child { margin-top: 0; }
.result-md .md-h1 { font-size: 22px; border-bottom: 1px solid var(--line, #e4e2db); padding-bottom: 6px; }
.result-md .md-h2 { font-size: 18px; }
.result-md .md-h3 { font-size: 16px; color: var(--teal, #117565); }
.result-md .md-h4,
.result-md .md-h5,
.result-md .md-h6 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-2, #696964);
}
.result-md .md-p {
  margin: 0 0 12px;
}
.result-md .md-ul,
.result-md .md-ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.result-md .md-ul li,
.result-md .md-ol li {
  margin-bottom: 4px;
}
.result-md .md-bq {
  margin: 0 0 12px;
  padding: 8px 14px;
  border-left: 3px solid var(--teal, #117565);
  background: #f7faf9;
  color: var(--ink-2, #4a4a45);
  font-style: italic;
}
.result-md .md-hr {
  border: 0;
  border-top: 1px solid var(--line, #e4e2db);
  margin: 18px 0;
}
.result-md strong { font-weight: 600; color: var(--ink, #1c1c1a); }
.result-md em { font-style: italic; }
.result-md .md-code-i {
  font: 500 12.5px/1.4 "IBM Plex Mono", monospace;
  background: #f2efe6;
  padding: 2px 6px;
  border-radius: 4px;
  color: #5a3015;
}
.result-md .md-code {
  background: #1c1c1a;
  color: #f4f4f0;
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  font: 400 12.5px/1.55 "IBM Plex Mono", monospace;
  margin: 0 0 12px;
}
.result-md a {
  color: var(--teal, #117565);
  text-decoration: underline;
}
.result-md a:hover { color: #0d574b; }


/* ----------------------------------------------------------------- */
/* Translate · Text / Document mode + document jobs                   */
/* ----------------------------------------------------------------- */
/* Several rules here use display:flex, which would beat the UA [hidden]. */
.hub-panel[data-panel="translate"] [hidden] { display: none !important; }

.mode-toggle {
  display: inline-flex;
  gap: 2px;
  margin-top: 14px;
  padding: 3px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 10px;
  background: var(--paper-2, #f1efe9);
}
.mode-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  font: 500 13px/1 "IBM Plex Sans", sans-serif;
  color: var(--ink-2, #696964);
  transition: background .12s, color .12s, box-shadow .12s;
}
.mode-toggle button svg { width: 15px; height: 15px; }
.mode-toggle button:hover { color: var(--ink, #1c1c1a); }
.mode-toggle button.active {
  background: #fff;
  color: var(--teal, #117565);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

.lang-picker-actions .lang-filter {
  margin-left: auto;
  width: 180px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 7px;
  padding: 6px 9px;
  font: 400 12.5px/1.2 "IBM Plex Sans", sans-serif;
  color: var(--ink, #1c1c1a);
  background: #fff;
}
.lang-picker-actions .lang-filter:focus {
  outline: none;
  border-color: var(--teal, #117565);
  box-shadow: 0 0 0 3px rgba(17, 117, 101, .12);
}
.lang-group-h {
  grid-column: 1 / -1;
  margin-top: 8px;
  font: 600 10.5px/1.2 "IBM Plex Sans", sans-serif;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-2, #696964);
}
.lang-group-h:first-child { margin-top: 2px; }

.doc-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 26px 16px;
  border: 1.5px dashed #cdcac0;
  border-radius: 12px;
  background: #fbfaf7;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.doc-drop:hover,
.doc-drop.over,
.doc-drop:focus-within {
  border-color: var(--teal, #117565);
  background: #f1f7f5;
}
.doc-drop input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}
.doc-drop svg { width: 28px; height: 28px; color: var(--teal, #117565); }
.doc-drop-title { font: 500 14px/1.3 "IBM Plex Sans", sans-serif; color: var(--ink, #1c1c1a); }
.doc-drop-title u { color: var(--teal, #117565); }
.doc-drop-hint { font: 400 12px/1.4 "IBM Plex Sans", sans-serif; color: var(--ink-2, #696964); }

.doc-file,
.doc-job-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.doc-file {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 10px;
  background: #fff;
}
.doc-file-ext {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 8px 6px;
  border-radius: 7px;
  background: var(--teal, #117565);
  color: #fff;
  text-align: center;
  font: 600 11px/1 "IBM Plex Mono", monospace;
}
.doc-file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.doc-file-info b {
  font: 600 14px/1.3 "IBM Plex Sans", sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-file-info .muted { font-size: 12px; }
.doc-note { font-size: 12px; margin: 10px 0 0; }

.doc-job {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line, #e4e2db);
  border-radius: 12px;
  background: #fff;
}
.doc-job-head .primary.small { margin-top: 0; padding: 8px 12px; font-size: 12px; }
.doc-progress {
  margin-top: 12px;
  height: 6px;
  border-radius: 6px;
  background: var(--paper-2, #f1efe9);
  overflow: hidden;
}
.doc-progress .bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal, #117565), #36a68f);
  transition: width .4s ease;
}
.doc-progress:not(.done) .bar {
  background-size: 200% 100%;
  animation: doc-progress-shimmer 1.6s linear infinite;
  background-image: linear-gradient(90deg, var(--teal, #117565), #36a68f, var(--teal, #117565));
}
.doc-progress.failed .bar { background: #c94a4a; }
@keyframes doc-progress-shimmer { to { background-position: -200% 0; } }
.doc-job-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font: 400 12.5px/1.3 "IBM Plex Sans", sans-serif;
  color: var(--ink-2, #696964);
}

.doc-card .card-head .lang { margin-right: auto; }
.doc-card.warn { border-color: #ecd9a6; background: #fffbf0; }
.doc-card .warn-text { color: #8a6412; }
.doc-preview {
  white-space: pre-wrap;
  max-height: 160px;
  overflow: auto;
  color: var(--ink, #1c1c1a);
}
.doc-badge {
  font: 600 10px/1 "IBM Plex Mono", monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--paper-2, #f1efe9);
  color: var(--ink-2, #696964);
}
.doc-badge.st-running   { background: #e7f2fb; color: #1f5f99; }
.doc-badge.st-succeeded { background: #e3f4ee; color: var(--teal, #117565); }
.doc-badge.st-failed    { background: #fbe5e5; color: #a33a3a; }
