/* UDF Hub. One stylesheet, no build step, no framework. */

:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --brand: #1d4ed8;
  --brand-soft: #dbeafe;
  --yes: #15803d;
  --yes-soft: #dcfce7;
  --no: #b91c1c;
  --no-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .18);
  --radius: 12px;
  --nav-w: 232px;
  --banner-h: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --panel: #121a2b;
    --panel-2: #172136;
    --ink: #e8eefb;
    --ink-2: #a9b6cd;
    --ink-3: #6b7a93;
    --line: #23304a;
    --line-2: #33425f;
    --brand: #6f9bff;
    --brand-soft: #1b2c4d;
    --yes: #4ade80;
    --yes-soft: #14321f;
    --no: #f87171;
    --no-soft: #3a1a1a;
    --warn: #fbbf24;
    --warn-soft: #3a2c10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---- classification banner ---- */
.banner {
  position: fixed;
  left: 0; right: 0; top: 0;
  z-index: 60;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;
  background: #15803d;
}
.banner-bottom { top: auto; bottom: 0; }
/* An author `display: flex` beats the browser's own [hidden] rule, so without
   this the hidden banner still lays out as an empty coloured strip. */
.banner[hidden] { display: none; }
body.has-banner { padding-top: 24px; padding-bottom: 24px; }
body.has-banner { --banner-h: 24px; }

.boot-splash {
  height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}

/* ---- shell ---- */
.shell { display: flex; min-height: calc(100vh - var(--banner-h) * 2); }

.nav {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  position: sticky;
  top: var(--banner-h);
  height: calc(100vh - var(--banner-h) * 2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.nav .brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 8px 14px;
  font-weight: 800; font-size: 17px; letter-spacing: -.01em;
}
.nav .brand .mark {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 28px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff; display: grid; place-items: center; font-size: 15px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none;
  border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
}
.nav-item:hover { background: var(--panel-2); color: var(--ink); }
.nav-item.on { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.nav-item .ico { width: 18px; text-align: center; font-size: 14px; }
.nav-item .badge {
  margin-left: auto; background: var(--brand); color: #fff;
  border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px;
}
.nav-item.on .badge { background: var(--brand); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 6px; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); padding: 8px 10px 4px; font-weight: 700;
}
.nav-foot { margin-top: auto; padding-top: 10px; }
.nav-me {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 9px; cursor: pointer; border: 0; background: none; width: 100%;
  text-align: left;
}
.nav-me:hover { background: var(--panel-2); }
.nav-me .who { min-width: 0; }
.nav-me .n { font-weight: 600; font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-me .r { font-size: 11.5px; color: var(--ink-3); }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0 0 3px; letter-spacing: -.02em; }
.page-head .sub { color: var(--ink-2); font-size: 13.5px; max-width: 62ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--panel);
  color: var(--ink); cursor: pointer; font-size: 13.5px; font-weight: 550;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--no); border-color: var(--line-2); }
.btn.danger:hover { background: var(--no-soft); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- forms ---- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--panel);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; min-width: 0; }
.check { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; cursor: pointer; }
.check input { margin-top: 3px; flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--brand); }
.check .lbl { font-weight: 600; font-size: 13.5px; }
.check .hint { font-size: 12px; color: var(--ink-3); }

/* ---- cards ---- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-head {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.card-head h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }

/* ---- stats ---- */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; }
.stat .v { font-size: 27px; font-weight: 750; letter-spacing: -.03em; margin-top: 3px; line-height: 1.1; }
.stat .n { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---- chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
  background: var(--panel-2); color: var(--ink-2);
}
.chip .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.tag { font-size: 11.5px; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line); padding: 1px 8px; border-radius: 999px; }

.avatar {
  width: 26px; height: 26px; border-radius: 999px; flex: 0 0 26px;
  display: inline-grid; place-items: center; object-fit: cover;
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.avatar.lg { width: 34px; height: 34px; flex-basis: 34px; font-size: 13px; }
.avatar.sm { width: 20px; height: 20px; flex-basis: 20px; font-size: 9px; }

/* ---- idea board (the mockup) ---- */
.idea-list { display: flex; flex-direction: column; gap: 12px; }
.idea {
  display: flex; gap: 14px; align-items: stretch;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px;
}
.idea:hover { border-color: var(--line-2); }
.idea .vote {
  flex: 0 0 74px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  justify-content: center;
}
.vote-btn {
  width: 100%; padding: 4px 0; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.vote-btn:hover { background: var(--panel-2); }
.vote-btn.yes.on { background: var(--yes-soft); border-color: var(--yes); color: var(--yes); }
.vote-btn.no.on { background: var(--no-soft); border-color: var(--no); color: var(--no); }
.vote-score { font-size: 21px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.vote-score.pos { color: var(--yes); }
.vote-score.neg { color: var(--no); }
.vote-count { font-size: 10.5px; color: var(--ink-3); text-align: center; }
.idea .body { min-width: 0; flex: 1; }
.idea .body h3 { margin: 0 0 4px; font-size: 15.5px; letter-spacing: -.01em; }
.idea .body h3 button {
  border: 0; background: none; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-align: left;
}
.idea .body h3 button:hover { color: var(--brand); }
.idea .blurb {
  color: var(--ink-2); font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.idea .meta { display: flex; align-items: center; gap: 9px; margin-top: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.idea .bar { height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 9px; }
.idea .bar i { display: block; height: 100%; background: var(--brand); }

.empty { text-align: center; padding: 46px 20px; color: var(--ink-3); }
.empty .big { font-size: 30px; margin-bottom: 8px; }
.empty h3 { margin: 0 0 5px; color: var(--ink-2); font-size: 16px; }

/* ---- toolbar ---- */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .grow { flex: 1 1 200px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; background: var(--panel); }
.seg button {
  border: 0; background: none; padding: 6px 11px; cursor: pointer;
  font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--brand-soft); color: var(--brand); font-weight: 650; }

/* ---- tables / lists ---- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 700; padding: 9px 14px; border-bottom: 1px solid var(--line);
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--panel-2); }
.list-row .t { font-weight: 600; font-size: 14px; }
.list-row .s { font-size: 12px; color: var(--ink-3); }
.list-row .right { margin-left: auto; display: flex; align-items: center; gap: 9px; }

/* ---- board ---- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.lane { flex: 0 0 268px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.lane h3 {
  margin: 0; padding: 10px 12px; font-size: 12.5px; display: flex; align-items: center; gap: 7px;
  border-bottom: 1px solid var(--line);
}
.lane h3 .count { margin-left: auto; color: var(--ink-3); font-weight: 600; }
.lane .cards { padding: 9px; display: flex; flex-direction: column; gap: 8px; min-height: 40px; max-height: 62vh; overflow-y: auto; }
.tick {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 10px; cursor: pointer; box-shadow: var(--shadow);
}
.tick:hover { border-color: var(--line-2); }
.tick .t { font-size: 13px; font-weight: 600; line-height: 1.35; }
.tick .m { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.lane-blurb { padding: 0 12px 9px; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }

/* ---- drawer ---- */
.drawer-scrim {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .42);
  z-index: 70; display: flex; justify-content: flex-end;
}
.drawer {
  width: min(720px, 100%); background: var(--bg); height: 100%;
  overflow-y: auto; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.drawer-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 2;
}
.drawer-head .top { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.drawer-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; line-height: 1.3; }
.drawer-head .meta { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 9px; font-size: 12.5px; color: var(--ink-3); }
.drawer-body { padding: 18px 20px 60px; }
.drawer-close { margin-left: auto; }

.section-title {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); font-weight: 700; margin: 20px 0 8px;
}
.section-title:first-child { margin-top: 0; }
.prose { white-space: pre-wrap; line-height: 1.6; font-size: 14.5px; }

/* ---- timeline ---- */
.timeline { border-left: 2px solid var(--line); margin-left: 7px; padding-left: 16px; }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item .dot {
  position: absolute; left: -23px; top: 3px; width: 12px; height: 12px;
  border-radius: 999px; border: 2px solid var(--panel); background: var(--ink-3);
}
.tl-item .when { font-size: 11.5px; color: var(--ink-3); }
.tl-item .what { font-size: 13.5px; }
.tl-item .note { font-size: 13px; color: var(--ink-2); margin-top: 3px; white-space: pre-wrap; }

/* ---- comments ---- */
.comment { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.comment:last-of-type { border-bottom: 0; }
.comment .c-body { min-width: 0; flex: 1; }
.comment .c-head { display: flex; align-items: baseline; gap: 8px; }
.comment .c-name { font-weight: 650; font-size: 13.5px; }
.comment .c-when { font-size: 11.5px; color: var(--ink-3); }
.comment .c-text { font-size: 14px; white-space: pre-wrap; margin-top: 2px; }

/* ---- modal ---- */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: min(620px, 100%); max-height: 88vh; overflow-y: auto;
}
.modal-head { padding: 16px 20px 0; }
.modal-head h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.02em; }
.modal-head .sub { color: var(--ink-2); font-size: 13px; }
.modal-body { padding: 16px 20px; }
.modal-foot {
  padding: 13px 20px; border-top: 1px solid var(--line);
  display: flex; gap: 9px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--panel);
}

/* ---- toasts ---- */
#toasts { position: fixed; right: 16px; bottom: 40px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: var(--bg); padding: 10px 15px; border-radius: 10px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 380px;
  animation: toast-in .16s ease-out;
}
.toast.bad { background: var(--no); color: #fff; }
.toast.good { background: var(--yes); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---- login ---- */
.login-wrap { min-height: 82vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 32px 30px; width: min(430px, 100%);
}
.login-card h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.login-card .sub { color: var(--ink-2); font-size: 14px; margin-bottom: 22px; }
.login-mark {
  width: 46px; height: 46px; border-radius: 13px; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff; display: grid; place-items: center; font-size: 23px;
}
.login-users { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.login-user {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  cursor: pointer; text-align: left; width: 100%;
}
.login-user.sel { border-color: var(--brand); background: var(--brand-soft); }
.login-user .n { font-weight: 620; font-size: 14px; }
.login-user .r { font-size: 12px; color: var(--ink-3); }

/* ---- process diagram ---- */
.flow-wrap { overflow-x: auto; padding: 6px 0 12px; }
.flow-wrap svg { display: block; min-width: 940px; }
.flow-key { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }

/* ---- metrics bits ---- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 132px 1fr 54px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { height: 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.bar-row .track i { display: block; height: 100%; background: var(--brand); }
.bar-row .val { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 58px; }
.spark .col { flex: 1; background: var(--brand-soft); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.spark .col i { position: absolute; inset: auto 0 0 0; background: var(--brand); border-radius: 3px 3px 0 0; display: block; }
.spark-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); margin-top: 5px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.callout {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 9px; padding: 11px 13px; font-size: 13.5px; color: var(--ink-2);
}
.callout.warn { border-left-color: var(--warn); }

/* ---- mobile ---- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .nav {
    width: 100%; flex: none; height: auto; position: sticky; top: var(--banner-h);
    flex-direction: row; align-items: center; gap: 2px; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; z-index: 50;
  }
  .nav .brand { padding: 0 10px 0 4px; font-size: 15px; }
  .nav .brand span:not(.mark) { display: none; }
  .nav-item { width: auto; padding: 7px 10px; white-space: nowrap; }
  .nav-item .lbl { display: none; }
  .nav-item.on .lbl { display: inline; }
  .nav-sep, .nav-label { display: none; }
  .nav-foot { margin: 0 0 0 auto; padding: 0; }
  .nav-me .who { display: none; }
  .main { padding: 16px 14px 50px; }
  .idea { flex-direction: row; }
  .idea .vote { flex-basis: 60px; }
  .drawer { width: 100%; }
}
