/* DNA Payments Tracker - single stylesheet, no build step */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --line: #e3e8ef;
  --text: #1a2332;
  --muted: #64748b;
  --brand: #221e44;        /* DNA Payments deep navy */
  --brand-2: #2e2960;
  --brand-yellow: #fdb913; /* DNA Payments yellow */
  --accent: #0ea5a4;       /* teal */
  --accent-soft: #e6f7f7;
  --ok: #16a34a;
  --ok-soft: #e9f9ef;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --info: #2563eb;
  --info-soft: #e8effd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 39, 73, .06), 0 4px 16px rgba(15, 39, 73, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .35rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h1 + .sub { color: var(--muted); margin: 0 0 1.25rem; }

/* ---- Top bar ---- */
.topbar { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px; min-height: 56px; flex-wrap: wrap;
}
.brand {
  color: #fff; font-weight: 300; font-size: 1.12rem; letter-spacing: .2px;
  display: inline-flex; align-items: center; white-space: nowrap;
}
.brand strong { font-weight: 800; }
.brand .brand-sep { width: 1px; height: 20px; background: rgba(255,255,255,.35); margin: 0 12px; }
.brand .brand-mark { width: 19px; height: 19px; margin-right: 7px; flex: none; }
.brand .brand-app { color: var(--brand-yellow); font-weight: 600; letter-spacing: .6px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  color: #c8d3e2; padding: 6px 12px; border-radius: 6px; font-weight: 500;
}
.nav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.08); }
.nav a.on { color: #fff; background: rgba(255,255,255,.14); }
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-user > a { color: #c8d3e2; font-weight: 500; }
.nav-user > a.on, .nav-user > a:hover { color: #fff; text-decoration: none; }

.container { max-width: 1280px; margin: 24px auto 64px; padding: 0 20px; }

/* ---- Cards / layout ---- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-main-side { grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 900px) { .grid-2, .grid-main-side { grid-template-columns: 1fr; } }

.stat { text-align: left; }
.stat .n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat.accent .n { color: var(--accent); }
.stat.ok .n { color: var(--ok); }
.stat.warn .n { color: var(--warn); }
.stat.bad .n { color: var(--bad); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
td .small, .small { color: var(--muted); font-size: .82rem; }
th a { color: var(--muted); }
th a.on { color: var(--text); }

/* ---- Badges / pills ---- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: .76rem; font-weight: 600; white-space: nowrap;
}
.badge-in_progress { background: var(--info-soft); color: var(--info); }
.badge-complete    { background: var(--ok-soft); color: var(--ok); }
.badge-on_hold     { background: var(--warn-soft); color: var(--warn); }
.badge-declined    { background: var(--bad-soft); color: var(--bad); }
.badge-admin { background: var(--brand); color: #fff; }
.badge-staff { background: var(--line); color: var(--muted); }
.badge-muted { background: var(--line); color: var(--muted); }

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; color: #fff; margin: 1px 2px 1px 0; white-space: nowrap;
}

/* ---- Progress dots ---- */
.dots { display: inline-flex; gap: 3px; align-items: center; }
.dot {
  width: 11px; height: 11px; border-radius: 999px;
  background: var(--line); display: inline-block;
}
.dot.done { background: var(--accent); }
.progress-label { font-size: .8rem; color: var(--muted); margin-left: 6px; white-space: nowrap; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: .85rem; margin: 0 0 4px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=tel], input[type=search], input[type=color], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 70px; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.checkbox input { width: auto; }

/* ---- Buttons ---- */
.btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #0b8a89; }
.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: #fff; color: var(--text); border-color: #cbd5e1; }
.btn-outline:hover { background: #f1f5f9; }
.btn-ghost { background: transparent; color: inherit; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-sm { padding: 4px 10px; font-size: .82rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- Flash / alerts ---- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash-success { background: var(--ok-soft); color: #14532d; border: 1px solid #bbe7c8; }
.flash-error   { background: var(--bad-soft); color: #7f1d1d; border: 1px solid #f5c6c6; }
.flash-info    { background: var(--info-soft); color: #1e3a8a; border: 1px solid #c7d7f8; }
.flash-warning { background: var(--warn-soft); color: #78350f; border: 1px solid #f2ddb5; }

/* ---- Page header row ---- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }

/* ---- Filters bar ---- */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filters .field { margin: 0; min-width: 130px; flex: 0 1 auto; }
.filters .field.grow { flex: 1 1 180px; }

/* ---- Login ---- */
.login-wrap { max-width: 400px; margin: 8vh auto 0; }
.login-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.login-logo .brand { color: var(--brand); font-size: 1.55rem; }
.login-logo .brand .brand-sep { background: rgba(34,30,68,.25); height: 26px; }
.login-logo .brand .brand-mark { width: 24px; height: 24px; }
.login-logo .brand .brand-app { color: #b8860b; }
.login-divider {
  display: flex; align-items: center; gap: 10px; color: var(--muted);
  font-size: .8rem; margin: 16px 0;
}
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.g_id_signin { display: flex; justify-content: center; }

/* ---- Stalling rows: applications that need revisiting ---- */
tr.stall-due > td { background: #fdf6e2; }
tr.stall-due:hover > td { background: #fbefcf; }
tr.stall-overdue > td { background: #fdecec; }
tr.stall-overdue:hover > td { background: #fadcda; }
.stall-swatch {
  display: inline-block; width: 11px; height: 11px; border-radius: 3px;
  vertical-align: -1px; margin-right: 4px;
}

/* ---- Quick-update board (dashboard) ---- */
.quickboard th, .quickboard td { text-align: center; padding: 7px 6px; }
.quickboard th:first-child, .quickboard td:first-child { text-align: left; padding-left: 10px; }
.quickboard th { font-size: .7rem; letter-spacing: .2px; }
.quickboard input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.quickboard form { display: inline; }
.quickboard .badge { font-size: .7rem; }

/* ---- Modal ---- */
dialog.modal {
  border: none; border-radius: var(--radius); padding: 20px 22px;
  width: min(480px, 92vw); box-shadow: 0 12px 48px rgba(15, 23, 42, .3);
  color: var(--text);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }

/* ---- Stage checklist ---- */
.stage-list { list-style: none; margin: 0; padding: 0; }
.stage-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-bottom: 1px solid var(--line);
}
.stage-list li:last-child { border-bottom: 0; }
.stage-list .meta { margin-left: auto; text-align: right; color: var(--muted); font-size: .78rem; }
.stage-toggle { display: flex; align-items: center; gap: 10px; flex: 1; }
.stage-toggle input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.stage-toggle .name { font-weight: 500; }
.stage-list.readonly .stage-toggle input { pointer-events: none; opacity: .55; }
.stage-list.readonly .name { color: var(--muted); }

/* ---- Notes timeline ---- */
.note { padding: 10px 0; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; }
.note .who { font-weight: 600; font-size: .85rem; }
.note .when { color: var(--muted); font-size: .78rem; margin-left: 6px; }
.note .body { margin-top: 3px; white-space: pre-wrap; }

/* ---- Activity feed ---- */
.feed { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.feed li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--muted); font-size: .78rem; white-space: nowrap; }

/* ---- Misc ---- */
.error-page { text-align: center; padding: 12vh 0; }
.error-page h1 { font-size: 3rem; color: var(--brand); }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 16px; color: var(--muted); }
details.collapse summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 500; margin: 0; }
.kv dd { margin: 0; }
.reset-link-box {
  background: var(--accent-soft); border: 1px solid #b8e8e8; border-radius: 8px;
  padding: 12px 14px; font-family: ui-monospace, monospace; font-size: .85rem;
  word-break: break-all; margin: 10px 0;
}
@media print { .topbar, .btn, .filters, .pager { display: none !important; } }
