/* PSR Assistant — Dark mode first, AccrediLaw brand */

:root {
  --bg: #0A1F44;
  --surface: #122B56;
  --surface-raised: #1A3568;
  --gold: #CBA135;
  --gold-dim: rgba(203, 161, 53, 0.15);
  --text: #E8E8E8;
  --text-secondary: #8B95A5;
  --text-muted: #5A6577;
  --success: #2ECC71;
  --warning: #F1C40F;
  --error: #E74C3C;
  --white: #FFFFFF;
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  height: calc(100% - var(--nav-height) - var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
}

/* ── Bottom Navigation ── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--surface-raised);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 8px 12px;
  cursor: pointer;
  min-width: 64px;
  min-height: 48px;
  transition: color 0.15s;
}

.nav-btn.active { color: var(--gold); }
.nav-btn:hover { color: var(--text); }

/* ── Typography ── */

h1 { font-size: 22px; font-weight: 700; color: var(--white); margin-bottom: 4px; }
h2 { font-size: 18px; font-weight: 600; color: var(--white); margin-bottom: 4px; }
h3 { font-size: 14px; font-weight: 600; color: var(--gold); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

.subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }

/* ── Cards ── */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  border-left: 3px solid var(--gold);
  cursor: pointer;
  transition: background 0.15s;
  min-height: 48px;
}

.card:active { background: var(--surface-raised); }

.card-title { font-size: 17px; font-weight: 600; color: var(--white); margin-bottom: 4px; }
.card-subtitle { font-size: 14px; color: var(--text-secondary); }

.card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-dim);
  border-radius: var(--radius-sm);
  color: var(--gold);
  margin-bottom: 12px;
}

/* ── Hero stats (home screen) ── */

.hero-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ── Forms ── */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--surface-raised);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus { border-color: var(--gold); }

.form-input::placeholder { color: var(--text-muted); }

textarea.form-input {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238B95A5' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Pills (quick select) ── */

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.pill {
  padding: 8px 16px;
  border: 1px solid var(--surface-raised);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.pill:active, .pill.selected {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

/* ── Flags / toggles ── */

.flag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.15s;
}

.flag-row.active {
  background: var(--gold-dim);
  border-left: 3px solid var(--gold);
}

.flag-row:active { background: var(--surface-raised); }

.flag-label { font-size: 15px; color: var(--text); }

.flag-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  transition: all 0.15s;
}

.flag-row.active .flag-indicator {
  background: var(--gold);
  border-color: var(--gold);
}

/* ── Tick list (consultation) ── */

.tick-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--surface-raised);
  cursor: pointer;
  min-height: 48px;
}

.tick-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--text-muted);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tick-row.checked .tick-box {
  background: var(--gold);
  border-color: var(--gold);
}

.tick-row.checked .tick-box::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.tick-text { font-size: 15px; color: var(--text); flex: 1; }

/* ── Signpost panel ── */

.signpost-panel {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 2px solid var(--gold);
  padding: 16px;
  margin: 16px -16px 0;
}

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

.signpost-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.signpost-badge {
  background: var(--gold);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
}

.signpost-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--surface-raised);
  cursor: pointer;
}

.signpost-item:last-child { border-bottom: none; }

.signpost-ref {
  font-size: 14px;
  color: var(--text);
  font-family: "SF Mono", "Courier New", monospace;
}

.signpost-summary {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: none;
}

.signpost-item.expanded .signpost-summary { display: block; }

/* ── Cross-reference flags ── */

.flag-panel {
  background: var(--gold-dim);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.flag-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 8px;
}

.flag-panel-item {
  font-size: 14px;
  color: var(--text);
  padding: 8px 0;
  border-bottom: 1px solid rgba(203, 161, 53, 0.2);
}

.flag-panel-item:last-child { border-bottom: none; }

.flag-panel-ref {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: "SF Mono", "Courier New", monospace;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  min-height: 48px;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--gold);
  color: var(--bg);
  width: 100%;
}

.btn-primary:active { opacity: 0.85; }

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text);
  width: 100%;
}

.btn-secondary:active { background: var(--surface); }

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}

/* ── Departure buttons ── */

.departure-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.departure-btn {
  padding: 24px 16px;
  background: var(--surface);
  border: 2px solid var(--surface-raised);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.departure-btn:active, .departure-btn.selected {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.departure-btn-icon { font-size: 32px; }
.departure-btn-label { font-size: 16px; font-weight: 600; color: var(--white); }
.departure-btn-sub { font-size: 12px; color: var(--text-secondary); }

/* ── Clock display ── */

.clock-display {
  text-align: center;
  padding: 24px 0;
}

.clock-value {
  font-size: 48px;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  color: var(--white);
  letter-spacing: 2px;
}

.clock-label {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.clock-bar {
  height: 6px;
  background: var(--surface-raised);
  border-radius: 3px;
  margin: 12px 0;
  overflow: hidden;
}

.clock-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s linear, background-color 0.5s;
}

.clock-bar-fill.green { background: var(--success); }
.clock-bar-fill.amber { background: var(--warning); }
.clock-bar-fill.red { background: var(--error); }

/* ── Step navigation pills ── */

.step-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.step-nav::-webkit-scrollbar { display: none; }

.step-pill {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid var(--surface-raised);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.step-pill.completed {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.step-pill.current {
  border-color: var(--gold);
  color: var(--bg);
  background: var(--gold);
  transform: scale(1.15);
}

.step-pill.future {
  border-color: var(--surface-raised);
  color: var(--text-muted);
}

/* ── Section divider ── */

.section-divider {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--surface-raised);
  margin-bottom: 12px;
}

/* ── Density toggle ── */

.density-toggle {
  display: flex;
  background: var(--surface);
  border-radius: 20px;
  padding: 3px;
  font-size: 13px;
}

.density-option {
  padding: 6px 14px;
  border-radius: 17px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.density-option.active {
  background: var(--gold);
  color: var(--bg);
}

/* ── Escape fee banner ── */

.escape-banner {
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin: 16px 0;
}

.escape-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.escape-banner-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Utilities ── */

.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-gold { color: var(--gold); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.mono { font-family: "SF Mono", "Courier New", monospace; }
