/* Va'a Vitals backoffice. Colours come from vaavitals.com (see docs/SPEC.md). */
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("/fonts/Poppins-Medium.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("/fonts/Poppins-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("/fonts/Poppins-Bold.ttf") format("truetype"); }

:root {
  --navy: #0b0088;
  --royal: #1100d9;
  --royal-dark: #0d00ab;
  --coral: #bf4337;
  --coral-soft: #fbeceb;
  --ink: #0e1233;
  --text: #2a2f52;
  --muted: #6b7196;
  --line: #e6e8f2;
  --bg: #f6f7fb;
  --card: #ffffff;
  --lagoon: #129e93;
  --lagoon-soft: #e3f6f4;
  --amber: #b97a12;
  --amber-soft: #fdf3df;
  --blue-soft: #eceaff;
  --radius: 16px;
  --head: "Poppins", "Segoe UI", system-ui, sans-serif;
  --body: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--body); color: var(--text); background: var(--bg); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--royal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--head); color: var(--ink); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---- Shell ---- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: linear-gradient(165deg, #0b0088 0%, #080062 55%, #060a2e 100%); color: #fff; padding: 26px 16px 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; }
.side::after { content: ""; position: absolute; inset: auto -60px -80px auto; width: 320px; height: 320px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M20 30 100 170 180 30' fill='none' stroke='%23ffffff' stroke-opacity='.06' stroke-width='18'/%3E%3Cpath d='M58 30 100 104 142 30' fill='none' stroke='%23ffffff' stroke-opacity='.05' stroke-width='12'/%3E%3C/svg%3E") no-repeat center / contain; pointer-events: none; }
.brand { display: block; padding: 0 10px 22px; }
.brand img { width: 150px; height: auto; display: block; }
.brand span { display: block; margin-top: 8px; font: 500 11px var(--head); letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.55); }
.nav { display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: rgba(255,255,255,.74); font: 500 14px var(--head); text-decoration: none; }
.nav a svg { width: 19px; height: 19px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 #e5604f; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.12); position: relative; z-index: 1; }
.side-foot .who { font: 600 13.5px var(--head); }
.side-foot .mail { font-size: 12px; color: rgba(255,255,255,.55); overflow: hidden; text-overflow: ellipsis; }
.side-foot button { margin-top: 10px; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 10px; padding: 7px 12px; font: 500 12.5px var(--head); cursor: pointer; }
.side-foot button:hover { background: rgba(255,255,255,.1); }

.main { padding: 30px 36px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumb { font: 500 12.5px var(--head); color: var(--muted); margin-bottom: 6px; display: block; }

/* ---- Cards and grids ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card > h2 { margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2, .card.flush > .card-head { padding: 18px 22px 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 18px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: 2fr 1fr; }
.g2e { grid-template-columns: 1fr 1fr; }
.stack { display: grid; gap: 18px; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g2, .g2e, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .main { padding: 20px 16px 40px; } }

.stat { position: relative; overflow: hidden; }
.stat .label { font: 500 11.5px var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .value { font: 700 32px/1.15 var(--head); color: var(--ink); margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .value small { font: 500 14px var(--head); color: var(--muted); margin-left: 4px; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat.hero { background: linear-gradient(135deg, #0b0088, #1100d9); border: 0; }
.stat.hero .label, .stat.hero .sub { color: rgba(255,255,255,.7); }
.stat.hero .value { color: #fff; }
.stat.hero .value small { color: rgba(255,255,255,.7); }
.stat.hero::after { content: ""; position: absolute; right: -30px; bottom: -46px; width: 150px; height: 150px; border: 14px solid rgba(255,255,255,.08); border-top: 0; transform: rotate(45deg) skew(12deg, 12deg); }

/* ---- Tables ---- */
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font: 500 11.5px var(--head); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 22px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 13px 22px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: #fafbff; }
.t .r { text-align: right; font-variant-numeric: tabular-nums; }
.t .name { font-weight: 600; color: var(--ink); }
.t .sub { font-size: 12.5px; color: var(--muted); }
.empty { padding: 34px 22px; text-align: center; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-soft); color: var(--royal); display: inline-grid; place-items: center; font: 600 12.5px var(--head); flex: none; }
.person { display: flex; align-items: center; gap: 12px; }

/* ---- Pills ---- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font: 500 12px var(--head); background: var(--blue-soft); color: var(--royal); white-space: nowrap; }
.pill.ok { background: var(--lagoon-soft); color: var(--lagoon); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--coral-soft); color: var(--coral); }
.pill.off { background: #eef0f6; color: var(--muted); }

/* ---- Forms and buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 18px; font: 600 13.5px var(--head); cursor: pointer; background: var(--royal); color: #fff; text-decoration: none; }
.btn:hover { background: var(--royal-dark); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f3f4fa; }
.btn.danger { background: #fff; color: var(--coral); border: 1px solid #f0cfcb; }
.btn.danger:hover { background: var(--coral-soft); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }
label.f { display: block; font: 500 12.5px var(--head); color: var(--ink); margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; border: 1px solid #d5d8e8; border-radius: 12px; padding: 10px 13px; font: inherit; color: var(--ink); background: #fff; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(17,0,217,.22); border-color: var(--royal); }
.check { display: flex; gap: 9px; align-items: center; font-weight: 500; color: var(--ink); }
.check input { width: 17px; height: 17px; accent-color: var(--royal); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 180px; }
.note { padding: 11px 14px; border-radius: 12px; background: var(--lagoon-soft); color: #0b6f67; margin-bottom: 18px; font-weight: 500; }
.note.err { background: var(--coral-soft); color: var(--coral); }
.val { color: var(--coral); font-size: 12.5px; margin-top: 5px; display: block; }

/* ---- Small pieces ---- */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-weight: 500; }
.bars { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 44px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar-track { height: 9px; border-radius: 9px; background: #eef0f7; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9px; background: linear-gradient(90deg, #0b0088, #1100d9); }
.chart { width: 100%; height: auto; display: block; }
.module { margin-bottom: 18px; }
.module-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.module-head p { margin: 4px 0 0; color: var(--muted); }
.order { width: 30px; height: 30px; border-radius: 10px; background: var(--blue-soft); color: var(--royal); display: inline-grid; place-items: center; font: 600 13px var(--head); flex: none; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ---- Sign in ---- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: linear-gradient(140deg, #0b0088 0%, #1100d9 60%, #2a1cf0 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::before { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600'%3E%3Cg fill='none' stroke='%23fff'%3E%3Cpath d='M60 120 300 540 540 120' stroke-opacity='.07' stroke-width='46'/%3E%3Cpath d='M170 120 300 348 430 120' stroke-opacity='.06' stroke-width='30'/%3E%3C/g%3E%3C/svg%3E") no-repeat right -80px bottom -120px / 620px; }
.login-art img { width: 220px; position: relative; }
.login-art h1 { color: #fff; font-size: 40px; line-height: 1.12; max-width: 460px; position: relative; }
.login-art p { color: rgba(255,255,255,.75); max-width: 420px; font-size: 15.5px; position: relative; }
.login-form { display: grid; place-items: center; padding: 40px; background: #fff; }
.login-form form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.login-form .btn { width: 100%; justify-content: center; padding: 13px; margin-top: 6px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { padding: 32px; min-height: 240px; } .login-art h1 { font-size: 28px; } }

/* Keep names, numbers and dates on one line in tables. */
.t td.r, .t td .name, .t td.muted { white-space: nowrap; }
.t td .sub { white-space: normal; }
.card.flush { overflow-x: auto; }
.t th, .t td { padding-left: 16px; padding-right: 16px; }
.t th:first-child, .t td:first-child { padding-left: 22px; white-space: nowrap; }
.t th:last-child, .t td:last-child { padding-right: 22px; }
.t td:first-child .sub { white-space: normal; }
