/*
 * H1 Ratio: the demo page (templates/demo/). The Habitat One look of static/h1/admin.css,
 * without Django admin: Manrope; ink, cobalt, coral (accents only), paper, ice, night.
 * Every colour has words beside it; nothing is told by colour alone.
 */

@font-face { font-family: Manrope; src: url("fonts/manrope-regular.b14c3069e3f7.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Manrope; src: url("fonts/manrope-medium.9efdb4161ece.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: Manrope; src: url("fonts/manrope-bold.ad56d0ba69e7.ttf") format("truetype"); font-weight: 600 800; font-style: normal; font-display: swap; }

:root {
    --ink: #153475;
    --cobalt: #315dd9;
    --coral: #ff7967;
    --paper: #f7f9fe;
    --ice: #e9effb;
    --night: #101f47;
    --muted: #596781;
    --line: #d0dbec;
    --surface: #ffffff;
    --good: #146c2e;
    --good-bg: #e4f4ea;
    --warn: #8a5a00;
    --warn-bg: #fff3d9;
    --bad: #a3231b;
    --bad-bg: #fde8e6;
    --bar-now: #b8c6e3;
    --shadow: 0 18px 44px rgba(21, 52, 117, 0.08);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #e9effb;
        --cobalt: #8fb0ff;
        --paper: #0b1636;
        --ice: #17295a;
        --night: #ffffff;
        --muted: #a8b6d4;
        --line: #2a3f78;
        --surface: #101f47;
        --good: #8fe0a6;
        --good-bg: #123b25;
        --warn: #ffd27a;
        --warn-bg: #3d2f0c;
        --bad: #ffaaa3;
        --bad-bg: #4a1714;
        --bar-now: #3a5291;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1rem/1.55 Manrope, system-ui, sans-serif;
}
a { color: var(--cobalt); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 16px; }

/* --- Header ------------------------------------------------------------------------------- */

.top { padding: 20px 0; }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; color: var(--ink); }
.wordmark { font-weight: 800; font-size: 1.375rem; letter-spacing: -0.03em; }
.wordmark span { font-weight: 500; }
.wordmark .dot { color: var(--coral); }
.product { font-weight: 600; color: var(--muted); font-size: 0.9375rem; }
.top form { margin: 0; }
.mainnav { display: flex; gap: 4px 16px; flex-wrap: wrap; margin-left: auto; }
.mainnav a { font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px 0; }
.mainnav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--coral); }
.org-picker, .org-name { margin-left: 8px; }
.org-picker select { font-weight: 600; max-width: 16rem; }
.org-name { font-weight: 600; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.flash { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--good-bg); color: var(--good); font-weight: 600; }
.flash.error { background: var(--warn-bg); color: var(--warn); }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }

/* --- Hero: the one figure ------------------------------------------------------------------ */

.hero { padding: 8px 0 24px; }
.eyebrow { font-weight: 600; color: var(--muted); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 8px; }
.hero h1 { font-size: clamp(1.75rem, 5vw, 3rem); line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 12px; color: var(--night); font-weight: 800; }
.hero h1 .figure { color: var(--cobalt); white-space: nowrap; }
.hero .lede { font-size: 1.125rem; max-width: 44rem; margin: 0; }

.pickers { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; margin: 20px 0 0; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs a { display: inline-block; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; }
.tabs a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pickers label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 4px; }
.pickers select { font: inherit; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.pickers noscript button, .button { display: inline-block; text-decoration: none; font: inherit; font-weight: 600; padding: 8px 18px; border-radius: 999px; border: 0; background: var(--ink); color: var(--paper); cursor: pointer; }

/* --- Panels ---------------------------------------------------------------------------------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.25rem; margin: 0 0 4px; color: var(--night); letter-spacing: -0.01em; }
.panel .sub { color: var(--muted); margin: 0 0 16px; font-size: 0.9375rem; }
.small { font-size: 0.875rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 12px; margin: 0 0 16px; }
.stat { background: var(--ice); border-radius: 16px; padding: 14px 16px; }
.stat .label { font-size: 0.875rem; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: var(--night); font-variant-numeric: tabular-nums; }

/* --- The ranked year ------------------------------------------------------------------------ */

.rank { list-style: none; margin: 0; padding: 0; }
.rank > li { border-top: 1px solid var(--line); padding: 14px 0; }
.rank > li:first-child { border-top: 0; }
.rank-head { display: grid; grid-template-columns: 2rem 1fr auto; gap: 4px 12px; align-items: baseline; }
.rank-no { font-weight: 800; color: var(--muted); }
.rank-name { font-weight: 700; color: var(--night); }
.rank-total { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.bar { grid-column: 2 / 4; height: 10px; background: var(--ice); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--bar-now); border-radius: 999px; }
.rank > li.best .bar span { background: var(--cobalt); }
.tags { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 0.8125rem; background: var(--ice); color: var(--ink); }
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.answer-is { margin: 12px 0 0; }

details { margin-top: 8px; }
details > summary { cursor: pointer; font-weight: 600; color: var(--cobalt); font-size: 0.9375rem; padding: 4px 0; }
details details { margin-left: 0; }
.months { list-style: none; padding: 0; margin: 8px 0 0; }
.months > li { border-top: 1px solid var(--line); }
.months summary { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); font-weight: 500; }
.months summary .num { font-variant-numeric: tabular-nums; font-weight: 700; }
.scroll { overflow-x: auto; }
table.lines { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin: 4px 0 12px; }
table.lines td, table.lines th { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
table.lines .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.lines .src { color: var(--muted); }

/* --- The month chart ------------------------------------------------------------------------ */

.chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 180px; margin: 8px 0 4px; }
.chart .m { display: flex; gap: 2px; align-items: end; height: 100%; }
.chart .m span { flex: 1; border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .now { background: var(--bar-now); }
.chart .best { background: var(--cobalt); }
.chart-labels { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; font-size: 0.75rem; color: var(--muted); text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.875rem; margin: 12px 0 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* --- Ruled out, and the scope --------------------------------------------------------------- */

.out { list-style: none; padding: 0; margin: 0; }
.out li { padding: 8px 0; border-top: 1px solid var(--line); }
.out li:first-child { border-top: 0; }
.out strong { color: var(--night); }
.out .tags { margin-top: 6px; }
.scope ul { margin: 8px 0 0; padding-left: 20px; }
.scope li { margin: 4px 0; }
.notice { border-left: 4px solid var(--coral); padding: 4px 0 4px 12px; margin: 12px 0 0; }

footer { color: var(--muted); font-size: 0.875rem; padding: 24px 0 40px; }

/* --- Sign in -------------------------------------------------------------------------------- */

.signin { max-width: 26rem; margin: 8vh auto 0; }
.signin label { display: block; font-weight: 600; margin: 12px 0 4px; }
.signin input { width: 100%; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.signin .button { margin-top: 16px; width: 100%; padding: 12px; }
.signin a.button { display: block; text-align: center; box-sizing: border-box; }
.errors { color: #b42318; }

@media (max-width: 40rem) {
    .chart { height: 140px; gap: 3px; }
    .chart-labels { gap: 3px; }
    .rank-head { grid-template-columns: 1.5rem 1fr auto; }
}

/* --- Your accounts (templates/demo/accounts_*.html) ----------------------------------------- */

.file { display: block; width: 100%; padding: 16px; border: 2px dashed var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); font: inherit; }
.short { width: 7rem; }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--cobalt); }
table.readings input[type=date] { width: 9.5rem; }
table.readings .src-row td { border-bottom: 1px solid var(--line); padding-top: 0; font-size: 0.75rem; }
table.readings tr:not(.src-row) td { border-bottom: 0; }
.gap { border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; margin: 0 0 16px; }
.gap legend { font-weight: 700; color: var(--night); padding: 0 4px; }
.gap ul { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.gap-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 8px 0; }
.gap-row > label, .gap-row > .label { font-weight: 600; min-width: 12rem; }
.typed { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0; }
.typed label { font-size: 0.875rem; font-weight: 600; }
.typed input { width: 5.5rem; display: block; }
.months-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); }
.rests { margin: 0 0 8px; padding-left: 20px; }
.rests li { margin: 6px 0; }

/* --- Sites (templates/clients/*.html) ------------------------------------------------------- */

.hero.compact { padding-bottom: 8px; }
.hero.compact h1 { margin-bottom: 16px; }
.stat .of { font-size: 1rem; font-weight: 600; color: var(--muted); }
.filters { padding: 16px 20px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; }
.filter-row label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.875rem; }
.filter-row label.grow { flex: 1 1 16rem; }
.filter-row input, .filter-row select { padding: 8px 10px; border-radius: 10px; font-weight: 400; font-size: 1rem; }
.filter-actions { display: flex; gap: 12px; align-items: center; }
table.sites { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
table.sites th, table.sites td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.sites th { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
table.sites th a { color: inherit; text-decoration: none; }
table.sites th[aria-sort] a { color: var(--ink); }
table.sites td.num { font-variant-numeric: tabular-nums; }
table.sites tbody tr:hover { background: var(--ice); }
table.sites .tags { display: flex; flex-wrap: wrap; gap: 4px; }
table.sites .check { width: 2rem; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; font-size: 0.875rem; color: var(--muted); flex-wrap: wrap; }
.pager a { font-weight: 600; }

dl.groups { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
dl.groups dt { font-size: 0.8125rem; color: var(--muted); font-weight: 600; }
dl.groups dd { margin: 0; font-weight: 700; color: var(--night); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.toolbar h2 { margin: 0; }
fieldset.bulk { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 0 0 12px; background: var(--ice); }
fieldset.bulk legend { font-weight: 700; font-size: 0.875rem; padding: 0 4px; }
fieldset.bulk select { padding: 6px 8px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-size: 0.875rem; }
.hero.compact .tabs { margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 12px 16px; margin: 0 0 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.875rem; }
.form-grid input, .form-grid select { padding: 8px 10px; border-radius: 10px; font-weight: 400; font-size: 1rem; }
.help { font-weight: 400; color: var(--muted); font-size: 0.8125rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin-top: 12px; }
.link-button.danger { color: #b42318; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form.add { margin-top: 12px; }
.inline-form input { padding: 6px 10px; }
.group-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.group-row form { margin: 0; }
.group-pick { margin: 8px 0; }
.group-pick ul { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
label.block { display: flex; margin: 4px 0; }
input.copy { width: 100%; padding: 10px 12px; font-family: ui-monospace, monospace; font-size: 0.875rem; }
.small-lede { margin: 0 0 16px; color: var(--muted); }
.small-value { font-size: 1.125rem; }
.button.danger { background: #b42318; border-color: #b42318; }
.notice.warn-notice { border-color: #b42318; }
.secret { display: block; padding: 12px 14px; border-radius: 12px; background: var(--ice); color: var(--ink); font-size: 0.95em; overflow-wrap: anywhere; user-select: all; }
