:root {
  --navy: #0c1f3a; --navy-2: #142e52; --navy-3: #1d3d6b;
  --accent: #2e6fb0; --accent-2: #4a8fd4; --gold: #c9a45c;
  --bg: #eef1f6; --card: #ffffff; --line: #dfe5ee; --line-2: #eef2f7;
  --text: #1b2634; --muted: #66748a;
  --green: #147a4d; --green-bg: #e3f4ec;
  --red: #b3251a; --red-bg: #fcebe9;
  --yellow: #96660a; --yellow-bg: #fdf3d9;
  --shadow: 0 1px 2px rgba(16, 34, 61, .05), 0 4px 14px rgba(16, 34, 61, .06);
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.55 "Segoe UI", -apple-system, "Helvetica Neue",
  Roboto, sans-serif; background: var(--bg); color: var(--text); }

/* ── top navigation ── */
.topnav { display: flex; align-items: center; gap: 28px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; padding: 0 28px; flex-wrap: wrap; min-height: 54px;
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 2px 10px rgba(12,31,58,.35); }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 16px;
  letter-spacing: .02em; padding: 14px 0; }
.brand span { color: var(--gold); font-weight: 500; }
.navlinks { display: flex; gap: 4px; flex: 1; }
.navlinks a { color: #c4d2e4; text-decoration: none; padding: 16px 12px 13px;
  border-bottom: 3px solid transparent; font-weight: 500; transition: color .15s; }
.navlinks a:hover { color: #fff; }
.navlinks a.on { color: #fff; border-bottom-color: var(--gold); }
.navuser { display: flex; gap: 12px; align-items: center; font-size: 13px;
  color: #c4d2e4; }
.navuser a { color: #8fb3da; text-decoration: none; }
.navuser a:hover { color: #fff; }

main { max-width: 1280px; margin: 28px auto; padding: 0 24px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 28px; }

h1 { font-size: 24px; font-weight: 650; margin: 4px 0 18px; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; margin: 26px 0 10px; color: var(--navy-2);
  text-transform: uppercase; letter-spacing: .05em; }
h2 .small { text-transform: none; letter-spacing: 0; font-weight: 400; }
h3 { font-size: 14px; margin: 16px 0 8px; }

/* ── cards & stats ── */
.card { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
  box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  border-top: 3px solid var(--accent); }
.stat .n { font-size: 30px; font-weight: 700; color: var(--navy);
  letter-spacing: -.02em; line-height: 1.15; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; margin-top: 2px; }

/* ── tables ── */
table { width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  margin-bottom: 6px; }
table table { box-shadow: none; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-2);
  vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: #f7f9fc; font-weight: 600;
  border-bottom: 1px solid var(--line); }
tbody tr:nth-child(even) td, tr:nth-child(even) td { background: #fbfcfe; }
tr:hover td { background: #f2f6fb; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── badges ── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.badge-admin { background: var(--gold); color: #3d2e0d; }
.b-draft, .b-received { background: #e5eaf1; color: #45536a; }
.b-in_review, .b-extracted { background: #dcebfb; color: #1c4d8f; }
.b-approved_to_sign, .b-checked { background: #e9e4fb; color: #4c2ea3; }
.b-out_for_signature, .b-owner_reviewed { background: #fdeecb; color: #8a5a08; }
.b-active, .b-approved_to_pay, .b-paid, .b-submitted { background: var(--green-bg); color: var(--green); }
.b-expired, .b-on_hold { background: var(--yellow-bg); color: var(--yellow); }
.b-terminated, .b-rejected { background: var(--red-bg); color: var(--red); }

/* ── flashes ── */
.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px;
  border: 1px solid transparent; }
.flash-success { background: var(--green-bg); color: var(--green);
  border-color: #bfe5d2; }
.flash-error { background: var(--red-bg); color: var(--red); border-color: #f2c7c2; }
.flash-info { background: #dcebfb; color: #1c4d8f; border-color: #bcd8f4; }

/* ── forms & buttons ── */
form.inline { display: inline; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px;
  font-weight: 500; }
input[type=text], input[type=email], input[type=date], input[type=number],
input[type=file], select, textarea { width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 7px; font: inherit;
  background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none;
  border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(46,111,176,.12); }
textarea { min-height: 70px; }
button, .btn { display: inline-block; background: var(--accent); color: #fff;
  border: 0; padding: 8px 16px; border-radius: 7px; font: inherit;
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s; box-shadow: var(--shadow); }
button:hover, .btn:hover { background: #275e97; text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button.secondary, .btn.secondary { background: #fff; color: var(--navy-2);
  border: 1px solid var(--line); }
button.secondary:hover, .btn.secondary:hover { background: #f2f6fb; }
button.danger, .btn.danger { background: var(--red); }
button.danger:hover, .btn.danger:hover { background: #971e15; }
button.success, .btn.success { background: var(--green); }
button.success:hover, .btn.success:hover { background: #0f6440; }

/* ── check panel ── */
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px;
  background: #fff; }
.check-pass { border-left: 4px solid var(--green); }
.check-flag { border-left: 4px solid #d7a410; background: var(--yellow-bg); }
.check-fail { border-left: 4px solid var(--red); background: var(--red-bg); }
.check-row .dot { font-size: 15px; line-height: 1.5; }
.quote { font-size: 12px; color: var(--muted); border-left: 3px solid var(--line);
  padding-left: 10px; margin-top: 5px; font-style: italic; }

/* ── scorecard ── */
.scorecard { display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.sc-cell { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-size: 12px; background: #fff; }
.sc-standard { background: var(--green-bg); border-color: #bfe5d2; }
.sc-deviates { background: var(--red-bg); border-color: #f2c7c2; }
.sc-absent { background: var(--yellow-bg); border-color: #eedcab; }
.sc-cell b { display: block; font-size: 12px; margin-bottom: 3px;
  text-transform: capitalize; }

/* ── misc ── */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px;
  align-items: center; }
.formgrid { display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 18px; }
.login-box { max-width: 400px; margin: 90px auto; text-align: center;
  padding: 34px 30px; }
.login-box h1 { margin-bottom: 4px; }
.tabbar { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabbar a { padding: 6px 14px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); color: var(--text); text-decoration: none;
  font-size: 13px; transition: background .15s; }
.tabbar a:hover { background: #f2f6fb; text-decoration: none; }
.tabbar a.on { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }

/* ── term grid ── */
.gridtable th { position: sticky; top: 0; }
.gridtable td.gc { font-size: 12px; white-space: nowrap; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; cursor: default; }
.gc-standard { background: var(--green-bg) !important; color: var(--green); }
.gc-deviates { background: var(--red-bg) !important; color: var(--red);
  font-weight: 600; }
.gc-absent { background: var(--yellow-bg) !important; color: var(--yellow); }
.gc-extracted { background: #e8f1fb !important; color: #1c4d8f; }
.gc-na, .gc-none { color: #b6c0cf; }
