:root,
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-2: #0b2538;
  --card: #0e1b2d;
  --muted: #93a3b8;
  --text: #e6edf5;
  --accent: #0ea5e9;
  --accent-strong: #22d3ee;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --input-bg: rgba(255, 255, 255, 0.04);
  --hover-bg: rgba(255, 255, 255, 0.06);
  --card-gradient-from: rgba(255, 255, 255, 0.02);
  --card-gradient-to: rgba(255, 255, 255, 0.01);
}

[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-2: #e8ecf1;
  --card: #ffffff;
  --muted: #5a6a7e;
  --text: #1a2332;
  --accent: #0284c7;
  --accent-strong: #0891b2;
  --border: rgba(0, 0, 0, 0.10);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
  --input-bg: rgba(0, 0, 0, 0.03);
  --hover-bg: rgba(0, 0, 0, 0.04);
  --card-gradient-from: rgba(0, 0, 0, 0.01);
  --card-gradient-to: rgba(0, 0, 0, 0.02);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', 'Helvetica Neue', sans-serif;
  font-weight: 500;
  line-height: 1.5;
  min-height: 100vh;
}

.bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(800px at 15% 20%, rgba(34, 211, 238, 0.15), transparent),
    radial-gradient(700px at 80% 0%, rgba(14, 165, 233, 0.18), transparent),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  z-index: -1;
}

[data-theme="light"] .bg {
  background: radial-gradient(800px at 15% 20%, rgba(2, 132, 199, 0.06), transparent),
    radial-gradient(700px at 80% 0%, rgba(8, 145, 178, 0.05), transparent),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 72px;
}

.admin-app {
  max-width: 1280px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: linear-gradient(160deg, var(--card-gradient-from), var(--card-gradient-to));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 20px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--card-gradient-from);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.sidebar-link:hover {
  border-color: var(--accent);
}

.sidebar-link.active {
  border-color: var(--accent);
  background: rgba(14, 165, 233, 0.08);
}

.sidebar-back {
  display: inline-flex;
  justify-content: center;
  width: 100%;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section {
  margin-top: 8px;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 14px;
  align-items: start;
}

.section-output {
  display: grid;
  gap: 12px;
}

.section-grid .card {
  margin-top: 0;
}

.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hero-inline {
  align-items: flex-start;
  text-align: left;
}

.hero h1 {
  margin: 12px 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.02em;
}

.hero-logo {
  max-width: 280px;
  height: auto;
}

.hero h1.hero-title {
  margin: 8px 0 0;
  font-size: clamp(36px, 6vw, 52px);
  letter-spacing: -0.03em;
}

.hero-subtitle {
  color: var(--muted);
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero p {
  margin: 0 0 16px;
  color: var(--muted);
  max-width: 720px;
}

#metaInfo {
  white-space: pre-line;
  text-align: center;
}

.language-bar {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin: 12px 0 4px;
}

.language-bar .field {
  margin: 0;
}

.language-bar .hint {
  margin: 0;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent-strong);
  font-weight: 600;
}

.cta-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button:not(:disabled):active {
  transform: translateY(1px);
}

.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  color: #04121c;
  padding: 14px 26px;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.35);
}

.record-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 20px;
  text-align: left;
}

.record-btn__label {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.record-btn__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(4, 18, 28, 0.75);
}

.record-btn__status::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  box-shadow: 0 0 0 4px rgba(4, 18, 28, 0.08);
}

.record-btn__status.ready::before {
  background: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.15);
}

.record-btn__status.recording::before {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.record-btn__status.analyzing::before {
  background: #22d3ee;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.18);
}

.record-btn[data-state='recording'] {
  background: linear-gradient(90deg, #f59e0b, #f97316);
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.4);
  color: #0f172a;
}

.record-btn[data-state='recording'] .record-btn__status {
  color: rgba(15, 23, 42, 0.85);
}

.record-btn[data-state='analyzing'] {
  background: linear-gradient(90deg, #22d3ee, #0ea5e9);
  box-shadow: 0 12px 30px rgba(14, 165, 233, 0.4);
  color: #03111c;
}

.record-btn[data-state='analyzing'] .record-btn__status {
  color: rgba(3, 17, 28, 0.85);
}

.record-btn .record-btn__status[hidden],
.record-btn .record-btn__label[hidden] {
  display: none;
}

.ghost {
  background: var(--hover-bg);
  color: var(--text);
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

a.ghost {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pill {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.pill.recording {
  color: #0a0a0a;
  background: #fbbf24;
  border-color: #fbbf24;
}

.pill.analyzing {
  color: #06121c;
  background: #22d3ee;
  border-color: #22d3ee;
}

.pill.ready {
  color: var(--muted);
}

#liveTranscriptStatus,
#realtimeTranscriptStatus,
#recordingLiveStatus,
#recordingRealtimeStatus {
  background: var(--hover-bg);
  border-color: var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 18px;
}

.card {
  background: linear-gradient(140deg, var(--card-gradient-from), var(--card-gradient-to));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}

.card[data-collapsed='true'] .card-body {
  display: none;
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.job-id {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-body {
  margin-top: 16px;
}

.card-body-stack > * + * {
  margin-top: 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.summary-grid .diktat-section {
  grid-column: 1 / -1;
}

@media (max-width: 800px) {
  .summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

.ai-hinweise-card {
  background: var(--card-gradient-from);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.ai-zusammenfassung {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}
.ai-hinweise-list {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.ai-hinweise-list strong {
  font-size: 0.85rem;
  color: #f0a500;
}
.ai-hinweise-list p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.summary-section {
  background: var(--card-gradient-from);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.summary-section-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
}

.summary-header-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.summary-toggle-all {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
}

.summary-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
  align-items: center;
}

/* t2med-Buttons (Einzelfeld + Alle) */
.t2med-btn {
  padding: 3px;
  line-height: 0;
}

.t2med-btn[hidden] {
  display: none !important;
}

.t2med-format-picker[hidden] {
  display: none !important;
}

.t2med-btn:hover {
  background: var(--hover-bg);
}

.t2med-logo-img {
  height: 22px;
  width: 22px;
  border-radius: 5px;
  display: block;
}

/* Format-Auswahl unter Summary-Header */
.t2med-format-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 2px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.t2med-format-picker label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* Alle-Button im Card-Header neben 📋 */
.card-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* t2med Setup-Karte (index.html) */
.t2med-install-btn {
  display: inline-block;
  margin: 8px 0 12px;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}

.t2med-install-steps {
  margin: 0 0 12px 18px;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}

.t2med-other-platforms {
  font-size: 12px;
  margin-top: 8px;
}

/* macOS Terminal-Befehl Block */
.t2med-mac-install {
  margin: 8px 0 12px;
}

.t2med-cmd-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.t2med-cmd-code {
  font-family: monospace;
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
  flex: 1;
  user-select: all;
}

.t2med-safari-warn {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.5;
}

.t2med-confirm-btn {
  margin-bottom: 12px;
  font-size: 13px;
}

.t2med-unconfirm-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.t2med-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.summary-title {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  font-size: 17px;
}

.summary-section .icon-btn {
  padding: 6px 8px;
  border-radius: 8px;
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
}

.summary-list li {
  margin: 8px 0;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  width: 100%;
}

.summary-item-toggle {
  width: 18px;
  height: 18px;
  margin-top: 0;
  accent-color: var(--accent-strong);
  flex-shrink: 0;
}

.summary-item span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Editable section items — checkbox outside label */
li.summary-item {
  cursor: default;
  align-items: flex-start;
}

.summary-item-check {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  padding-top: 2px;
}

.summary-item-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  outline: none;
  cursor: text;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background 0.15s, box-shadow 0.15s;
}

.summary-item-text:focus {
  background: var(--card-gradient-from);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* --- Diktat Sections --- */

.diktat-section .diktat-text {
  min-height: 60px;
  padding: 12px;
  background: var(--card-gradient-from);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
}

.diktat-section .diktat-text[contenteditable="true"] {
  cursor: text;
  outline: none;
}

.diktat-section .diktat-text[contenteditable="true"]:focus {
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.diktat-section .diktat-text[contenteditable="false"] {
  cursor: default;
  opacity: 0.7;
}

.diktat-section .diktat-text:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
}

.diktat-section .diktat-clear-row {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.diktat-section .diktat-clear-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 14px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.diktat-section .diktat-clear-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.diktat-section .diktat-status {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  min-height: 18px;
}

.diktat-record-btn,
.diktat-stop-btn {
  font-size: 18px;
  transition: background 0.2s, transform 0.1s;
}

.diktat-record-btn.recording {
  background: rgba(220, 38, 38, 0.15);
  animation: diktat-pulse 1.5s ease-in-out infinite;
}

.diktat-record-btn.paused {
  background: rgba(59, 130, 246, 0.15);
  animation: none;
}

.diktat-stop-btn {
  background: rgba(220, 38, 38, 0.1);
}

.diktat-stop-btn:hover {
  background: rgba(220, 38, 38, 0.25);
}

.diktat-record-btn:disabled,
.diktat-stop-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@keyframes diktat-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.duration-timer-card {
  padding: 10px 22px;
  text-align: center;
  transition: background 0.4s ease;
}

.duration-timer {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.duration-timer-card.ok {
  background: rgba(40, 167, 69, 0.2);
  border-color: rgba(40, 167, 69, 0.4);
}

.duration-timer-card.warning {
  background: rgba(255, 193, 7, 0.25);
  border-color: rgba(255, 193, 7, 0.5);
}

.duration-timer-card.caution {
  background: rgba(255, 140, 0, 0.25);
  border-color: rgba(255, 140, 0, 0.5);
}

.duration-timer-card.danger {
  background: rgba(220, 53, 69, 0.3);
  border-color: rgba(220, 53, 69, 0.5);
}

.duration-card {
  padding: 16px 22px;
}

.duration-card .card-header {
  margin-bottom: 0;
}

.duration-header-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.duration-header-left h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.duration-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent-strong);
  flex-shrink: 0;
  cursor: pointer;
}

.login-grid {
  align-items: end;
}

.login-actions {
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
}

.app:not(.admin-app) #loginCard {
  --inline-control-height: 46px;
}

.app:not(.admin-app) #loginCard .inline-form {
  gap: 20px;
  align-items: center;
}

.app:not(.admin-app) #loginCard .field.inline-field {
  justify-content: center;
  text-align: left;
  width: auto;
}

.app:not(.admin-app) #loginCard .login-actions-row {
  justify-content: center;
  width: 100%;
}

.app:not(.admin-app) #loginCard .login-actions-row > span {
  display: none;
}

.app:not(.admin-app) #loginCard #loginStatus {
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 700;
}

.app:not(.admin-app) #loginCard .field.inline-field span {
  text-align: left;
}

.app:not(.admin-app) #loginCard .field.inline-field input {
  min-height: var(--inline-control-height);
}

.app:not(.admin-app) #loginCard .login-actions-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.app:not(.admin-app) #loginCard .login-actions {
  margin-top: 0;
}

.app:not(.admin-app) #loginCard .login-actions-block .error,
.app:not(.admin-app) #loginCard .login-actions-block .hint {
  margin-top: 0;
}

.recording-row {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
}

.context-input-row {
  margin-top: 12px;
  margin-bottom: 4px;
}

.context-input-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}

.context-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.context-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.context-input:focus {
  border-color: var(--accent);
}

.recording-row .pill {
  margin-left: 6px;
}

#protectedArea {
  --inline-control-height: 46px;
  --inline-control-width: auto;
  margin-top: 16px;
}

#protectedArea .recording-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 400px);
  margin: 0 auto 16px;
}

#protectedArea .recording-row .record-btn {
  grid-column: 1 / -1;
  width: 100%;
  align-items: center;
  text-align: center;
}

#protectedArea .recording-row .ghost {
  width: 100%;
}

.progress-pill {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.5);
  color: #c4f1f9;
}

.pill-field .pill {
  align-self: center;
}

.pill-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

#protectedArea #userPill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--inline-control-height);
  padding: 14px 20px;
  font-weight: 700;
  color: #04121c;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border: none;
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(14, 165, 233, 0.28);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.user-list {
  display: grid;
  gap: 12px;
}

.user-list-header,
.user-row {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 1fr 0.7fr auto 0.6fr;
  gap: 12px;
  align-items: center;
}

.user-list-header {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 6px;
}

.user-row {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-gradient-from);
}

.user-row.empty {
  grid-template-columns: 1fr;
  text-align: center;
  color: var(--muted);
}

.user-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-name {
  font-weight: 600;
  color: var(--text);
}

.user-meta {
  font-size: 13px;
  color: var(--muted);
}

.user-input,
.user-select {
  width: 100%;
}

.request-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.request-list-header,
.request-row {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.request-list-header {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 6px;
}

.request-row {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-gradient-from);
}

.request-row.empty {
  grid-template-columns: 1fr;
  text-align: center;
  color: var(--muted);
}

.request-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-actions,
.request-actions {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ghost.small {
  padding: 8px 12px;
  font-size: 13px;
}

.primary.small {
  padding: 8px 12px;
  font-size: 13px;
  box-shadow: none;
}

.pill.danger {
  color: #ffe4e6;
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.5);
}

.inline-link {
  color: var(--accent-strong);
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

.inline-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

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

.metric-grid-tight {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.metric {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-gradient-from);
}

.metric-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  font-size: 20px;
  font-weight: 600;
  margin-top: 4px;
}

.chart-card canvas {
  width: 100%;
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.analytics-table {
  display: grid;
  gap: 10px;
}

.analytics-row {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr 0.7fr 0.9fr 0.8fr 0.9fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-gradient-from);
}

.analytics-header {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 6px;
  border: none;
  background: transparent;
}

.analytics-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analytics-sub {
  font-size: 12px;
  color: var(--muted);
}

.analytics-row.is-selected {
  border-color: var(--accent);
  background: rgba(14, 165, 233, 0.08);
}

#protectedArea .inline-form {
  gap: 20px;
  align-items: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  flex: 1;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.password-toggle:hover {
  opacity: 1;
}

.field.inline-field .password-wrapper {
  flex: 1;
  min-width: 0;
}

.register-app .password-toggle {
  right: 36px;
}

.field.inline-field {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  text-align: center;
}

#protectedArea .field.inline-field {
  justify-content: center;
  text-align: left;
  width: auto;
}

.field span {
  font-weight: 600;
  color: var(--text);
}

.field.inline-field span {
  white-space: nowrap;
  min-width: 140px;
}

#protectedArea .field.inline-field span {
  text-align: left;
}

.field.inline-field select {
  min-width: 170px;
  width: auto;
}

#protectedArea .pill-row {
  justify-content: center;
  width: var(--inline-control-width);
}

#settingsLink {
  flex: 0 0 auto;
  width: 40px;
  max-width: 40px;
  align-self: center;
  border-radius: 10px;
}

#protectedArea .field.inline-field select {
  min-height: var(--inline-control-height);
  width: var(--inline-control-width);
  max-width: 100%;
}

input:not([type='checkbox']):not([type='radio']),
textarea,
select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

input:not([type='checkbox']):not([type='radio']):disabled,
textarea:disabled,
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--card-gradient-from);
  color: var(--muted);
}

textarea {
  min-height: 56px;
}

code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 0.9em;
  background: var(--hover-bg);
  padding: 2px 6px;
  border-radius: 6px;
}

.prompt-editor {
  min-height: 260px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  line-height: 1.45;
}

.prompt-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.warning {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.prompt-versions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prompt-versions h3 {
  margin: 0;
  font-size: 18px;
}

.version-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.version-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--card-gradient-from);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.version-info {
  flex: 1;
  min-width: 0;
}

.version-meta {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.version-snippet {
  margin-top: 6px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.version-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ghost.danger {
  color: #f87171;
}

.ghost.danger:hover {
  background: rgba(248, 113, 113, 0.15);
}

.hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

#gdtInfo, #gdtInfoResults {
  text-align: center;
}

#protectedArea #gdtInfo,
#protectedArea #gdtInfoResults {
  min-height: 30px;
  margin-bottom: 4px;
}

#protectedArea #gdtInfo[hidden],
#protectedArea #gdtInfoResults[hidden] {
  display: block;
  visibility: hidden;
}

.progress {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.2);
  color: #ccecff;
  text-align: center;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.status-bar__message {
  font-weight: 500;
}

.status-bar .ghost {
  padding: 8px 14px;
  font-size: 14px;
}

.live-transcript {
  background: var(--card-gradient-from);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 160px;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.6;
}

.live-transcript.empty {
  color: var(--muted);
}

.btn-retry {
  display: block;
  margin: 12px auto 0;
  padding: 10px 20px;
  background: var(--accent, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-retry:hover {
  opacity: 0.85;
}

.model-feedback {
  margin-top: 6px;
}

.recording-card .recording-meta {
  margin-top: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 12px;
}

.card-subheader h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--hover-bg);
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid var(--border);
}

.lucide-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 0;
}

.lucide-icon svg {
  display: block;
}

.collapse-btn {
  line-height: 1;
  min-width: 36px;
  text-align: center;
}

.collapse-btn .lucide-icon svg {
  transition: transform 0.2s ease;
}

.collapse-btn[aria-expanded="true"] .lucide-icon svg {
  transform: rotate(90deg);
}

.output {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 420px;
  overflow: auto;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

.error {
  margin-top: 18px;
  padding: 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecdd3;
  border-radius: 12px;
}

.error.model-feedback {
  margin-top: 6px;
}

/* --- Navbar --- */

.main-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
}

[data-theme="light"] .main-navbar {
  background: rgba(245, 247, 250, 0.8);
}

.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 8px;
}

.navbar-left,
.navbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.navbar-left {
  min-width: 0;
  flex: 1;
}

.navbar-right {
  flex: 1;
  justify-content: flex-end;
}

.navbar-center {
  flex: 0 0 auto;
}

.navbar-logo-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  gap: 2px;
}

.navbar-logo {
  height: 32px;
  width: auto;
}

.navbar-brand-name {
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}

.navbar-user {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-strong);
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid var(--accent);
  padding: 0 9px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  /* Width = 2 buttons (each: 1px+9px+18px+9px+1px = 38px) + 4px gap */
  width: 80px;
  /* Height = same as navbar-btn: 2*7px padding + 18px icon + 2px border = 34px */
  height: 34px;
  line-height: 34px;
  box-sizing: border-box;
}

.navbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--hover-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 9px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.navbar-btn:hover {
  background: var(--input-bg);
  border-color: var(--accent);
}

.navbar-btn.active {
  background: rgba(14, 165, 233, 0.15);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.navbar-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}

/* Body offset for fixed navbar */
body {
  padding-top: 56px;
}

/* Hide old theme toggle when navbar exists */
.main-navbar ~ .theme-toggle {
  display: none !important;
}

/* --- Template Bottom Bar --- */

.template-bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 0 20px;
  height: 48px;
}

[data-theme="light"] .template-bottombar {
  background: rgba(245, 247, 250, 0.8);
}

.bottombar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
}



.bottombar-dropdown {
  position: relative;
  width: min(100%, 400px);
}

.bottombar-select {
  width: 100%;
  padding: 8px 20px;
  border: 1px solid var(--border);
  font-family: inherit;
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
  text-align: center;
}

.bottombar-select:hover,
.bottombar-select:focus {
  border-color: var(--accent);
  outline: none;
}

.bottombar-select.disabled,
.bottombar-select:disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.bottombar-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card-gradient-from);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  z-index: 1001;
}

[data-theme="light"] .bottombar-menu {
  background: #fff;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.bottombar-option {
  display: block;
  width: 100%;
  padding: 8px 16px;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.12s;
}

.bottombar-option:hover {
  background: var(--hover-bg);
}

.bottombar-option.active {
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent);
  font-weight: 600;
}

/* --- Theme Toggle (fallback, hidden when navbar present) --- */

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 18px;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
  transition: background 0.15s ease;
}

.theme-toggle:hover {
  background: var(--input-bg);
}

/* Light-theme overrides for elements with hardcoded dark colors */
[data-theme="light"] .progress {
  color: var(--accent);
}

[data-theme="light"] .output {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .t2med-cmd-box {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .warning {
  color: #92400e;
}

[data-theme="light"] .error {
  color: #b91c1c;
}

[data-theme="light"] .pill.danger {
  color: #b91c1c;
}

[data-theme="light"] .progress-pill {
  color: var(--accent);
}

[data-theme="light"] .ghost.danger {
  color: #dc2626;
}

[data-theme="light"] .ghost.danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

[data-theme="light"] input:not([type='checkbox']):not([type='radio']):disabled,
[data-theme="light"] textarea:disabled,
[data-theme="light"] select:disabled {
  background: rgba(0, 0, 0, 0.02);
}

@media (max-width: 1024px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .section-grid {
    grid-template-columns: 1fr;
  }

  .user-list-header,
  .user-row {
    grid-template-columns: 1fr;
  }

  .user-list-header {
    display: none;
  }

  .request-list-header,
  .request-row {
    grid-template-columns: 1fr;
  }

  .request-list-header {
    display: none;
  }

  .analytics-row {
    grid-template-columns: 1fr;
  }

  .analytics-header {
    display: none;
  }
}

@media (max-width: 640px) {
  .language-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-row {
    flex-direction: column;
    align-items: center;
  }

  .icon-btn {
    padding: 8px 12px;
  }

  .navbar-user {
    font-size: 11px;
    padding: 0 7px;
    /* 2 mobile buttons (each: 1px+7px+18px+7px+1px = 34px) + 4px gap */
    width: 72px;
    height: 30px;
    line-height: 30px;
  }

  .navbar-logo {
    height: 26px;
  }

  .main-navbar {
    padding: 0 10px;
    height: 48px;
  }

  body {
    padding-top: 48px;
  }

  .navbar-btn {
    padding: 6px 7px;
  }

  .template-bottombar {
    padding: 0 10px;
    height: 42px;
  }

  .bottombar-select,
  .bottombar-option {
    font-size: 0.8rem;
  }
}

@media (max-width: 430px) {
  .app {
    padding: 32px 16px 56px;
  }

  .app:not(.admin-app) #loginCard .inline-form,
  #protectedArea .inline-form {
    align-items: stretch;
  }

  .app:not(.admin-app) #loginCard .field.inline-field,
  #protectedArea .field.inline-field {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 8px;
    width: 100%;
  }

  .app:not(.admin-app) #loginCard .field.inline-field span,
  #protectedArea .field.inline-field span {
    min-width: 0;
    white-space: normal;
  }

  .app:not(.admin-app) #loginCard .field.inline-field input,
  .app:not(.admin-app) #loginCard .field.inline-field select,
  #protectedArea .field.inline-field input,
  #protectedArea .field.inline-field select {
    width: 100%;
  }

  #protectedArea .pill-row {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  #protectedArea #userPill,
  #protectedArea #logoutBtn {
    width: 100%;
  }

  #protectedArea .recording-row {
    width: 100%;
  }
}

/* Register page – single-column centered card */
.register-app {
  max-width: 520px;
}

.register-app .grid {
  grid-template-columns: 1fr;
}

