:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --ink: #14172b;
  --muted: #5c6274;
  --accent: #2f4bd8;
  --accent-soft: #e8ecfb;
  --border: #dde0ea;
  --ok: #16803c;
  --warn: #a45b06;
  --error: #b42318;
  --radius: 12px;
  --shadow: 0 8px 26px rgba(20, 23, 43, 0.07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin: 0 0 .3em; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 0 0 .6em; }
h3 { font-size: 1rem; margin: 0 0 .5em; }
p { margin: 0 0 .9em; }
small, .muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }

.wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 720px; }
.wrap.wide { max-width: 1240px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; color: var(--ink); }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.brand span.sub { color: var(--accent); }
.top nav { display: flex; gap: 16px; align-items: center; font-size: .92rem; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover, .top nav a.on { color: var(--ink); }

main { padding: 28px 0 64px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card > h2 { border-bottom: 1px solid var(--border); padding-bottom: 10px; }

.lede { font-size: 1.02rem; color: var(--muted); max-width: 62ch; }

/* form */
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend, .legend { font-weight: 650; font-size: .95rem; padding: 0 0 10px; display: block; }
.grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
label.lbl { font-size: .82rem; font-weight: 600; letter-spacing: .01em; color: #2b3040; }
label.lbl .req { color: var(--error); margin-left: 3px; }
.hint { font-size: .76rem; color: var(--muted); }

input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=number], input[type=password], select, textarea {
  font: inherit; color: inherit; background: #fcfcfe;
  border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 11px; width: 100%; transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff;
}
.field.err input, .field.err select, .field.err textarea { border-color: var(--error); }
.field .msg { font-size: .78rem; color: var(--error); }
input[aria-invalid=true] { border-color: var(--error); }

.people-block { border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.people-block .block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.people-block .block-head strong { font-size: .9rem; }
.btn {
  font: inherit; font-weight: 600; font-size: .92rem; border-radius: 9px; cursor: pointer;
  padding: 10px 18px; border: 1px solid transparent; background: var(--accent); color: #fff;
  text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--border); }
.btn.danger { background: var(--error); }
.btn.small { padding: 5px 11px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

/* file drop */
.drop {
  border: 1.5px dashed var(--border); border-radius: var(--radius); background: #fbfbfe;
  padding: 22px; text-align: center; transition: border-color .15s, background .15s;
}
.drop.hot { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { display: block; margin: 0 auto 8px; }
.filelist { list-style: none; margin: 12px 0 0; padding: 0; text-align: left; font-size: .85rem; }
.filelist li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--border); }
.filelist li:first-child { border-top: 0; }

/* alerts */
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: .9rem; border: 1px solid; }
.alert.error { background: #fef3f2; border-color: #fcc9c4; color: var(--error); }
.alert.ok { background: #f0fdf4; border-color: #bbf0cb; color: var(--ok); }
.alert.warn { background: #fffbeb; border-color: #fde68a; color: var(--warn); }
.alert.info { background: var(--accent-soft); border-color: #cfd8f7; color: var(--accent); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
tbody tr:hover { background: #fafbff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.kv th { width: 190px; }
table.kv th, table.kv td { border-bottom: 1px solid #eef0f6; }
.masked { color: var(--muted); font-variant-numeric: tabular-nums; }

.chip {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid;
}
.chip.new { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.chip.in_review { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.chip.waiting { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.chip.complete { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.chip.archived, .chip.spam { background: #f4f4f5; border-color: #e4e4e7; color: #52525b; }

/* admin bits */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 8px; align-items: center; }
.toolbar input[type=text] { width: 240px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a {
  font-size: .82rem; text-decoration: none; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface);
}
.tabs a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tabs a .n { opacity: .65; margin-left: 5px; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 14px; font-size: .85rem; }
.mono-s { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .82rem; }
.timeline li { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px solid #f0f1f6; }
.timeline time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.inline { display: inline; }
.right { text-align: right; }
footer.site { border-top: 1px solid var(--border); background: var(--surface); padding: 18px 0; font-size: .8rem; color: var(--muted); }
details summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.hidden { display: none !important; }
textarea.json { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; min-height: 460px; }

/* consent row (no inline styles: CSP blocks them) */
.consent-line { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: .92rem; }
.consent-line input[type=checkbox] { margin-top: 4px; width: 16px; height: 16px; flex: 0 0 auto; }

/* layout utilities (inline styles are blocked by the CSP) */
.mt { margin-top: 12px; }
.mt-lg { margin-top: 16px; }
.spacer { flex: 1 1 auto; }
.title-inline { display: inline-block; margin: 0 10px 0 0; font-size: 1.45rem; }
