/* ═══ The Brutalist Editor — Design System ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border-radius: 0; }

:root {
  --surface:    #131313;
  --surface-2:  #1c1b1b;
  --surface-3:  #201f1f;
  --divider:    #1a1a1a;
  --border:     #333;
  --primary:    #fff;
  --secondary:  #666;
  --text:       #e5e2e1;
  --text-dim:   #c6c6c6;
  --text-muted: #666;
  --error:      #ffb4ab;
  --font:       'Inter', system-ui, sans-serif;
  --mono:       'Space Grotesk', monospace;
}

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 72px;
}

/* ═══ Screens ═══ */
.screen { display: none; padding: 20px; }
.screen.active { display: block; }

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.screen-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Подзаголовки на вложенных экранах */
.btn-back + h1 {
  font-size: 20px;
}

.avatar {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--secondary);
}

.btn-back {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 12px 16px 12px 0;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  font-family: var(--mono);
  -webkit-tap-highlight-color: transparent;
}

/* ═══ Buttons ═══ */
.btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn-primary { border-color: var(--primary); color: var(--primary); }
.btn-primary:hover { background: rgba(255,255,255,0.05); }

.btn-secondary { border-color: var(--border); color: var(--secondary); }
.btn-secondary:hover { background: rgba(255,255,255,0.03); }

.btn-sm { padding: 10px 14px; font-size: 12px; min-height: 44px; }
.btn-full { width: 100%; text-align: center; font-family: var(--mono); font-weight: 600; letter-spacing: 0.5px; padding: 14px; margin-top: 24px; }

.btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══ Action row ═══ */
.action-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.action-row .btn { flex: 1; text-align: center; }

/* ═══ Filters ═══ */
.filter-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 12px;
}

.filter {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 0 12px;
  border-bottom: 1px solid transparent;
  margin-bottom: -13px;
  min-height: 44px;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.filter.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ═══ Meeting list ═══ */
.meeting-list { display: flex; flex-direction: column; }

.meeting-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: background 0.15s;
}

@media (hover: hover) {
  .meeting-item:hover { background: var(--surface-2); margin: 0 -20px; padding: 16px 20px; }
}
.meeting-item:active { background: var(--surface-2); }

.meeting-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.meeting-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
}

.meeting-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meeting-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

.meeting-status {
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══ Detail ═══ */
.detail-meta {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.detail-content {
  min-height: 200px;
  margin-bottom: 16px;
}

.transcript-line {
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
  display: grid;
  grid-template-columns: 50px auto;
  gap: 0;
}

.ts {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 2px;
}

.speaker-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 2px;
}

.speech-text {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--divider);
  margin-bottom: 16px;
}

/* ═══ Type selector ═══ */
.type-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.type-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
  font-family: var(--font);
}

.type-card.active { border-color: var(--primary); }
.type-card:hover { border-color: var(--secondary); }

.type-title { font-size: 14px; font-weight: 600; color: var(--primary); }
.type-desc { font-size: 12px; color: var(--text-muted); }

/* ═══ Forms ═══ */
.form-section { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 8px 0;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.form-input:focus, .form-select:focus { border-color: var(--primary); }
.form-input::placeholder { color: var(--text-muted); }

.form-select { cursor: pointer; }
.form-select option { background: var(--surface-3); }

.source-row { display: flex; gap: 8px; flex-wrap: wrap; }
.source-btn { font-size: 12px; padding: 8px 14px; }
.source-btn.active { border-color: var(--primary); color: var(--primary); }

.speakers-selector { display: flex; gap: 6px; }
.speakers-btn { font-size: 12px; padding: 8px 12px; min-width: 42px; }
.speakers-btn.active { border-color: var(--primary); color: var(--primary); }

.search-input { margin-bottom: 16px; border: none; border-bottom: 1px solid var(--divider); }

/* File drop */
.file-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  border: 1px dashed var(--border);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
.file-drop:hover { border-color: var(--primary); color: var(--text); }
.file-drop.dragover { border-color: var(--primary); background: var(--surface-2); }
.file-drop input { display: none; }
.file-drop.has-file { border-style: solid; color: var(--text); }

/* Record area */
.record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.record-circle {
  width: 80px;
  height: 80px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-circle:hover { background: rgba(255,255,255,0.05); }
.record-circle.recording { border-color: var(--error); color: var(--error); animation: blink 1.2s infinite; }

.record-timer {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--text-muted);
  letter-spacing: 2px;
}

.record-status { font-size: 13px; color: var(--text-muted); }

/* Progress bar */
.progress-section { margin-top: 16px; }
.progress-track { height: 2px; background: var(--divider); width: 100%; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); width: 0%; transition: width 0.5s linear; }
.progress-label { font-family: var(--mono); font-size: 12px; color: var(--text-muted); margin-top: 8px; text-align: center; }

/* ═══ Members / Clients ═══ */
.section-title {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 0 8px;
  border-top: 1px solid var(--primary);
}

.member-list, .client-list { display: flex; flex-direction: column; }

.member-item, .client-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-avatar {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--secondary);
  flex-shrink: 0;
}

.member-info, .client-info { flex: 1; }

.member-name, .client-name { font-size: 14px; font-weight: 600; color: var(--primary); }
.member-role { font-size: 12px; color: var(--text-muted); }
.member-voice { font-size: 11px; color: var(--text-muted); font-family: var(--mono); margin-top: 2px; }

.client-desc { font-size: 12px; color: var(--text-muted); }
.client-stats { font-size: 11px; color: var(--text-muted); font-family: var(--mono); margin-top: 2px; }
.client-arrow { color: var(--text-muted); font-family: var(--mono); }

/* ═══ Bottom nav ═══ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 4px 20px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--divider);
  z-index: 50;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 12px 4px;
  min-height: 44px;
  transition: color 0.15s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active { color: var(--primary); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--primary);
}

/* ═══ Overlay / Dialog ═══ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.dialog {
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialog h2 { font-size: 17px; font-weight: 600; flex-shrink: 0; }
.hint { font-size: 13px; color: var(--text-muted); line-height: 1.5; flex-shrink: 0; }

#dialogBody {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.naming-card {
  background: var(--surface);
  border: 1px solid var(--divider);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.naming-label { font-size: 13px; color: var(--primary); font-weight: 600; font-family: var(--mono); }
.naming-quote { font-size: 12px; color: var(--text-muted); line-height: 1.5; font-style: italic; }
.naming-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  padding: 6px 0;
  outline: none;
  width: 100%;
  font-family: var(--font);
}
.naming-input:focus { border-color: var(--primary); }

/* ═══ Status ═══ */
.status-bar {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}

.recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--error);
}

.recording-dot {
  width: 8px;
  height: 8px;
  background: var(--error);
  animation: blink 1.2s infinite;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* ═══ Summary ═══ */
.summary-content h3 { margin: 20px 0 8px; color: var(--primary); font-size: 15px; font-weight: 600; }
.summary-content .summary-item { padding: 4px 0 4px 16px; color: var(--text-dim); }
.summary-content br { display: block; margin: 8px 0; }

.empty-action { text-align: center; padding: 40px 20px; }
.empty-action p { color: var(--text-muted); margin-bottom: 16px; }

/* ═══ Danger button ═══ */
.btn-danger { border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: rgba(255, 180, 171, 0.08); }

/* ═══ Cloud recording cards ═══ */
.cloud-recording-item { cursor: pointer; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.cloud-recording-item.selected { border-color: var(--primary); }

/* ═══ Speaker stats ═══ */
.speaker-stat { padding: 12px 0; border-bottom: 1px solid var(--divider); }

/* ═══ Utils ═══ */
.empty { color: var(--text-muted); font-size: 14px; text-align: center; padding: 40px 0; }
.hidden { display: none !important; }
body.overlay-open { overflow: hidden; }

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  border: 1px solid var(--error);
  color: var(--error);
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px 20px;
  z-index: 200;
  max-width: 400px;
  width: calc(100% - 40px);
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.visible { opacity: 1; pointer-events: auto; }
.toast.success { border-color: #4caf50; color: #4caf50; }

@media (prefers-reduced-motion: reduce) {
  .recording-dot { animation: none; }
}
