:root {
  --navy: #00213d;
  --navy-2: #003a6b;
  --royal: #1b5a96;
  --gold: #c4a05a;
  --gold-2: #e8d7a8;
  --cyan: #1493b8;
  --paper: #f5f8fc;
  --ink: #0e2438;
  --muted: #5b6b7c;
  --line: #d5dee8;
  --surface: #ffffff;
  --shadow: 0 18px 40px -28px rgba(0, 33, 61, 0.45);
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Lato, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 100% 0%, rgba(20, 147, 184, 0.08), transparent 42%),
    var(--paper);
}
h1, h2, h3, h4, .eyebrow, .nav-item, button, .kpi strong, .brand-lockup strong {
  font-family: Montserrat, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3 { letter-spacing: -0.04em; margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.fnf-current-logo { width: 44px; height: 44px; object-fit: contain; flex: none; }
.eyebrow { margin: 0 0 4px; color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.fine-print, .muted { color: var(--muted); font-size: 13px; }
.form-error { min-height: 1.2em; color: #8d3b32; font-size: 14px; }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
}
.login-brand {
  padding: 64px 56px;
  color: white;
  background:
    radial-gradient(circle at 20% 20%, rgba(20, 147, 184, 0.28), transparent 36%),
    linear-gradient(160deg, #00182d, var(--navy) 42%, var(--navy-2));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
}
.login-brand h1 { font-size: clamp(40px, 5vw, 64px); font-weight: 800; max-width: 10ch; }
.login-brand p { max-width: 38ch; color: #d6e4f2; font-size: 18px; line-height: 1.5; }
.login-card {
  margin: auto;
  width: min(420px, calc(100% - 40px));
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  border-radius: 18px;
  padding: 28px;
  display: grid;
  gap: 14px;
  backdrop-filter: blur(10px);
}
.login-card h2 { font-size: 28px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }
.primary-action, .secondary-action, .mini-button {
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 11px 14px;
  font-weight: 700;
}
.primary-action { background: linear-gradient(120deg, #d2b579, var(--gold)); color: var(--navy); }
.secondary-action, .mini-button { background: white; color: var(--ink); border-color: var(--line); }
.mini-button { padding: 7px 10px; font-size: 12px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.sidebar {
  background: linear-gradient(180deg, #00182d, var(--navy) 30%, #012845);
  color: white;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand-lockup { display: flex; gap: 10px; align-items: center; padding: 6px 8px 18px; }
.brand-lockup strong { display: block; font-size: 13px; }
.brand-lockup small { color: var(--gold-2); }
.primary-nav { display: grid; gap: 4px; }
.nav-item {
  text-align: left;
  color: #d5e3f0;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.is-active { background: linear-gradient(120deg, var(--navy-2), var(--royal)); color: white; }

.workspace { min-width: 0; overflow-x: hidden; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 18px 22px 12px;
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 2;
}
.topbar h1 { font-size: clamp(26px, 3vw, 36px); font-weight: 800; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.view-as, .who { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.who strong { color: var(--ink); }
.capital-ticker {
  margin: 12px 22px 0;
  overflow: hidden;
  min-width: 0;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--navy), var(--navy-2));
  color: var(--gold-2);
  border: 1px solid rgba(196, 160, 90, 0.7);
}
.capital-ticker p { margin: 0; padding: 8px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
main { padding: 16px 22px 40px; display: grid; gap: 14px; min-width: 0; }
main > * { min-width: 0; }

.cockpit {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 14px;
  color: white;
  background:
    radial-gradient(circle at 90% 0%, rgba(20, 147, 184, 0.35), transparent 32%),
    linear-gradient(135deg, #00182d, var(--navy) 46%, var(--navy-2));
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.cockpit h2 { font-size: 28px; }
.profit-figure { font-size: clamp(36px, 5vw, 56px); font-weight: 800; letter-spacing: -0.05em; }
.profit-figure span, .cockpit .muted { color: #d6e4f2; }
.glass {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 12px 14px;
  color: #f5f8fc;
}
.glass h3 { margin: 0 0 10px; color: var(--gold-2); font-size: 13px; letter-spacing: 0.04em; }
.glass .list li {
  background: rgba(4, 24, 44, 0.45);
  border: 1px solid rgba(232, 215, 168, 0.28);
  color: #f5f8fc;
}
.glass .list li strong { display: block; color: white; font-size: 13px; }
.glass .list li span { display: block; margin-top: 4px; color: #d6e4f2; font-size: 13px; line-height: 1.4; }
.glass .list li small { display: block; margin-top: 6px; color: var(--gold-2); font-size: 11px; letter-spacing: 0.04em; }
.glass-empty {
  margin: 0;
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(232, 215, 168, 0.45);
  background: rgba(4, 24, 44, 0.35);
  color: #d6e4f2;
  font-size: 13px;
  line-height: 1.4;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(20, 147, 184, 0.28), transparent 34%),
    linear-gradient(155deg, #00182d, var(--navy) 58%, #012a4a);
  box-shadow: var(--shadow);
}
.kpi {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(232, 215, 168, 0.28);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 0;
  color: white;
}
.kpi span { display: block; color: var(--gold-2); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.kpi strong { display: block; margin-top: 8px; font-size: 22px; letter-spacing: -0.04em; }
.kpi small { color: #d6e4f2; display: block; margin-top: 8px; font-size: 11px; line-height: 1.35; }
.meter { display: block; height: 4px; margin-top: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); }
.meter::after { content: ""; display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--gold-2)); }
.kpi.is-profit { background: linear-gradient(160deg, #e8d7a8, var(--gold)); color: var(--navy); }
.kpi.is-profit span, .kpi.is-profit small { color: #5c4514; }
.kpi.is-profit .meter { background: rgba(0, 33, 61, 0.16); }

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.panel h2, .panel h3 { font-size: 16px; margin-bottom: 8px; }
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; }
.list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.list li, .card, .lead, .doc, .message {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #fff, #fbfcfe);
}
.row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.tabs { display: flex; gap: 8px; }
.tabs button.is-active { background: var(--navy); color: white; }
.board { display: flex; gap: 10px; overflow-x: auto; min-width: 0; max-width: 100%; padding-bottom: 8px; }
.column { background: #eef3f8; border-radius: 12px; padding: 8px; min-height: 180px; flex: 0 0 220px; }
.column h3 { font-size: 12px; margin: 4px 6px 8px; }
.deal-card { background: white; border-radius: 10px; padding: 0 0 8px; margin-bottom: 8px; border: 1px solid var(--line); overflow: hidden; border-top: 6px solid var(--card, var(--navy)); }
.deal-card strong { display: block; font-size: 13px; }
.deal-card select { width: calc(100% - 16px); margin: 6px 8px 0; padding: 6px; }
.card-open { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 8px; color: inherit; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 7px; font-size: 11px; font-weight: 800; }
.badge-overdue { background: #8d3b32; color: #fff; }
.badge-due-soon { background: #f0b429; color: #1a1404; }
.badge-stale { background: #5b6b7c; color: #fff; }
.badge-duplicate { background: #12315c; color: #fff; }
.check-line { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.check-line select { max-width: 180px; }
.task-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.list-board { width: 100%; border-collapse: collapse; }
.list-board td, .list-board th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
button.text-link { background: transparent; border: 0; padding: 0; cursor: pointer; }
.column h3 .count { color: var(--muted); font-weight: 600; }
.type-legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.deal-detail { display: grid; gap: 12px; margin-top: 12px; border-top: 8px solid var(--card, var(--navy)); padding-top: 12px; }
.deal-detail-head { display: grid; gap: 8px; }
.card-row { display: grid; grid-template-columns: 220px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.card-row span { color: var(--muted); font-weight: 700; }
.check-block { margin-top: 12px; }
.check-block ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.check-block label { font-weight: 400; color: var(--ink); grid-template-columns: auto 1fr; align-items: start; }
.text-link { color: var(--royal); font-weight: 700; }
#commission-board table, .matrix { width: 100%; border-collapse: collapse; }
#commission-board td, #commission-board th, .matrix td, .matrix th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.banner {
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff8ea;
  border: 1px solid #e6d3a2;
  color: #5c4514;
}
.banner strong { font-family: Montserrat, sans-serif; }
.sample-tag { font-size: 11px; font-weight: 800; color: var(--royal); letter-spacing: 0.06em; text-transform: uppercase; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.catalog { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; color: var(--ink); }
.math { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.math div { background: #f5f8fc; border-radius: 10px; padding: 8px; }
.math strong { display: block; }
.matrix { font-size: 13px; }
.matrix td, .matrix th { white-space: normal; }
.desk-form { display: grid; gap: 8px; max-width: 520px; margin-top: 8px; }
.desk-form select, .desk-form button { width: 100%; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cockpit, .split, .login-screen { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: auto; z-index: 3; padding: 10px; min-width: 0; max-width: 100%; }
  .primary-nav { display: flex; overflow-x: auto; gap: 6px; min-width: 0; max-width: 100%; }
  .nav-item { flex: none; }
  .topbar { min-width: 0; }
  .top-actions { min-width: 0; }
  .brand-lockup small, .brand-lockup strong { font-size: 12px; }
  .topbar, main, .capital-ticker { margin-left: 0; }
  .topbar { padding: 12px; align-items: flex-start; }
  main { padding: 12px; }
  .capital-ticker { margin: 10px 12px 0; }
  .kpi-grid, .math { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .capital-ticker p { white-space: normal; }
  .kpi strong { font-size: 20px; }
  .fnf-current-logo { width: 38px; height: 38px; }
  .login-brand { padding: 28px 20px; min-height: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
