/* ==============================
   Design Tokens
   ============================== */
:root {
  --bg: #F6F7F9;
  --bg-deep: #EEF1F5;
  --panel: #FFFFFF;
  --panel-strong: #F8FAFC;
  --ink: #20242C;
  --ink-soft: #667085;
  --line: #D9E0EA;
  --line-strong: #C4CDD8;
  --brand: #FF5A36;
  --brand-deep: #E14A2A;
  --accent: #6E8DFF;
  --accent-glow: rgba(110, 141, 255, 0.18);
  --success: #275f4e;
  --error: #D84A3A;
  --shadow: 0 18px 40px rgba(28, 40, 64, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

/* ==============================
   Fluid root font — scales with browser zoom + viewport.
   16px baseline at 375px → 18px at 1200px.
   ============================== */
html {
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.125rem);
}

/* ==============================
   Reset & Base
   ============================== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, var(--accent-glow), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.18)),
    url("/app/real-estate-grid.svg"),
    linear-gradient(180deg, #FBFCFE 0%, var(--bg) 100%);
  background-size: cover;
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Golos Text", "Trebuchet MS", sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

/* ==============================
   App Shell — mobile-first padding
   ============================== */
.app-shell {
  min-height: 100vh;
  padding: 0.75rem;
}

/* ==============================
   Screen Layout
   ============================== */
.screen {
  width: 100%;
  max-width: 56rem;          /* ~900px at 16px base */
  margin: 0 auto;
  display: grid;
  gap: 0.875rem;
}

/* ==============================
   Panel / Card Surface
   ============================== */
.screen-header,
.project-header,
.panel,
.banner {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.screen-header,
.project-header,
.panel {
  border-radius: var(--radius-xl);
  padding: 1rem;
}

/* ==============================
   Flex Row (headers, meta)
   ============================== */
.screen-header,
.project-header,
.panel-head,
.row,
.button-row,
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ==============================
   Grid Stacks
   ============================== */
.screen-header,
.panel,
.stack-form,
.project-list,
.meeting-list,
.timeline,
.speaker-list,
.result-stack,
.people-list,
.stack,
.transcript-box {
  display: grid;
  gap: 0.875rem;
}

/* ==============================
   Eyebrow / Brand Mark
   ============================== */
.brand-mark,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.6875rem;
  color: var(--brand);
}

.brand-mark::before,
.eyebrow::before {
  content: "";
  width: 1.125rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

/* ==============================
   Typography — all rem, headings use clamp
   ============================== */
.screen-header h1,
.project-heading h1,
.panel h2 {
  margin: 0;
  font-family: "Unbounded", "Golos Text", sans-serif;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.screen-header h1 {
  font-size: clamp(1.6rem, 5vw + 0.5rem, 2.8rem);
}

.project-heading h1,
.panel h2 {
  font-size: clamp(1.25rem, 3.5vw + 0.3rem, 2rem);
}

.screen-header p,
.panel-copy,
.field span,
.file-picker-meta span,
.project-card span,
.meeting-row span,
.empty-state,
.muted,
.banner,
.transcript-row p {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ==============================
   Project Screen
   ============================== */
.project-screen { gap: 0.75rem; }

.project-heading {
  display: grid;
  gap: 0.375rem;
  min-width: 0;
  flex: 1;
}

/* ==============================
   Buttons — min-height 2.75rem (44px) for touch
   ============================== */
.primary-button,
.ghost-button,
.back-button,
.file-picker-button {
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.125rem;
  min-height: 2.75rem;
  font-size: 0.9rem;
  transition: transform 180ms ease, background 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fffaf6;
  box-shadow: 0 10px 22px rgba(255, 90, 54, 0.24);
}

.ghost-button,
.back-button {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--ink);
}

.primary-button:hover,
.ghost-button:hover,
.back-button:hover,
.project-card-body:hover,
.meeting-row-body:hover,
.file-picker-button:hover {
  transform: translateY(-1px);
}

/* ==============================
   Panel — main variant
   ============================== */
.panel-main {
  background: rgba(255, 255, 255, 0.98);
}

/* ==============================
   Fields
   ============================== */
.field {
  display: grid;
  gap: 0.5rem;
}

.meeting-datetime-edit {
  margin-top: 0.375rem;
  display: grid;
  gap: 0.25rem;
}

.date-inline,
.time-inline {
  background: none;
  border: none;
  border-bottom: 1px solid color-mix(in oklch, currentColor 25%, transparent);
  color: inherit;
  font: inherit;
  opacity: 0.55;
  padding: 0.125rem 0;
  cursor: pointer;
  width: auto;
}

.date-inline { font-size: 0.85rem; }
.time-inline { font-size: 0.8rem; }

.date-inline:focus,
.time-inline:focus {
  outline: none;
  opacity: 0.9;
  border-bottom-color: currentColor;
}

.time-range-edit {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.time-sep {
  opacity: 0.4;
  font-size: 0.75rem;
}

/* Date + time lines in meeting list */
.meeting-date-line {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.meeting-time-line {
  color: var(--accent);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* Date + time in result panel header */
.meeting-meta-line {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.field input,
.speaker-item input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.95);
  padding: 0.875rem 1rem;
  color: var(--ink);
  font-size: 1rem;
  min-height: 2.75rem;
}

.field input:focus,
.speaker-item input:focus {
  outline: 2px solid rgba(183, 82, 52, 0.18);
  border-color: rgba(183, 82, 52, 0.32);
}

/* ==============================
   List Items
   ============================== */
.project-list,
.meeting-list,
.people-list,
.result-stack {
  gap: 0.625rem;
}

.project-card,
.meeting-row,
.speaker-item,
.result-block,
.person-row,
.timeline-item,
.meta-box,
.transcript-row,
.empty-state {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.project-card,
.meeting-row {
  width: 100%;
  padding: 0;
  display: grid;
  gap: 0;
}

.project-card-body,
.meeting-row-body {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1rem 1rem 0.625rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
  min-height: 3rem;
}

.card-remove-button {
  margin: 0 0.75rem 0.75rem;
  width: fit-content;
  font-size: 0.8rem;
  padding: 0.375rem 0.875rem;
  min-height: 2rem;
}

.meeting-info {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.project-card strong,
.meeting-row strong,
.file-picker-meta strong,
.speaker-item span,
.timeline-item strong,
.result-block strong,
.transcript-row strong {
  color: var(--ink);
}

.speaker-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.speaker-unidentified {
  font-size: 0.75rem;
  color: #aaa;
  font-weight: 400;
}

.speaker-confidence {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.speaker-confidence--high {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.speaker-confidence--medium {
  background: rgba(234, 179, 8, 0.1);
  color: #a16207;
}

.speaker-reasoning {
  font-size: 0.75rem;
  color: #aaa;
  line-height: 1.4;
  margin-top: 0.1rem;
}

/* ==============================
   File Picker
   ============================== */
.file-picker {
  display: grid;
  gap: 0.75rem;
  border-radius: var(--radius-lg);
  border: 1.5px dashed rgba(110, 141, 255, 0.46);
  background:
    radial-gradient(circle at top right, rgba(110, 141, 255, 0.12), transparent 40%),
    linear-gradient(180deg, #FCFDFE 0%, #F4F7FD 100%);
  padding: 1rem;
}

.file-picker-button {
  position: relative;
  width: fit-content;
  background: rgba(110, 141, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(110, 141, 255, 0.24);
  box-shadow: 0 6px 18px rgba(110, 141, 255, 0.12);
}

.file-picker-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-picker-actions {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.record-start-button,
.record-stop-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.125rem;
  min-height: 2.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.record-start-button {
  background: rgba(255, 90, 54, 0.1);
  color: var(--brand);
  border: 1px solid rgba(255, 90, 54, 0.24);
}

.record-start-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 90, 54, 0.16);
}

.record-stop-button {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 90, 54, 0.3);
}

.record-stop-button:hover {
  transform: translateY(-1px);
}

.rec-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.record-stop-button .rec-dot {
  animation: pulse-rec 1s ease-in-out infinite;
}

@keyframes pulse-rec {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

.file-picker-meta {
  display: grid;
  gap: 0.25rem;
}

.file-processing-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-processing-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(110, 141, 255, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.file-processing-stage {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
}

.file-ready-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-ready-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #22c55e;
  flex-shrink: 0;
}

/* ==============================
   Status Chip
   ============================== */
.status-chip {
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(110, 141, 255, 0.12);
  color: var(--accent);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

/* ==============================
   Timeline
   ============================== */
.timeline { gap: 0.625rem; }

.timeline-item {
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.timeline-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: rgba(102, 112, 133, 0.28);
  flex: 0 0 auto;
}

.timeline-item.current {
  border-color: rgba(255, 90, 54, 0.28);
  background: rgba(255, 243, 239, 0.96);
}
.timeline-item.current .timeline-dot { background: var(--brand); }

.timeline-item.done {
  border-color: rgba(110, 141, 255, 0.24);
  background: rgba(244, 247, 255, 0.96);
}
.timeline-item.done .timeline-dot { background: var(--success); }

/* ==============================
   Meta Box, Speaker, Person, Result, Transcript
   ============================== */
.meta-box {
  padding: 0.875rem 1rem;
  display: grid;
  gap: 0.625rem;
}

.speaker-item,
.person-row,
.result-block,
.transcript-row {
  padding: 0.875rem 1rem;
}

.speaker-item,
.person-row {
  display: grid;
  gap: 0.625rem;
}

.transcript-box {
  border-top: 1px solid var(--line);
  padding-top: 0.375rem;
}

.transcript-row p {
  margin: 0.375rem 0 0;
  line-height: 1.5;
}

.result-block ul,
.result-block ol {
  margin: 0.5rem 0 0;
  padding-left: 1.125rem;
  display: grid;
  gap: 0.5rem;
}

/* ==============================
   Upload Progress
   ============================== */
.upload-progress-wrap {
  position: relative;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.upload-progress-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(110, 141, 255, 0.22), rgba(110, 141, 255, 0.38));
  border-radius: inherit;
  transition: width 200ms ease;
}

.upload-progress-label {
  position: relative;
  z-index: 1;
  padding: 0 1rem;
  font-size: 0.85rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ==============================
   Banners
   ============================== */
.banner {
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.875rem;
  font-size: 0.9rem;
}

.banner-ok {
  color: var(--success);
  border-color: rgba(46, 139, 87, 0.16);
}

.banner-error {
  color: var(--error);
  border-color: rgba(216, 74, 58, 0.18);
}

.banner-shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(7px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

.empty-state {
  padding: 1rem;
  line-height: 1.5;
  font-size: 0.9rem;
}

/* ==============================
   Mobile: small tweaks for narrow screens
   ============================== */
@media (max-width: 480px) {
  .project-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .project-card-body,
  .meeting-row-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

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

  .screen-header h1 {
    font-size: clamp(1.4rem, 6vw, 2rem);
  }
}

/* ==============================
   Desktop: wider layout + 2-column results
   ============================== */
@media (min-width: 640px) {
  .app-shell { padding: 1.25rem; }

  .screen-header,
  .project-header,
  .panel {
    padding: 1.25rem;
  }
}

@media (min-width: 900px) {
  .app-shell { padding: 1.5rem; }

  .result-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-block:last-of-type {
    grid-column: 1 / -1;
  }
}

/* ==============================
   Result tabs
   ============================== */
.result-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--color-surface-alt, #f3f4f6);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.tab-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms, color 150ms, box-shadow 150ms;
}

.tab-btn:hover {
  background: rgba(255,255,255,0.6);
  color: var(--color-text, #111);
}

.tab-btn--active {
  background: #fff;
  color: var(--color-text, #111);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ==============================
   Transcript full view
   ============================== */
.transcript-full {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.25rem 0;
}

.tf-row {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
}

.tf-avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  margin-top: 0.1rem;
}

.tf-body {
  flex: 1;
  min-width: 0;
}

.tf-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.tf-name {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tf-role {
  font-size: 0.72rem;
  color: var(--color-text-muted, #6b7280);
  background: var(--color-surface-alt, #f3f4f6);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-weight: 500;
}

.tf-timecode {
  font-size: 0.72rem;
  color: var(--color-text-muted, #9ca3af);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.tf-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text, #111);
  background: var(--color-surface-alt, #f9fafb);
  border-radius: 0 10px 10px 10px;
  padding: 0.625rem 0.875rem;
}

/* ==============================
   Summary improvements
   ============================== */
.empty-hint {
  color: var(--color-text-muted, #9ca3af);
  font-size: 0.9rem;
  font-style: italic;
  margin: 0.25rem 0;
}

.action-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.action-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.4rem 0.75rem;
  align-items: center;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms;
}
.action-item:last-child { border-bottom: none; }
.action-item:hover { background: var(--color-surface-alt, #f3f4f6); }

.action-edit-hint {
  opacity: 0;
  font-size: 0.75rem;
  transition: opacity 120ms;
}
.action-item:hover .action-edit-hint { opacity: 1; }

.action-owner {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
}
.action-task {
  font-size: 0.92rem;
}
.action-deadline {
  font-size: 0.8rem;
  color: var(--color-text-muted, #6b7280);
  white-space: nowrap;
}
.action-deadline--empty {
  color: #4f6ef7;
  font-size: 0.78rem;
}

/* статичный action item (режим просмотра) — без интерактива */
.action-item--static {
  cursor: default;
  grid-template-columns: auto 1fr auto;
}
.action-item--static:hover { background: transparent; }

/* panel-head top row: заголовок + кнопка в одну строку */
.panel-head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.highlights-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.highlight-card {
  background: var(--color-surface-alt, #f9fafb);
  border-left: 3px solid var(--color-accent, #4f6ef7);
  border-radius: 0 8px 8px 0;
  padding: 0.625rem 0.875rem;
}

.highlight-speaker {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-accent, #4f6ef7);
  margin-bottom: 0.2rem;
}

.highlight-quote {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--color-text, #111);
  font-style: italic;
}

.topics-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.topic-card {
  background: var(--color-surface-alt, #f9fafb);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
}

.topic-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text, #111);
  margin-bottom: 0.25rem;
}

.topic-narrative {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--color-text-secondary, #444);
}

/* ── Transcript toolbar (toggle + edit/regen actions) ── */
.transcript-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.transcript-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.ghost-button--sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.78rem;
}

/* Режим редактирования расшифровки */
.transcript-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.transcript-edit-hint {
  font-size: 0.83rem;
  color: var(--color-text-muted, #6b7280);
  background: #f0f4ff;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  line-height: 1.5;
}

.transcript-edit-hint code {
  background: rgba(0,0,0,0.07);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}

.transcript-editor {
  width: 100%;
  min-height: 320px;
  padding: 0.875rem 1rem;
  font-family: "Golos Text", ui-monospace, monospace;
  font-size: 0.85rem;
  line-height: 1.65;
  border: 1.5px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  resize: vertical;
  background: #fafafa;
  color: var(--color-text, #111);
  outline: none;
  transition: border-color 150ms;
  box-sizing: border-box;
}

.transcript-editor:focus {
  border-color: #4f6ef7;
  background: #fff;
}

/* ── Transcript version toggle (Дословно / LLM восстановил) ── */
.transcript-version-toggle {
  display: flex;
  gap: 0.25rem;
  background: var(--color-surface-alt, #f3f4f6);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
}

.tvt-btn {
  padding: 0.3rem 0.875rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text-muted, #6b7280);
  transition: background 150ms, color 150ms;
}

.tvt-btn:hover:not(:disabled) {
  background: rgba(0,0,0,0.05);
  color: var(--color-text, #111);
}

.tvt-btn--active {
  background: #fff;
  color: var(--color-text, #111);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tvt-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── Poor transcript error block ── */
.poor-transcript-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.5rem;
  background: #fff8f0;
  border: 1.5px solid #f59e0b;
  border-radius: 12px;
  margin-top: 1rem;
}

.poor-transcript-icon {
  font-size: 2rem;
}

.poor-transcript-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #92400e;
}

.poor-transcript-body {
  font-size: 0.9rem;
  color: #78350f;
  line-height: 1.5;
}

.poor-transcript-hints {
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.6;
}

.poor-transcript-hints ul {
  margin: 0.25rem 0 0 1.1rem;
  padding: 0;
}

/* ── Quality warning banner ── */
.quality-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.6rem 0.875rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #92400e;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

/* ==============================
   Auth Screen
   ============================== */
.auth-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.01em;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-error {
  background: rgba(216, 74, 58, 0.08);
  border: 1px solid rgba(216, 74, 58, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  color: var(--error);
  line-height: 1.45;
}

.auth-switch {
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-align: center;
}

.link-button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-button:hover {
  color: var(--brand);
}

.link-button:disabled {
  opacity: 0.4;
  cursor: default;
  text-decoration: none;
}

.link-button--danger {
  color: #d14343;
}
.link-button--danger:hover {
  color: #b02020;
}

/* ==============================
   Админ-таблица пользователей
   ============================== */
.admin-table {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.5rem;
}

.admin-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.9fr 0.9fr 1.8fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  font-size: 0.88rem;
}
.admin-row--head {
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted, #6b7280);
  border-bottom: 1.5px solid var(--color-border, #e5e7eb);
}
.admin-row--busy { opacity: 0.5; }

.admin-login { font-weight: 500; }
.admin-self { color: var(--color-text-muted, #9ca3af); font-weight: 400; }
.admin-quota { font-variant-numeric: tabular-nums; }

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.82rem;
}

.role-badge, .status-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}
.role-badge--admin { background: #eef2ff; color: #4f46e5; }
.role-badge--member { background: #f3f4f6; color: #6b7280; }
.status-badge--active { background: #ecfdf5; color: #059669; }
.status-badge--banned { background: #fef2f2; color: #dc2626; }

@media (max-width: 720px) {
  .admin-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 0.5rem;
  }
  .admin-row--head { display: none; }
  .admin-actions { grid-column: 1 / -1; }
}

/* ==============================
   User chip (top-right of projects screen)
   ============================== */
.screen-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-deep);
  border-radius: 100px;
  padding: 0.3rem 0.75rem 0.3rem 0.9rem;
  font-size: 0.82rem;
}

.user-chip-login {
  color: var(--ink-soft);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-logout {
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.user-logout:hover {
  color: var(--error);
}

/* Кнопка «Редактировать итоги» — последний элемент внутри result-stack */
.edit-btn--mobile-wrap {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  /* На десктопе (2-кол. grid) растягиваем на обе колонки */
  grid-column: 1 / -1;
}
@media (max-width: 600px) {
  .edit-btn--mobile-wrap { justify-content: stretch; }
  .edit-btn--mobile-wrap .ghost-button { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════
   Summary Edit — редизайн редактирования итогов
   ═══════════════════════════════════════════════════════════ */

/* Режим правки — лёгкий левый акцент */
.summary-edit {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin-left: -1.25rem;
}

/* Базовый textarea — «документ-стиль», без тяжёлой рамки */
.se-textarea {
  width: 100%;
  padding: 0.4rem 0;
  border: none;
  border-bottom: 1.5px solid transparent;
  border-radius: 0;
  font-family: inherit;
  line-height: 1.55;
  resize: none;
  background: transparent;
  outline: none;
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 150ms;
  color: var(--ink);
  display: block;
}
.se-textarea:hover { border-bottom-color: var(--line); }
.se-textarea:focus { border-bottom-color: var(--accent); }

.se-textarea--overview {
  font-size: 0.95rem;
  color: var(--ink-soft);
  min-height: 3.5rem;
}
.se-textarea--decision {
  font-size: 0.95rem;
  min-height: 1.5rem;
}
.se-textarea--task {
  font-size: 1rem;
  font-weight: 500;
  min-height: 2.4rem;
  color: var(--ink);
}

/* ── Участники — чипы ── */
.se-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.se-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--accent-glow);
  border: 1.5px solid rgba(110, 141, 255, 0.3);
  border-radius: 999px;
  padding: 0.28rem 0.45rem 0.28rem 0.75rem;
  transition: border-color 150ms;
}
.se-chip:focus-within { border-color: var(--accent); }

.se-chip-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  min-width: 3ch;
  max-width: 22ch;
}

.se-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.65rem;
  padding: 0;
  opacity: 0.45;
  transition: opacity 150ms, background 150ms;
  line-height: 1;
}
.se-chip:hover .se-chip-remove,
.se-chip-remove:focus { opacity: 1; background: rgba(0, 0, 0, 0.08); }
.se-chip-remove:hover { color: var(--error); }

.se-chip-add {
  border: 1.5px dashed var(--line-strong);
  background: transparent;
  border-radius: 999px;
  padding: 0.28rem 0.8rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  transition: border-color 150ms, color 150ms;
}
.se-chip-add:hover { border-color: var(--accent); color: var(--accent); }

/* ── Решения — строки ── */
.se-decisions {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.25rem;
}

.se-decision-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
  transition: background 120ms;
}
.se-decision-row:hover { background: var(--bg-deep); }

.se-decision-num {
  font-size: 0.88rem;
  color: var(--ink-soft);
  padding-top: 0.35rem;
  min-width: 1.4rem;
  flex-shrink: 0;
  user-select: none;
}

/* Иконка удаления строки — появляется при наведении */
.se-row-remove {
  border: none;
  background: transparent;
  padding: 0.35rem 0.3rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  opacity: 0;
  flex-shrink: 0;
  border-radius: 6px;
  transition: opacity 150ms, color 150ms, background 150ms;
  line-height: 1;
}
.se-decision-row:hover .se-row-remove,
.se-row-remove:focus { opacity: 1; }
.se-row-remove:hover { color: var(--error); background: rgba(216, 74, 58, 0.08); }

/* На тач-устройствах — всегда видна (opacity ниже, но не ноль) */
@media (hover: none) {
  .se-row-remove { opacity: 0.35; }
}

/* ── Добавить — пунктирная строка-призрак ── */
.se-ghost-add {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding: 0.45rem 0.75rem;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  background: transparent;
  font-size: 0.85rem;
  color: var(--ink-soft);
  width: 100%;
  text-align: left;
  transition: border-color 150ms, color 150ms, background 150ms;
}
.se-ghost-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ── Задачи — вертикальные карточки ── */
.se-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.se-action-card {
  background: var(--panel-strong);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem 0.75rem;
  transition: border-color 150ms, box-shadow 150ms;
}
.se-action-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Мета-строка: ответственный + срок + удалить */
.se-action-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  margin-top: 0.625rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.se-action-meta-field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.se-meta-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.se-meta-input {
  border: none;
  border-bottom: 1.5px solid var(--line);
  background: transparent;
  outline: none;
  font-size: 0.88rem;
  color: var(--ink);
  padding: 0.1rem 0.2rem;
  min-width: 0;
  width: 14ch;
  transition: border-color 150ms;
}
.se-meta-input:focus { border-bottom-color: var(--accent); }
.se-meta-input::placeholder { color: var(--ink-soft); opacity: 0.6; }
.se-meta-input--date { width: auto; min-width: 9ch; }

.se-meta-select {
  border: none;
  border-bottom: 1.5px solid var(--line);
  background: transparent;
  outline: none;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--ink);
  padding: 0.1rem 0.25rem;
  cursor: pointer;
  max-width: 16ch;
  transition: border-color 150ms;
  appearance: auto;
}
.se-meta-select:focus { border-bottom-color: var(--accent); }
.se-meta-select option[value=""] { color: var(--ink-soft); }

/* Иконка удаления задачи — справа, появляется на hover карточки */
.se-action-remove {
  border: none;
  background: transparent;
  padding: 0.25rem 0.35rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  border-radius: 6px;
  margin-left: auto;
  opacity: 0.35;
  transition: opacity 150ms, color 150ms, background 150ms;
  line-height: 1;
}
.se-action-card:hover .se-action-remove,
.se-action-remove:focus { opacity: 1; }
.se-action-remove:hover { color: var(--error); background: rgba(216, 74, 58, 0.08); }

@media (hover: none) {
  .se-action-remove { opacity: 0.5; }
}

/* ── Sticky save bar ── */
.se-sticky-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0 0.5rem;
  background: linear-gradient(to bottom, transparent, var(--panel) 45%);
  margin-top: 1.5rem;
  z-index: 10;
}

/* Мобайл — кнопки на всю ширину */
@media (max-width: 480px) {
  .se-sticky-bar {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }
  .se-sticky-bar .primary-button,
  .se-sticky-bar .ghost-button {
    width: 100%;
    text-align: center;
  }
  .summary-edit {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    border-top: 3px solid var(--accent);
    padding-top: 1rem;
  }
}

/* ── LLM-улучшение расшифровки (RefineControl + diff) ───────────────── */

.refine-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}

.refine-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted, #9ca3af);
}

.refine-error {
  font-size: 0.85rem;
  color: var(--brand);
  flex-basis: 100%;
}

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

.refine-progress-label {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.refine-progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--accent-glow);
  overflow: hidden;
}

.refine-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.6s ease;
  min-width: 4%;
}

.refine-done {
  font-size: 0.82rem;
  color: var(--accent);
  margin: 8px 0;
}

.tf-refined-badge {
  font-size: 0.68rem;
  color: var(--accent);
  background: var(--accent-glow);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}

.tf-text--refined {
  border-left: 2px solid var(--accent-glow);
  padding-left: 8px;
}

.tf-diff {
  margin-top: 4px;
}

.tf-diff summary {
  font-size: 0.74rem;
  color: var(--color-text-muted, #9ca3af);
  cursor: pointer;
  user-select: none;
}

.tf-diff-original {
  font-size: 0.85rem;
  color: var(--color-text-muted, #6b7280);
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 4px;
  text-decoration: line-through;
  text-decoration-color: rgba(0, 0, 0, 0.25);
}

.transcript-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.transcript-box-head .eyebrow {
  margin-bottom: 0;
}
