/* UCP Tracker – Dark mode default, mobile-first */

:root {
  --bg: #0f1115;
  --surface: #1a1d24;
  --surface2: #242830;
  --border: #2e333d;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --primary: #4f8cff;
  --primary-hover: #3a7aef;
  --accent: #00c853;
  --warning: #ffab00;
  --danger: #ff5252;
  --case: #4f8cff;
  --avail: #00c853;
  --call: #ffab00;
  --block: #b388ff;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --header-pad-y: 12px;
  --header-content-height: 40px; /* matches .icon-btn */
  --header-height: calc(var(--header-pad-y) * 2 + var(--header-content-height) + var(--safe-top));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface2: #f0f2f5;
  --border: #dce0e6;
  --text: #1a1d24;
  --text-muted: #5f6368;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* Layout */
#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(80px + var(--safe-bottom)); /* space for bottom nav later */
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

#app.is-db-view {
  max-width: none;
  padding-bottom: calc(24px + var(--safe-bottom));
}

#view-db[hidden],
#view-today[hidden] {
  display: none !important;
}

/* Header — pad past notch / status bar in standalone webapp */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--header-pad-y) + var(--safe-top)) 16px var(--header-pad-y);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.view-toggle {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}

.view-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
}

.view-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}

.day-pager {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.day-pager[hidden] {
  display: none !important;
}

#app.is-db-view .app-header h1 {
  font-size: 1rem;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--surface2);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.icon-btn:active { background: var(--border); }

/* Quick Add Card (top 1/3) */
.quick-add {
  margin: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.quick-add h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.quick-add-row {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  flex: 1;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-mic,
.btn-photo {
  color: #fff;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.35rem;
  flex-shrink: 0;
  padding: 0;
}

.btn-mic {
  background: linear-gradient(135deg, #ff5252, #ff1744);
  position: relative;
}

.btn-photo {
  background: linear-gradient(135deg, #5b8def, #3d6fd8);
}

.btn-photo:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* Period tracking */
.stats-section {
  margin: 0 16px 4px;
}

.stats-section-bottom {
  margin: 8px 16px 28px;
  padding-top: 8px;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.stats-header:active {
  opacity: 0.9;
}

.stats-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.stats-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 700;
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}

.stats-section.is-collapsed .stats-chevron {
  transform: rotate(0deg);
}

.stats-ytd {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.stats-body {
  margin-top: 10px;
}

.stats-section.is-collapsed .stats-body {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-points {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.projection-card {
  margin-top: 10px;
  background: linear-gradient(145deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.projection-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.projection-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.projection-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
  margin-top: 2px;
}

.projection-remain-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--warning);
  margin-top: 2px;
  text-align: right;
}

.projection-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.4;
}

.projection-quarters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.proj-q {
  flex: 1;
  min-width: 64px;
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.proj-q-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.proj-q-pts {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* Timeline */
.timeline-section {
  flex: 1;
  padding: 0 16px 24px;
}

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

.timeline-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.day-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.timeline-canvas {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  position: relative;
}

.tl-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}
.tl-row:last-of-type {
  margin-bottom: 4px;
}
.tl-row-label {
  flex: 0 0 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1.2;
}
.tl-row-label span {
  font-weight: 600;
  opacity: 0.85;
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.tl-row-body {
  flex: 1;
  min-width: 0;
}

.timeline-hours {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
}

.timeline-track {
  position: relative;
  height: 44px;
  background: var(--surface2);
  border-radius: 8px;
}

.tl-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  min-width: 4px;
}

.tl-block.case { background: var(--case); z-index: 2; }
.tl-block.avail {
  background: var(--avail);
  opacity: 0.85;
  color: #04150a;
  font-weight: 700;
  z-index: 1;
  font-size: 0.65rem;
}
.tl-block.call { background: var(--call); }
.tl-block.block-marker { background: var(--block); height: 10px; top: auto; bottom: 2px; z-index: 3; }

.entry-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.entry-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.entry-time {
  font-weight: 600;
  font-size: 0.95rem;
}

.entry-pts {
  font-weight: 700;
  color: var(--accent);
}

.entry-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text-muted);
}
.badge.peds { background: #3d2b6b; color: #d4bfff; }
.badge.stipend { background: #3d2e00; color: #ffd54f; }
.badge.inhouse { background: #3d2e00; color: #ffd54f; }

/* Modal / Form */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 20px 16px calc(40px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.modal-header h2 { font-size: 1.2rem; }

/* Camera → print prompt: above other UI, centered so it’s hard to miss */
.photo-sheet-overlay {
  z-index: 320;
  align-items: center;
  padding: 20px 16px;
}

.photo-sheet-overlay .photo-sheet-modal {
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: min(88dvh, 520px);
  padding: 22px 18px 28px;
  transform: translateY(24px) scale(0.98);
  box-shadow: var(--shadow);
}

.photo-sheet-overlay.open .photo-sheet-modal {
  transform: translateY(0) scale(1);
}

.photo-sheet-modal .photo-sheet-copy {
  margin: 0 0 18px;
  line-height: 1.45;
}

.photo-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.photo-sheet-skip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}

.photo-sheet-skip input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(20px); }

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.chip:disabled,
.chip.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.chip-block {
  position: relative;
  padding-right: 28px;
}
.chip-count {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #04140a;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.label-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0;
}

.time-roller {
  appearance: none;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.time-roller:focus {
  border-color: var(--primary);
}

.time-format-hint {
  margin: -6px 0 14px;
}

.flats-cart {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.flats-cart-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 6px 2px;
}
.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.85rem;
}
.cart-item.uncounted {
  opacity: 0.65;
}
.cart-x {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
}

.call-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.call-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.call-panel-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.call-panel-hint {
  font-size: 0.75rem;
  color: var(--call);
  text-align: right;
  max-width: 55%;
}
.call-chips .chip {
  font-size: 0.8rem;
  padding: 7px 12px;
}

.call-cats {
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.call-cats .chip {
  font-size: 0.82rem;
  padding: 9px 14px;
  flex: 1 1 auto;
  text-align: center;
}
.inhouse-subs {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px dashed rgba(255, 171, 0, 0.4);
}
.subs-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.or-call-stipend,
.or-stipend-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.toggle-row.compact {
  padding: 4px 0;
}

.day-blockers {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.blocker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}
.time-roller-sm {
  width: auto;
  min-width: 7.5rem;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.context-banner {
  margin: 4px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.context-banner strong {
  color: var(--primary);
}

.tl-block.partial-block {
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 77, 79, 0.22),
    rgba(255, 77, 79, 0.22) 6px,
    rgba(255, 77, 79, 0.08) 6px,
    rgba(255, 77, 79, 0.08) 12px
  );
  color: #ffb4b4;
  border: 1px solid rgba(255, 77, 79, 0.4);
  z-index: 1;
  pointer-events: none;
  font-size: 0.65rem;
}

.tl-block.call-hatch {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 171, 0, 0.28),
    rgba(255, 171, 0, 0.28) 4px,
    rgba(255, 171, 0, 0.08) 4px,
    rgba(255, 171, 0, 0.08) 10px
  );
  border: 1px solid rgba(255, 171, 0, 0.45);
  z-index: 0;
  pointer-events: none;
}
.legend-hatch {
  color: var(--call);
}

.badge.or { background: #1a3a5c; color: #9ec9ff; }

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger-outline:active { opacity: 0.85; }

.points-explainer {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--surface2);
}
.points-explainer summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.explainer-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.explain-row {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.explain-title {
  font-size: 0.85rem;
  font-weight: 700;
}
.explain-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.pending-section {
  margin: 0 16px 12px;
}
.pending-section.pending-flash .pending-card {
  animation: pending-flash 1.6s ease-out 1;
}
@keyframes pending-flash {
  0% {
    box-shadow: 0 0 0 3px var(--primary);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}
.pending-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pending-card {
  background: var(--surface);
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
}
.pending-card.conf-low {
  border-color: var(--danger);
}
.pending-card.conf-mid {
  border-color: var(--call);
}
.pending-transcript {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.pending-confidence {
  font-variant-numeric: tabular-nums;
}
.pending-confidence.low { color: var(--danger); }
.pending-confidence.mid { color: var(--call); }
.pending-confidence.high { color: var(--accent); }
.pending-review-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(79, 140, 255, 0.12);
  border: 1px solid rgba(79, 140, 255, 0.35);
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.4;
}
.pending-review-banner.warn {
  background: rgba(255, 171, 0, 0.12);
  border-color: rgba(255, 171, 0, 0.35);
}
.badge.photo { background: #1a3a5c; color: #9ec9ff; }

.dictation-status {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--accent);
}

.dictation-help {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--surface2);
}
.dictation-help summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.dictation-help-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dict-tip-intro {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.dict-tip-example {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
}
.dict-tip-example-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.dict-tip-example pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}
.dict-tip-row {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.dict-tip-phrase {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
}
.dict-tip-meaning {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.35;
}
.dict-tip-also {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.9;
}
.settings-dict-help {
  margin-top: 16px;
}

.mic-visualizer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 23, 68, 0.08);
  border: 1px solid rgba(255, 77, 79, 0.3);
}
.mic-visualizer[hidden] {
  display: none !important;
}
.mic-viz-rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff1744;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(255, 23, 68, 0.65);
  animation: mic-rec-blink 1.1s ease-in-out infinite;
}
@keyframes mic-rec-blink {
  50% { opacity: 0.35; }
}
.mic-viz-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 36px;
  min-width: 0;
}
.mic-viz-bar {
  flex: 1;
  max-width: 7px;
  height: 100%;
  background: linear-gradient(to top, #ff1744, #ff8a80);
  border-radius: 3px;
  transform-origin: center bottom;
  transform: scaleY(0.12);
  will-change: transform;
}
.mic-viz-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ff5252;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.mic-visualizer.is-active {
  display: flex;
}
.mic-visualizer.is-active .mic-viz-bar--idle {
  animation: mic-viz-idle 0.85s ease-in-out infinite;
}
.mic-visualizer.is-active .mic-viz-bar--idle:nth-child(3n + 1) {
  animation-delay: 0.1s;
}
.mic-visualizer.is-active .mic-viz-bar--idle:nth-child(3n + 2) {
  animation-delay: 0.2s;
}
@keyframes mic-viz-idle {
  0%, 100% { transform: scaleY(0.14); opacity: 0.55; }
  50% { transform: scaleY(0.42); opacity: 1; }
}

.btn-mic.recording {
  background: linear-gradient(135deg, #d50000, #ff1744);
  box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.45);
}
.btn-mic.recording::after {
  content: "■";
  position: absolute;
  font-size: 0.55rem;
  bottom: 6px;
  right: 7px;
  line-height: 1;
  opacity: 0.9;
}

.day-flag {
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 10px;
}
.stipend-flag {
  background: rgba(255, 171, 0, 0.12);
  border: 1px solid rgba(255, 171, 0, 0.35);
  color: var(--call);
}
.inhouse-flag {
  background: rgba(79, 140, 255, 0.12);
  border: 1px solid rgba(79, 140, 255, 0.35);
  color: var(--primary);
}

.tl-block.call-band {
  background: rgba(255, 171, 0, 0.18);
  border: 1px dashed rgba(255, 171, 0, 0.45);
  z-index: 0;
  pointer-events: none;
}

.suggestions {
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 180px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  z-index: 20;
  box-shadow: var(--shadow);
}
.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
}
.suggestion-label {
  flex: 1;
  min-width: 0;
}
.suggestion-fav {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  opacity: 0.35;
}
.suggestion-fav.on {
  color: var(--accent);
  opacity: 1;
}
.suggestion-section {
  padding: 8px 14px 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  pointer-events: none;
}
.suggestion-item:hover,
.suggestion-item.active {
  background: var(--surface2);
}

.relative { position: relative; }

.points-preview {
  background: var(--surface2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
  font-size: 0.9rem;
}
.points-preview strong {
  color: var(--accent);
  font-size: 1.15rem;
}

.helper-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-top: 8px; font-size: 0.9rem; }

/* ── Database spreadsheet view ── */
#view-db {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.db-toolbar {
  position: sticky;
  top: var(--header-height);
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.db-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.db-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.db-filter input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  min-width: 7.5rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--text);
}

.db-filter-grow {
  flex: 1 1 160px;
}

.db-filter-grow input {
  min-width: 100%;
}

.db-filter-clear {
  padding: 8px 14px;
  font-size: 0.8rem;
  height: fit-content;
}

.db-summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.db-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 24px;
}

.db-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
}

.db-table th,
.db-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.db-table th {
  position: sticky;
  top: 0;
  z-index: 12;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  user-select: none;
}

.db-table th.sortable {
  cursor: pointer;
}

.db-table th.sortable:hover {
  color: var(--text);
}

.db-table th.sort-asc::after {
  content: " ↑";
  color: var(--primary);
}

.db-table th.sort-desc::after {
  content: " ↓";
  color: var(--primary);
}

.db-table th.sticky-col,
.db-table td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 11;
  background: var(--surface);
}

.db-table th.sticky-col {
  z-index: 13;
}

.db-table tbody tr:hover td {
  background: var(--surface2);
}

.db-table tbody tr:hover td.sticky-col {
  background: var(--surface2);
}

.db-table td {
  background: var(--bg);
}

.db-cell {
  display: block;
  padding: 8px 12px;
  min-height: 2.25rem;
  line-height: 1.3;
  cursor: pointer;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-cell.readonly {
  cursor: default;
  color: var(--text-muted);
}

.db-cell.editing {
  padding: 2px;
  cursor: default;
}

.db-cell input,
.db-cell select {
  width: 100%;
  min-width: 5.5rem;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.8rem;
  outline: none;
}

.db-cell .db-suggest-wrap {
  position: relative;
}

.db-cell .suggestions {
  z-index: 30;
}

.db-cell-art {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.db-cell-pts {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-align: right;
}

.db-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-muted);
}

.db-badge.or { background: #1a3a5c; color: #9ec9ff; }
.db-badge.inhouse { background: rgba(255, 171, 0, 0.18); color: var(--call); }
.db-badge.yes { background: rgba(0, 200, 83, 0.15); color: var(--accent); }
.db-badge.no { opacity: 0.45; }

.db-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.db-blocks-popover {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + var(--safe-bottom));
}

.db-blocks-popover[hidden] {
  display: none !important;
}

.db-blocks-popover-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 12px 12px;
  width: min(480px, 100%);
  max-height: min(80dvh, 560px);
  overflow-y: auto;
  padding: 16px;
  box-shadow: var(--shadow);
}

.db-blocks-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 700;
}

#db-block-custom {
  margin-top: 10px;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.db-blocks-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.db-blocks-actions .btn {
  flex: 1;
}

@media (min-width: 720px) {
  .db-blocks-popover {
    align-items: center;
  }
  .db-blocks-popover-inner {
    border-radius: 14px;
  }
}

/* ── Auth gate ─────────────────────────────────────────────── */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) calc(16px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(16px + var(--safe-left));
  background: var(--bg);
}

.auth-gate[hidden] {
  display: none !important;
}

.auth-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 22px 24px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 1.45rem;
  margin: 0 0 6px;
}

.auth-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 20px;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 16px;
  justify-content: center;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-error {
  color: #ff6b6b;
  font-size: 0.88rem;
  margin: 0 0 12px;
}

.auth-ok {
  color: var(--accent);
  font-size: 0.88rem;
  margin: 0 0 12px;
}

.settings-section-title {
  font-size: 0.95rem;
  margin: 20px 0 8px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.account-panel {
  margin-top: 8px;
  padding-top: 4px;
}
