/* shell.css — Material Design 3 (Material You / Android) design system for NeoBrain */

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 COLOR TOKENS — Dark theme, Medical Teal primary
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  --md-primary:                   #4ECDC4;
  --md-on-primary:                #00201F;
  --md-primary-container:         #004F4E;
  --md-on-primary-container:      #70F7EE;

  --md-secondary:                 #FFBA45;
  --md-on-secondary:              #3F2D00;
  --md-secondary-container:       #5A4000;
  --md-on-secondary-container:    #FFDEA6;

  --md-tertiary:                  #A8C7FA;
  --md-on-tertiary:               #0842A0;
  --md-tertiary-container:        #265EA5;
  --md-on-tertiary-container:     #D6E3FF;

  --md-error:                     #FFB4AB;
  --md-on-error:                  #690005;
  --md-error-container:           #93000A;
  --md-on-error-container:        #FFDAD6;

  --md-surface:                   #141218;
  --md-surface-dim:               #141218;
  --md-surface-container-lowest:  #0F0D13;
  --md-surface-container-low:     #1C1B20;
  --md-surface-container:         #201F26;
  --md-surface-container-high:    #2B2930;
  --md-surface-container-highest: #36343B;

  --md-on-surface:                #E6E1E5;
  --md-on-surface-variant:        #CAC4D0;
  --md-outline:                   #938F99;
  --md-outline-variant:           #49454F;

  --md-inverse-surface:           #E6E1E5;
  --md-inverse-on-surface:        #322F37;
  --md-inverse-primary:           #006B69;

  /* ── MD3 Shape scale ──────────────────────────────────────────────────── */
  --md-shape-xs:   4px;
  --md-shape-sm:   8px;
  --md-shape-md:   12px;
  --md-shape-lg:   16px;
  --md-shape-xl:   28px;
  --md-shape-full: 9999px;

  /* ── Elevation tint (primary overlay) ────────────────────────────────── */
  --md-elev-1: rgba(78,205,196,0.05);
  --md-elev-2: rgba(78,205,196,0.08);
  --md-elev-3: rgba(78,205,196,0.11);

  /* ── Layout ───────────────────────────────────────────────────────────── */
  --topbar-h:   64px;
  --navbar-h:   80px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Google Sans', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--md-surface);
  color: var(--md-on-surface);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  padding-bottom: var(--navbar-h);
}

a { color: inherit; text-decoration: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 TOP APP BAR — Small
   ══════════════════════════════════════════════════════════════════════════ */
.top-app-bar {
  height: var(--topbar-h);
  background: var(--md-surface-container);
  display: flex;
  align-items: center;
  padding: 0 4px 0 16px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--md-outline-variant);
}

.top-app-bar-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--md-on-surface);
  letter-spacing: 0;
  flex: 1;
}

.top-app-bar-title span {
  color: var(--md-primary);
}

/* Icon button (48dp touch target, 24dp icon) */
.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--md-shape-full);
  background: transparent;
  border: none;
  color: var(--md-on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: background 0.15s;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.icon-btn:hover  { background: rgba(232,225,229,0.08); }
.icon-btn:active { background: rgba(232,225,229,0.12); }
.icon-btn svg, .icon-btn span { pointer-events: none; }

/* WS indicator dot (inline in top bar) */
.ws-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ws-dot.on  { background: #69E587; box-shadow: 0 0 6px #69E587; }
.ws-dot.off { background: var(--md-outline); }

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 NAVIGATION BAR — bottom
   ══════════════════════════════════════════════════════════════════════════ */
.nav-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--navbar-h);
  background: var(--md-surface-container);
  border-top: 1px solid var(--md-outline-variant);
  display: flex;
  align-items: center;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 0;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--md-on-surface-variant);
  font-family: inherit;
  text-decoration: none;
  position: relative;
}

.nav-item-indicator {
  width: 64px;
  height: 32px;
  border-radius: var(--md-shape-full);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background 0.2s;
  margin-bottom: 2px;
}

.nav-item.active .nav-item-indicator {
  background: var(--md-secondary-container);
}
.nav-item.active { color: var(--md-on-surface); }

.nav-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 FAB — Extended
   ══════════════════════════════════════════════════════════════════════════ */
.fab {
  position: fixed;
  bottom: calc(var(--navbar-h) + 16px);
  right: 16px;
  z-index: 90;
  height: 56px;
  border-radius: var(--md-shape-lg);
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.1px;
  cursor: pointer;
  box-shadow:
    0 3px 8px rgba(0,0,0,0.3),
    0 1px 3px rgba(0,0,0,0.15);
  transition: box-shadow 0.2s, background 0.15s;
}
.fab:hover {
  background: color-mix(in srgb, var(--md-primary-container), var(--md-on-primary-container) 8%);
  box-shadow:
    0 6px 14px rgba(0,0,0,0.35),
    0 2px 5px rgba(0,0,0,0.15);
}
.fab-icon { font-size: 22px; font-weight: 400; line-height: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════════════════ */
.main-content {
  padding: 16px 16px 24px;
  max-width: 640px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 CARDS
   ══════════════════════════════════════════════════════════════════════════ */
.md-card {
  background: var(--md-surface-container-high);
  border-radius: var(--md-shape-md);
  padding: 16px;
  margin-bottom: 8px;
}

.md-card-outlined {
  background: var(--md-surface);
  border-radius: var(--md-shape-md);
  border: 1px solid var(--md-outline-variant);
  padding: 16px;
  margin-bottom: 8px;
}

.md-card-elevated {
  background: color-mix(in srgb, var(--md-surface-container-low), var(--md-primary) 5%);
  border-radius: var(--md-shape-md);
  padding: 16px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25), 0 1px 1px rgba(0,0,0,0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 BUTTONS
   ══════════════════════════════════════════════════════════════════════════ */
.btn-filled {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: 40px; padding: 0 24px;
  border-radius: var(--md-shape-full);
  background: var(--md-primary); color: var(--md-on-primary);
  border: none; font-family: inherit; font-size: 14px; font-weight: 500;
  letter-spacing: 0.1px; cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s;
}
.btn-filled:hover:not(:disabled) {
  background: color-mix(in srgb, var(--md-primary), var(--md-on-primary) 8%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.btn-filled:disabled { opacity: 0.38; cursor: not-allowed; }
.btn-filled.full { width: 100%; height: 48px; font-size: 15px; }

.btn-tonal {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: 40px; padding: 0 24px;
  border-radius: var(--md-shape-full);
  background: var(--md-secondary-container); color: var(--md-on-secondary-container);
  border: none; font-family: inherit; font-size: 14px; font-weight: 500;
  letter-spacing: 0.1px; cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s;
}
.btn-tonal:hover:not(:disabled) {
  background: color-mix(in srgb, var(--md-secondary-container), var(--md-on-secondary-container) 8%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.btn-tonal:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-outlined {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: 40px; padding: 0 24px;
  border-radius: var(--md-shape-full);
  background: transparent; color: var(--md-primary);
  border: 1px solid var(--md-outline); font-family: inherit; font-size: 14px;
  font-weight: 500; letter-spacing: 0.1px; cursor: pointer;
  transition: background 0.15s;
}
.btn-outlined:hover { background: rgba(78,205,196,0.08); }

.btn-text {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: 40px; padding: 0 12px;
  border-radius: var(--md-shape-full);
  background: transparent; color: var(--md-primary);
  border: none; font-family: inherit; font-size: 14px; font-weight: 500;
  letter-spacing: 0.1px; cursor: pointer; transition: background 0.15s;
}
.btn-text:hover { background: rgba(78,205,196,0.08); }

/* Small action buttons */
.btn-xs {
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 12px;
  border-radius: var(--md-shape-full);
  font-size: 12px; font-weight: 500; letter-spacing: 0.5px;
  cursor: pointer; border: none; font-family: inherit;
  transition: background 0.12s;
}
.btn-xs-filled  { background: var(--md-primary); color: var(--md-on-primary); }
.btn-xs-filled:hover  { background: color-mix(in srgb, var(--md-primary), var(--md-on-primary) 8%); }
.btn-xs-tonal   { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.btn-xs-tonal:hover   { background: color-mix(in srgb, var(--md-secondary-container), var(--md-on-secondary-container) 8%); }
.btn-xs-error   { background: var(--md-error-container); color: var(--md-on-error-container); }
.btn-xs-error:hover   { background: color-mix(in srgb, var(--md-error-container), var(--md-on-error-container) 8%); }
.btn-xs-surface { background: var(--md-surface-container-highest); color: var(--md-on-surface); }
.btn-xs-surface:hover { background: color-mix(in srgb, var(--md-surface-container-highest), var(--md-on-surface) 8%); }

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 TEXT FIELDS — Outlined variant
   ══════════════════════════════════════════════════════════════════════════ */
.md-field {
  position: relative;
  margin-bottom: 20px;
}

.md-field input,
.md-field textarea,
.md-field select {
  width: 100%;
  padding: 16px;
  background: transparent;
  border: 1px solid var(--md-outline);
  border-radius: var(--md-shape-xs);
  color: var(--md-on-surface);
  font-size: 16px;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.15s, border-width 0.1s;
  -webkit-appearance: none;
}
.md-field textarea { resize: vertical; min-height: 120px; }
.md-field select { cursor: pointer; }
.md-field select option { background: var(--md-surface-container); }

.md-field input::placeholder,
.md-field textarea::placeholder { color: transparent; }

.md-field input:focus,
.md-field textarea:focus,
.md-field select:focus {
  border: 2px solid var(--md-primary);
  padding: 15px; /* compensate 1→2px border shift */
}

/* Floating label */
.md-field label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-on-surface-variant);
  font-size: 16px;
  font-family: inherit;
  pointer-events: none;
  transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);
  background: var(--md-surface-container-low);
  padding: 0 4px;
  line-height: 1;
}
/* textarea label sits at top */
.md-field textarea ~ label { top: 16px; transform: none; }

/* Float up when focused or has content */
.md-field input:focus ~ label,
.md-field input:not(:placeholder-shown) ~ label,
.md-field textarea:focus ~ label,
.md-field textarea:not(:placeholder-shown) ~ label,
.md-field.has-value label {
  top: 0;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
}
.md-field input:focus ~ label,
.md-field textarea:focus ~ label {
  color: var(--md-primary);
}

/* Supporting text below field */
.md-field-hint {
  font-size: 12px;
  color: var(--md-on-surface-variant);
  padding: 4px 16px 0;
  margin-top: -12px;
  margin-bottom: 8px;
  display: block;
}

/* Simpler labeled field (no float, used in overlays with select) */
.md-select-field { margin-bottom: 16px; }
.md-select-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.md-select-field select {
  width: 100%; padding: 12px 16px;
  background: var(--md-surface-container-highest);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-shape-xs);
  color: var(--md-on-surface); font-size: 14px; font-family: inherit;
  outline: none; cursor: pointer; -webkit-appearance: none;
}
.md-select-field select:focus { border-color: var(--md-primary); border-width: 2px; }
.md-select-field select option { background: var(--md-surface-container); }

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 CHIPS
   ══════════════════════════════════════════════════════════════════════════ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 12px;
  border-radius: var(--md-shape-sm);
  font-size: 12px; font-weight: 500; letter-spacing: 0.5px;
  white-space: nowrap;
}
/* Assist/suggestion chips */
.chip-surface {
  background: var(--md-surface-container-highest);
  color: var(--md-on-surface);
  border: 1px solid var(--md-outline-variant);
}
/* Filter chip — workspace */
.chip-primary {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  border: 1px solid transparent;
}
.chip-secondary {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
  border: 1px solid transparent;
}
.chip-finance {
  background: #fff8e1;
  color: #6d4c00;
  border: 1px solid #ffe082;
}
.chip-tertiary {
  background: var(--md-tertiary-container);
  color: var(--md-on-tertiary-container);
  border: 1px solid transparent;
}
.chip-error {
  background: var(--md-error-container);
  color: var(--md-on-error-container);
  border: 1px solid transparent;
}
/* Interactive filter chips */
.chip-filter {
  background: transparent;
  color: var(--md-on-surface-variant);
  border: 1px solid var(--md-outline);
  cursor: pointer; font-family: inherit;
  transition: background 0.15s;
}
.chip-filter.selected {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
  border-color: transparent;
}
.chip-filter:hover { background: rgba(202,196,208,0.08); }

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 BOTTOM SHEET / DIALOG
   ══════════════════════════════════════════════════════════════════════════ */
.scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
}

/* Bottom sheet (mobile-first) */
.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--md-surface-container-low);
  border-radius: var(--md-shape-xl) var(--md-shape-xl) 0 0;
  padding: 0 24px 40px;
  z-index: 210;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}
.sheet-handle {
  width: 32px; height: 4px;
  background: var(--md-surface-container-highest);
  border-radius: var(--md-shape-full);
  margin: 12px auto 20px;
}
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.sheet-title {
  font-size: 22px; font-weight: 500; color: var(--md-on-surface);
}

/* Dialog (desktop) */
@media (min-width: 600px) {
  .bottom-sheet {
    top: 50%; left: 50%;
    bottom: auto; right: auto;
    transform: translate(-50%, -50%);
    width: calc(100% - 32px);
    max-width: 520px;
    border-radius: var(--md-shape-xl);
    padding: 24px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    max-height: 88vh;
  }
  .sheet-handle { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 TAB BAR (Secondary tabs)
   ══════════════════════════════════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--md-outline-variant);
  margin-bottom: 24px;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1; min-width: 80px;
  height: 48px;
  background: transparent; border: none;
  color: var(--md-on-surface-variant);
  font-family: inherit; font-size: 14px; font-weight: 500;
  letter-spacing: 0.1px; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.tab-btn.active {
  color: var(--md-primary);
  border-bottom-color: var(--md-primary);
}
.tab-btn:not(.active):hover { background: rgba(78,205,196,0.06); }

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD — Section headers, lists
   ══════════════════════════════════════════════════════════════════════════ */
.page-title {
  font-size: 22px; font-weight: 500;
  color: var(--md-on-surface);
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: 14px; color: var(--md-on-surface-variant);
  margin-bottom: 24px;
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 8px;
}
.section-title {
  font-size: 14px; font-weight: 500;
  color: var(--md-on-surface-variant);
  letter-spacing: 0.1px;
  text-transform: uppercase;
  font-size: 11px;
  display: flex; align-items: center; gap: 8px;
}
.section-link {
  font-size: 12px; font-weight: 500;
  color: var(--md-primary); cursor: pointer;
}

/* Badge / count pill */
.badge {
  min-width: 20px; height: 20px;
  background: var(--md-error-container);
  color: var(--md-on-error-container);
  border-radius: var(--md-shape-full);
  font-size: 11px; font-weight: 700;
  padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Sync status chips row */
.sync-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.sync-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: var(--md-shape-sm);
  font-size: 12px; font-weight: 500;
  background: var(--md-surface-container-highest);
  color: var(--md-on-surface-variant);
  border: 1px solid var(--md-outline-variant);
}
.sync-chip::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--md-outline);
  flex-shrink: 0;
}
.sync-chip.on {
  background: rgba(105,229,135,0.08);
  color: #69E587;
  border-color: rgba(105,229,135,0.2);
}
.sync-chip.on::before {
  background: #69E587;
  box-shadow: 0 0 6px #69E587;
}

/* Item list cards */
.item-row {
  background: var(--md-surface-container);
  border-radius: var(--md-shape-md);
  padding: 16px;
  margin-bottom: 8px;
  transition: background 0.12s;
}
.item-row:last-child { margin-bottom: 0; }
.item-row-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.item-date {
  font-size: 11px; font-weight: 500;
  color: var(--md-on-surface-variant);
  margin-left: auto;
}
.item-body {
  font-size: 14px; color: var(--md-on-surface);
  line-height: 1.5; margin-bottom: 12px;
  word-break: break-word;
}
.item-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}

/* State labels (instead of heavy tags) */
.state-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: var(--md-shape-full);
  text-transform: uppercase;
}
.state-drafted   { background: var(--md-surface-container-highest); color: var(--md-on-surface-variant); }
.state-reviewed  { background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.state-committed { background: rgba(105,229,135,0.12); color: #69E587; border: 1px solid rgba(105,229,135,0.2); }
.state-rejected  { background: var(--md-error-container); color: var(--md-on-error-container); }
.state-failed    { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

/* Empty state */
.empty-state {
  padding: 24px 0;
  text-align: center;
  color: var(--md-on-surface-variant);
  font-size: 14px;
}

/* Audit log rows */
.audit-row {
  display: flex; gap: 8px; align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--md-outline-variant);
  font-size: 12px; flex-wrap: wrap;
}
.audit-row:last-child { border-bottom: none; }
.audit-ts     { color: var(--md-on-surface-variant); white-space: nowrap; flex-shrink: 0; min-width: 80px; }
.audit-action { font-weight: 500; color: var(--md-on-surface); }
.audit-entity { color: var(--md-on-surface-variant); font-size: 11px; }

/* ═══════════════════════════════════════════════════════════════════════════
   MD3 ALERTS / BANNERS
   ══════════════════════════════════════════════════════════════════════════ */
.md-alert {
  padding: 12px 16px; border-radius: var(--md-shape-xs);
  font-size: 14px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 8px;
}
.md-alert-error {
  background: var(--md-error-container);
  color: var(--md-on-error-container);
}
.md-alert-success {
  background: rgba(105,229,135,0.12);
  border: 1px solid rgba(105,229,135,0.25);
  color: #69E587;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPINNER
   ══════════════════════════════════════════════════════════════════════════ */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH PAGES (login / bootstrap)
   ══════════════════════════════════════════════════════════════════════════ */
body.auth-page {
  background: var(--md-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  padding-bottom: 0; /* no nav bar on auth pages */
}

.auth-surface {
  background: var(--md-surface-container-low);
  border-radius: var(--md-shape-xl);
  padding: 32px 24px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.auth-logo {
  font-size: 28px;
  font-weight: 600;
  color: var(--md-primary);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--md-on-surface-variant);
  margin-bottom: 32px;
}

/* Override field background for auth pages */
body.auth-page .md-field input,
body.auth-page .md-field textarea {
  background: transparent;
}
body.auth-page .md-field label {
  background: var(--md-surface-container-low);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS PAGE — List tiles
   ══════════════════════════════════════════════════════════════════════════ */
.settings-section {
  margin-bottom: 8px;
}
.settings-section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--md-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 4px 8px;
}
.list-tile {
  background: var(--md-surface-container);
  border-radius: var(--md-shape-md);
  padding: 16px;
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 16px;
}
.list-tile-icon {
  font-size: 20px;
  color: var(--md-on-surface-variant);
  width: 24px; text-align: center; flex-shrink: 0;
}
.list-tile-content { flex: 1; }
.list-tile-headline {
  font-size: 16px; font-weight: 400; color: var(--md-on-surface);
}
.list-tile-supporting {
  font-size: 14px; color: var(--md-on-surface-variant); margin-top: 2px;
}
.list-tile-trailing {
  font-size: 14px; color: var(--md-on-surface-variant); flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   VOICE RECORD BUTTON
   ══════════════════════════════════════════════════════════════════════════ */
.record-btn {
  width: 80px; height: 80px;
  border-radius: var(--md-shape-full);
  border: 2px solid rgba(239,68,68,0.4);
  background: rgba(239,68,68,0.08);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.record-btn:hover:not(.recording) {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.6);
}
.record-btn.recording {
  background: rgba(239,68,68,0.2);
  border-color: #ef4444;
  animation: pulse-record 1.2s ease-in-out infinite;
}
@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.35); }
  50%       { box-shadow: 0 0 0 16px rgba(239,68,68,0); }
}
.record-icon-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: #ef4444; display: block;
}
.record-icon-stop {
  width: 22px; height: 22px; border-radius: 4px;
  background: #ef4444; display: block;
}
.record-duration {
  font-size: 24px; font-weight: 400; letter-spacing: 2px;
  color: #ef4444; margin-top: 14px;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CODE / JSON PREVIEW
   ══════════════════════════════════════════════════════════════════════════ */
.code-preview {
  background: var(--md-surface-container-lowest);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-shape-xs);
  padding: 12px 14px;
  font-size: 12px;
  font-family: 'Roboto Mono', 'SF Mono', 'Fira Code', monospace;
  color: var(--md-on-surface-variant);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.detail-label {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--md-on-surface-variant); margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER ROW
   ══════════════════════════════════════════════════════════════════════════ */
.filter-row {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}

/* Loading full-screen */
.loading-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — MD3 Navigation Rail on medium/large screens
   mobile-first base = bottom nav bar
   ≥840px (MD3 "medium" breakpoint) = left nav rail + content offset
   ≥1280px = wider content column
   ══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 840px) {
  /* ── Remove bottom body padding (no more bottom nav) ─────────────────── */
  body { padding-bottom: 0; }

  /* ── Navigation Rail ─────────────────────────────────────────────────── */
  /* MD3 spec: 80dp wide, full height below top bar, icons + labels */
  .nav-bar {
    width: 80px;
    height: auto;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    right: auto;
    border-top: none;
    border-right: 1px solid var(--md-outline-variant);
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 12px 0 24px;
    overflow-y: auto;
  }

  .nav-item {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
    width: 100%;
    align-items: center;
  }

  .nav-item-indicator {
    width: 56px;
    height: 32px;
    margin-bottom: 4px;
  }

  .nav-label {
    font-size: 11px;
    letter-spacing: 0.3px;
  }

  /* ── Main content — offset for rail ──────────────────────────────────── */
  .main-content {
    margin-left: 80px;
    max-width: 720px;
    padding: 28px 40px;
  }

  /* ── FAB — desktop position ──────────────────────────────────────────── */
  /* No longer needs to clear the bottom nav */
  .fab {
    bottom: 32px;
    right: 32px;
  }

  /* ── Top App Bar — subtle desktop tweak ─────────────────────────────── */
  .top-app-bar {
    padding: 0 8px 0 24px;
  }

  /* ── Auth surface — a bit more padding on desktop ────────────────────── */
  .auth-surface {
    max-width: 448px;
    padding: 40px 40px 36px;
  }

  /* ── Bottom sheet becomes dialog (already at 600px, reinforce here) ──── */
  .bottom-sheet {
    width: 540px;
    max-width: 540px;
    padding: 28px 32px 32px;
  }
}

/* ── Large desktop (≥1280px) — wider content, two-column ready ─────────── */
@media (min-width: 1280px) {
  .nav-bar {
    width: 88px;
  }

  .main-content {
    margin-left: 88px;
    max-width: 860px;
    padding: 36px 56px;
  }

  /* Two-column cards grid for the dashboard sections on large screens */
  .two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .two-col-grid .item-row { margin-bottom: 0; }
}

/* ── Ensure auth pages never get the rail offset ─────────────────────── */
@media (min-width: 840px) {
  body.auth-page { padding-bottom: 0; }
}
