:root {
  --accent: #F75065; --btn: #C8102E; --btn-hover: #A50D26; --dark: #1E1E2A;
  --ink: #1E1E2A; --ink-2: #555A66; --ink-3: #8A8F99; --line: #E6E7EB; --bg: #F6F6F8; --card: #FFFFFF;
  --good: #1E8E5A; --good-bg: #E6F4EC; --warn: #B7791F; --warn-bg: #FDF3E1; --serious: #D9622B; --serious-bg: #FCEBE2;
  --bad: #C8102E; --bad-bg: #FBE7EA; --muted-bg: #EFF0F3;
  --radius: 10px; --shadow: 0 1px 2px rgba(30,30,42,.06), 0 2px 8px rgba(30,30,42,.04);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1, h2, h3 { font-family: Poppins, Inter, sans-serif; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 600; } h2 { font-size: 17px; font-weight: 600; } h3 { font-size: 14px; font-weight: 600; }
a { color: var(--btn); text-decoration: none; } a:hover { text-decoration: underline; }
.boot { padding: 60px; text-align: center; color: var(--ink-3); }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* Top bar */
.top { background: var(--dark); color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-family: Poppins; font-weight: 600; font-size: 16px; color: #fff; }
.brand .dot { width: 26px; height: 26px; border-radius: 7px; background: var(--btn); display: grid; place-items: center; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a { color: #C9CAD1; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.nav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.06); }
.nav a.on { color: #fff; background: rgba(255,255,255,.1); box-shadow: inset 0 -2px 0 var(--accent); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #C9CAD1; white-space: nowrap; }
.who button { background: transparent; border: 1px solid #3A3B48; color: #fff; }
.role-tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: rgba(247,80,101,.18); color: #FFB3BE; text-transform: capitalize; }

main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; color: var(--ink-2); }

/* Cards & tiles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.card > .card-b { padding: 16px; }
.grid { display: grid; gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { padding: 14px 16px; }
.tile .lab { color: var(--ink-2); font-size: 12px; font-weight: 500; }
.tile .val { font-family: Poppins; font-size: 26px; font-weight: 600; margin-top: 4px; }
.tile .sub { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.tile.alert { border-left: 3px solid var(--accent); }

/* Buttons & forms */
button, .btn { font: inherit; font-weight: 500; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button:hover { border-color: #C9CBD2; }
button.primary { background: var(--btn); border-color: var(--btn); color: #fff; }
button.primary:hover { background: var(--btn-hover); }
button.danger { color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; padding: 6px 8px; color: var(--ink-2); }
button.ghost:hover { background: var(--muted-bg); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #D5D7DD; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--ink-2); }
textarea { min-height: 76px; resize: vertical; }
input[type=checkbox] { width: auto; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
label.f .lock { font-weight: 400; color: var(--ink-3); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.err { color: var(--bad); background: var(--bad-bg); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.note { background: var(--muted-bg); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); font-size: 13px; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--dark); color: #fff; font-weight: 500; font-size: 12px; text-align: left; padding: 9px 10px; white-space: nowrap; }
th:first-child { border-top-left-radius: 8px; } th:last-child { border-top-right-radius: 8px; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; } tr.click:hover td { background: #FAFAFB; }
td.actions { white-space: nowrap; text-align: right; width: 1%; }
td .clip { max-width: 360px; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { padding: 28px; text-align: center; color: var(--ink-3); }

/* People */
.av { width: 36px; height: 36px; border-radius: 50%; background: var(--muted-bg); color: var(--ink-2); display: inline-grid; place-items: center; font-weight: 600; font-size: 13px; overflow: hidden; flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 72px; height: 72px; font-size: 22px; }
.person { display: flex; gap: 10px; align-items: center; }
.person .n { font-weight: 600; } .person .d { color: var(--ink-3); font-size: 12px; }

/* Bars */
.bar { position: relative; height: 10px; background: var(--muted-bg); border-radius: 5px; min-width: 110px; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--dark); }
.bar > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--accent); border-radius: 1px; }
.barcell { display: flex; align-items: center; gap: 8px; }
.barcell .v { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.seg { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: #fff; min-width: 110px; }
.seg > i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--muted-bg); color: var(--ink-2); }
.chip.good { background: var(--good-bg); color: var(--good); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.serious { background: var(--serious-bg); color: var(--serious); } .chip.bad { background: var(--bad-bg); color: var(--bad); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; border-radius: 0; background: transparent; padding: 10px 12px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--btn); font-weight: 600; }
.tabs .count { font-size: 11px; color: var(--ink-3); margin-left: 4px; }

/* Member header */
.mhead { display: flex; gap: 18px; align-items: center; padding: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.mhead .meta { flex: 1; min-width: 220px; }
.mhead .meta p { margin: 4px 0 0; color: var(--ink-2); }

/* Utilization grid */
.ugrid td, .ugrid th { padding: 6px 8px; }
.ugrid input { width: 72px; padding: 5px 6px; text-align: right; font-variant-numeric: tabular-nums; }
.ugrid tr.total td { background: #FAFAFB; font-weight: 600; }
.ugrid .over { color: var(--bad); font-weight: 600; }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(30,30,42,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(680px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.modal.sm { width: min(440px, 100%); }
.modal .mh { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal .mb { padding: 18px; overflow-y: auto; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; }
#toast.show { opacity: 1; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #1E1E2A 0%, #2B2B3A 60%, #3A1E28 100%); }
.login .card { width: min(400px, 100%); padding: 28px; }
.login h1 { margin: 14px 0 4px; }

.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; background: var(--muted-bg); padding: 10px 12px; border-radius: 8px; user-select: all; }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
  .nav { order: 3; flex: 0 0 100%; }
  .who { margin-left: auto; }
  main { padding: 16px 12px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
.over { color: var(--bad); font-weight: 600; }
