/* === Apple HIG Design Tokens === */
:root {
  /* === Semantic Colors (HIG) === */
  --label:           #1d1d1f;            /* primary text — off-black, less harsh than #000 */
  --label-secondary: rgba(60, 60, 67, 0.6);
  --label-tertiary:  rgba(60, 60, 67, 0.3);

  --bg:              #f5f5f7;            /* grouped content, warmer than #fff */
  --bg-elevated:     #ffffff;            /* cards, modals, glass background */
  --bg-tertiary:     #fafafc;            /* subtle nested bg */

  --separator:       rgba(60, 60, 67, 0.18);  /* hairline */
  --separator-opaque:#d2d2d7;

  /* Tints (semantic — never raw color names) */
  --tint-blue:       #007AFF;            /* accent / primary */
  --tint-blue-bg:    rgba(0, 122, 255, 0.12);
  --tint-blue-hover: #0066d6;
  --tint-green:      #34C759;            /* success */
  --tint-green-bg:   rgba(52, 199, 89, 0.14);
  --tint-red:        #FF3B30;            /* danger */
  --tint-red-bg:     rgba(255, 59, 48, 0.10);
  --tint-orange:     #FF9500;            /* warning */
  --tint-orange-bg:  rgba(255, 149, 0, 0.12);
  --tint-purple:     #AF52DE;            /* info / speaker */
  --tint-purple-bg:  rgba(175, 82, 222, 0.12);
  --tint-yellow:     #FFCC00;

  /* Aliases (compat dgn existing naming, gradually migrate) */
  --ink:             var(--label);
  --ink-secondary:   #515154;
  --muted:           rgba(60, 60, 67, 0.45);
  --border:          var(--separator-opaque);
  --border-soft:     var(--separator);
  --accent:          var(--tint-blue);
  --accent-hover:    var(--tint-blue-hover);
  --accent-pressed:  #005bbf;
  --accent-ink:      #ffffff;
  --accent-soft:     var(--tint-blue-bg);
  --danger:          var(--tint-red);
  --danger-soft:     var(--tint-red-bg);
  --warn:            var(--tint-orange);
  --warn-soft:       var(--tint-orange-bg);
  --ok:              var(--tint-green);
  --ok-soft:         var(--tint-green-bg);
  --info:            var(--tint-purple);
  --info-soft:       var(--tint-purple-bg);

  /* === Spacing — strict 8pt grid === */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Aliases */
  --space-1: var(--sp-1);
  --space-2: var(--sp-2);
  --space-3: var(--sp-3);
  --space-4: var(--sp-4);
  --space-5: var(--sp-5);
  --space-6: var(--sp-6);
  --space-8: var(--sp-8);
  --space-10: var(--sp-10);

  /* === Typography Scale (HIG) === */
  --type-display:   34px;  /* page hero */
  --type-title1:    28px;
  --type-title2:    22px;  /* section headers */
  --type-title3:    20px;
  --type-headline:  17px;  /* body emphasis */
  --type-body:      16px;
  --type-callout:   15px;
  --type-subhead:   14px;
  --type-footnote:  13px;
  --type-caption:   12px;
  --type-caption2:  11px;

  /* === Border Radius (iOS 17+ trend: more rounded) === */
  --radius-sm:   6px;   /* tags, pills */
  --radius-md:   10px;  /* buttons, inputs */
  --radius:      12px;  /* cards (compat) */
  --radius-lg:   14px;
  --radius-xl:   18px;  /* glass panels, large cards, modals */
  --radius-pill: 9999px;

  /* === Shadows (subtle, blur ≥ 2× offset) === */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-2: 0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-3: 0 4px 16px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-4: 0 12px 32px rgba(0,0,0,0.14), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-5: 0 20px 56px rgba(0,0,0,0.20), 0 8px 16px rgba(0,0,0,0.08);

  /* Aliases */
  --shadow-sm: var(--shadow-1);
  --shadow-md: var(--shadow-2);
  --shadow-lg: var(--shadow-4);

  /* === Motion (Apple house curves) === */
  --ease-out:    cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-in:     cubic-bezier(0.4, 0.0, 1.0, 1);
  --ease-in-out: cubic-bezier(0.4, 0.0, 0.2, 1);
  --spring:      cubic-bezier(0.17, 0.67, 0.83, 0.67);
  --dur-fast:    150ms;
  --dur-base:    250ms;
  --dur-slow:    350ms;
  --transition:  var(--dur-base) var(--ease-out);  /* default */

  /* === Liquid Glass (iOS 17+) === */
  --glass-bg:        rgba(255, 255, 255, 0.72);
  --glass-blur:      blur(28px) saturate(200%) brightness(1.02);
  --glass-border:    rgba(255, 255, 255, 0.75);
  --glass-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.5),
    0 2px 12px rgba(9, 30, 66, 0.06),
    0 0 0 0.5px rgba(9, 30, 66, 0.04);
}

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

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--type-body);
  line-height: 1.5;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";   /* Inter stylistic alternates if used */
}

::selection { background: var(--accent-soft); color: var(--ink); }

/* === App shell (sidebar layout) === */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--separator);
  display: flex;
  flex-direction: column;
  padding: var(--sp-5) var(--sp-3) var(--sp-4);
  overflow-y: auto;
  z-index: 50;
  box-shadow: inset -0.5px 0 0 rgba(255,255,255,0.5);
}
/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(1px)) {
  .sidebar { background: var(--bg-elevated); }
}
.sidebar-head {
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px;
}
.brand {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.brand:hover { opacity: .8; }

.sidebar-cta { width: 100%; margin-bottom: 18px; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding-right: 2px;
}
.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 12px 12px 6px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition);
  border: 1px solid transparent;
}
.sidebar-item:hover { background: var(--border-soft); color: var(--ink); }
.sidebar-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(0,113,227,.15);
}
.sidebar-item.active:hover { background: var(--accent-soft); }
.sidebar-item-icon { font-size: 16px; flex-shrink: 0; opacity: .9; }
.sidebar-item-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-item-badge {
  background: var(--border-soft);
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.sidebar-item.active .sidebar-item-badge {
  background: var(--accent);
  color: white;
}
.sidebar-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}
.sidebar-quota {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  font-size: 12px;
}
.quota-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.quota-label { color: var(--muted); font-weight: 500; letter-spacing: .02em; text-transform: uppercase; font-size: 10px; }
.quota-value { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.quota-bar {
  height: 4px;
  background: var(--border-soft);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 6px;
}
.quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transition: width var(--transition);
  border-radius: var(--radius-pill);
}
.quota-tokens {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.sidebar-foot {
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  margin-top: 14px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--info));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 14px; font-weight: 500; color: var(--ink); }
.user-logout { font-size: 12px; color: var(--muted); text-decoration: none; }
.user-logout:hover { color: var(--danger); }

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 40;
  opacity: 0;
  transition: opacity var(--transition);
}
.sidebar-backdrop.show { opacity: 1; }

/* === Main area === */
.main-area { min-width: 0; /* prevent grid blowout */ }
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 28px 80px;
}

/* === Cards === */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: var(--space-4);
  transition: box-shadow var(--transition);
}
.card:hover { /* hover only on interactive cards */ }
.card.compact { padding: 16px 20px; }

/* === Headings — HIG type scale === */
h1 {
  font-size: var(--type-title1);   /* 28px */
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 6px;
}
h2 {
  font-size: var(--type-title3);   /* 20px */
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0 0 var(--sp-3);
}
h3 {
  font-size: var(--type-headline); /* 17px */
  line-height: 1.35;
  font-weight: 600;
  margin: 0 0 var(--sp-2);
}
.muted { color: var(--label-secondary); }
.small { font-size: var(--type-footnote); }   /* 13px */
.tiny { font-size: var(--type-caption); }     /* 12px */
code {
  background: var(--border-soft);
  padding: 1.5px 6px;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* === Layout helpers === */
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap > * + * { margin-left: var(--space-2); }
.row.wrap { flex-wrap: wrap; gap: var(--space-2); }
.col { display: flex; flex-direction: column; gap: var(--space-2); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  min-height: 40px;                /* HIG-friendly touch target */
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: var(--fw-medium, 500);
  font-size: var(--type-callout);
  letter-spacing: -0.01em;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--bg-tertiary); border-color: var(--border-soft); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--tint-blue-bg), 0 0 0 4px var(--tint-blue);
  border-color: var(--tint-blue);
}
.btn.small {
  padding: 7px 14px;
  min-height: 36px;                /* HIG: 36pt acceptable for secondary */
  font-size: var(--type-footnote);
  border-radius: var(--radius-sm);
}
.btn.big {
  padding: 14px 24px;
  min-height: 48px;
  font-size: var(--type-headline);
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold, 600);
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.btn.danger { color: var(--danger); border-color: var(--border); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--bg-elevated); border-color: var(--border); }

/* Global focus-visible (links, inputs, etc) */
:focus-visible {
  outline: 3px solid var(--tint-blue-bg);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible { outline: none; }  /* override: we use box-shadow instead */

/* === Forms === */
.upload-form { display: grid; gap: 16px; max-width: 560px; margin-top: 12px; }
.upload-form label {
  display: grid;
  gap: 6px;
}
.upload-form label > span:first-child {
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-secondary);
}
.upload-form input[type=text],
.upload-form input[type=password],
.upload-form input[type=file],
.upload-form select,
.upload-form textarea {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px; /* prevent iOS Safari zoom on focus */
  background: var(--bg-elevated);
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.upload-form input:focus, .upload-form select:focus, .upload-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.error {
  color: var(--danger);
  font-size: 14px;
  padding: 10px 14px;
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  margin: 0;
}

/* === Login === */
.login-screen {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 80px);
  padding: 0 24px;
}
.login-screen .card {
  width: 100%;
  max-width: 400px;
  margin: 0;
  padding: 32px 28px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.login-screen h1 { margin-bottom: 8px; }

/* === Drag-drop upload zone === */
.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  background: var(--bg);
  transition: all var(--transition);
  cursor: pointer;
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dropzone .icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: .6;
}
.dropzone .primary-text { font-weight: 500; color: var(--ink); }
.dropzone .secondary-text { font-size: 13px; color: var(--muted); margin-top: 4px; }
.dropzone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.file-preview {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.file-preview .file-icon { font-size: 24px; }
.file-preview .file-info { flex: 1; min-width: 0; }
.file-preview .file-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-preview .file-meta { font-size: 12px; color: var(--muted); }

/* === Advanced upload toggle === */
.advanced-toggle {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0;
  margin-top: 4px;
}
.advanced-toggle summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-secondary);
  list-style: none;
  user-select: none;
}
.advanced-toggle summary::-webkit-details-marker { display: none; }
.advanced-toggle summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  transition: transform var(--transition);
}
.advanced-toggle[open] summary::before { transform: rotate(90deg); }
.advanced-body {
  padding: 0 14px 14px;
  display: grid;
  gap: 8px;
}

/* === Project grid (card-based) === */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  text-decoration: none;
  color: var(--ink);
  transition: all var(--transition);
  display: block;
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}
.project-card .pname {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.project-card .pslug {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  margin-bottom: 14px;
}
.project-card .pstats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-secondary);
}
.project-card .pstats span { display: inline-flex; align-items: center; gap: 4px; }
.project-card .pstats .num { font-weight: 600; color: var(--ink); }

/* === Meeting list (cards) === */
.meeting-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.meeting-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--ink);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  transition: all var(--transition);
}
.meeting-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  background: #fdfdfe;
}
.meeting-card .mlabel {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}
.meeting-card .mmeta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.meeting-card .mmeta .dot { color: var(--border); }

/* === Status badges === */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  background: var(--border-soft);
  color: var(--ink-secondary);
  letter-spacing: 0.01em;
}
.status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.status-queued { background: var(--warn-soft); color: #b45309; }
.status-queued::before { background: var(--warn); }
.status-preprocessing { background: var(--warn-soft); color: #c2410c; }
.status-preprocessing::before { background: var(--warn); animation: pulse 1.4s infinite; }
.status-uploading { background: var(--info-soft); color: #4f46e5; }
.status-uploading::before { background: var(--info); animation: pulse 1.4s infinite; }
.status-loading_model { background: var(--info-soft); color: #4f46e5; }
.status-loading_model::before { background: var(--info); animation: pulse 1.4s infinite; }
.status-transcribing { background: var(--accent-soft); color: var(--accent); }
.status-transcribing::before { background: var(--accent); animation: pulse 1.4s infinite; }
.status-done { background: var(--ok-soft); color: #047857; }
.status-done::before { background: var(--ok); }
.status-error { background: var(--danger-soft); color: #b91c1c; }
.status-error::before { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(1.3); }
}

/* === Progress bar === */
.progress-bar {
  height: 6px;
  background: var(--border-soft);
  border-radius: var(--radius-pill);
  margin-top: 12px;
  overflow: hidden;
}
.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--info));
  transition: width .5s cubic-bezier(.4, 0, .2, 1);
  border-radius: var(--radius-pill);
}

/* === Meeting navigation (shared across Editor / Reader / Summary) === */
.meeting-nav {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.meeting-nav-views {
  display: flex;
  gap: 2px;
  background: var(--bg);
  padding: 3px;
  border-radius: var(--radius-sm);
}
.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.view-tab:hover { color: var(--ink); background: var(--bg-elevated); }
.view-tab.active {
  background: var(--bg-elevated);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.meeting-nav-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-right: 4px;
}

/* Dark mode meeting nav */
body.reader-dark .meeting-nav { background: #2c2c2e; border-color: #3a3a3c; }
body.reader-dark .meeting-nav-views { background: #1c1c1e; }
body.reader-dark .view-tab { color: #ebebf5; }
body.reader-dark .view-tab:hover { background: #3a3a3c; color: white; }
body.reader-dark .view-tab.active { background: #3a3a3c; color: #0a84ff; }

@media (max-width: 640px) {
  .meeting-nav { padding: 6px; flex-direction: column; align-items: stretch; }
  .meeting-nav-views { width: 100%; justify-content: space-around; }
  .meeting-nav-actions { width: 100%; justify-content: center; }
  .view-tab { padding: 8px 10px; flex: 1; justify-content: center; }
}

/* === Step timeline === */
.step-timeline {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  font-size: 12px;
  color: var(--muted);
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.step:not(:last-child)::after {
  content: "";
  display: block;
  width: 16px;
  height: 1px;
  background: var(--border);
  margin-left: 4px;
  flex-shrink: 0;
}
.step-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--border-soft);
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: white;
  font-weight: 700;
  transition: all var(--transition);
}
.step-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step.pending .step-dot { background: var(--border-soft); border-color: var(--border); }
.step.active .step-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: stepPulse 1.4s infinite;
}
.step.active .step-label { color: var(--accent); font-weight: 600; }
.step.done .step-dot {
  background: var(--ok);
  border-color: var(--ok);
}
.step.done .step-dot::before { content: "✓"; }
.step.done .step-label { color: var(--ink-secondary); }
.step.error .step-dot {
  background: var(--danger);
  border-color: var(--danger);
}
.step.error .step-dot::before { content: "✕"; }
.step.error .step-label { color: var(--danger); font-weight: 600; }

@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 8px var(--accent-soft); }
}

@media (max-width: 640px) {
  .step-timeline { gap: 2px; }
  .step { padding: 4px 6px; font-size: 11px; }
  .step-label { display: none; } /* mobile: dots only */
  .step.active .step-label { display: inline; }
  .step:not(:last-child)::after { width: 8px; }
}

/* === Audio player wrapper (sticky, liquid glass) === */
.audio-wrapper {
  position: sticky;
  top: var(--sp-3);
  z-index: 10;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  margin-bottom: var(--sp-4);
}
@supports not (backdrop-filter: blur(1px)) {
  .audio-wrapper { background: var(--bg-elevated); box-shadow: var(--shadow-2); }
}
.audio-wrapper audio {
  width: 100%;
  height: 40px;
}

/* === Transcript segments === */
.segments { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.seg {
  display: grid;
  grid-template-columns: 78px 130px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition);
}
.seg:hover {
  background: #fafafc;
  border-color: var(--border-soft);
}
.ts {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
  padding-top: 2px;
  font-weight: 500;
}
.ts:hover { text-decoration: underline; }
.speaker {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-secondary);
  outline: none;
  border-bottom: 1px dashed transparent;
  min-height: 1.4em;
  word-break: break-word;
}
.speaker:focus, .text:focus {
  border-bottom-color: var(--accent);
  background: #fffef5;
}
.speaker:empty::before {
  content: attr(data-placeholder);
  color: #c0c5ce;
  font-weight: 400;
  font-style: italic;
}
.text {
  outline: none;
  border-bottom: 1px dashed transparent;
  word-break: break-word;
  line-height: 1.55;
}

/* Speaker color coding (consistent per name) */
.speaker[data-color="0"] { color: #007aff; }
.speaker[data-color="1"] { color: #af52de; }
.speaker[data-color="2"] { color: #ff9500; }
.speaker[data-color="3"] { color: #34c759; }
.speaker[data-color="4"] { color: #ff3b30; }
.speaker[data-color="5"] { color: #5ac8fa; }

/* === Log === */
pre.log {
  background: #1d1d1f;
  color: #e8e8ed;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 12px 0 0;
  line-height: 1.5;
}
details summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  padding: 4px 0;
  color: var(--ink-secondary);
  user-select: none;
}
details summary:hover { color: var(--ink); }

/* === Empty states === */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty .icon { font-size: 48px; opacity: .4; margin-bottom: 12px; }
.empty .title { font-size: 16px; font-weight: 500; color: var(--ink-secondary); margin-bottom: 6px; }
.empty .sub { font-size: 14px; }
.empty .btn { margin-top: 16px; }

/* === Copy fallback modal === */
.copy-fallback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  animation: fadeIn var(--dur-base) var(--ease-out);
}
.copy-fallback-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: var(--sp-6);
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  max-width: 720px;
  width: 100%;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  box-shadow: var(--shadow-5);
  animation: scaleIn var(--dur-slow) var(--ease-out);
}
@supports not (backdrop-filter: blur(1px)) {
  .copy-fallback-card { background: var(--bg-elevated); }
  .copy-fallback-overlay { background: rgba(0,0,0,0.6); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.copy-fallback-card h3 { margin: 0; font-size: 18px; }
.copy-fallback-card textarea {
  flex: 1;
  min-height: 320px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  background: var(--bg);
  color: var(--ink);
}
.copy-fallback-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
body.reader-dark .copy-fallback-card { background: #2c2c2e; color: #ebebf5; }
body.reader-dark .copy-fallback-card textarea { background: #1c1c1e; color: #ebebf5; border-color: #3a3a3c; }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  transition: all 280ms cubic-bezier(.4, 0, .2, 1);
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success { background: var(--ok); }
.toast.error { background: var(--danger); }

/* === Save state indicator === */
.save-state {
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.save-state.dirty { color: var(--warn); }
.save-state.saved { color: var(--ok); }

/* === Summary view === */
.summary-list { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.summary-item {
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.summary-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.summary-item-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  flex: 1;
  letter-spacing: -0.01em;
}
.summary-ts {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.summary-detail {
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.6;
  margin: 0 0 8px;
}
.summary-quote {
  margin: 8px 0 0;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-left: 2px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.55;
}
.action-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.action-table th, .action-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
  vertical-align: top;
}
.action-table th { font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.action-table tr:last-child td { border-bottom: none; }

/* Color decisions/questions/actions berbeda per section */
.card:has(h2:nth-of-type(1)) .summary-item:has(.summary-item-title) { /* default */ }
section.card h2:first-child + .summary-list .summary-item { border-left-color: var(--accent); }

/* === Reader mode (chat-style, paragraph-grouped) === */
.reader {
  max-width: 760px;
  margin: 0 auto;
  padding: 4px 0 80px;
}
.reader-back {
  font-size: 13px;
  margin-bottom: 8px;
}
.reader-back a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}
.reader-back a:hover { color: var(--accent); }

.reader-head {
  padding-bottom: 18px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.reader-title {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 6px 0 10px;
}
.reader-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.reader-meta-dot { color: var(--border); }

/* Reader-specific styling — toolbar replaced with shared meeting-nav */

.reader-body {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Speaker block (chat-bubble style, grouped consecutive segments) */
.reader-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px 16px;
  transition: border-color var(--transition);
}
.reader-block:hover { border-color: var(--border); }
.reader-block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  gap: 12px;
}
.reader-speaker {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,.04);
  border: 1px solid transparent;
}
.reader-speaker-unknown {
  color: var(--muted) !important;
  font-style: italic;
  font-weight: 500;
}
.reader-block-ts {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.reader-block-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reader-line {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  position: relative;
  padding-left: 0;
}
.reader-line-ts {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  color: var(--muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 8px;
  vertical-align: middle;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity var(--transition);
}
.reader-line:hover .reader-line-ts { opacity: 1; }

.reader-foot {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
}

@media (max-width: 640px) {
  .reader-title { font-size: 24px; }
  .reader-block { padding: 12px 14px; }
  .reader-line { font-size: 15px; }
  .reader-toolbar { padding: 10px 12px; top: 60px; }
  .reader-toolbar-group { width: 100%; justify-content: center; }
  .reader-line-ts { opacity: 1; } /* always show on mobile (no hover) */
}

/* Reader dark mode */
body.reader-dark { background: #1c1c1e; color: #ebebf5; }
body.reader-dark .sidebar {
  background: #2c2c2e;
  border-color: #3a3a3c;
}
body.reader-dark .sidebar-item { color: #ebebf5; }
body.reader-dark .sidebar-item:hover { background: #3a3a3c; color: white; }
body.reader-dark .sidebar-item.active { background: rgba(10,132,255,.2); color: #0a84ff; }
body.reader-dark .sidebar-item-badge { background: #3a3a3c; color: #ebebf5; }
body.reader-dark .sidebar-section-title,
body.reader-dark .sidebar-empty,
body.reader-dark .user-logout { color: #8e8e93; }
body.reader-dark .user-name,
body.reader-dark .brand { color: white; }
body.reader-dark .sidebar-quota { background: #1c1c1e; border-color: #3a3a3c; }
body.reader-dark .quota-value { color: white; }

body.reader-dark .reader, body.reader-dark .reader-body { color: #ebebf5; }
body.reader-dark .reader-meta, body.reader-dark .reader-back a { color: #8e8e93; }
body.reader-dark .reader-head, body.reader-dark .reader-foot { border-color: #3a3a3c; }
body.reader-dark .reader-toolbar {
  background: #2c2c2e;
  border-color: #3a3a3c;
}
body.reader-dark .reader-block {
  background: #2c2c2e;
  border-color: #3a3a3c;
}
body.reader-dark .reader-block:hover { border-color: #48484a; }
body.reader-dark .reader-line { color: #ebebf5; }
body.reader-dark .reader-line-ts { background: #1c1c1e; color: #8e8e93; }
body.reader-dark .reader-block-ts { color: #8e8e93; }
body.reader-dark .reader-speaker { background: rgba(255,255,255,.08); }

body.reader-dark .btn {
  background: #2c2c2e;
  color: #ebebf5;
  border-color: #3a3a3c;
}
body.reader-dark .btn:hover { background: #3a3a3c; }
body.reader-dark .btn.primary { background: #0a84ff; color: white; border-color: #0a84ff; }
body.reader-dark .btn.ghost { background: transparent; color: #0a84ff; border-color: transparent; }

/* === Tablet (sidebar narrower) === */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 220px 1fr; }
}

/* === Mobile (sidebar jadi drawer) === */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: grid; place-items: center; }
  .sidebar-backdrop.show { display: block; }
  .container { padding: 64px 18px 60px; }
}

@media (max-width: 640px) {
  .container { padding: 64px 14px 60px; }
  .card { padding: 16px 16px; }
  h1 { font-size: 22px; }
  .seg { grid-template-columns: 56px 90px 1fr; gap: 8px; padding: 10px 6px; }
  .ts { font-size: 11px; }
  .audio-wrapper { top: 62px; padding: 10px 12px; }
  .meeting-card { padding: 14px 14px; }
  .project-grid { grid-template-columns: 1fr; gap: 12px; }
  .row.gap > * + * { margin-left: 0; }
  .row.gap { flex-wrap: wrap; gap: 8px; }
  .btn.big { width: 100%; }
}
