:root {
  --blue: #34428A; --blue-600: #2B3876; --blue-50: #ECEEF6; --blue-100: #DCE0EF;
  --crimson: #B42329; --crimson-50: #FBECEC; --crimson-100: #F4D3D4;
  --green: #1E7B4F; --green-50: #E7F3EC; --amber: #8A5A00; --amber-50: #FDF3DC;
  --tint: #F3F5F8; --line: #E3E6EC; --line-2: #D3D8E1;
  --ink: #161B2E; --ink-2: #4A5168; --ink-3: #7B8196; --white: #fff;
  --serif: 'Source Serif 4', Georgia, serif; --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 10px; --r-lg: 14px; --shadow: 0 8px 28px rgba(22, 27, 46, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--sans); color: var(--ink); background: var(--white); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.fill { fill: currentColor; stroke: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: var(--r); border: 1px solid transparent; font-weight: 600; background: var(--blue); color: #fff; transition: background .15s, opacity .15s; white-space: nowrap; }
.btn:hover { background: var(--blue-600); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--tint); }
.btn.danger { background: var(--crimson); }
.btn.danger:hover { background: #9a1d22; }
.btn.danger-ghost { background: #fff; color: var(--crimson); border-color: var(--crimson); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.link { background: none; color: var(--blue); height: auto; padding: 0; border: 0; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.pill:hover { background: var(--tint); }
.pill.wa { color: var(--green); border-color: #9CCDB3; }
.pill.wa:hover { background: var(--green-50); }
.pill.off { color: var(--ink-3); border-style: dashed; cursor: default; }
.pill .ico { width: 13px; height: 13px; }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip.blood.on { background: var(--crimson); border-color: var(--crimson); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 500; background: var(--tint); color: var(--ink-2); }
.tag.green { background: var(--green-50); color: var(--green); }
.tag.red { background: var(--crimson-50); color: var(--crimson); }
.tag.amber { background: var(--amber-50); color: var(--amber); }
.tag.blue { background: var(--blue-50); color: var(--blue); }

/* forms */
.field { display: block; }
.field > span { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.input, .select, .textarea { width: 100%; height: 44px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: #fff; outline: none; transition: border .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); }
.select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%234A5168' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center; padding-right: 32px; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.hint.ok { color: var(--green); } .hint.bad { color: var(--crimson); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--blue); flex: none; }

.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: .2s; cursor: pointer; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked + i { background: var(--blue); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--blue-100); }

/* avatars */
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; background: var(--blue-50); color: var(--blue); overflow: hidden; letter-spacing: .02em; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 76px; height: 76px; font-size: 22px; }
.av.sm { width: 28px; height: 28px; font-size: 10.5px; }
.av.c1 { background: #ECEEF6; color: #34428A; } .av.c2 { background: #F8EEDF; color: #8A5A00; } .av.c3 { background: #E7F3EC; color: #1E7B4F; }
.av.c4 { background: #F2ECF7; color: #6A3D8C; } .av.c5 { background: #FBECEC; color: #B42329; } .av.c6 { background: #E6F1F6; color: #1F6680; }

.card { border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; }

/* toast */
#toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 11px 14px; border-radius: var(--r); box-shadow: var(--shadow); font-size: 13px; animation: tin .2s ease-out; pointer-events: auto; }
.toast.err { background: var(--crimson); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line-2); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }

/* platform brand badge (groups) */
.pbadge { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.pbadge .ico { width: 22px; height: 22px; stroke-width: 1.9; }
.pbadge.sm { width: 30px; height: 30px; } .pbadge.sm .ico { width: 16px; height: 16px; }
