:root {
  color-scheme: light;
  --app-bg: #fdfdfd;
  --header-bg: #fdfdfd;
  --rail-bg: #fdfdfd;
  --page-text: #212529;
  --page-muted: #6c757d;
  --brand-detail: #404040;
  --card: #fdfdfd;
  --card-text: #212529;
  --card-muted: #6c757d;
  --border: #c0c0c0;
  --border-strong: #9fa2a5;
  --control-bg: #fdfdfd;
  --control-hover: #fff0f2;
  --divider: #dedede;
  --dialog-bg: #fdfdfd;
  --input-bg: #fdfdfd;
  --field-text: #404040;
  --skeleton-a: #fff0f2;
  --skeleton-b: #fdfdfd;
  --skeleton-border: #efd0d5;
  --danger-border: #d99089;
  --primary: #d30422;
  --primary-hover: #ad031c;
  --primary-soft: #fff0f2;
  --success: #2f855a;
  --warning: #b26a00;
  --danger: #b42318;
  --link: #0056b3;
  --font: "Segoe UI Variable", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --app-bg: #1a202c;
  --header-bg: #1a202c;
  --rail-bg: #1a202c;
  --page-text: #e0e0e0;
  --page-muted: #c5c9cf;
  --brand-detail: #e0e0e0;
  --card: #1a202c;
  --card-text: #f2f3f5;
  --card-muted: #c5c9cf;
  --border: #4a5568;
  --border-strong: #718096;
  --control-bg: #1a202c;
  --control-hover: #232b3a;
  --divider: #4a5568;
  --dialog-bg: #1a202c;
  --input-bg: #1a202c;
  --field-text: #e0e0e0;
  --skeleton-a: #2b1c24;
  --skeleton-b: #1a202c;
  --skeleton-border: #4a5568;
  --danger-border: #c05660;
  --primary-soft: #2b1c24;
  --success: #68d391;
  --warning: #f6ad55;
  --danger: #fc8181;
  --link: #8ab8ff;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--app-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--page-text);
  background: var(--app-bg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea { font: inherit; }

button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(211 4 34 / 24%);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(90px, auto) auto minmax(0, 1fr);
  background: var(--app-bg);
}

.app-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 28px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-lockup {
  width: 151px;
  flex: none;
  display: grid;
  justify-items: center;
}

.brand-wordmark {
  width: 151px;
  height: 47px;
  fill: var(--primary);
}

.brand-caption {
  margin-top: -1px;
  color: var(--brand-detail);
  font-size: 10px;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
}

.brand-mark {
  width: 64px;
  height: 64px;
  flex: none;
}

.mark-lower { fill: var(--brand-detail); }
.mark-wave { stroke: var(--primary); }

.brand-name {
  overflow: hidden;
  color: var(--brand-detail);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--page-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.service-status-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.service-status-available { color: var(--success); }
.service-status-degraded { color: var(--warning); }
.service-status-unavailable,
.service-status-not_configured { color: var(--danger); }

.migration-banner {
  position: relative;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  color: var(--card-text);
  background: var(--primary-soft);
  border-bottom: 1px solid var(--primary);
}

.migration-banner div { min-width: 0; }
.migration-banner strong { display: block; }
.migration-banner span {
  display: block;
  margin-top: 3px;
  color: var(--card-muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.migration-banner .primary-button { flex: none; text-decoration: none; }

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.sidebar {
  min-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  padding: 26px 16px 18px;
  background: var(--rail-bg);
  border-right: 1px solid var(--border);
}

.sidebar-heading h1,
.detail-header h2,
.welcome-state h2 {
  margin: 0;
  color: var(--page-text);
}

.sidebar-heading h1 { font-size: 22px; }

.sidebar-heading .primary-button {
  width: 100%;
  margin-top: 14px;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.back-button,
.reader-back,
.record-action-button {
  min-height: 42px;
  border-radius: 4px;
  font-weight: 650;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
}

.primary-button:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.primary-button svg,
.back-button svg,
.reader-back svg,
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.secondary-button,
.icon-button,
.back-button,
.reader-back {
  padding: 0 14px;
  color: var(--card-text);
  background: var(--control-bg);
  border: 1px solid var(--border);
}

.secondary-button:hover,
.icon-button:hover,
.back-button:hover,
.reader-back:hover {
  color: var(--primary);
  background: var(--control-hover);
  border-color: var(--primary);
}

.compact { min-height: 40px; }

.icon-button {
  width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.back-button {
  display: none;
  align-items: center;
  gap: 6px;
}

.reader-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

@media (min-width: 761px) {
  .reader-back {
    min-height: auto;
    padding: 2px 0;
    color: var(--page-muted);
    background: transparent;
    border: 0;
    border-radius: 2px;
  }

  .reader-back:hover {
    color: var(--primary);
    background: transparent;
    border-color: transparent;
  }

  .reader-back:focus-visible {
    color: var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 4px;
  }
}

.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }
:root[data-theme="dark"] .theme-icon-light { display: none; }

.authors-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.author-row {
  width: 100%;
  min-height: 67px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  gap: 10px;
  align-items: center;
  padding: 12px 10px 12px 14px;
  color: var(--card-text);
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.author-row:hover,
.author-row.selected { border-color: var(--primary); }

.author-row.selected { box-shadow: inset 4px 0 0 var(--primary); }

.author-row-title,
.author-row-meta { display: block; min-width: 0; }
.author-row-copy { min-width: 0; }

.author-row-meta-line,
.detail-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.author-row-title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-lock-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 36%, transparent);
  border-radius: 999px;
}

.author-lock-badge svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.author-row-meta {
  color: var(--card-muted);
  font-size: 12px;
  line-height: 1.35;
}

.author-row-meta-line {
  flex-wrap: wrap;
  margin-top: 5px;
}

.author-row > svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.main-content {
  min-width: 0;
  padding: 32px 38px 48px;
  background: var(--app-bg);
}

.welcome-state {
  min-height: calc(100vh - 170px);
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.welcome-mark { width: 96px; height: 96px; }
.welcome-state h2 { margin-top: 18px; font-size: 32px; }
.welcome-state p { margin: 9px 0 0; color: var(--page-muted); font-size: 17px; }

.author-detail { width: min(100%, 1050px); margin: 0 auto; }

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.detail-header h2 { font-size: clamp(30px, 4vw, 46px); line-height: 1.08; }
.detail-title-row { flex-wrap: wrap; }
.detail-title-row .author-lock-badge { padding: 5px 9px; font-size: 12px; }
.detail-count { margin: 10px 0 0; color: var(--page-muted); }
.detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.records-list { display: grid; gap: 26px; }
.date-group { display: grid; gap: 12px; }
.date-heading { margin: 0; color: var(--page-text); font-size: 16px; }

.record {
  overflow: hidden;
  color: var(--card-text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.record:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

.record-summary {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 70px 130px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  color: inherit;
  text-align: left;
  background: var(--card);
  border: 0;
}

button.record-summary:hover { background: var(--primary-soft); }
.record-time { font-size: 17px; font-weight: 700; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.status svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.status-completed { color: var(--success); }
.status-failed { color: var(--danger); }
.status-processing,
.status-uploading { color: var(--warning); }

.status-ring {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.record-helper {
  overflow: hidden;
  color: var(--card-muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-helper.error { color: var(--danger); }
.disclosure-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform 150ms ease; }
.record.expanded .disclosure-icon { transform: rotate(180deg); }
.record-mode { padding: 0 18px 12px; color: var(--card-muted); font-size: 12px; }

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--divider);
}

.record-action-link,
.record-action-button,
.text-button {
  color: var(--link);
  background: transparent;
  border: 0;
  font-weight: 650;
  text-decoration: none;
}

.record-action-link:hover,
.record-action-button:hover,
.text-button:hover { color: var(--primary); }

.record-action-button { min-height: 30px; padding: 0; }
.mail-delivery { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mail-delivery-label { color: var(--card-muted); font-size: 13px; }
.mail-delivery-sent .mail-delivery-label { color: var(--success); }
.mail-delivery-failed .mail-delivery-label { color: var(--danger); }

.record-text {
  padding: 18px;
  white-space: pre-wrap;
  border-top: 1px solid var(--divider);
  font-size: 15px;
  line-height: 1.65;
}

.transcription-reader {
  width: min(100%, 860px);
  margin: 0 auto;
}

.reader-header { margin-bottom: 18px; }
.reader-author {
  margin: 0 0 7px;
  color: var(--page-muted);
  font-size: 15px;
  font-weight: 650;
}
.reader-title {
  margin: 0;
  color: var(--page-text);
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
}
.reader-metadata {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 18px;
  color: var(--page-muted);
}
.reader-date,
.reader-mode { font-size: 14px; }
.reader-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-bottom: 18px;
  padding: 14px 16px;
  color: var(--card-text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.reader-speaker-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  color: var(--card-text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.reader-speaker-view {
  display: inline-flex;
  flex: none;
  gap: 3px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.reader-speaker-view legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.reader-speaker-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.reader-speaker-choice:has(input:checked) {
  color: var(--card-text);
  background: var(--primary-soft);
}
.reader-speaker-choice input[type="radio"] {
  width: 17px;
  min-height: 17px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}
.reader-speaker-status {
  flex: 1 1 280px;
  margin: 0;
  color: var(--card-muted);
  font-size: 13px;
  line-height: 1.45;
}
.reader-speaker-unavailable { border-style: dashed; }
.meeting-protocol-panel {
  display: grid;
  min-width: 0;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  overflow-wrap: anywhere;
  color: var(--card-text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.meeting-protocol-title { margin: 0; font-size: 19px; }
.meeting-protocol-content {
  display: grid;
  min-width: 0;
  gap: 10px;
}
.meeting-protocol-content p { min-width: 0; margin: 0; line-height: 1.5; }
.meeting-protocol-template,
.meeting-protocol-copy,
.meeting-protocol-generated { color: var(--card-muted); }
.meeting-protocol-generated { font-size: 13px; }
.meeting-protocol-warning {
  padding: 10px 12px;
  color: var(--field-text);
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
}
.meeting-protocol-error { color: var(--danger); }
.meeting-protocol-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.meeting-protocol-actions > button,
.meeting-protocol-content > button {
  max-width: 100%;
  white-space: normal;
}
.meeting-protocol-content > button,
.meeting-protocol-download { justify-self: start; }
.meeting-protocol-download { max-width: 100%; }
.reader-text {
  min-width: 0;
  padding: clamp(20px, 4vw, 38px);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--card-text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: clamp(16px, 1.7vw, 18px);
  line-height: 1.75;
  user-select: text;
}
.reader-text:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.reader-speaker-label {
  padding: 1px 3px;
  color: var(--link);
  background: color-mix(in srgb, var(--primary-soft) 74%, transparent);
  border-radius: 4px;
  font-weight: 700;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
  user-select: text;
}
.reader-speaker-label:hover { color: var(--primary); }
.reader-speaker-label:focus-visible {
  outline: 3px solid rgb(211 4 34 / 24%);
  outline-offset: 2px;
}
.reader-state { min-height: 150px; display: grid; align-content: center; }

.empty-state,
.error-state,
.dialog-loading {
  padding: 24px;
  color: var(--card-text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.empty-state strong,
.error-state strong { font-size: 17px; }
.empty-state p,
.error-state p { margin: 7px 0 0; color: var(--card-muted); line-height: 1.5; }
.compact-empty { padding: 16px; }
.error-state .secondary-button { margin-top: 14px; }

.content-lock-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 26px;
  color: var(--card-text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.content-lock-state > svg {
  width: 34px;
  height: 34px;
  color: var(--primary);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.content-lock-state strong { font-size: 19px; }
.content-lock-state > p { margin: 0; color: var(--card-muted); line-height: 1.5; }
.content-unlock-form { width: min(100%, 430px); margin-top: 5px; }
.content-unlock-form .primary-button { margin-top: 14px; }

.skeleton-list { display: grid; gap: 10px; }
.skeleton-row {
  min-height: 67px;
  background: linear-gradient(90deg, var(--skeleton-a) 20%, var(--skeleton-b) 45%, var(--skeleton-a) 70%);
  background-size: 250% 100%;
  border: 1px solid var(--skeleton-border);
  border-radius: 10px;
  animation: shimmer 1.3s linear infinite;
}

@keyframes shimmer { to { background-position: -250% 0; } }

.app-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 24px;
  overflow: auto;
  color: var(--card-text);
  background: var(--dialog-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}

.app-dialog::backdrop { background: rgb(15 18 25 / 72%); }
.confirm-dialog { width: min(500px, calc(100vw - 32px)); }
.portal-access-dialog { width: min(480px, calc(100vw - 32px)); }
.speaker-correction-dialog { width: min(620px, calc(100vw - 32px)); }
.portal-access-dialog::backdrop {
  background: rgb(15 18 25 / 82%);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.dialog-header h2 { margin: 0; color: var(--card-text); font-size: 26px; }
.dialog-header p { margin: 6px 0 0; color: var(--card-muted); line-height: 1.45; }
.dialog-header .icon-button { flex: none; }

.speaker-correction-sections { display: grid; gap: 14px; }
.speaker-correction-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--divider);
  border-radius: 8px;
}
.speaker-correction-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.speaker-correction-section:nth-child(2) {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.protocol-template-settings {
  display: grid;
  min-width: 0;
  gap: 10px;
  margin: 18px 0;
  padding: 15px;
  overflow-wrap: anywhere;
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.protocol-template-settings h3 { margin: 0; font-size: 17px; }
.protocol-template-settings label,
.protocol-template-settings select { min-width: 0; }
.protocol-template-settings .form-note,
.protocol-template-settings .field-error { margin-top: 0; }
.protocol-template-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.protocol-template-actions > button { max-width: 100%; white-space: normal; }

.full-width { grid-column: 1 / -1; }
label { display: grid; gap: 7px; }
.field-label { color: var(--field-text); font-size: 13px; font-weight: 700; }

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--card-text);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

input:focus,
select:focus,
textarea:focus { border-color: var(--primary); }
input.invalid { border-color: var(--danger); }

textarea {
  resize: vertical;
  line-height: 1.45;
}

.portal-code-input {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: .3em;
  text-align: center;
}

.enabled-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 17px;
  color: var(--field-text);
  line-height: 1.4;
}

.enabled-toggle input[type="checkbox"] {
  appearance: none;
  width: 20px;
  min-width: 20px;
  min-height: 20px;
  margin: 1px 0 0;
  display: grid;
  place-content: center;
  background: var(--input-bg);
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  transition: background 120ms ease, border-color 120ms ease;
}

.enabled-toggle input[type="checkbox"]::before {
  width: 9px;
  height: 5px;
  content: "";
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform 120ms ease;
}

.enabled-toggle input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.enabled-toggle input[type="checkbox"]:checked::before {
  transform: translateY(-1px) rotate(-45deg) scale(1);
}

.enabled-toggle input[type="checkbox"]:focus-visible {
  outline: 3px solid rgb(211 4 34 / 24%);
  outline-offset: 2px;
}

.enabled-toggle.nested-toggle {
  margin: 12px 0 0 30px;
  color: var(--card-muted);
  font-size: 14px;
}

.form-note { margin: 10px 0 0; color: var(--card-muted); font-size: 13px; line-height: 1.5; }
.field-error { min-height: 20px; margin: 10px 0 0; color: var(--danger); font-size: 13px; }

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.split-actions { justify-content: flex-start; }
.action-spacer { flex: 1; }

.danger-button {
  padding: 0 14px;
  color: var(--danger);
  background: var(--control-bg);
  border: 1px solid var(--danger-border);
}

.danger-button:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
button:disabled { cursor: wait; opacity: .58; }

.password-settings,
.provider-settings {
  margin: 20px 0 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.password-settings legend,
.provider-settings legend { padding: 0 7px; color: var(--field-text); font-weight: 700; }
.password-settings .enabled-toggle { margin-top: 0; }
#settings-new-password-row { margin-top: 14px; }
.mail-form-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.mail-form-toolbar .form-note { margin: 0; }
.text-button { padding: 5px 0; flex: none; }

.admin-section {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--divider);
}

.admin-section h3 {
  margin: 0;
  color: var(--card-text);
  font-size: 19px;
}

.admin-section > .form-note { margin: 7px 0 16px; }

.release-summary {
  margin-bottom: 18px;
  padding: 15px;
  color: var(--card-text);
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  line-height: 1.5;
}

.release-summary:empty { display: none; }
.release-summary strong { display: block; }
.release-summary p { margin: 5px 0 0; color: var(--card-muted); }
.release-summary a { color: var(--link); }

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(430px, calc(100vw - 32px));
  padding: 13px 16px;
  color: var(--card-text);
  background: var(--dialog-bg);
  border: 1px solid var(--primary);
  border-radius: 4px;
  box-shadow: 0 12px 38px rgb(0 0 0 / 24%);
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 270px minmax(0, 1fr); }
  .main-content { padding-inline: 24px; }
  .record-summary { grid-template-columns: 60px 115px minmax(0, 1fr) 22px; gap: 9px; padding-inline: 13px; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-rows: minmax(72px, auto) auto minmax(0, 1fr); }
  .app-header { min-width: 0; padding: 8px 14px; flex-wrap: wrap; gap: 10px; }
  .brand { gap: 7px; }
  .brand-lockup { width: 86px; }
  .brand-wordmark { width: 86px; height: 27px; }
  .brand-caption { font-size: 6px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-name { font-size: 15px; font-weight: 500; }
  .header-actions { gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
  .service-status {
    width: 30px;
    min-height: 30px;
    justify-content: center;
    padding: 0;
    border: 0;
  }
  .service-status-label { display: none; }
  .theme-toggle,
  .global-settings-button,
  .logout-button,
  #android-update-button { width: 40px; min-height: 40px; }
  .back-button { min-height: 40px; padding: 0 9px; }
  .back-button span { display: none; }
  .detail-open .back-button { display: inline-flex; }

  .migration-banner { align-items: stretch; padding: 12px 14px; }
  .migration-banner .primary-button { padding-inline: 11px; }

  .workspace { display: block; }
  .sidebar { min-height: calc(100vh - 72px); padding: 20px 18px 22px; border-right: 0; }
  .main-content { min-height: calc(100vh - 72px); padding: 22px 18px 110px; }
  .show-authors .main-content { display: none; }
  .detail-open .sidebar { display: none; }
  .detail-open .main-content { display: block; }
  .detail-header { display: grid; gap: 16px; margin-bottom: 22px; }
  .detail-header h2 { font-size: 34px; }
  .detail-actions { justify-content: flex-start; }
  .detail-actions button { flex: 1 1 150px; }
  .welcome-state { min-height: 65vh; }

  .record-summary {
    grid-template-columns: 56px minmax(0, 1fr) 22px;
    gap: 8px;
    padding: 13px;
  }
  .record-summary .status { justify-self: start; }
  .record-helper { grid-column: 1 / 3; grid-row: 2; white-space: normal; }
  .record-summary .disclosure-icon,
  .record-summary .disclosure-spacer { grid-column: 3; grid-row: 1 / 3; }
  .record-mode { padding-inline: 13px; }
  .record-actions { padding-inline: 13px; }
  .reader-back { margin-bottom: 18px; }
  .reader-actions { align-items: flex-start; }
  .reader-actions .mail-delivery { width: 100%; }
  .reader-speaker-controls { align-items: stretch; }
  .reader-speaker-view { width: 100%; }
  .reader-speaker-choice { flex: 1 1 0; justify-content: center; padding-inline: 7px; }
  .meeting-protocol-panel { padding: 14px; }
  .meeting-protocol-actions > button,
  .meeting-protocol-content > button,
  .protocol-template-actions > button { flex: 1 1 100%; justify-content: center; }

  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .app-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); padding: 19px; }
  .dialog-header h2 { font-size: 23px; }
  .dialog-actions > button { flex: 1 1 auto; }
  .speaker-correction-section { grid-template-columns: 1fr; align-items: stretch; padding: 12px; }
  .speaker-correction-section > button,
  .speaker-correction-actions > button { flex: 1 1 100%; }
  .split-actions .action-spacer { display: none; }
  .mail-form-toolbar { display: grid; }
  .release-summary { padding: 13px; }
  .toast { right: 10px; bottom: 10px; }
}

@media (max-width: 520px) {
  .migration-banner { display: grid; }
  .migration-banner .primary-button { width: 100%; }
}

@media (max-width: 380px) {
  .brand-mark,
  .brand-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

.whats-new-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.whats-new-page .app-header { min-height: 72px; }
.whats-new-page .brand-name { display: inline; }
.release-notes-content { max-width: 800px; margin: 0 auto; padding: 32px 24px 64px; }
.release-notes-content h1 { margin: 28px 0 8px; font-size: clamp(28px, 5vw, 36px); font-weight: 650; }
.release-notes-intro { margin: 0 0 32px; color: var(--page-muted); line-height: 1.6; }
.release-note { padding: 24px 0; border-top: 1px solid var(--divider); }
.release-note-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; }
.release-note h2 { margin: 0; font-size: 24px; font-weight: 650; }
.release-note time { color: var(--page-muted); font-size: 14px; }
.release-note ul { margin: 16px 0 0; padding-left: 22px; line-height: 1.65; }
.release-note li + li { margin-top: 8px; }
.release-notes-error { padding: 16px; border: 1px solid var(--danger-border); border-radius: 4px; line-height: 1.6; }
.release-notes-error p { margin: 0 0 16px; }
