/* VA Claim Companion — Dark theme, mobile-first */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #090912;
  --surface: #11111C;
  --surface-2: #18182A;
  --border: #1D1D30;
  --border-2: #252538;
  --text: #E4E4F0;
  --text-muted: #5A5A7A;
  --text-dim: #2E2E48;
  --accent: #4F6EF7;
  --accent-dim: rgba(79,110,247,0.12);
  --green: #22C55E;
  --green-dim: rgba(34,197,94,0.12);
  --yellow: #F59E0B;
  --yellow-dim: rgba(245,158,11,0.12);
  --red: #EF4444;
  --red-dim: rgba(239,68,68,0.12);
  --blue: #38BDF8;
  --blue-dim: rgba(56,189,248,0.12);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 60px;
  --header-h: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ─── Loading ─── */
.screen-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent) 0%, #7B5CF7 100%);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Login ─── */
.screen-login {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px calc(40px + var(--safe-bottom));
  text-align: center;
}

.login-mark {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, var(--accent) 0%, #7B5CF7 100%);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  margin-bottom: 32px;
}

.login-title {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.login-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 290px;
  margin-bottom: 44px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  padding: 15px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { opacity: 0.75; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

.login-note {
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-dim);
  max-width: 260px;
  line-height: 1.6;
}

.sandbox-banner {
  margin-top: 28px;
  padding: 10px 16px;
  background: var(--yellow-dim);
  border: 1px solid rgba(245,158,11,0.18);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--yellow);
  font-weight: 500;
  max-width: 340px;
  text-align: center;
}

/* ─── Header ─── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: var(--safe-top);
  background: rgba(9,9,18,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
  flex: 1;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: var(--yellow-dim);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 5px;
  font-size: 9px;
  font-weight: 700;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}

.icon-btn:active { background: var(--border); }

/* ─── Bottom Nav ─── */
.nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding-bottom: var(--safe-bottom);
  height: calc(var(--nav-h) + var(--safe-bottom));
  background: rgba(9,9,18,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding-top: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s;
}

.nav-item.active { color: var(--accent); }
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.75; }

/* ─── Content ─── */
.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
}

/* ─── Cards ─── */
.card {
  margin: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.12s;
}

.card:active { border-color: var(--border-2); background: var(--surface-2); }

.card-top {
  padding: 14px 16px 10px;
}

.card-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.claim-type {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.claim-id {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-family: 'SF Mono', 'Monaco', monospace;
}

/* Phase bar */
.phase-wrap { padding: 0 16px 14px; }

.phase-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.phase-track {
  display: flex;
  gap: 3px;
  margin-bottom: 4px;
}

.phase-seg {
  flex: 1;
  height: 3px;
  background: var(--border-2);
  border-radius: 2px;
}

.phase-seg.done { background: var(--accent); }
.phase-seg.active { background: var(--accent); opacity: 0.45; }

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

/* Status pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill.pending     { background: rgba(90,90,122,0.15); color: var(--text-muted); }
.pill.pending .pill-dot { background: var(--text-muted); }

.pill.progress    { background: var(--blue-dim); color: var(--blue); }
.pill.progress .pill-dot { background: var(--blue); animation: pulse 1.4s ease-in-out infinite; }

.pill.decision    { background: var(--yellow-dim); color: var(--yellow); }
.pill.decision .pill-dot { background: var(--yellow); }

.pill.granted     { background: var(--green-dim); color: var(--green); }
.pill.granted .pill-dot { background: var(--green); }

.pill.denied      { background: var(--red-dim); color: var(--red); }
.pill.denied .pill-dot { background: var(--red); }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.35; } }

/* Contention tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 16px 14px;
}

.tag {
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 6px;
}

/* Claude interpretation */
.interpret {
  margin: 0 16px 14px;
  background: var(--accent-dim);
  border: 1px solid rgba(79,110,247,0.18);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}

.interpret-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 5px;
}

.interpret-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.interpret-loading {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Section header */
.section-hd {
  padding: 18px 14px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.section-count {
  font-size: 11px;
  color: var(--text-dim);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 64px 28px;
}

.empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  color: var(--text-dim);
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.empty-sub {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Error */
.error-card {
  margin: 12px 14px;
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.error-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 4px;
}

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

/* Last updated */
.last-upd {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 0 2px;
}

/* ─── Settings ─── */
.settings-section { margin-top: 20px; }

.settings-group {
  margin: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: default;
}

.settings-row:last-child { border-bottom: none; }
.settings-row-label { flex: 1; font-size: 14px; color: var(--text); }
.settings-row-val { font-size: 13px; color: var(--text-muted); }

.settings-danger .settings-row { cursor: pointer; }
.settings-danger .settings-row-label { color: var(--red); }

.settings-sub {
  margin: 6px 14px 0;
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 2px;
}

/* ─── Refresh button ─── */
.refresh-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 2px;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

.refresh-btn:active { background: var(--border); }
.refresh-btn svg { width: 13px; height: 13px; }

/* ─── Loading skeleton ─── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skel-card {
  margin: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.skel-line {
  height: 12px;
  margin-bottom: 8px;
}
