/* ==========================================================================
   transcribbler — warm, refined design system
   Palette: cream/ivory neutrals + terracotta accent
   Fonts: Fraunces (serif, headings) + DM Sans (sans, body)
   ========================================================================== */

/* --- Design Tokens -------------------------------------------------------- */
:root {
  /* Surfaces */
  --background: #f1efea;
  --surface: #ffffff;
  --surface-raised: #fdfcf9;
  --surface-inset: #e8e0cd;
  --surface-inset-hover: #ded4bd;

  /* Text */
  --text: #3a3e42;
  --text-secondary: #5c6066;
  --muted: #7a7e85;

  /* Borders */
  --border: #e0d9c8;
  --border-light: #ebe5d6;
  --border-focus: #0e6e8c;

  /* Primary — terracotta */
  --primary: #c4543a;
  --primary-hover: #a8432e;
  --primary-active: #8f3826;
  --primary-light: #f5e8e3;
  --primary-text: #ffffff;

  /* Secondary — navy */
  --secondary: #2b3f54;
  --secondary-hover: #233344;
  --secondary-active: #1b2835;
  --secondary-text: #ffffff;

  /* Success — forest green */
  --success: #3e6b45;
  --success-hover: #325637;
  --success-text: #ffffff;

  /* Danger — derived from terracotta (deeper, more red) */
  --danger: #a8382a;
  --danger-hover: #8f2e23;
  --danger-text: #ffffff;

  /* Warning / Notice */
  --warning-bg: #fdf6e3;
  --warning-border: #e8d49a;
  --warning-text: #6b5a2e;

  /* Meter levels */
  --meter-good: #3e6b45;
  --meter-low: #d4a94e;
  --meter-high: #a8382a;
  --meter-track: #e8e2d4;

  /* Progress */
  --progress-track: #e8e2d4;
  --progress-fill: #c4543a;

  /* Shadows — neutral charcoal-tinted */
  --shadow-xs: 0 1px 2px rgba(58, 62, 66, 0.04);
  --shadow-sm: 0 1px 4px rgba(58, 62, 66, 0.06);
  --shadow-md: 0 4px 16px rgba(58, 62, 66, 0.07);
  --shadow-lg: 0 12px 40px rgba(58, 62, 66, 0.09);
  --shadow-xl: 0 24px 70px rgba(58, 62, 66, 0.10);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* Typography */
  --font-heading: "Fraunces", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: "DM Sans", "Avenir Next", Avenir, "Segoe UI", Optima, system-ui, sans-serif;
  --line-height: 1.6;
  --line-height-tight: 1.25;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.2s;
  --duration-slow: 0.35s;
}

/* --- Font Faces (vendored, no CDN) ---------------------------------------- */
@font-face {
  font-family: "Fraunces";
  src: url("vendor/fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0309, U+0329, U+2000-206F, U+20AC, U+2122, U+2191-2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("vendor/fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F, U+A720-A7FF;
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("vendor/fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0309, U+0329, U+2000-206F, U+20AC, U+2122, U+2191-2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("vendor/fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F, U+A720-A7FF;
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* --- Reset / Base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--text);
  background: var(--background);
  min-height: 100dvh;
}

/* Subtle warm gradient on the page background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(196, 84, 58, 0.04), transparent),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(212, 169, 78, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

/* --- Brand Header --------------------------------------------------------- */
.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 16px 12px;
  user-select: none;
  cursor: pointer;
  transition: opacity var(--duration) var(--ease);
}

.brand:hover {
  opacity: 0.92;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow: var(--shadow-sm), 0 3px 12px rgba(196, 84, 58, 0.28);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.brand:hover .brand-badge {
  transform: scale(1.05);
  box-shadow: var(--shadow-md), 0 5px 16px rgba(196, 84, 58, 0.35);
}

.brand-svg {
  display: block;
  border-radius: 50%;
}

.brand-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-license-suffix {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: inherit;
  color: var(--text);
  letter-spacing: inherit;
}

.brand-license-suffix.hidden {
  display: none;
}

.brand-subtitle {
  font-family: var(--font-body);
  font-size: 0.775rem;
  color: var(--muted);
  letter-spacing: 0.015em;
  font-weight: 500;
  margin-top: 3px;
}

/* --- Layout --------------------------------------------------------------- */
.container {
  position: relative;
  z-index: 1;
  max-width: 715px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

/* --- View Card ------------------------------------------------------------ */
.view {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
  animation: view-enter var(--duration-slow) var(--ease) both;
}

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

.hidden { display: none !important; }

/* --- Typography ----------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--text);
  line-height: var(--line-height-tight);
  text-wrap: balance;
  letter-spacing: -0.015em;
}

h1 {
  font-size: 1.75rem;
  font-weight: 500;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

p {
  text-wrap: pretty;
}

/* --- Hints & Notices ------------------------------------------------------ */
.hint {
  color: var(--muted);
  font-size: 0.925rem;
  line-height: 1.55;
  margin-top: 8px;
}

.notice {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 0.925rem;
  line-height: 1.55;
  color: var(--warning-text);
  margin: 16px 0;
}

/* --- Processing Notices (Upload vs Server-Processing) ----------------------- */
.processing-notice {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 0.925rem;
  line-height: 1.5;
  margin: 18px 0 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.processing-notice.notice-uploading {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

.processing-notice.notice-success {
  background: #eef6f0;
  border: 1px solid #b8dac0;
  color: #234728;
}

.processing-notice-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.processing-notice-text {
  font-size: 0.885rem;
  opacity: 0.92;
  line-height: 1.45;
}

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--secondary);
  background: var(--secondary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  color: var(--secondary-text);
  min-height: 44px;
  transition:
    background var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    transform var(--duration) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
  min-height: 34px;
}

.btn:hover {
  background: var(--secondary-hover);
  border-color: var(--secondary-hover);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  background: var(--secondary-active);
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Primary */
.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm), 0 2px 8px rgba(196, 84, 58, 0.18);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-md), 0 4px 14px rgba(196, 84, 58, 0.22);
}

.btn-primary:active {
  background: var(--primary-active);
}

/* Danger */
.btn-danger {
  background: var(--danger);
  color: var(--danger-text);
  border-color: var(--danger);
  box-shadow: var(--shadow-sm), 0 2px 8px rgba(168, 56, 42, 0.18);
}

.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  box-shadow: var(--shadow-md), 0 4px 14px rgba(168, 56, 42, 0.22);
}

/* Link button — plain text, no box */
.btn-link {
  border: none;
  background: none;
  color: var(--muted);
  padding: 8px 4px;
  text-decoration: underline;
  text-decoration-color: rgba(122, 126, 133, 0.3);
  text-underline-offset: 3px;
  border-radius: 0;
  min-height: auto;
  font-size: 0.9rem;
}

.btn-link:hover {
  background: none;
  color: var(--text-secondary);
  text-decoration-color: var(--text-secondary);
}

/* --- Forms ---------------------------------------------------------------- */
label {
  display: block;
  margin: 20px 0 8px;
  font-weight: 500;
  font-size: 0.925rem;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  transition:
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.4;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%238c7e6a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
select:hover,
textarea:hover {
  border-color: #d0c9b8;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 110, 140, 0.12);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

/* --- Meters --------------------------------------------------------------- */
.meter {
  height: 10px;
  background: var(--meter-track);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 18px 0;
}

.meter .bar {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--meter-good);
  transition: width 0.12s linear, background var(--duration) var(--ease);
}

.meter .bar.low { background: var(--meter-low); }
.meter .bar.high { background: var(--meter-high); }
.meter .bar.good { background: var(--meter-good); }

#meter-hint {
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.4em;
  transition: color var(--duration) var(--ease);
}

/* --- Divider -------------------------------------------------------------- */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 20px 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* --- Recording Indicator -------------------------------------------------- */
.rec-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
  margin: 20px 0;
  letter-spacing: 0.02em;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(168, 56, 42, 0.18);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(168, 56, 42, 0.18); }
  50% { opacity: 0.4; box-shadow: 0 0 0 6px rgba(168, 56, 42, 0.08); }
}

/* --- Progress Bar --------------------------------------------------------- */
.progress {
  height: 8px;
  background: var(--progress-track);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 16px 0;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  border-radius: var(--radius-pill);
  transition: width 0.3s var(--ease);
}

.progress-fill.uploading {
  background: linear-gradient(
    90deg,
    var(--primary) 0%,
    #e88065 50%,
    var(--primary) 100%
  );
  background-size: 200% 100%;
  animation: upload-shimmer 1.8s infinite linear;
}

@keyframes upload-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.upload-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: -6px;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
  gap: 8px;
  flex-wrap: wrap;
}

.upload-stats-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-stats-eta {
  font-weight: 600;
  color: var(--primary);
  background: rgba(196, 84, 58, 0.09);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#status-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* --- Selected File Card in Meta View -------------------------------------- */
.file-meta-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.file-meta-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

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

.file-meta-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.file-meta-est-time {
  color: var(--primary);
  font-weight: 500;
}

.file-meta-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta-size {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.file-meta-card .btn {
  flex-shrink: 0;
  width: auto;
}

/* --- Transcript / Pre ----------------------------------------------------- */
pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--surface-inset);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  font-size: 0.9rem;
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 14px 0;
}

/* --- Details / Summary ---------------------------------------------------- */
details {
  margin-top: 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

details summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 14px 18px;
  color: var(--text);
  background: var(--surface-raised);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--duration) var(--ease);
  user-select: none;
}

details summary::-webkit-details-marker { display: none; }

details summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform var(--duration) var(--ease);
  flex-shrink: 0;
}

details[open] summary::before {
  transform: rotate(45deg);
}

details summary:hover {
  background: var(--surface-inset);
}

details > pre {
  margin: 0 18px 18px;
  padding: 14px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
}

details > .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 16px 18px 14px;
  padding: 10px 20px;
  box-sizing: border-box;
  max-width: calc(100% - 36px);
  width: auto;
  font-size: 0.9rem;
  text-align: center;
  white-space: normal;
  line-height: 1.3;
}

/* --- Actions Row ---------------------------------------------------------- */
.actions {
  display: flex;
  gap: 10px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.actions-bottom {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

/* Start screen: center buttons + divider */
#view-home .btn,
#view-home .divider {
  margin-left: auto;
  margin-right: auto;
  display: flex;
}

#view-home .divider {
  width: fit-content;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Beschriftung oben, darunter zwei gleich breite Felder: Auswahl links,
   Test-Knopf rechts. Beide teilen sich die Karte hälftig (minus Abstand). */
.field-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.field-row > select,
.field-row > .btn {
  /* Hälftig abzüglich des halben Abstands: `flex: 1 1 0` verteilt bei
     Formularelementen nicht gleichmäßig (Firefox: 318 vs 290 px gemessen). */
  flex: 0 0 calc(50% - 5px);
  width: calc(50% - 5px);
  min-width: 0;
}

.field-row > .btn {
  white-space: nowrap;
}

/* --- Markdown Output ------------------------------------------------------ */
.markdown {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
  margin: 16px 0;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
  font-family: var(--font-heading);
  margin: 1em 0 0.35em;
  line-height: var(--line-height-tight);
}

.markdown h1:first-child,
.markdown h2:first-child {
  margin-top: 0;
}

.markdown h2 { font-size: 1.2rem; }
.markdown h3 { font-size: 1.05rem; }
.markdown h4 { font-size: 0.95rem; font-weight: 600; }

.markdown p { margin: 0.5em 0; }

.markdown ul,
.markdown ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.markdown li {
  margin: 0.2em 0;
  line-height: 1.6;
}

.markdown strong { font-weight: 600; color: var(--text); }

.markdown code {
  background: var(--surface-inset);
  border: 1px solid var(--border-light);
  padding: 1px 6px;
  border-radius: 5px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 0.88em;
  color: var(--text-secondary);
}

.markdown blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 16px;
  margin: 0.8em 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* --- Meta Row ------------------------------------------------------------- */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 12px 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 12px 16px;
  background: var(--surface-inset);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.meta-item strong {
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding: 12px 14px 40px;
  }

  .view {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }

  .actions .btn {
    width: 100%;
  }

  .actions-bottom {
    flex-direction: column;
  }

  .actions-bottom .btn {
    width: 100%;
  }

  .row {
    flex-direction: column;
  }

  .row .btn {
    width: 100%;
  }

  .brand {
    padding: 24px 14px 4px;
  }
}

/* --- Reduced Motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  max-width: 715px;
  margin: 0 auto;
  padding: 8px 20px 0;
  flex-wrap: wrap;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  background: var(--surface-inset);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:hover {
  background: #ded5bf;
  color: var(--text);
  border-color: var(--border);
}

.nav-item.active {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border-light);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

.nav-item.active:hover {
  background: var(--surface);
  color: var(--primary-hover);
  border-color: var(--border-light);
  box-shadow: var(--shadow-xs);
}

.nav-item.logout {
  color: var(--danger);
  background: rgba(168, 56, 42, 0.08);
  border-color: rgba(168, 56, 42, 0.16);
  margin-left: auto;
}

.nav-item.logout:hover {
  background: rgba(168, 56, 42, 0.16);
  border-color: rgba(168, 56, 42, 0.28);
  color: var(--danger-hover);
}

/* Hide nav on auth views */
body.auth-mode .nav {
  display: none;
}

/* ==========================================================================
   Auth Views (Login / Setup)
   ========================================================================== */
.view-auth {
  max-width: 420px;
  margin: 40px auto 0;
  text-align: center;
}

.view-auth h1 {
  margin-bottom: 16px;
}

.view-auth .auth-form {
  text-align: left;
  margin-top: 24px;
}

.view-auth .auth-error {
  background: rgba(168, 56, 42, 0.08);
  border: 1px solid rgba(168, 56, 42, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--danger);
  margin-top: 16px;
  display: none;
}

.view-auth .auth-error.visible {
  display: block;
}

.view-auth .btn-primary {
  width: 100%;
  margin-top: 20px;
}

/* ==========================================================================
   Settings Page
   ========================================================================== */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
  overflow-x: auto;
}

.settings-tab {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: none;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}

.settings-tab:hover {
  background: var(--surface-inset);
  color: var(--text-secondary);
}

.settings-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(196, 84, 58, 0.15);
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-panel .field-group {
  margin-bottom: 20px;
}

.settings-panel .field-helper {
  font-size: 0.825rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

.settings-panel .btn-save {
  margin-top: 24px;
}

/* Provider sections & LLM testing */
.provider-section {
  padding: 14px 0 6px;
  border-top: 1px solid var(--border-light);
}

.input-action-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 4px;
  flex-wrap: wrap;
}

.input-action-row input {
  flex: 1;
  min-width: 200px;
}

.btn-test-llm {
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 0.85rem;
  min-height: 42px;
  flex-shrink: 0;
}

.llm-test-status {
  display: none;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.4;
}

.llm-test-status.visible {
  display: block;
}

.llm-test-status.loading {
  background: var(--surface-inset);
  color: var(--muted);
  border: 1px solid var(--border-light);
}

.llm-test-status.success {
  background: rgba(62, 107, 69, 0.1);
  color: var(--success);
  border: 1px solid rgba(62, 107, 69, 0.25);
}

.llm-test-status.error {
  background: rgba(168, 56, 42, 0.1);
  color: var(--danger);
  border: 1px solid rgba(168, 56, 42, 0.25);
}

.llm-model-select {
  margin-top: 4px;
  margin-bottom: 6px;
}

/* Checkbox styling */
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
}

.checkbox-field input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-field label {
  margin: 0;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.925rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Sessions List
   ========================================================================== */
.sessions-list {
  margin: 16px 0;
}

.session-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

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

.session-label {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 4px;
}

.session-meta {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.session-meta span {
  display: block;
}

.session-actions {
  flex-shrink: 0;
}

.session-actions .btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  min-height: 36px;
}

.sessions-actions-top {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  margin-bottom: 16px;
}

/* ==========================================================================
   Jobs Page
   ========================================================================== */
.jobs-list {
  margin: 16px 0;
}

.job-item {
  padding: 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.job-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.job-title {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-status {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.job-status.status-waiting {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.job-status.status-transcribing {
  background: rgba(14, 110, 140, 0.1);
  color: var(--border-focus);
}

.job-status.status-summarizing {
  background: rgba(14, 110, 140, 0.1);
  color: var(--border-focus);
}

.job-status.status-done {
  background: rgba(62, 107, 69, 0.1);
  color: var(--success);
}

.job-status.status-failed {
  background: rgba(168, 56, 42, 0.1);
  color: var(--danger);
}

.job-status.status-cancelled {
  background: var(--surface-inset);
  color: var(--muted);
}

.job-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.job-progress {
  margin: 10px 0;
}

.job-progress-bar {
  height: 6px;
  background: var(--progress-track);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.job-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  border-radius: var(--radius-pill);
  transition: width 0.5s var(--ease);
}

.job-progress-text {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.job-error {
  font-size: 0.85rem;
  color: var(--danger);
  margin-top: 8px;
  line-height: 1.4;
}

.job-actions {
  margin-top: 12px;
}

.job-actions .btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  min-height: 36px;
}

.jobs-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-enter 0.3s var(--ease) both;
  max-width: 360px;
}

.toast.toast-success {
  background: var(--success);
  color: var(--success-text);
}

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

.toast.toast-exit {
  animation: toast-exit 0.25s var(--ease) both;
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-exit {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* ==========================================================================
   Fertigmeldung im Hintergrund (ADR-27)
   Stehende, schließbare Infobox. Sie erscheint nur, wenn ein anderes Meeting
   fertig wird, während in diesem Tab etwas läuft; der Klick öffnet ein neues
   Tab, damit die laufende Aufnahme oder der Upload unberührt bleibt.
   ========================================================================== */
.notice-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}

.meeting-notice {
  position: relative;
  padding: 14px 38px 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-body);
  animation: toast-enter 0.3s var(--ease) both;
}

.meeting-notice-done {
  border-left: 4px solid var(--success);
}

.meeting-notice-failed {
  border-left: 4px solid var(--danger);
}

/* Abgebrochen: weder Erfolg noch Fehler — der neutrale Balken sagt „vorbei,
   ohne Ergebnis". Ohne diese Regel fiele die Box auf den Standardrahmen
   zurück und sähe aus wie eine gewöhnliche Meldung. */
.meeting-notice-cancelled {
  border-left: 4px solid var(--muted);
}

.meeting-notice-heading {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text);
}

.meeting-notice-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.meeting-notice-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--muted);
}

.meeting-notice-close:hover {
  color: var(--text);
}

.meeting-notice-action {
  display: inline-block;
  text-decoration: none;
}

/* ==========================================================================
   Aufnahme-Leiste (ADR-29)
   Hält eine laufende Aufnahme über alle Ansichten hinweg sichtbar – inklusive
   Uhr – und führt mit einem Klick zurück. Damit kann das Verlassen einer
   Aufnahme sie nie mehr aus den Augen verlieren.
   ========================================================================== */
.recording-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--danger);
  color: var(--danger-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  box-shadow: 0 -6px 24px rgba(58, 62, 66, 0.18);
}

.recording-bar-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  animation: recording-pulse 1.4s ease-in-out infinite;
}

.recording-bar-text {
  font-weight: 600;
}

.recording-bar-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.recording-bar-return {
  margin-left: auto;
}

/* --- Pause der Aufnahme --------------------------------------------------- */
/* Kein weißer Knopf auf weißem Papier: der Grund ist immer leicht getönt,
   damit die Kante nicht die einzige Form ist (Rückmeldung aus dem Betrieb). */
.btn-secondary {
  background: var(--surface-inset);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-inset-hover);
}

/* „Aufnahme beenden" ist die normale Handlung, nicht die gefährliche:
   getönte Fläche mit dunkler Kontur — ruhig, aber eindeutig ein Knopf. */
.btn-neutral {
  background: var(--surface-inset);
  color: var(--text);
  border: 1px solid var(--text-secondary);
}

.btn-neutral:hover {
  background: var(--surface-inset-hover);
}

/* „Aufnahme verwerfen" löscht Ton. Rot, aber als Kontur — damit Löschen nicht
   lauter aussieht als Fertigwerden. */
.btn-danger-outline {
  background: var(--primary-light);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger-outline:hover {
  background: var(--danger);
  color: var(--danger-text);
}

/* Pausiert: Punkt steht still und wird bernsteinfarben statt rot. */
.rec-indicator.paused .dot {
  background: #d98324;
  box-shadow: 0 0 0 3px rgba(217, 131, 36, 0.18);
  animation: none;
}

.recording-bar.paused .recording-bar-dot {
  animation: none;
}

@keyframes recording-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* Damit die Leiste nichts verdeckt. */
body.recording-active {
  padding-bottom: 56px;
}

body.recording-active .notice-stack {
  bottom: 76px;
}

@media (max-width: 600px) {
  .notice-stack {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }

  .recording-bar {
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .recording-bar-return {
    margin-left: 0;
    width: 100%;
  }

  body.recording-active .notice-stack {
    bottom: 110px;
  }
}

/* ==========================================================================
   Prompt-Vorlagen im LLM-Panel (ADR-6)
   Bearbeitbar und auf den ausgelieferten Standard zurücksetzbar.
   ========================================================================== */
.settings-subheading {
  margin: 24px 0 6px;
  font-size: 1rem;
  font-weight: 700;
}

.template-editor {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.template-editor-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.template-editor-title {
  font-weight: 600;
  color: var(--text);
}

.template-editor-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-active);
  font-size: 0.75rem;
  font-weight: 600;
}

.template-editor-text {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.template-editor-text:focus {
  outline: none;
  border-color: var(--border-focus);
}

.template-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* ==========================================================================
   Löschprotokoll & Komplettlöschung (ADR-30)
   ========================================================================== */
.deletion-status {
  margin: 6px 0 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.deletion-status-warning {
  color: var(--danger);
  font-weight: 600;
}

.deletion-stats {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
}

.field-warning {
  color: var(--danger);
  font-weight: 600;
}

.settings-warnings {
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-warning,
.diagnostics-warning {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #b45309;
  font-size: 0.85rem;
  line-height: 1.4;
}

.diagnostics-summary {
  margin: 6px 0 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.diagnostics-warnings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#btn-deletion-export {
  text-decoration: none;
}

.deletion-log {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.deletion-entry {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.deletion-entry:last-child {
  border-bottom: none;
}

.deletion-empty {
  padding: 14px 10px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.delete-zone {
  margin-top: 26px;
  padding: 16px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

/* Im Kasten braucht die Überschrift keinen Abstand nach oben — der Innenabstand
   des Kastens genügt. Sonst stehen 40 px zwischen Rahmen und Text. */
.delete-zone .settings-subheading {
  margin-top: 0;
}

/* Etwas Luft zwischen Erklärtext und dem roten Knopf. */
.delete-zone .field-helper {
  margin-bottom: 16px;
}

.wipe-confirm {
  margin-top: 12px;
}

.wipe-confirm input {
  width: 100%;
  max-width: 320px;
}

/* ==========================================================================
   Ansage-Dialog (ADR-35)
   Das erste Modal der App. Es erscheint, wenn die Aufnahme bereits läuft: der
   Text ist zum Vorlesen gedacht, die Bestätigung bleibt mündlich. Deshalb
   verdunkelt der Dialog den Hintergrund, hält aber nichts an — „Verstanden"
   und Escape schließen ihn, die Aufnahme läuft weiter.
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  /* Über Aufnahmeleiste (9999) und Hinweis-Stapel (9998). */
  z-index: 10000;
  display: flex;
  /* Oben ausrichten und selbst scrollen: bei kleinem Fenster ist der Dialog
     höher als der Bildschirm, und mit `center` wäre sein Kopf unerreichbar. */
  align-items: flex-start;
  overflow-y: auto;
  padding: 5vh 20px;
  background: rgba(58, 62, 66, 0.55);
}

.modal {
  width: 100%;
  max-width: 520px;
  /* auto zentriert, solange Platz ist — und lässt oben Luft, wenn nicht. */
  margin: auto;
  padding: 26px 26px 22px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.modal p {
  margin: 0;
  line-height: 1.6;
  color: var(--text);
}

.modal .row {
  margin-top: 22px;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 600px) {
  .file-meta-card {
    padding: 14px 14px 12px;
    gap: 10px 12px;
  }

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

  .file-meta-card .btn {
    width: 100%;
    margin-top: 6px;
    justify-content: center;
    text-align: center;
  }

  details > .btn {
    width: calc(100% - 36px);
    display: flex;
    margin: 16px 18px 14px;
  }

  .input-action-row {
    flex-direction: column;
    gap: 8px;
  }

  .input-action-row input {
    width: 100%;
    min-width: 0;
  }

  .btn-test-llm {
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .nav {
    gap: 4px;
    padding: 6px 14px 0;
  }

  .nav-item {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .settings-tabs {
    gap: 2px;
  }

  .settings-tab {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .file-meta-card {
    padding: 14px 14px 12px;
    gap: 10px 12px;
  }

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

  .file-meta-card .btn {
    width: 100%;
    margin-top: 6px;
    justify-content: center;
    text-align: center;
  }

  .session-item {
    flex-direction: column;
    gap: 12px;
  }

  .session-actions {
    align-self: flex-end;
  }

  .job-header {
    flex-direction: column;
    gap: 8px;
  }

  .job-status {
    align-self: flex-start;
  }

  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .toast {
    max-width: 100%;
  }

  details > .btn {
    width: calc(100% - 36px);
    display: flex;
    margin: 16px 18px 14px;
  }

  .input-action-row {
    flex-direction: column;
    gap: 8px;
  }

  .input-action-row input {
    width: 100%;
    min-width: 0;
  }

  .btn-test-llm {
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}
