:root {
  --navy-950: #071c27;
  --navy-900: #0b2633;
  --navy-800: #123746;
  --teal-700: #087d78;
  --teal-600: #0d9488;
  --teal-100: #ccfbf1;
  --blue-50: #f2f7f9;
  --slate-950: #10212a;
  --slate-700: #405761;
  --slate-500: #6e828a;
  --slate-300: #cdd9dd;
  --slate-200: #dfe8eb;
  --slate-100: #edf3f5;
  --white: #ffffff;
  --amber-700: #a95708;
  --amber-100: #ffefc8;
  --red-700: #b42318;
  --red-100: #fee4e2;
  --green-700: #087443;
  --green-100: #d7f5e5;
  --shadow: 0 14px 32px rgba(19, 48, 60, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--slate-950);
  background: var(--blue-50);
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--blue-50); }
a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, .button { min-height: 44px; }
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px 20px; display: flex; flex-direction: column; background: var(--navy-950); color: #d9e9ee; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; color: white; padding: 0 8px 28px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--teal-600); color: white; font-weight: 800; font-size: .85rem; letter-spacing: -.03em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.brand strong { display: block; font-size: 1.08rem; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 2px; color: #8fb0bd; font-size: .72rem; }
.nav { display: grid; gap: 5px; }
.nav a { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: #aac3cc; font-weight: 650; font-size: .91rem; }
.nav a:hover { background: rgba(255,255,255,.055); color: white; text-decoration: none; }
.nav a.active { background: #123e4c; color: white; box-shadow: inset 3px 0 0 var(--teal-600); }
.nav a span { width: 22px; text-align: center; color: #73bdb7; font-size: 1.1rem; }
.nav a em { margin-left: auto; padding: 2px 6px; border-radius: 4px; background: #3f3440; color: #f9b7ad; font-style: normal; font-size: .65rem; text-transform: uppercase; }
.sidebar-foot { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.rules-chip { display: flex; align-items: center; gap: 9px; color: #8fb0bd; font-size: .75rem; }
.rules-chip i { width: 8px; height: 8px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 3px rgba(50,213,131,.12); }
.rules-chip strong { color: #d6e7ec; }
.link-button { display: block; min-height: 0; margin: 17px 0 6px; padding: 0; border: 0; background: transparent; color: #aac3cc; cursor: pointer; font-size: .82rem; }
.link-button:hover { color: white; text-decoration: underline; }
.sidebar-foot > small { color: #617f8a; font-size: .7rem; }
.main { min-width: 0; padding: 34px 40px 60px; }
.mobile-bar { display: none; }
.context-bar { display: flex; align-items: end; justify-content: flex-end; gap: 10px; margin: -10px 0 24px; padding-bottom: 16px; border-bottom: 1px solid var(--slate-200); }
.context-field { display: grid; gap: 5px; min-width: 190px; }
.context-field:first-of-type { min-width: 250px; }
.context-field label { color: var(--slate-500); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.context-field select { min-height: 38px; padding: 7px 10px; font-size: .84rem; font-weight: 700; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 7px; color: var(--teal-700); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.2rem); line-height: 1.14; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 1.17rem; letter-spacing: -.02em; }
h3 { margin: 0; font-size: 1rem; }
.subtle { margin: 7px 0 0; color: var(--slate-500); line-height: 1.5; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.button, button.primary, button.secondary, button.danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 9px; border: 1px solid transparent; font-weight: 750; font-size: .9rem; cursor: pointer; text-decoration: none; }
.button:hover { text-decoration: none; }
.button.primary, button.primary { background: var(--teal-700); color: white; box-shadow: 0 7px 16px rgba(8,125,120,.16); }
.button.primary:hover, button.primary:hover { background: #076b67; }
.button.secondary, button.secondary { background: white; border-color: var(--slate-300); color: var(--slate-950); }
.button.secondary:hover, button.secondary:hover { background: var(--slate-100); }
.button.danger, button.danger { background: white; border-color: #f6b4ae; color: var(--red-700); }
.button.small { min-height: 36px; padding: 7px 11px; font-size: .8rem; }
.flash { display: flex; align-items: center; gap: 10px; max-width: 920px; margin: 0 0 22px; padding: 13px 16px; border-radius: 10px; background: var(--green-100); color: var(--green-700); font-weight: 650; }
.flash span { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: var(--green-700); color: white; font-size: .75rem; }
.flash.error { background: var(--red-100); color: var(--red-700); }
.flash.error span { background: var(--red-700); }
.connection-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; padding: 15px 18px; border: 1px solid #b9d6dc; border-radius: 12px; background: #e9f6f7; }
.connection-strip strong { display: block; margin-bottom: 2px; }
.connection-strip p { margin: 0; color: var(--slate-700); font-size: .88rem; }
.connection-strip.warning { border-color: #f0cd87; background: #fff8e8; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.card { border: 1px solid var(--slate-200); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.metric { padding: 19px 20px; position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; width: 64px; height: 64px; right: -24px; top: -24px; border-radius: 50%; background: var(--teal-100); opacity: .75; }
.metric label { display: block; color: var(--slate-500); font-size: .78rem; font-weight: 700; }
.metric strong { display: block; margin: 9px 0 5px; font-size: 1.55rem; letter-spacing: -.035em; }
.metric small { color: var(--slate-500); font-size: .75rem; }
.metric.alert::after { background: var(--amber-100); }
.metric.alert strong { color: var(--amber-700); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .72fr); gap: 20px; }
.panel { padding: 21px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.panel-head a { font-size: .8rem; font-weight: 750; }
.readiness { display: grid; place-items: center; padding: 10px 0 16px; }
.readiness-ring { --progress: 0; width: 154px; height: 154px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal-600) calc(var(--progress) * 1%), var(--slate-100) 0); position: relative; }
.readiness-ring::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: white; }
.readiness-ring div { z-index: 1; text-align: center; }
.readiness-ring strong { display: block; font-size: 2rem; letter-spacing: -.05em; }
.readiness-ring span { color: var(--slate-500); font-size: .72rem; }
.check-list { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.check-list li { display: flex; align-items: center; gap: 9px; color: var(--slate-700); font-size: .84rem; }
.check-list i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--slate-100); color: var(--slate-500); font-style: normal; font-size: .72rem; }
.check-list li.done i { background: var(--green-100); color: var(--green-700); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { padding: 9px 11px; border-bottom: 1px solid var(--slate-200); color: var(--slate-500); font-size: .7rem; text-align: left; text-transform: uppercase; letter-spacing: .055em; }
td { padding: 13px 11px; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
tbody tr:hover { background: #f9fcfd; }
td.amount, th.amount { text-align: right; font-variant-numeric: tabular-nums; }
.transaction-name { display: block; max-width: 330px; color: var(--slate-950); font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.transaction-meta { display: block; margin-top: 3px; color: var(--slate-500); font-size: .72rem; }
.pill { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .035em; }
.pill.pending, .pill.review, .pill.partial, .pill.capital { background: var(--amber-100); color: var(--amber-700); }
.pill.approved, .pill.deductible { background: var(--green-100); color: var(--green-700); }
.pill.adjusted { background: #e2e9ff; color: #3449a4; }
.pill.excluded { background: var(--red-100); color: var(--red-700); }
.pill.income, .pill.balance_sheet { background: var(--slate-100); color: var(--slate-700); }
.sample { display: inline-flex; padding: 2px 5px; border-radius: 4px; background: #e2e9ff; color: #4054a8; font-size: .61rem; font-weight: 800; text-transform: uppercase; }
.empty { padding: 42px 20px; text-align: center; border: 1px dashed var(--slate-300); border-radius: 12px; background: #fbfdfe; }
.empty strong { display: block; margin-bottom: 7px; }
.empty p { max-width: 520px; margin: 0 auto 16px; color: var(--slate-500); }
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }
.filters .search-field { flex: 1; min-width: 230px; }
.form-field { display: grid; gap: 7px; }
.form-field label, fieldset > legend { color: var(--slate-700); font-size: .78rem; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--slate-300); border-radius: 8px; background: white; color: var(--slate-950); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(13,148,136,.12); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.help { color: var(--slate-500); font-size: .73rem; line-height: 1.45; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 18px; color: var(--slate-500); font-size: .8rem; }
.pagination div { display: flex; gap: 7px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .75fr); gap: 20px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 18px 0; border: 1px solid var(--slate-200); border-radius: 10px; overflow: hidden; background: var(--slate-200); }
.fact { padding: 13px; background: white; }
.fact label { display: block; margin-bottom: 5px; color: var(--slate-500); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.fact strong { font-size: .88rem; }
.rule-callout { margin: 18px 0; padding: 16px; border-left: 4px solid var(--teal-600); border-radius: 0 9px 9px 0; background: #edf9f8; }
.rule-callout p { margin: 8px 0; color: var(--slate-700); line-height: 1.52; }
.rule-callout a { font-size: .78rem; font-weight: 750; }
.notice { padding: 13px 15px; border-radius: 9px; background: #fff8e8; color: #71420f; font-size: .8rem; line-height: 1.5; }
.research-note { padding: 18px 0; border-top: 1px solid var(--slate-200); }
.research-note:first-child { border-top: 0; }
.research-note h3 { margin-bottom: 9px; }
.research-answer { white-space: pre-wrap; color: var(--slate-700); line-height: 1.55; font-size: .86rem; }
.sources { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.sources a { max-width: 100%; padding: 6px 9px; border-radius: 6px; background: var(--slate-100); font-size: .72rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-hero { display: grid; grid-template-columns: 1.3fr .7fr; overflow: hidden; margin-bottom: 20px; background: var(--navy-900); color: white; }
.report-hero > div { padding: 26px; }
.report-hero p { color: #a8c2cb; }
.report-number { display: grid; place-items: center; background: linear-gradient(135deg, rgba(13,148,136,.25), rgba(13,148,136,.05)); text-align: center; }
.report-number span { display: block; color: #a8c2cb; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.report-number strong { display: block; margin-top: 6px; font-size: 2rem; }
.summary-list { display: grid; gap: 1px; border-radius: 10px; overflow: hidden; background: var(--slate-200); }
.summary-row { display: flex; justify-content: space-between; gap: 20px; padding: 13px 15px; background: white; }
.summary-row strong { font-variant-numeric: tabular-nums; }
.summary-row.total { background: var(--navy-900); color: white; font-size: 1.05rem; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.guide-card { padding: 19px; }
.guide-card p { color: var(--slate-700); line-height: 1.52; font-size: .86rem; }
.guide-card a { font-size: .8rem; font-weight: 800; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 20px; }
.status-box { padding: 16px; border: 1px solid var(--slate-200); border-radius: 10px; background: #fbfdfe; }
.status-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--slate-100); font-size: .84rem; }
.status-line:last-child { border: 0; }
.status-line span { color: var(--slate-500); }
.auth-shell { min-height: 100vh; background: var(--navy-950); }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 28px; background-image: radial-gradient(circle at 15% 12%, rgba(13,148,136,.2), transparent 26%), radial-gradient(circle at 88% 88%, rgba(36,89,111,.3), transparent 28%); }
.auth-card { width: min(100%, 760px); border-radius: 18px; overflow: hidden; background: white; box-shadow: 0 28px 70px rgba(0,0,0,.3); }
.auth-card.narrow { width: min(100%, 440px); }
.auth-head { padding: 25px 28px 20px; background: #f5fafb; border-bottom: 1px solid var(--slate-200); }
.auth-head .brand { display: inline-flex; padding: 0 0 18px; color: var(--slate-950); }
.auth-head .brand small { color: var(--slate-500); }
.auth-head p { margin: 8px 0 0; color: var(--slate-500); line-height: 1.5; }
.auth-body { padding: 25px 28px 29px; }
.error-box { margin-bottom: 16px; padding: 12px 14px; border-radius: 9px; background: var(--red-100); color: var(--red-700); font-size: .86rem; font-weight: 650; }
.auth-footnote { margin: 18px 0 0; color: var(--slate-500); font-size: .73rem; line-height: 1.5; }
code { padding: 2px 5px; border-radius: 4px; background: var(--slate-100); font-size: .82em; word-break: break-all; }
@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .detail-grid, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .mobile-bar { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; position: sticky; top: 0; z-index: 25; background: var(--navy-950); color: white; }
  .mobile-bar button { width: 42px; min-height: 42px; border: 0; border-radius: 8px; background: rgba(255,255,255,.08); color: white; font-size: 1.2rem; }
  .mobile-bar a { display: flex; align-items: center; gap: 9px; color: white; font-weight: 750; }
  .mobile-bar a:hover { text-decoration: none; }
  .mobile-bar .brand-mark { width: 32px; height: 32px; border-radius: 8px; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); width: 272px; transition: transform .2s ease; box-shadow: 15px 0 40px rgba(0,0,0,.25); }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 24px 17px 45px; }
  .context-bar { display: grid; grid-template-columns: 1fr 1fr; margin-top: 0; }
  .context-field, .context-field:first-of-type { min-width: 0; }
  .context-bar button { grid-column: 1 / -1; width: 100%; }
  .page-header { display: grid; gap: 17px; }
  .cards, .guide-grid, .form-grid, .facts, .report-hero { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .report-number { min-height: 145px; }
  .connection-strip { align-items: flex-start; flex-direction: column; }
  .header-actions, .header-actions form { width: 100%; }
  .header-actions .button, .header-actions button { width: 100%; }
  .auth-main { padding: 14px; place-items: start center; }
  .auth-card { margin-top: 14px; }
  .auth-head, .auth-body { padding-left: 19px; padding-right: 19px; }
}
