.viz-root, :root {
  color-scheme: light;
  --green: #0B6E4F; --green-soft: #E8F3EE; --ink: #0A0A0A; --ink-2: #3A3A3C; --ink-3: #86868B;
  --line: #E5E5EA; --bg: #fff; --bg-2: #F5F5F7; --surface-1: #fcfcfb;
  /* categorical slots (validated reference palette, fixed order) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --neutral: #8a8984;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; color: var(--ink); background: var(--bg-2); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 12px 22px; background: rgba(255,255,255,.85); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand span { font-weight: 600; color: var(--green); }
.bar-right { display: flex; gap: 8px; }
.ghost { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 14px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.ghost:hover { background: var(--bg-2); }
.primary { border: 0; background: var(--green); color: #fff; border-radius: 99px; padding: 12px 22px; font-weight: 700; font-size: 15px; }
main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }
h1 { font-size: 34px; letter-spacing: -.03em; margin: 6px 0 4px; }
.sub { color: var(--ink-3); margin: 0 0 22px; }

.login { max-width: 380px; margin: 12vh auto 0; background: #fff; border-radius: 24px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.08); }
.login input { width: 100%; font: inherit; font-size: 17px; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); margin: 14px 0; outline: none; }
.login input:focus { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.login .err { color: #C0392B; font-size: 14px; min-height: 20px; }
.login .primary { width: 100%; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { background: #fff; border-radius: 20px; padding: 18px 20px; }
.tile .k { font-size: 12.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.tile .v { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; line-height: 1.1; }
.tile .v.small { font-size: 20px; }
.tile .d { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.card { background: #fff; border-radius: 20px; padding: 20px; }
.card h2 { font-size: 17px; margin: 0 0 2px; letter-spacing: -.01em; }
.card .note { font-size: 13px; color: var(--ink-3); margin: 0 0 14px; }
.donut-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: center; }
.donut path { stroke: #fff; stroke-width: 2; cursor: default; transition: opacity .15s; }
.donut path:hover { opacity: .85; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; font-size: 14px; color: var(--ink-2); }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 8px; }
.brow { display: grid; grid-template-columns: minmax(0, 190px) 1fr 44px; gap: 10px; align-items: center; font-size: 14px; color: var(--ink-2); }
.brow .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .track { height: 14px; }
.brow .fill { height: 100%; background: var(--green); border-radius: 0 4px 4px 0; min-width: 2px; }
.brow b { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.scatter svg { width: 100%; max-width: 420px; display: block; margin: 0 auto; }
.scatter circle.p { cursor: pointer; }

.people { margin-top: 14px; }
.people-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.people-head input { font: inherit; padding: 10px 16px; border-radius: 99px; border: 1px solid var(--line); min-width: 240px; outline: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #fafafa; }
td .nm { font-weight: 700; color: var(--ink); text-decoration: none; }
td .nm:hover { color: var(--green); }
.tag { font-size: 11px; font-weight: 600; background: var(--bg-2); color: var(--ink-3); border-radius: 6px; padding: 2px 6px; margin-left: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.acts { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.acts a, .acts button { font-size: 13px; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.acts .del { color: #C0392B; }
.acts .del.sure { background: #C0392B; color: #fff; border-color: #C0392B; }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-3); }

.person { display: grid; grid-template-columns: 360px 1fr; gap: 20px; margin-top: 14px; }
.person .big { font-size: 40px; font-weight: 800; letter-spacing: -.04em; margin: 4px 0; }
.axis { margin-bottom: 14px; font-size: 14px; color: var(--ink-2); }
.axis .top { display: flex; justify-content: space-between; margin-bottom: 5px; }
.axis .top b { color: var(--ink); }
.axis .tr { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--bg-2); }
.axis .l { background: var(--ink); } .axis .r { background: var(--green); }
.facts { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 14.5px; margin-top: 10px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 600; }
.back { display: inline-block; margin-bottom: 6px; color: var(--ink-3); text-decoration: none; font-weight: 600; font-size: 14px; }

.tip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; font-size: 13px; padding: 7px 10px; border-radius: 8px; opacity: 0; transform: translate(-50%, -120%); white-space: nowrap; z-index: 20; transition: opacity .1s; }
.tip.on { opacity: 1; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .charts, .person { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 160px 1fr; }
  .hide-sm { display: none; }
}
