:root {
  --navy: #0f2d52;
  --navy-2: #173e6e;
  --ink: #111827;
  --body: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6f9;
  --card: #ffffff;
  --blue: #1d4ed8;
  --green: #047857;
  --green-bg: #ecfdf5;
  --red: #b91c1c;
  --red-bg: #fef2f2;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --violet: #6d28d9;
  --violet-bg: #f5f3ff;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--body);
  background: var(--bg);
}
h1, h2, h3 { color: var(--ink); margin: 0 0 8px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--navy); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: var(--navy); color: #fff;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  background: #fff; color: var(--navy); font-weight: 700;
}
.brand-name { font-weight: 700; font-size: 17px; }
.brand-sub { font-size: 12px; opacity: .8; }
.session { display: flex; gap: 16px; align-items: center; }
.who { display: flex; gap: 8px; align-items: center; }
.who-name { font-weight: 600; }
.role-badge {
  font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
}

main { padding: 24px; max-width: 1280px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

/* Buttons and inputs */
.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font: inherit;
  font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1e40af; }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; padding: 6px 12px; }
.btn-link { background: none; border: none; color: var(--blue); font-weight: 600; cursor: pointer; padding: 0; }
input {
  width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit;
  margin-bottom: 12px;
}
input:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }
label { display: block; font-weight: 600; font-size: 13px; color: var(--ink); margin-bottom: 4px; }

/* Login */
.login-wrap { display: grid; place-items: center; min-height: 60vh; }
.login { width: 380px; }
.login .btn { width: 100%; margin-top: 4px; }
.fineprint { font-size: 12px; color: var(--muted); margin-top: 16px; }

/* Alerts */
.alert { border-radius: 8px; padding: 10px 14px; margin: 12px 0; font-size: 14px; }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }

/* Workspace */
.workspace { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.sidebar { position: sticky; top: 16px; }
.sidebar-head { display: flex; justify-content: space-between; align-items: baseline; }
.count { font-size: 13px; color: var(--muted); }
.claim-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.claim-list button {
  width: 100%; text-align: left; padding: 9px 10px; border: 1px solid transparent; border-radius: 8px;
  background: none; font: inherit; color: var(--ink); cursor: pointer;
}
.claim-list button:hover { background: #f3f4f6; }
.claim-list button.active { background: #eff6ff; border-color: #bfdbfe; color: var(--blue); font-weight: 600; }
.empty { text-align: center; padding: 48px 32px; }

.claim-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { margin-bottom: 16px; }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; color: var(--ink); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
.table td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: top; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #f3f4f6; }
.pill-ok { background: var(--green-bg); color: var(--green); }
.pill-wait { background: var(--amber-bg); color: var(--amber); }

/* Loading */
.loading { display: flex; gap: 14px; align-items: center; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid #dbeafe; border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Recommendation */
.decision-card { border-left: 6px solid var(--muted); }
.decision-card.approve { border-left-color: var(--green); }
.decision-card.deny { border-left-color: var(--red); }
.decision-card.flag_review { border-left-color: var(--amber); }
.decision-card.route_specialist { border-left-color: var(--violet); }
.decision-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.decision { font-size: 26px; font-weight: 700; color: var(--ink); }
.approve .decision { color: var(--green); }
.deny .decision { color: var(--red); }
.flag_review .decision { color: var(--amber); }
.route_specialist .decision { color: var(--violet); }
.net { text-align: right; }
.net-value { font-size: 24px; font-weight: 700; color: var(--ink); }
.confirmation {
  margin-top: 14px; padding: 10px 14px; border-radius: 8px; background: #eff6ff; color: #1e3a8a;
  border: 1px solid #bfdbfe; font-weight: 600;
}
.senior {
  margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: var(--amber-bg); color: var(--amber);
  border: 1px solid #fde68a; font-weight: 600;
}
.label { font-size: 12px; text-transform: uppercase; color: var(--muted); margin: 12px 0 2px; }
.text-block { margin: 0 0 6px; white-space: pre-wrap; color: var(--ink); }
.citations, .concerns { margin: 0; padding-left: 18px; }
.citations li, .concerns li { margin-bottom: 4px; }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* PDF modal */
.modal { position: fixed; inset: 0; background: rgba(17,24,39,.55); display: grid; place-items: center; z-index: 10; }
.modal-box { width: min(1000px, 94vw); height: 90vh; background: #fff; border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.modal-head .btn-ghost { color: var(--navy); }
#pdf-frame { flex: 1; border: 0; width: 100%; }

.footer { text-align: center; font-size: 12px; color: var(--muted); padding: 16px 24px 28px; }

@media (max-width: 900px) {
  .workspace, .grid-2 { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

/* --- AI Claim Advisor refinements (Step 5.9) --- */
.logo { width: auto; min-width: 40px; padding: 0 6px; font-size: 13px; letter-spacing: .04em; }
.logo-lg { height: 44px; min-width: 52px; font-size: 15px; background: var(--navy); color: #fff; }
.login { width: 420px; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.login-brand h1 { margin: 0; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.claim-head h2 { font-size: 22px; margin-bottom: 2px; }
.cms-status {
  display: inline-flex; gap: 8px; align-items: center; margin-top: 8px; padding: 4px 10px;
  border: 1px dashed #cbd5e1; border-radius: 8px; background: #f8fafc; font-size: 13px;
}
.cms-label { color: var(--muted); }
.cms-value { font-weight: 600; color: var(--ink); }
.rec-placeholder { display: flex; flex-direction: column; gap: 4px; border-style: dashed; background: #f8fafc; }
.loading { border: 1px solid #bfdbfe; background: #eff6ff; padding: 22px 24px; }
.loading strong { color: var(--navy); font-size: 16px; }
.loading .spinner { width: 34px; height: 34px; border-width: 4px; flex: none; }
.decision-card .eyebrow { color: var(--navy); font-weight: 600; }
.note { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--amber-bg); color: var(--amber); font-size: 13px; }
.code-hint { font-size: 11px; color: var(--muted); }
