/* Shared contrast and alignment rules for every screen. */
:root {
  --muted: #55515f;
  --line: #d5d0de;
  --control-border: #91899c;
}

.ui-button,
.new-project,
.sidebar-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.4;
}
.new-project,
.sidebar-nav button { justify-content: flex-start; }
.ui-button .button-icon,
button > span[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin: 0;
}
.button-icon svg { width: 18px; height: 18px; }
.ui-button.icon-button { gap: 0; }
.icon-button svg { width: 20px; height: 20px; }
.icon-button {
  background: #fff;
  color: #37313f;
  border: 1px solid #b5adbf;
}
.icon-button:hover {
  background: #e6def9;
  border-color: #796397;
}
.sidebar-user .icon-button { border-color: transparent; }
.sidebar-user .icon-button:hover { background: #383141; color: #fff; }
.sidebar-nav button,
.project-list button { color: #ede9f4; }
.sidebar-search,
.sidebar-search input::placeholder,
.project-list button small,
.project-list .empty,
.sidebar-user small { color: #cac3d5; }
.sidebar-search { border: 1px solid #6e657c; }
.sidebar-search input { border: 0; }
.sidebar-search input:focus-visible { outline-offset: -3px; }

input, textarea, select {
  min-width: 0;
  border-color: var(--control-border);
  background: #f8f7fa;
}
input::placeholder, textarea::placeholder { opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: #624787; }
input:disabled, select:disabled, textarea:disabled,
input[readonly] { color: #55515f; opacity: 1; background: #efedf3; }
.check input { flex: 0 0 20px; height: 20px; margin: 0; }
button:disabled {
  opacity: 1;
  color: #5b5566;
  background: #e7e3ed;
  border-color: #b5adbf;
  cursor: not-allowed;
}
button.primary:disabled,
.send:disabled,
.ui-button.primary:disabled {
  background: #e7e3ed;
  color: #5b5566;
}
button.send:not(:disabled):hover { background: #433373; color: #fff; }
.send:not(:disabled) { border: 1px solid #171719; }

/* Foreground and background must switch together, without a low-contrast tween. */
.tabs button { transition: none; color: #ede8f5; }
.tabs button:not(.active):hover { background: #393240; color: #fff; }
.tabs button.active { color: #30244e; }
.option-cards button {
  border-color: var(--control-border);
  min-height: 42px;
}
.option-cards button:hover { background: #f0eafa; }
.option-cards button[aria-pressed="true"] {
  border-color: #70538f;
  background: #ddd5ff;
  color: #30244e;
}
:focus-visible { outline: 3px solid #70538f; outline-offset: 3px; }
.tabs button:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.tabs button.active:focus-visible { outline-color: #433373; }
.sidebar :focus-visible { outline-color: #ddd5ff; }
.dropzone { border-color: #82758f; }
.dropzone:hover { background: #eeebf4; }

.transcript-search { border: 1px solid var(--control-border); }
.transcript-tools { display: flex; align-items: center; gap: 8px; }
.transcript-search input,
.transcript-search input:focus { border: 0; }
.transcript-search:focus-within { outline: 2px solid #70538f; outline-offset: 2px; }
.composer form { border: 1px solid var(--control-border); }
.composer textarea:focus-visible { outline: 0; }
.composer form:focus-within { outline: 2px solid #70538f; outline-offset: 2px; }
.speaker-chip > svg { width: 16px; height: 16px; color: #55515f; }
.speaker-chip:hover { background: #e9e3f4; }
.speaker-chip { min-height: 48px; }
.timestamp { color: #514b5b; }
.timestamp:hover { background: transparent; color: #30244e; text-decoration: underline; }
.bubble-actions { opacity: 1; align-items: center; flex-wrap: wrap; gap: 6px; }
.bubble-actions button {
  min-height: 36px;
  font-size: 12px;
  gap: 6px;
  padding: 5px 8px;
}
.bubble-actions .button-icon svg { width: 16px; height: 16px; }
.bubble-actions .icon-button { width: 36px; min-width: 36px; padding: 0; border: 0; }
.bubble-actions button:hover { background: #ffffffb3; }
.result-actions { flex-wrap: wrap; }
.result-actions .ui-button { min-height: 40px; }
.preset-row .ui-button { min-height: 40px; }
.result-header .avatar svg { width: 20px; height: 20px; }
.voice-actions .ui-button { min-height: 40px; }
.voice-actions .icon-button { width: 40px; min-width: 40px; padding: 0; }
.export-format { min-width: 112px; justify-content: flex-start; padding: 12px 16px; }
.option-cards .export-format { font-size: 14px; }
.export-format svg { width: 20px; height: 20px; }
.pill.success { border: 1px solid #498467; color: #1c5d43; }
.pill.warning { border: 1px solid #9f792c; color: #6a4b11; }
.pill.error { border: 1px solid #b15d5d; color: #8c2828; }
.progress-bar i { background: #70538f; }
.recording-dot { background: #9e2828; }
.voice-step { font-size: 14px; }

@media (max-width: 760px) {
  .content-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }
  .content-toolbar .tabs { grid-column: 1 / -1; }
  .content-toolbar .transcript-search { min-width: 0; width: auto; }
  .transcript-tools { gap: 6px; }
  .transcript-tools .icon-button { width: 40px; min-width: 40px; min-height: 42px; }
  .bubble-actions .ui-button { min-height: 40px; }
  .bubble-actions .icon-button { width: 40px; min-width: 40px; }
  .speaker-chip { padding: 9px 12px; }
  .result-actions { gap: 8px; }
  .result-actions .ui-button { flex: 1 0 auto; }
  .export-format { flex: 1; min-width: 88px; justify-content: center; }
  .voice-actions { gap: 8px; }
  .admin-row > .row { padding-left: 0; gap: 8px; }
}

/* Inline turn editing and anchored speaker controls share the existing palette. */
.turn-text {cursor:text;white-space:pre-wrap;overflow-wrap:anywhere;}
.turn-text:focus-visible {outline:2px solid var(--speaker-ink);outline-offset:5px;border-radius:4px;}
.turn.editing .bubble-actions {display:none;}
.turn-editor {margin-top:10px;}
.turn-editor textarea {font-family:inherit;font-size:14px;line-height:1.7;width:100%;resize:vertical;background:transparent;border:1px solid var(--speaker-ink);padding:10px;min-height:100px;}
.turn-editor .row {gap:8px;margin-top:10px;}
.turn-editor .inline-error:empty {display:none;}
.speaker-popover {position:fixed;z-index:60;max-height:calc(100dvh - 24px);overflow:auto;padding:14px;border:1px solid var(--field-border);border-radius:12px;background:#fff;color:var(--ink);box-shadow:0 3px 8px #17171924;}
.speaker-popover form {margin:0;}
.speaker-options {max-height:280px;overflow:auto;margin:10px 0;display:grid;gap:4px;}
.speaker-option {display:flex;align-items:center;gap:10px;width:100%;text-align:left;padding:9px;background:white;border-radius:8px;}
.speaker-option:hover,.speaker-option[aria-current=true] {background:var(--accent);color:var(--accent-ink);}
.speaker-option>.avatar {width:32px;height:32px;min-width:32px;font-size:12px;}
.speaker-option>.person-label {flex:1;min-width:0;overflow-wrap:anywhere;}
.speaker-option small {display:block;font-size:11px;}
.speaker-option>svg {width:18px;height:18px;flex-shrink:0;}
.create-person {width:100%;text-align:left;overflow-wrap:anywhere;color:var(--accent-ink);}
.speaker-popover .inline-error:empty {display:none;}
.speaker-count-form {display:grid;gap:12px;}
.speaker-count-form label {margin:0;}
.speaker-chip-editor {display:flex;flex-wrap:wrap;gap:5px;max-width:100%;padding:5px;}
.speaker-chip-editor input {width:180px;max-width:calc(100vw - 150px);min-height:38px;font-family:inherit;}
.speaker-chip-editor .icon-button {width:34px;height:38px;min-height:38px;padding:7px;}
.speaker-chip-editor .inline-error {width:100%;margin:0;font-size:12px;}
@media(max-width:760px){.turn-editor textarea{font-size:16px;}.turn-editor .row>button{flex:1;}.speaker-popover{padding:12px;}}

.result-table-scroll{overflow:auto;margin:14px 0;max-width:100%;border:1px solid var(--line);border-radius:8px;}.result-table-scroll table{border-collapse:collapse;width:100%;min-width:480px;font-size:13px;}.result-table-scroll th,.result-table-scroll td{text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:top;}.result-table-scroll th{background:var(--soft);font-weight:700;}.result-table-scroll tr:last-child td{border-bottom:0;}
