@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e1e4ec;
  --text: #121530;
  --text-2: #4a4f68;
  --muted: #6b7088;
  --accent: #1f2a80;
  --accent-hover: #2a379c;
  --accent-ink: #ffffff;
  --accent-soft: #e4e7f8;
  --brand-navy: #1f2a80;
  --brand-navy-deep: #131a57;
  --brand-red: #d9262c;
  --series-1: #3b4cc0;
  --good: #0ca30c;
  --good-text: #006300;
  --good-soft: #e3f4e1;
  --warn: #fab219;
  --warn-text: #7a5200;
  --warn-soft: #fdf1d6;
  --bad: #d03b3b;
  --bad-text: #a32222;
  --bad-soft: #fbe3e1;
  --group: #6250d6;
  --group-soft: #ebe8fb;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(18 21 48 / 0.05), 0 8px 24px rgb(18 21 48 / 0.06);
  --shadow-lift: 0 2px 4px rgb(18 21 48 / 0.06), 0 12px 32px rgb(18 21 48 / 0.1);
  --ring: 0 0 0 4px var(--accent-soft);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7088' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0e1020;
    --surface: #161a2e;
    --surface-2: #1e2340;
    --border: #2b3152;
    --text: #eef0fa;
    --text-2: #b9bdd6;
    --muted: #8a8fae;
    --accent: #8e9cf0;
    --accent-hover: #a5b0f4;
    --accent-ink: #0e1020;
    --accent-soft: #262d5c;
    --brand-navy: #1a2170;
    --brand-navy-deep: #10153f;
    --series-1: #8e9cf0;
    --good-text: #5fd35f;
    --good-soft: #15301a;
    --warn-text: #fab219;
    --warn-soft: #3a2d0c;
    --bad-text: #f08a8a;
    --bad-soft: #3d1a1a;
    --group: #a59bf0;
    --group-soft: #2a2550;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-lift: 0 2px 6px rgb(0 0 0 / 0.5);
    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8fae' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0e1020;
  --surface: #161a2e;
  --surface-2: #1e2340;
  --border: #2b3152;
  --text: #eef0fa;
  --text-2: #b9bdd6;
  --muted: #8a8fae;
  --accent: #8e9cf0;
  --accent-hover: #a5b0f4;
  --accent-ink: #0e1020;
  --accent-soft: #262d5c;
  --brand-navy: #1a2170;
  --brand-navy-deep: #10153f;
  --series-1: #8e9cf0;
  --good-text: #5fd35f;
  --good-soft: #15301a;
  --warn-text: #fab219;
  --warn-soft: #3a2d0c;
  --bad-text: #f08a8a;
  --bad-soft: #3d1a1a;
  --group: #a59bf0;
  --group-soft: #2a2550;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-lift: 0 2px 6px rgb(0 0 0 / 0.5);
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8fae' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
[hidden] {
  display: none !important;
}
h1, h2, h3 {
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.15rem; font-weight: 700; }
h2 { font-size: 1.08rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.92rem; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 10px 24px;
  background: linear-gradient(100deg, var(--brand-navy-deep), var(--brand-navy));
  color: #fff;
  box-shadow: inset 0 -3px 0 var(--brand-red), 0 4px 16px rgb(19 26 87 / 0.18);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-logo { height: 46px; width: auto; padding: 3px 7px; border-radius: 12px; background: #fff; }
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand h1 { color: #fff; font-size: 1.05rem; }
.brand small { font-size: 0.8rem; color: rgb(255 255 255 / 0.72); }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; padding: 4px; border-radius: 12px; background: rgb(255 255 255 / 0.08); }
.topbar nav a {
  text-decoration: none;
  color: rgb(255 255 255 / 0.78);
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 550;
  transition: background 0.15s, color 0.15s;
}
.topbar nav a:hover { color: #fff; background: rgb(255 255 255 / 0.1); }
.topbar nav a[aria-current='page'] { background: #fff; color: var(--brand-navy); font-weight: 650; }
.topbar .spacer { flex: 1; }
.who { font-size: 0.85rem; color: rgb(255 255 255 / 0.78); }
.topbar button.link { color: #fff; font-weight: 600; border: 1px solid rgb(255 255 255 / 0.35); border-radius: 9px; padding: 6px 12px; }
.topbar button.link:hover { background: rgb(255 255 255 / 0.12); }
.topbar :focus-visible { outline-color: #fff; }

.conn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 550;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  white-space: nowrap;
}
.conn::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.6);
}
.conn[data-state='online']::before { background: #3ddc6a; box-shadow: 0 0 0 3px rgb(61 220 106 / 0.25); }
.conn[data-state='offline'] { background: var(--warn); color: #3a2700; }
.conn[data-state='offline']::before { background: #3a2700; }

/* ---------- layout ---------- */
main { padding: 28px 24px 40px; max-width: 1200px; margin: 0 auto; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }

/* ---------- forms ---------- */
label { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
input, select, textarea {
  font: inherit;
  color: inherit;
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--muted); opacity: 0.8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.field + .field { margin-top: 14px; }
button, .btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  min-height: 44px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
button:hover { background: var(--surface-2); }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgb(31 42 128 / 0.25);
}
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--bad-text); border-color: var(--bad); background: transparent; }
button.danger:hover { background: var(--bad-soft); }
button.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; box-shadow: 0 4px 14px rgb(208 59 59 / 0.3); }
button.danger.solid:hover:not(:disabled) { filter: brightness(1.08); background: var(--bad); }
button.danger.solid:disabled { box-shadow: none; }
button.big { min-height: 58px; font-size: 1.08rem; width: 100%; border-radius: 12px; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 4px 6px; min-height: 0; color: var(--accent); font-weight: 600; }

.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; border-radius: 9px; min-height: 40px; background: transparent; color: var(--text-2); }
.seg button:hover { background: rgb(0 0 0 / 0.03); }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgb(18 21 48 / 0.12); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.group { background: var(--group-soft); color: var(--group); }
.badge.in { background: var(--good-soft); color: var(--good-text); }
.badge.pending { background: var(--warn-soft); color: var(--warn-text); }
.badge.bad { background: var(--bad-soft); color: var(--bad-text); }

.avatar {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  background: var(--accent-soft);
  color: var(--accent);
}
.avatar.group { background: var(--group-soft); color: var(--group); border-radius: 12px; }
.avatar.in { background: var(--good-soft); color: var(--good-text); }
.avatar.lg { width: 60px; height: 60px; font-size: 1.2rem; }

/* ---------- login ---------- */
.login-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-brand {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 48px 40px;
  color: #fff;
  background:
    radial-gradient(circle at 15% 15%, rgb(255 255 255 / 0.1), transparent 40%),
    radial-gradient(circle at 90% 95%, rgb(217 38 44 / 0.35), transparent 45%),
    linear-gradient(150deg, var(--brand-navy) 0%, var(--brand-navy-deep) 100%);
}
.login-brand::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 6px;
  background: var(--brand-red);
}
.login-brand-inner { max-width: 440px; text-align: center; }
.logo-plate { display: inline-block; padding: 16px 22px; border-radius: 24px; background: #fff; box-shadow: 0 18px 40px rgb(0 0 0 / 0.25); }
.login-logo { display: block; width: min(300px, 64vw); height: auto; }
.eyebrow { margin-top: 32px; font-size: 0.8rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(255 255 255 / 0.7); }
.login-brand h1 { margin-top: 10px; font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 750; letter-spacing: -0.02em; color: #fff; }
.login-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  font-weight: 600;
  font-size: 0.95rem;
}
.login-date::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-red); }
.login-tag { margin-top: 18px; color: rgb(255 255 255 / 0.72); font-size: 0.95rem; }

.login-main { display: grid; place-items: center; padding: 40px 24px; }
.login { width: min(420px, 100%); }
.login header { margin-bottom: 22px; }
.login header h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.login header p { margin-top: 4px; }
.login .seg { width: 100%; margin-bottom: 20px; }
.login .seg button { flex: 1; }
.login button.big { margin-top: 6px; }
.error-text { color: var(--bad-text); font-size: 0.9rem; min-height: 1.2em; margin-top: 12px; font-weight: 550; }

/* ---------- desk ---------- */
.desk-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'head progress' 'search search';
  gap: 18px 24px;
  align-items: center;
  margin-bottom: 16px;
  padding: 24px 26px 24px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 95% 0%, rgb(217 38 44 / 0.1), transparent 35%),
    linear-gradient(160deg, var(--accent-soft), var(--surface) 70%);
  box-shadow: var(--shadow);
}
.desk-hero-head { grid-area: head; min-width: 0; }
.desk-progress { grid-area: progress; }
.desk-search { grid-area: search; }
.greet { font-size: 0.84rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.desk-title { margin: 4px 0 0; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 750; letter-spacing: -0.03em; }
.searchbox { position: relative; }
.searchbox input {
  font-size: 1.2rem;
  padding: 18px 18px 18px 56px;
  border-radius: var(--radius);
  border-width: 2px;
  background: var(--surface) var(--search-icon) no-repeat 18px center / 24px;
  box-shadow: var(--shadow-lift);
}
.searchbox input:focus { box-shadow: var(--ring), var(--shadow-lift); }
.hint { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); margin: 10px 2px 0; }
kbd {
  font: 600 0.72rem/1 var(--font);
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--text-2);
}
.hint kbd + kbd { margin-left: -2px; }

.desk-progress { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.ring-fill.zero { stroke-opacity: 0; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-size: 1.25rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1; }
.ring-label span { font-size: 0.68rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.counts { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.counts li { display: flex; align-items: baseline; gap: 8px; }
.counts b { font-size: 1.1rem; font-weight: 750; letter-spacing: -0.02em; color: var(--accent); min-width: 2.2ch; text-align: right; }
.counts span { font-size: 0.82rem; color: var(--text-2); font-weight: 550; }

.desk { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); gap: 24px; align-items: start; }
.desk-left { min-width: 0; }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.result {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  font-weight: 400;
  justify-content: flex-start;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(18 21 48 / 0.04);
  position: relative;
}
.result::after { content: '›'; font-size: 1.5rem; line-height: 1; color: var(--muted); opacity: 0; transition: opacity 0.15s, transform 0.15s; }
.result:hover { background: var(--surface); border-color: var(--accent-soft); box-shadow: var(--shadow-lift); }
.result:hover::after, .result[aria-selected='true']::after { opacity: 1; transform: translateX(2px); color: var(--accent); }
.result[aria-selected='true'] { border-color: var(--accent); box-shadow: var(--ring); }
.result .who-col, .recent .who-col { flex: 1; min-width: 0; }
.result .name, .recent .name { font-weight: 650; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .meta, .recent .meta { font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
mark { background: rgb(250 178 25 / 0.35); color: inherit; border-radius: 3px; padding: 0 1px; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.results .empty { border: 1.5px dashed var(--border); border-radius: var(--radius); background: var(--surface); }

/* Idle panel */
.ready {
  text-align: center;
  padding: 36px 24px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--border);
  background: var(--surface);
}
.ready-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-soft) var(--search-icon) no-repeat center / 32px;
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent-soft) 45%, transparent);
}
.ready h2 { font-size: 1.15rem; }
.ready p { margin-top: 6px; font-size: 0.9rem; }
.ready-tips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }
.ready-tips span { font-size: 0.78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }

/* Selected member, presented as a membership card */
.member-card {
  position: relative;
  overflow: hidden;
  padding: 22px 24px 24px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 110% -10%, rgb(217 38 44 / 0.55), transparent 45%),
    radial-gradient(circle at -10% 120%, rgb(255 255 255 / 0.12), transparent 40%),
    linear-gradient(135deg, var(--brand-navy), var(--brand-navy-deep));
  box-shadow: 0 18px 40px rgb(19 26 87 / 0.3);
  animation: card-in 0.25s ease-out;
}
.member-card.group {
  background:
    radial-gradient(circle at 110% -10%, rgb(217 38 44 / 0.45), transparent 45%),
    linear-gradient(135deg, #3d2f9e, #1d1660);
}
.member-card::after {
  /* Ring watermark echoing the logo's oval */
  content: '';
  position: absolute;
  right: -60px;
  bottom: -80px;
  width: 240px;
  height: 160px;
  border-radius: 50%;
  border: 14px solid rgb(255 255 255 / 0.07);
  pointer-events: none;
}
@keyframes card-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
.mc-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mc-org { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgb(255 255 255 / 0.7); }
.mc-type { font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgb(255 255 255 / 0.16); }
.mc-name { margin: 28px 0 18px; font-size: 1.55rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; color: #fff; }
.mc-fields { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; }
.mc-fields dt { font-size: 0.68rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(255 255 255 / 0.6); }
.mc-fields dd { margin: 2px 0 0; font-weight: 600; font-size: 0.95rem; letter-spacing: 0.02em; }
.mc-top .mc-right { display: flex; align-items: center; gap: 10px; }
.mc-stamp {
  transform: rotate(-6deg);
  padding: 4px 10px 3px;
  border: 2.5px solid #3ddc6a;
  border-radius: 10px;
  color: #3ddc6a;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.1;
  background: rgb(14 16 32 / 0.25);
  animation: stamp 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.mc-stamp small { display: block; font-size: 0.7rem; letter-spacing: 0.04em; }
@keyframes stamp { from { opacity: 0; transform: rotate(-6deg) scale(1.8); } to { opacity: 1; transform: rotate(-6deg) scale(1); } }

.panel-actions { margin-top: 14px; }
.status-box { border-radius: 12px; padding: 14px 16px; font-weight: 600; }
.status-box.in { background: var(--good-soft); color: var(--good-text); }
.status-box.warn { background: var(--warn-soft); color: var(--warn-text); }
.rep-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rep-list li { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; font-size: 0.92rem; }
.panel.done-flash .member-card { animation: flash 1.2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 8px var(--good); } to { box-shadow: 0 18px 40px rgb(19 26 87 / 0.3); } }

.recent-card h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.recent { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.recent li { display: flex; align-items: center; gap: 12px; }
.recent li.muted { font-size: 0.9rem; }
.recent .avatar { width: 34px; height: 34px; font-size: 0.78rem; }

.notices { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.notices:empty { margin: 0; }
.notices li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 0.92rem; }
.notices li[data-kind='warn'] { background: var(--warn-soft); color: var(--warn-text); }
.notices li[data-kind='error'] { background: var(--bad-soft); color: var(--bad-text); }
.notices li[data-kind='info'] { background: var(--accent-soft); color: var(--text); }
.notices li p { flex: 1; }
.notices li button { min-height: 0; padding: 2px 10px; background: transparent; border-color: currentColor; color: inherit; }

/* ---------- dashboard ---------- */
.hero-card {
  position: relative;
  overflow: hidden;
  color: #fff;
  border: 0;
  padding: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgb(217 38 44 / 0.35), transparent 40%),
    linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-deep) 100%);
  box-shadow: 0 16px 40px rgb(19 26 87 / 0.25);
}
.hero-card .muted { color: rgb(255 255 255 / 0.75); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.hero { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.hero-value { font-size: clamp(56px, 9vw, 104px); font-weight: 750; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.hero-of { font-size: 1.15rem; color: rgb(255 255 255 / 0.8); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 18px 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent); }
.tile:nth-child(2)::before { background: var(--group); }
.tile:nth-child(3)::before { background: var(--brand-red); }
.tile:nth-child(4)::before { background: var(--good); }
.tile .label { font-size: 0.84rem; color: var(--text-2); font-weight: 600; }
.tile .value { font-size: 2.1rem; font-weight: 750; line-height: 1.15; margin-top: 4px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 0.8rem; color: var(--muted); }

.meter { margin-top: 20px; }
.meter-track { height: 12px; border-radius: 6px; background: rgb(255 255 255 / 0.18); position: relative; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 6px; background: #fff; transition: width 0.6s ease; }
.meter-fill.met { background: #3ddc6a; }
.meter-text { display: flex; justify-content: space-between; gap: 10px; font-size: 0.9rem; color: rgb(255 255 255 / 0.85); margin-top: 8px; flex-wrap: wrap; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--border); stroke-width: 1; }
.chart .bar { fill: var(--series-1); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { fill: var(--brand-red); }
.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  margin-top: -8px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
th { font-size: 0.74rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface-2); }
th:first-child { border-top-left-radius: 10px; }
th:last-child { border-top-right-radius: 10px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 0.88rem; }
.pager-buttons { display: inline-flex; align-items: center; gap: 10px; }
.pager-buttons button { min-height: 36px; padding: 6px 12px; font-size: 0.86rem; }

/* ---------- admin ---------- */
.quorum-status {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.qs-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--muted);
}
.qs-icon::before { content: '–'; }
.qs-body { flex: 1; min-width: 0; }
.qs-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.qs-body h2 { font-size: 1.15rem; font-weight: 700; margin-top: 2px; }
.qs-detail { font-size: 0.9rem; color: var(--text-2); margin-top: 2px; }
.qs-meter { height: 8px; margin-top: 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; max-width: 520px; }
.qs-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.6s ease; }
.quorum-status[data-state='unset'] { border-style: dashed; box-shadow: none; }
.quorum-status[data-state='pending'] .qs-icon { background: var(--accent-soft); color: var(--accent); }
.quorum-status[data-state='pending'] .qs-icon::before { content: '…'; }
.quorum-status[data-state='met'] { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.quorum-status[data-state='met'] .qs-icon { background: var(--good); color: #fff; }
.quorum-status[data-state='met'] .qs-icon::before { content: '✓'; }
.quorum-status[data-state='met'] h2, .quorum-status[data-state='met'] .qs-label { color: var(--good-text); }
.quorum-status[data-state='met'] .qs-fill { background: var(--good); }
.quorum-status[data-state='met'] .qs-meter { background: rgb(255 255 255 / 0.5); }

.tabs {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.tabs button { border: 0; border-radius: 10px; background: none; color: var(--text-2); min-height: 40px; padding: 8px 16px; }
.tabs button:hover { background: var(--surface-2); }
.tabs button[aria-selected='true'] { background: var(--accent); color: var(--accent-ink); }
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  color: var(--text-2);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone b { color: var(--accent); }
.mapping { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.problems { max-height: 220px; overflow: auto; font-size: 0.88rem; background: var(--warn-soft); color: var(--warn-text); border-radius: 12px; padding: 12px 16px; margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 0.92rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; word-break: break-all; }

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 24px;
  width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow-lift);
}
dialog::backdrop { background: rgb(14 16 32 / 0.55); backdrop-filter: blur(2px); }
dialog.modal { width: min(520px, calc(100vw - 32px)); padding: 26px; border-radius: 20px; border-top: 5px solid var(--bad); }
dialog.modal[open] { animation: modal-in 0.2s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; gap: 16px; align-items: flex-start; }
.modal-head h2 { font-size: 1.25rem; font-weight: 700; }
.modal-head p { margin-top: 4px; font-size: 0.92rem; }
.modal-icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--bad-soft);
  color: var(--bad-text);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad-soft) 50%, transparent);
}
.impact { list-style: none; margin: 20px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); display: grid; gap: 8px; font-size: 0.92rem; }
.impact li { position: relative; padding-left: 16px; }
.impact li::before { content: ''; position: absolute; left: 0; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); }
.impact b { color: var(--text); }
.modal-note { margin-top: 12px; font-size: 0.86rem; color: var(--bad-text); font-weight: 550; }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; font-size: 0.92rem; }
.backup-row button { flex: none; }
dialog.modal .field { margin-top: 18px; }
#reset-confirm { font-weight: 650; letter-spacing: 0.12em; }
.modal-actions { margin-top: 22px; }


#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  opacity: 0;
  background: var(--text);
  color: var(--bg);
  padding: 13px 20px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  transition: 0.2s;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast[data-kind='error'] { background: var(--bad); color: #fff; }
#toast[data-kind='good'] { background: #0a7d0a; color: #fff; }

@media (max-width: 1320px) {
  .who { display: none; }
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 32px 20px 36px; }
  .eyebrow { margin-top: 20px; }
  .login-tag { display: none; }
}
@media (max-width: 860px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .panel-col { order: -1; }
  .panel-col .panel.idle, .panel-col .recent-card { display: none; }
  .desk-hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'progress' 'head' 'search'; }
  .ring { width: 84px; height: 84px; }
  .ring-label b { font-size: 1.15rem; }
  .ring-label span { font-size: 0.66rem; }
  .counts { grid-template-columns: repeat(3, auto); gap: 4px 18px; }
  .counts li { flex-direction: column; gap: 0; }
  .counts b { text-align: left; }
}
@media (max-width: 600px) {
  main { padding: 16px 16px 32px; }
  .topbar { padding: 10px 16px; gap: 10px 12px; }
  .topbar-logo { height: 40px; }
  .brand small { display: none; }
  .topbar .spacer, .who { display: none; }
  .brand { flex: 1 1 0; }
  .brand h1 { font-size: 0.92rem; }
  .topbar button.link { order: 2; }
  .conn { order: 3; }
  .topbar nav { order: 5; width: 100%; }
  .topbar nav a { flex: 1; text-align: center; }
  .desk-hero { margin-bottom: 18px; padding: 20px 18px 22px; }
  .hint { display: none; }
  .card { padding: 18px; }
  .hero-card { padding: 22px; }
  .tabs { display: flex; }
  .quorum-status { flex-wrap: wrap; padding: 16px; }
  .quorum-status button { width: 100%; }
  .backup-row { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.check { font-weight: 500; }
.row.check input { width: auto; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* ---------- light / dark switch ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9px;
  border: 1px solid rgb(255 255 255 / 0.35);
  background: transparent;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}
.theme-toggle:hover { background: rgb(255 255 255 / 0.12); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun, .theme-toggle[data-mode='dark'] .i-moon { display: none; }
.theme-toggle[data-mode='dark'] .i-sun { display: block; }
.login-main { position: relative; }
.login-theme { position: absolute; top: 20px; right: 24px; color: var(--text-2); border-color: var(--border); background: var(--surface); }
.login-theme:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 600px) {
  .topbar .theme-toggle { order: 2; padding: 6px 9px; }
  .topbar .theme-toggle span { display: none; }
  .login-theme { top: 12px; right: 16px; }
}

/* ---------- confirmations, events ---------- */
dialog.modal[data-tone='info'] { border-top-color: var(--accent); }
dialog.modal[data-tone='info'] .modal-icon { background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-soft) 50%, transparent); }
dialog.modal[data-tone='info'] .impact li::before { background: var(--accent); }
dialog.modal[data-tone='info'] .modal-note { color: var(--text-2); font-weight: 500; }
#cf-typed { font-weight: 650; letter-spacing: 0.12em; }
dialog.modal form.stack { gap: 18px; }
.span-2 { grid-column: 1 / -1; }
#event-dlg .grid-2 { grid-template-columns: 1fr 1fr; gap: 14px; }

.choice { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.choice legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; padding: 0; }
.choice-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 400; }
.choice-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-opt input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.choice-opt span { display: grid; gap: 2px; }
.choice-opt small { color: var(--muted); font-size: 0.85rem; }

.ev-current { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 20px; margin: 0; padding: 16px 18px; border-radius: 12px; background: var(--surface-2); }
.ev-current dt { font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ev-current dd { margin: 2px 0 0; font-weight: 600; }
.ev-actions { white-space: nowrap; text-align: right; }
.ev-actions button { margin-left: 6px; }
button.link.danger-text { color: var(--bad-text); }
@media (max-width: 600px) {
  #event-dlg .grid-2 { grid-template-columns: 1fr; }
  .ev-actions { white-space: normal; }
}

/* ---------- getting started ---------- */
.setup { display: grid; gap: 16px; margin-bottom: 18px; border-top: 4px solid var(--accent); }
.setup h2 { font-size: 1.25rem; font-weight: 700; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.setup-steps li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.setup-steps li > div { flex: 1; display: grid; gap: 2px; }
.setup-steps small { color: var(--muted); font-size: 0.85rem; }
.step-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: 0.85rem; font-weight: 800; }
.setup-steps li.done .step-mark { background: var(--good); border-color: var(--good); color: #fff; }
.setup-steps li.done .step-mark::after { content: '✓'; }
.setup-steps li.done b { color: var(--muted); text-decoration: line-through; }
@media (max-width: 600px) { .setup-steps li { flex-wrap: wrap; } .setup-steps button { width: 100%; } }
