/* Healthite Pulse - discovery portal.
   Hand-written, no build step: the file you edit is the file the browser gets. */

:root {
    --paper:   #f1f3f0;
    --surface: #ffffff;
    --sunk:    #e8ece7;
    --ink:     #101c22;
    --ink-2:   #3b4950;
    --muted:   #6b7a7f;
    --line:    #d8ded9;
    --line-2:  #bcc6be;

    --accent:      #1f5d5a;
    --accent-soft: #dde9e6;
    --warn:        #8e6412;
    --warn-soft:   #f4ead4;
    --danger:      #93382b;
    --danger-soft: #f6e3de;

    --radius: 7px;
    --shadow: 0 1px 2px rgba(16, 28, 34, .06);
}

* { box-sizing: border-box; }

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

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
a { color: var(--ink); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- guest pages ---------- */
.guest {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
}
.guest-inner { width: 100%; max-width: 400px; }
.guest-inner.guest-wide { max-width: 620px; }
.guest-brand { text-align: center; margin-bottom: 22px; }
.guest-brand .name { font-size: 19px; font-weight: 700; }
.guest-brand .tag { font-size: 13.5px; color: var(--muted); }
.guest-foot { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ---------- app shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    background: var(--ink);
    color: #d6dedb;
    padding: 0 20px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar .brand { font-weight: 600; letter-spacing: -.01em; }
.topbar .brand span { display: block; font-size: 11.5px; font-weight: 400; color: #8ea09b; letter-spacing: .02em; }
.topbar .who { font-size: 13.5px; color: #a9b8b3; display: flex; align-items: center; gap: 12px; }
.topbar .who strong { color: #fff; font-weight: 500; }

.main { flex: 1; padding: 26px 20px 64px; }
.container { max-width: 1080px; margin-inline: auto; }

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 25px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.foot {
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: 14px 20px;
    font-size: 12.5px;
    color: var(--muted);
}

/* ---------- cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 18px;
}
.card > h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #fafbf9;
}
.card-body { padding: 16px; }

/* A card-like block used inside another card, where nesting .card would double
   the border and the shadow. */
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.panel-head {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted);
    padding: 11px 14px;
    margin: 0;
    border-bottom: 1px solid var(--line);
    background: #fafbf9;
}
.panel-body { padding: 14px; }

/* ---------- grid ---------- */
.grid { display: grid; gap: 16px; }
@media (min-width: 700px) {
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.hint { margin-top: 5px; font-size: 12.5px; color: var(--muted); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
    width: 100%;
    padding: 9px 11px;
    font: inherit;
    font-size: 14.5px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-2);
    border-radius: 6px;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(31, 93, 90, .13);
}
input[aria-invalid=true] { border-color: var(--danger); }
textarea { resize: vertical; min-height: 84px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    font: inherit;
    font-size: 14.5px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #23343c; }
.btn-secondary { background: #fff; border-color: var(--line-2); color: var(--ink-2); }
.btn-secondary:hover { background: #f7f8f6; }
.btn-link { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.btn-block { width: 100%; }

/* ---------- messages ---------- */
.alert { border-radius: 6px; padding: 11px 14px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: var(--accent-soft); border-color: #b8d3ce; color: var(--accent); }
.alert-warning { background: var(--warn-soft); border-color: #e4d3ad; color: var(--warn); }
.alert-error   { background: var(--danger-soft); border-color: #e5c3ba; color: var(--danger); }
.field-error { margin-top: 5px; font-size: 12.5px; color: var(--danger); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    padding: 9px 16px;
    border-bottom: 1px solid var(--line);
    background: #fafbf9;
    white-space: nowrap;
}
td { padding: 9px 16px; border-bottom: 1px solid #f0f3f0; vertical-align: top; }
tr:last-child td { border-bottom: 0; }

.pill {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 1px 9px;
    font-size: 12px;
    color: var(--ink-2);
    background: #fff;
}
.pill-ok { border-color: #b8d3ce; background: var(--accent-soft); color: var(--accent); }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- error pages ---------- */
.oops { text-align: center; padding: 56px 16px; }
.oops .code { font-size: 46px; font-weight: 700; letter-spacing: -.02em; }
.oops p { color: var(--muted); margin: 8px 0 20px; }

/* ---------- navigation ---------- */
.nav {
    background: #17282f;
    padding: 0 20px;
    display: flex;
    gap: 2px;
    overflow-x: auto;
}
.nav a {
    color: #a9b8b3;
    text-decoration: none;
    font-size: 13.5px;
    padding: 10px 12px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.nav a:hover { color: #fff; }
.nav a.on { color: #fff; border-bottom-color: var(--accent-soft); }

/* ---------- page furniture ---------- */
.page-head.with-action {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumb a { color: var(--muted); }

.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 16px;
}
.toolbar .field { margin-bottom: 0; }
.toolbar .grow { flex: 1 1 220px; min-width: 0; }

.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.row-actions form { margin: 0; }

/* ---------- pills ---------- */
.pill-info   { border-color: #b9cbd8; background: #e3edf4; color: #2a556e; }
.pill-warn   { border-color: #e4d3ad; background: var(--warn-soft); color: var(--warn); }
.pill-muted  { border-color: var(--line); background: var(--sunk); color: var(--muted); }
.pill-danger { border-color: #e5c3ba; background: var(--danger-soft); color: var(--danger); }

/* ---------- progress ---------- */
.meter { height: 6px; border-radius: 999px; background: var(--sunk); overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter-row { display: flex; align-items: center; gap: 10px; }
.meter-row .pct { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

/* ---------- discovery steps ---------- */
.steps { display: grid; gap: 10px; }
.step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.step .n {
    flex: none;
    width: 26px; height: 26px;
    border-radius: 999px;
    background: var(--sunk);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}
.step.done .n { background: var(--accent); color: #fff; }
.step .body { flex: 1; min-width: 0; }
.step .body h3 { font-size: 14.5px; }
.step .body p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- the one-time invitation link ---------- */
.copybox {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-top: 10px;
}
.copybox input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    background: #fff;
}
.copybox button { flex: none; }

.linkish { color: var(--accent); text-decoration: none; font-weight: 500; }
.linkish:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- discovery step tabs ---------- */
.steptabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.steptab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px 7px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-2);
    text-decoration: none;
    font-size: 13.5px;
}
.steptab:hover { border-color: var(--line-2); }
.steptab .n {
    flex: none;
    width: 20px; height: 20px;
    border-radius: 999px;
    background: var(--sunk);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}
.steptab.done .n { background: var(--accent); color: #fff; }
.steptab.on {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}
.steptab.on .n { background: rgba(255,255,255,.18); color: #fff; }
.steptab.on.done .n { background: var(--accent); color: #fff; }
.steptab.locked { opacity: .5; cursor: default; }

/* A step's own heading stays quiet next to the tabs above it. */
.card > h2 .quiet { text-transform: none; letter-spacing: 0; color: var(--ink-2); }
