:root {
  --bg: #101418;
  --bg-2: #171d24;
  --card: #1c242e;
  --line: #2b3644;
  --text: #e8eef5;
  --muted: #8b9aab;
  --accent: #f0b429;
  --accent-2: #3d9cf0;
  --ok: #3dd68c;
  --warn: #f5a524;
  --err: #ef6b73;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body.embed .sidebar { width: 200px; }
.login-card .btn.primary { display: block; text-align: center; margin: 12px 0; text-decoration: none; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 0.9em; background: #0d1116; padding: 0.1em 0.35em; border-radius: 4px; }

body { display: flex; }
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: #1a1406;
  display: grid; place-items: center; font-weight: 700;
}
.brand small { display: block; color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar nav a {
  color: var(--text); padding: 10px 12px; border-radius: 8px; text-decoration: none;
}
.sidebar nav a.active, .sidebar nav a:hover { background: #243040; text-decoration: none; }
.logout { margin-top: auto; }
.logout button, .btn, button {
  background: transparent; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
}
.btn.primary, button[type="submit"].primary { background: var(--accent); color: #1a1406; border-color: var(--accent); font-weight: 600; }
.content { flex: 1; padding: 32px 40px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
h1 { margin: 0 0 6px; font-size: 1.7rem; }
h2 { margin: 28px 0 12px; font-size: 1.15rem; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi-grid .card { padding: 12px 14px; }
.kpi-grid .card strong { font-size: 1.25rem; line-height: 1.2; }
.kpi-grid .card small { display: block; color: var(--muted); margin-top: 4px; font-size: 0.78rem; }
.stats-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px;
  margin: 0 0 10px;
}
.stats-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.stats-presets .pill.active {
  background: #243040; border-color: var(--accent-2); color: var(--text);
}
.stats-cal { margin: 0; max-width: 220px; }
.stats-cal .date-range-toggle { margin: 0; min-height: 42px; }
.stats-account { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.stats-account select {
  background: #0f141a; color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; min-height: 42px;
}
.stats-hint { margin: 0 0 14px; font-size: 0.82rem; }
.stats-charts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 16px;
}
.stats-charts[hidden] { display: none !important; }
.chart-card[hidden] { display: none !important; }
.stats-radial.is-one { grid-template-columns: minmax(260px, 480px); }
.chart-radial-layout {
  display: grid; grid-template-columns: 220px minmax(0, 1fr);
  align-items: center; gap: 8px 12px;
}
.chart-radial-plot { display: grid; place-items: center; }
.chart-slice { cursor: pointer; transition: opacity 0.12s linear, filter 0.12s linear; }
.chart-slice.is-muted { opacity: 0.28; }
.chart-slice.is-active { filter: brightness(1.16); }
.chart-donut-hole { fill: var(--card); }
.chart-donut-total { fill: var(--text); font-size: 15px; font-weight: 700; }
.chart-donut-caption { fill: #8b9aab; font-size: 10px; }
.chart-card { padding: 14px 16px; }
.chart-card h2 { margin: 0 0 8px; font-size: 0.98rem; }
.chart-host { position: relative; min-height: 220px; }
.stats-svg { display: block; overflow: visible; }
.chart-grid { stroke: #2b3644; stroke-width: 1; }
.chart-axis { fill: #8b9aab; font-size: 10px; }
.chart-hover-band { fill: rgba(61, 156, 240, 0.14); pointer-events: none; }
.chart-bar { transition: opacity 0.12s linear; }
.chart-bar.is-muted { opacity: 0.28; }
.chart-bar.is-active { filter: brightness(1.16); stroke: rgba(255, 255, 255, 0.45); stroke-width: 1; }
.chart-hit { cursor: pointer; }
.chart-line, .chart-line-dot { pointer-events: none; }
.chart-tip {
  position: fixed;
  z-index: 40;
  min-width: 176px;
  max-width: 280px;
  padding: 8px 10px;
  background: #12181f;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-size: 0.8rem;
  pointer-events: none;
}
.chart-tip[hidden] { display: none !important; }
.chart-tip span { display: inline; color: inherit; }
.chart-tip .swatch { display: inline-block; }
.chart-tip-kicker { font-size: 0.72rem; color: var(--muted); margin-bottom: 2px; }
.chart-tip strong {
  display: flex; align-items: center; gap: 6px;
  margin: 0; font-size: 0.86rem; font-weight: 650;
}
.chart-tip-main { font-size: 1.2rem; font-weight: 700; margin: 4px 0 6px; }
.chart-tip-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  line-height: 1.45;
}
.chart-tip-name { display: inline-flex; align-items: center; color: var(--muted); min-width: 0; }
.chart-tip-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-tip-row.is-total {
  margin-top: 4px; padding-top: 5px; border-top: 1px solid var(--line); color: var(--text);
}
.chart-tip-row.is-total .chart-tip-name { color: var(--text); }
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px;
  font-size: 0.78rem; color: var(--muted);
}
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chart-legend-item.is-on { color: var(--text); }
.swatch {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px;
  margin-right: 6px; vertical-align: middle;
}
.stats-block {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 0 0 12px; padding: 0;
}
.stats-block summary {
  list-style: none; cursor: pointer; padding: 10px 14px; font-weight: 600;
}
.stats-block summary::-webkit-details-marker { display: none; }
.stats-block summary::before {
  content: "▸"; display: inline-block; width: 1.1em; color: var(--muted);
}
.stats-block[open] summary::before { content: "▾"; }
.stats-block .table { margin: 0; }
.table.compact th, .table.compact td { padding: 6px 8px; font-size: 0.85rem; }
.col-help { cursor: help; }
.col-help-text,
.col-help-text[hidden] {
  display: none !important;
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
th.col-help {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-decoration-color: var(--muted);
}
.kpi.col-help > span:first-of-type {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-decoration-color: var(--muted);
}
.col-help-pop { max-width: 340px; }
.col-help-pop strong { display: block; margin: 0 0 2px; }
.col-help-pop p {
  margin: 6px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45;
}
@media (max-width: 960px) {
  .stats-charts { grid-template-columns: 1fr; }
  .chart-radial-layout { grid-template-columns: 1fr; justify-items: center; }
}
.grid.two { grid-template-columns: 1fr 1fr; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
}
.grid.stats .card > span { color: var(--muted); display: block; }
.grid.stats .card > strong { font-size: 1.8rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.page-actions form { margin: 0; }
.disk-links { white-space: nowrap; }
.disk-links a { margin-right: 10px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; }
.status, .pill, .ok, .warn {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.85rem;
}
.status.sent, .status.done, .ok { background: #163627; color: var(--ok); }
.status.failed, .status.error { background: #3a1719; color: var(--err); }
.status.pending, .warn { background: #3a2a10; color: var(--warn); }
.status.downloading, .status.uploading, .status.summarizing, .status.sending { background: #13273a; color: var(--accent-2); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { background: var(--card); border: 1px solid var(--line); color: var(--text); padding: 6px 12px; }
.filters { margin: 8px 0 16px; }
.sort-link { color: var(--muted); text-decoration: none; }
.sort-link.active, .sort-link:hover { color: var(--accent); text-decoration: none; }
.filter-row th { font-weight: 400; vertical-align: top; }
.col-filter {
  width: 100%; min-height: 36px; padding: 6px 8px; margin: 4px 0 0;
  font-size: 0.85rem; border-radius: 6px;
}
.meetings-table-form { margin: 0; overflow: visible; }
.table { overflow: visible; }
.filter-row th:nth-child(2),
.table td:nth-child(2) { min-width: 168px; }
.date-range { position: relative; min-width: 150px; }
.date-range input[type="hidden"] { display: none !important; }
.date-range-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 48px; margin: 4px 0 0; padding: 6px 8px;
  text-align: left; color: var(--muted); font: inherit;
  background: #0f141a; border: 1px solid var(--line); border-radius: 6px;
}
.date-range-toggle.is-filled { color: var(--text); }
.date-range-toggle:hover { border-color: var(--accent-2); }
.date-range-icon {
  width: 16px; height: 16px; flex: 0 0 16px; display: block;
}
.date-range-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.date-range-line { display: flex; gap: 6px; align-items: baseline; line-height: 1.2; }
.date-range-k { color: var(--muted); font-size: 0.72rem; width: 1.4em; flex: none; }
.date-cal {
  position: fixed;
  display: none;
  z-index: 10000;
  box-sizing: border-box;
  width: 300px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  color: var(--text);
}
.date-cal.is-open { display: block; }
.date-cal-head {
  display: grid; grid-template-columns: 36px 1fr 36px;
  align-items: center; gap: 8px; margin-bottom: 8px;
}
.date-cal-title { text-align: center; font-weight: 600; text-transform: capitalize; }
.date-cal button {
  box-sizing: border-box;
  width: auto; min-width: 0; min-height: 0; margin: 0;
  padding: 0; font: inherit; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 8px;
}
.date-cal-nav {
  height: 36px; width: 36px; border: 1px solid var(--line) !important; font-size: 1.2rem;
}
.date-cal button:hover { background: #243040; }
.date-cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px;
}
.date-cal-dow { margin-bottom: 4px; }
.date-cal-dow span {
  display: block; text-align: center; color: var(--muted);
  font-size: 0.75rem; padding: 4px 0;
}
.date-cal-day {
  height: 34px; width: 100% !important; border-radius: 8px; font-size: 0.85rem;
}
.date-cal-day.is-other { color: #5b6b7c; }
.date-cal-day.is-today { box-shadow: inset 0 0 0 1px var(--accent-2); }
.date-cal-day.is-in-range { background: #13273a; color: var(--accent-2); }
.date-cal-day.is-selected,
.date-cal-day.is-selected:hover {
  background: var(--accent); color: #1a1406; font-weight: 600;
}
.date-cal-actions { display: flex; gap: 6px; margin-top: 10px; }
.date-cal-action {
  flex: 1; height: 32px; border: 1px solid var(--line) !important;
  color: var(--muted); font-size: 0.75rem;
}
.date-range-block { max-width: 280px; margin: 10px 0 16px; }
.account-form, .settings-form { margin-bottom: 18px; }
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -8px 0 16px;
}
.settings-tab {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}
.settings-tab:hover { background: #243040; }
.settings-tab.is-active {
  background: #243040;
  border-color: var(--accent-2);
  font-weight: 600;
}
.settings-panel[hidden] { display: none; }
.settings-actions {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.poll-window label { min-width: 140px; flex: 1; max-width: 220px; }
.poll-schedule {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 28px;
  align-items: center;
  margin: 8px 0 12px;
}
.poll-schedule-fields { flex: 1; min-width: 240px; }
.poll-clock {
  display: flex;
  align-items: center;
  gap: 18px;
}
.poll-clock svg {
  width: 240px; height: 240px; min-width: 240px; min-height: 240px;
  display: block; flex: none;
  touch-action: none; user-select: none; cursor: pointer;
  overflow: visible;
}
.poll-clock-face { fill: #0f141a; stroke: var(--line); }
.poll-clock-track { fill: none; stroke: #243040; stroke-width: 18; }
.poll-clock-arc, .poll-clock-full {
  fill: none; stroke: var(--accent-2); stroke-width: 18; stroke-linecap: butt;
  pointer-events: none;
}
.poll-clock.is-now .poll-clock-arc,
.poll-clock.is-now .poll-clock-full { stroke: var(--ok); }
.poll-clock.is-off .poll-clock-arc,
.poll-clock.is-off .poll-clock-full { stroke: #3a4a5c; }
.poll-clock-tick { stroke: #5b6b7c; stroke-width: 1.5; }
.poll-clock-tick.is-major { stroke: var(--text); stroke-width: 2.2; }
.poll-clock-label {
  fill: var(--text); font-size: 16px; font-weight: 600;
  text-anchor: middle; dominant-baseline: middle;
  font-family: "Segoe UI", system-ui, sans-serif;
  pointer-events: none;
}
.poll-clock-hour, .poll-clock-minute, .poll-clock-second { pointer-events: none; stroke-linecap: round; }
.poll-clock-hour { stroke: var(--text); stroke-width: 6; }
.poll-clock-minute { stroke: #c5d0dc; stroke-width: 3.5; }
.poll-clock-second { stroke: var(--accent); stroke-width: 1.5; }
.poll-clock-hub { fill: var(--accent); pointer-events: none; }
.poll-clock-knob { cursor: grab; }
.poll-clock-knob circle { fill: var(--accent-2); stroke: #0f141a; stroke-width: 2; }
.poll-clock-knob text {
  fill: #0f141a; font-size: 11px; font-weight: 700;
  text-anchor: middle; dominant-baseline: middle;
  font-family: "Segoe UI", system-ui, sans-serif;
  pointer-events: none;
}
.poll-clock.is-now .poll-clock-knob circle { fill: var(--ok); }
.poll-clock.is-off .poll-clock-knob circle { fill: #5b6b7c; }
.poll-clock-knob.is-active { cursor: grabbing; }
.poll-clock-knob.is-active circle { fill: var(--accent); }
.poll-clock-now { display: flex; flex-direction: column; gap: 2px; min-width: 11rem; max-width: 16rem; }
.poll-clock-now strong {
  color: var(--text); font-size: 1.55rem; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.poll-clock-status { font-size: 0.9rem; color: var(--muted); }
.poll-clock.is-now .poll-clock-status { color: var(--ok); }
.poll-clock.is-wait .poll-clock-status { color: var(--accent-2); }
.poll-clock.is-off .poll-clock-status { color: var(--warn); }
.poll-clock-hint { font-size: 0.8rem; line-height: 1.35; margin-top: 6px; }
.poll-clock-full { visibility: hidden; }
.poll-clock-full.is-on { visibility: visible; }
.poll-clock svg [hidden] { display: none; }
input[type="time"] { color-scheme: dark; }
label { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; color: var(--muted); font-size: 0.9rem; }
input:not([type="checkbox"]):not([type="hidden"]), select, textarea {
  background: #0f141a; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font: inherit; width: 100%;
}
select { min-height: 42px; }
textarea {
  min-height: 280px; resize: vertical; font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.row { display: flex; gap: 10px; align-items: center; }
.help { color: var(--muted); line-height: 1.5; }
.error-cell { color: var(--err); font-size: 0.9rem; }
.log-msg {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.8rem/1.4 Consolas, "Courier New", monospace;
  color: var(--text);
  max-width: 72vw;
}
.nowrap { white-space: nowrap; }
.protocol-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 10px;
}
.protocol-head h3 { margin: 0; }
.protocol-body {
  line-height: 1.65;
  font-size: 0.98rem;
  max-width: 52rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.protocol-body:has(p) { white-space: normal; }
.protocol-body p { margin: 0 0 0.75em; }
.protocol-body .protocol-h {
  margin: 1.2em 0 0.35em;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.protocol-body .protocol-h:first-child { margin-top: 0; }
.protocol-body b, .protocol-body strong {
  display: inline;
  font-size: inherit;
  color: var(--text);
}
.protocol-body ul, .protocol-body ol { margin: 0.2em 0 0.9em 1.2em; }
.protocol-body li { margin: 0.2em 0; }
.protocol-body a { word-break: break-word; }
.protocol-body.protocol-plain { white-space: pre-wrap; word-break: break-word; }
.login-body { display: grid; place-items: center; }
.login-card {
  width: 360px; background: var(--card); padding: 32px; border-radius: 16px; border: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.login-card button { width: 100%; margin-top: 8px; }
.login-card h1 { margin-bottom: 8px; }
.alert.error { background: #3a1719; color: var(--err); padding: 8px 10px; border-radius: 8px; margin: 12px 0; }
.alert.ok { background: #163627; color: var(--ok); padding: 8px 10px; border-radius: 8px; margin: 12px 0; }
.alert.warn { background: #3a2a10; color: var(--warn); padding: 8px 10px; border-radius: 8px; margin: 12px 0; }
pre {
  background: #0d1116; padding: 12px 14px; border-radius: 8px;
  overflow-x: auto; color: var(--text); line-height: 1.45;
}
.option-grid { display: grid; gap: 8px; margin: 12px 0 16px; }
.row.wrap { flex-wrap: wrap; }
.export-table input[type="checkbox"] { width: auto; }
.period-form, .export-form { margin-bottom: 18px; }
.back { color: var(--muted); }

.live-card { margin-bottom: 16px; }
.live-stage { font-size: 1.15rem; margin: 8px 0 12px; }
.live-detail { min-height: 1.4em; }
.live-detail.is-error { color: var(--err); }
.live-steps {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0; margin: 0 0 12px;
}
.live-step {
  padding: 4px 10px; border-radius: 999px; font-size: 0.85rem;
  border: 1px solid var(--line); color: var(--muted);
}
.live-step.done { background: #163627; color: var(--ok); border-color: #1f4a34; }
.live-step.current { background: #13273a; color: var(--accent-2); border-color: #2a5c88; }
.live-step.error { background: #3a1719; color: var(--err); border-color: #6a2a30; }
.progress-track {
  height: 10px; background: #0d1116; border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line); margin: 8px 0;
}
.progress-track.mini { height: 6px; margin: 6px 0; }
.progress-fill {
  height: 100%; width: 0; background: var(--accent-2);
  transition: width 0.25s linear;
}
.progress-fill.indeterminate {
  width: 30% !important;
  animation: live-pulse 1.2s ease-in-out infinite;
}
.live-card.is-failed .progress-fill { background: var(--err); }
.live-card.is-done .progress-fill { background: var(--ok); width: 100% !important; }
.live-compact-stage { font-size: 0.9rem; }
.live-jobs { display: grid; gap: 12px; margin-bottom: 8px; }
.live-mini h3, .live-mini a { font-weight: 600; }
@keyframes live-pulse {
  0% { transform: translateX(-40%); }
  50% { transform: translateX(180%); }
  100% { transform: translateX(-40%); }
}

@media (max-width: 800px) {
  body { display: block; }
  .sidebar { width: auto; min-height: 0; }
  .grid.two { grid-template-columns: 1fr; }
  .content { padding: 20px; }
}

.howto-zoom { margin: 0 0 20px; padding: 0; }
.howto-zoom summary {
  list-style: none; cursor: pointer; padding: 12px 18px;
  color: var(--text); font-weight: 600;
}
.howto-zoom summary::-webkit-details-marker { display: none; }
.howto-zoom summary::before {
  content: "▸"; display: inline-block; width: 1.1em; color: var(--muted);
}
.howto-zoom[open] summary::before { content: "▾"; }
.howto-zoom summary:hover { color: var(--accent); }
.howto-zoom-list {
  margin: 0; padding: 0 18px 16px 38px; color: var(--muted);
  font-size: 0.9rem; line-height: 1.45;
}
.howto-zoom-list li { margin: 0 0 8px; }
.howto-zoom-list ul { margin: 6px 0 0; padding-left: 18px; }
.howto-zoom-list strong { font-size: inherit; color: var(--text); }
.howto-zoom-list code { color: var(--text); }
.actions-cell { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-compact {
  padding: 4px 10px; font-size: 0.82rem; width: auto; min-height: 0;
}
.transcript-download-all { margin-bottom: 16px; }
.pack-progress { margin: 0 0 16px; }
#pack-detail { white-space: pre-wrap; }
.pack-form button:disabled { opacity: 0.55; cursor: progress; }
.transcript-pack { margin-bottom: 18px; }
.transcript-pack h2 { margin: 0; font-size: 1.15rem; }
.transcript-files { max-height: 420px; overflow: auto; margin-top: 10px; }
.keywords-field textarea { min-height: 72px; font-family: inherit; }
