:root {
  --ink: #16202a;
  --muted: #5f6b76;
  --line: #dde3e8;
  --bg: #f4f6f8;
  --card: #ffffff;
  --accent: #1f5f8b;
  --accent-dark: #163f5c;
  --ok: #2c6e49;
  --warn: #a15c00;
  --danger: #a3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.3px; }
h2 { font-size: 17px; margin: 0; letter-spacing: -0.1px; }
h3 { font-size: 14px; margin: 0 0 6px; }
p { margin: 0 0 10px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px; background: #10212e; color: #fff;
}
.brand { font-size: 19px; font-weight: 700; letter-spacing: -0.4px; color: #fff; }
.brand span { font-weight: 300; color: #9fc4dc; }
.brand-lg { font-size: 28px; color: var(--ink); }
.brand-lg span { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topnav a { color: #cfe2ee; }
.topnav .who { color: #8fa6b5; font-size: 13px; }
.inline { display: inline; margin: 0; }

.subnav {
  display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 28px;
  background: #fff; border-bottom: 1px solid var(--line); font-size: 13px;
}
.subnav a { color: var(--muted); padding: 4px 10px; border-radius: 6px; }
.subnav a:hover { background: #eef3f6; color: var(--accent); text-decoration: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 28px 60px; }
.foot { max-width: 1180px; margin: 0 auto; padding: 0 28px 40px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }

/* Page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin-right: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.link-card { display: block; color: inherit; transition: border-color .15s; }
.link-card:hover { border-color: var(--accent); text-decoration: none; }
.stats { display: flex; gap: 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.stats div { display: flex; flex-direction: column; }
.stats strong { font-size: 18px; }
.stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* Badges */
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; border: 1px solid transparent; white-space: nowrap;
}
.badge-ok { background: #e8f3ec; color: var(--ok); border-color: #c6e2d1; }
.badge-warn { background: #fdf1e2; color: var(--warn); border-color: #f0d8b6; }
.badge-info { background: #e9f1f7; color: var(--accent); border-color: #c9dcea; }
.badge-muted { background: #f0f2f4; color: var(--muted); border-color: #dfe3e6; }

/* Par links */
.par { font-size: 12px; color: var(--muted); }
.par a { color: var(--accent); }
.par .sep { margin: 0 4px; color: #b9c2c9; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600;
}
.table td { padding: 10px; border-bottom: 1px solid #edf1f4; vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table.compact td, .table.compact th { padding: 7px 8px; }
.table .right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Definition lists */
.kv-list { margin: 0 0 10px; }
.kv { display: flex; gap: 16px; padding: 6px 0; border-bottom: 1px dotted #e3e8ec; }
.kv dt { flex: 0 0 200px; font-size: 12.5px; color: var(--muted); }
.kv dd { margin: 0; flex: 1; font-size: 13.5px; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.field > span { color: var(--muted); font-weight: 600; }
input[type=text], input[type=date], input[type=number], input[type=password], select, textarea {
  font: inherit; font-size: 13.5px; padding: 8px 10px; border: 1px solid #cbd4da;
  border-radius: 7px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b9d5e7; border-color: var(--accent); }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check input { width: auto; }

.btn {
  display: inline-block; font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: #fff; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn-ghost { background: #fff; color: var(--accent); border-color: #c4d4e0; }
.btn-ghost:hover { background: #f2f7fa; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #7e1c16; }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.inline-form .field { min-width: 200px; }

details.edit { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details.edit summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent);
  padding: 4px 0; list-style: none;
}
details.edit summary::before { content: "▸ "; }
details.edit[open] summary::before { content: "▾ "; }
details.edit .edit-body { padding: 12px 0 0; }

/* Notices */
.notice { background: #f7f9fb; border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 12px 14px; border-radius: 8px; margin-top: 14px; font-size: 13.5px; }
.notice-warn { background: #fdf7ef; border-left-color: var(--warn); }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; }
.alert-ok { background: #e9f5ee; border: 1px solid #c4e0d0; color: #23583a; }
.alert-err { background: #fbeceb; border: 1px solid #edc7c3; color: #7d231d; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.approved { font-size: 13px; color: var(--ok); margin-top: 8px; }
.sub { margin-top: 18px; }
.right { text-align: right; }

.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.mini { background: #f8fafb; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.mini h3 { margin-bottom: 6px; }

.mitid { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 12px; padding: 10px 14px; background: #f8fafb; border: 1px dashed #c3ced6; border-radius: 8px; }
.mitid p { margin: 0; }

.danger-zone { margin-top: 14px; padding: 12px 14px; border: 1px solid #eccac6; background: #fdf4f3; border-radius: 8px; }

.check-row { border-top: 1px solid var(--line); padding: 12px 0; }
.check-title { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }

.lookup { margin-top: 12px; padding: 10px 14px; background: #f2f8f4; border: 1px solid #cfe4d6; border-radius: 8px; font-size: 13.5px; }

/* Login */
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: #10212e; }
.login-card { background: #fff; padding: 32px; border-radius: 14px; width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { font-size: 22px; margin-top: 18px; }
.demo { margin-top: 20px; padding: 12px; background: #f5f7f9; border-radius: 8px; font-size: 12.5px; }
.demo p { margin: 0 0 4px; }
.demo-title { font-weight: 700; margin-bottom: 6px; }
code { background: #e9eef2; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* Law page */
.law-card h2 { margin-bottom: 8px; }
blockquote { margin: 10px 0; padding: 10px 14px; background: #f7f9fb; border-left: 3px solid #b9c7d2; font-size: 13px; color: #33414d; }
blockquote p { margin: 0 0 6px; }
.quote-ref { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }

@media (max-width: 760px) {
  .page-head { flex-direction: column; }
  .kv { flex-direction: column; gap: 2px; }
  .kv dt { flex: none; }
  .topbar { flex-wrap: wrap; gap: 10px; }
}
