/* =========================================================================
 * starter — a neutral, ready-to-use design for the skeleton's markup.
 * =========================================================================
 *
 * REBRAND HERE. Everything below the tokens reads these variables; change
 * them and the whole site (public pages, sign-in, members, control panel)
 * follows. Dark mode overrides the colour tokens only.
 *
 * Want a bigger change? Copy the theme first, never edit it in place:
 *   php .inc/cli/make-theme.php mybrand
 *
 * Rules that keep the CSP happy: no @import from other origins (list CDN
 * stylesheets in theme.php instead), no inline styles anywhere.
 * ========================================================================= */

/* Outfit, self-hosted (SIL Open Font License, fonts/OFL.txt). */
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/outfit-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/outfit-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Brand kit: Green carries the brand, Ink and Mist do the rest */
  --color-primary: #007a3d;
  --color-primary-hover: #005a2d;
  --color-primary-text: #ffffff;
  --color-ink: #1b1a1f;
  --color-green: #00a854;
  --color-navy: #1b1a1f;
  --color-navy-text: #f3f8f4;
  --color-panel: #f3f8f4;

  /* Surfaces & text */
  --color-bg: #f3f8f4;
  --color-surface: #ffffff;
  --color-surface-alt: #eef3ef;
  --color-text: #1b1a1f;
  --color-muted: #5a5f5c;
  --color-border: #e1e7e2;

  /* Status */
  --color-success: #13774a;  --color-success-bg: #e2f5ea;
  --color-info: #007a3d;     --color-info-bg: #e3f3e9;
  --color-warning: #8a5a00;  --color-warning-bg: #fdf1d6;
  --color-danger: #c22c22;   --color-danger-bg: #fde7e4;

  /* Shape & type */
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --font-size: 16px;
  --radius: 14px;
  --radius-small: 8px;
  --radius-pill: 999px;
  --shadow: none;
  --space: 1rem;
  --width-page: 1280px;
  --width-auth: 440px;
  --width-sidebar: 236px;
}

/* -- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: var(--font-size); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.55;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 calc(var(--space) * .5); }
p { margin: 0 0 var(--space); }
code, pre, .secret { font-family: var(--font-mono); font-size: .9em; }
code { background: var(--color-surface-alt); padding: .1em .35em; border-radius: var(--radius-small); }
hr { border: 0; border-top: 1px solid var(--color-border); }

/* -- Shell --------------------------------------------------------------- */

.layout { min-height: 100vh; display: flex; flex-direction: column; }
.layout__main { width: 100%; max-width: var(--width-page); margin: 0 auto; padding: calc(var(--space) * 2) var(--space); flex: 1; }
.layout__main--centered { display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; }

.layout__body { display: flex; flex: 1; width: 100%; max-width: calc(var(--width-page) + var(--width-sidebar)); margin: 0 auto; }
.layout__body > .layout__main { min-width: 0; }

.site-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.layout--app .nav, .layout--app .site-footer__text { max-width: calc(var(--width-page) + var(--width-sidebar)); }
.site-footer { border-top: 1px solid var(--color-border); color: var(--color-muted); font-size: .875rem; }
.site-footer__text { max-width: var(--width-page); margin: 0 auto; padding: var(--space); }

/* -- Navigation ---------------------------------------------------------- */

.nav { max-width: var(--width-page); margin: 0 auto; padding: .75rem var(--space); display: flex; align-items: center; gap: var(--space); flex-wrap: wrap; }
.nav__brand { font-weight: 700; color: var(--color-text); margin-right: auto; }
.nav__list { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; }
.nav__link { display: inline-block; padding: .4rem .7rem; border-radius: var(--radius-small); color: var(--color-muted); font: inherit; }
.nav__link:hover { background: var(--color-surface-alt); color: var(--color-text); text-decoration: none; }
.nav__link--button { background: none; border: 0; cursor: pointer; }
.nav__form { margin: 0; }

.sidebar { width: var(--width-sidebar); flex: none; padding: calc(var(--space) * 2) 0 var(--space) var(--space); }
.sidebar__title { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-muted); padding: 0 .75rem .5rem; }
.sidebar__list { list-style: none; margin: 0; padding: 0; position: sticky; top: var(--space); }
.sidebar__link { display: block; padding: .45rem .75rem; border-radius: var(--radius-small); color: var(--color-text); }
.sidebar__link:hover { background: var(--color-surface-alt); text-decoration: none; }
.sidebar__link--active { background: var(--color-surface); color: var(--color-primary); font-weight: 600; box-shadow: var(--shadow); }

/* -- Page ---------------------------------------------------------------- */

.page__header { margin-bottom: calc(var(--space) * 1.5); }
.page__title { font-size: 1.75rem; }
.page__lead { color: var(--color-muted); font-size: 1.05rem; }
.page--home .page__title { font-size: 2.25rem; }
.page--error, .page--maintenance { text-align: center; }

.section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: calc(var(--space) * 1.25);
  margin-bottom: var(--space);
}
.section__title { font-size: 1.1rem; }
h3.section__title { font-size: 1rem; margin-top: var(--space); }
.section__text { color: var(--color-muted); }
/* Inside the sign-in card, sections are plain dividers and buttons fill the width. */
.card--auth .section { background: none; border: 0; border-top: 1px solid var(--color-border); border-radius: 0; box-shadow: none; padding: var(--space) 0 0; margin: var(--space) 0 0; }
.card--auth .btn:not(.btn--link) { width: 100%; }
.card--auth .form { margin-bottom: 0; }

/* -- Cards & stats ------------------------------------------------------- */

.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: calc(var(--space) * 1.5); }
.card--auth { width: 100%; max-width: var(--width-auth); }
.card__brand { display: block; margin-bottom: calc(var(--space) * 1.5); }
.card__brand img { display: block; height: 26px; width: auto; }
.card__title { font-size: 1.05rem; margin-bottom: .25rem; }
.card__text { color: var(--color-muted); margin: 0; font-size: .925rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space); margin-bottom: calc(var(--space) * 1.5); }
.card--link { color: inherit; transition: border-color .15s, transform .15s; }
.card--link:hover { border-color: var(--color-primary); text-decoration: none; transform: translateY(-1px); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space); margin-bottom: calc(var(--space) * 1.5); }
.stat { display: flex; flex-direction: column; gap: .2rem; padding: var(--space); border-radius: var(--radius); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); border-left-width: 4px; }
.stat:hover { text-decoration: none; }
.stat__label { font-size: .8rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat__value { font-weight: 600; }
.stat--ok { border-left-color: var(--color-success); }
.stat--warn { border-left-color: var(--color-warning); }
.stat--fail { border-left-color: var(--color-danger); }

/* -- Forms --------------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: var(--space); margin-bottom: var(--space); }
.form:last-child { margin-bottom: 0; }
.form--inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: .5rem; }
.form--inline .field { flex: 1 1 200px; }

.field { display: flex; flex-direction: column; gap: .3rem; }
.field__label { font-weight: 600; font-size: .9rem; }
.field__input {
  width: 100%;
  padding: .55rem .7rem;
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
}
.field__input:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; border-color: transparent; }
.field__hint { color: var(--color-muted); font-size: .85rem; margin: 0; }
.field__error { color: var(--color-danger); font-size: .85rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem;
  font: inherit; font-weight: 600; font-size: .925rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--color-surface-alt); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--color-ink); border-color: var(--color-ink); color: #fff; }
.btn--primary:hover { background: var(--color-primary); border-color: var(--color-primary); }
.btn--link { background: none; border-color: transparent; color: var(--color-primary); padding-left: .25rem; padding-right: .25rem; }
.btn--link:hover { background: none; text-decoration: underline; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: var(--space) 0; }
.actions__form { margin: 0; display: inline; }
.links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; margin-top: var(--space); font-size: .925rem; }
.captcha { min-height: 65px; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: .75rem; }

/* -- Feedback ------------------------------------------------------------ */

.alerts { display: flex; flex-direction: column; gap: .5rem; margin-bottom: var(--space); }
.alert { padding: .7rem 1rem; border-radius: var(--radius-small); border: 1px solid transparent; margin: 0 0 var(--space); }
.alerts .alert { margin: 0; }
.alert--success { background: var(--color-success-bg); color: var(--color-success); }
.alert--info { background: var(--color-info-bg); color: var(--color-info); }
.alert--warning { background: var(--color-warning-bg); color: var(--color-warning); }
.alert--danger { background: var(--color-danger-bg); color: var(--color-danger); }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--color-surface-alt); color: var(--color-muted); }
.badge--on { background: var(--color-success-bg); color: var(--color-success); }
.badge--off, .badge--warn { background: var(--color-warning-bg); color: var(--color-warning); }
.badge--fail { background: var(--color-danger-bg); color: var(--color-danger); }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 var(--space); padding: 0; }
.tag { font-family: var(--font-mono); font-size: .8rem; padding: .15rem .5rem; border-radius: var(--radius-small); background: var(--color-surface-alt); }
.tag--grant { color: var(--color-success); }
.tag--deny { color: var(--color-danger); }

/* -- Data ---------------------------------------------------------------- */

.datalist { margin: 0 0 var(--space); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.datalist__row { display: grid; grid-template-columns: 180px 1fr; gap: var(--space); padding: .7rem var(--space); border-bottom: 1px solid var(--color-border); }
.datalist__row:last-child { border-bottom: 0; }
.datalist__key { color: var(--color-muted); }
.datalist__value { margin: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-small); margin-bottom: var(--space); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--color-surface); }
.table th, .table td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.table thead th { background: var(--color-surface-alt); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--color-muted); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr:hover { background: var(--color-surface-alt); }
.table--checks th[scope=row] { width: 220px; font-weight: 600; }
.table code { white-space: nowrap; }
.table--checks td:nth-child(2) { width: 1%; }
.table__pre { white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: .8rem; }

.log { margin: 0 0 var(--space); padding: var(--space); background: var(--color-surface-alt); border-radius: var(--radius-small); overflow-x: auto; font-size: .8rem; line-height: 1.45; white-space: pre-wrap; word-break: break-all; }

.secret { display: inline-block; padding: .3rem .6rem; background: var(--color-surface-alt); border-radius: var(--radius-small); letter-spacing: .05em; user-select: all; }
.code-list { columns: 2; padding-left: 1.5rem; margin: 0 0 var(--space); }
.code-list__item { margin-bottom: .4rem; }
.qr-code { margin: 0 0 var(--space); }
.qr { display: block; width: 220px; height: auto; max-width: 100%; border-radius: var(--radius-small); } /* keep it black on white */

.pagination { display: flex; align-items: center; gap: var(--space); margin: var(--space) 0; }
.pagination__current { color: var(--color-muted); font-size: .9rem; }

/* -- Small screens ------------------------------------------------------- */

@media (max-width: 760px) {
  .layout__body { flex-direction: column; }
  .sidebar { width: auto; padding: var(--space) var(--space) 0; }
  .sidebar__list { display: flex; flex-wrap: wrap; gap: .25rem; position: static; }
  .datalist__row { grid-template-columns: 1fr; gap: .2rem; }
  .code-list { columns: 1; }
  .page__title { font-size: 1.5rem; }
}

/* =========================================================================
 * Signature Metrics additions
 * ========================================================================= */

body { -webkit-font-smoothing: antialiased; }
.muted { color: var(--color-muted); }
.text-link { font-weight: 600; }
.text-link:hover { text-decoration: underline; }

.btn--small { padding: .3rem .65rem; font-size: .875rem; }
.btn--large { padding: .8rem 1.35rem; font-size: 1.05rem; }
.btn--danger { color: var(--color-danger); border-color: var(--color-danger-bg); }
.btn--danger:hover { background: var(--color-danger-bg); }

.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; color: var(--color-ink); margin-right: auto; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand__logo { display: block; height: 24px; width: auto; }

/* -- Site (www) -------------------------------------------------------------- */

.layout--site { background: var(--color-surface); }
.site-main { flex: 1; }
.wrap { max-width: var(--width-page); margin: 0 auto; padding: 0 1.5rem; }

.btn { border-radius: var(--radius-pill); }
.btn--outline { background: transparent; border-color: var(--color-ink); color: var(--color-ink); }
.btn--outline:hover { background: var(--color-ink); color: #fff; }
.btn--ghost-accent { background: transparent; border-color: var(--color-ink); color: var(--color-ink); }
.btn--ghost-accent:hover { background: var(--color-info-bg); }

/* -- Dashboard ---------------------------------------------------------------- */

.site-header--app .nav { max-width: none; padding: .7rem 1.25rem; }
.nav__team { color: var(--color-text); font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; }
.layout--app .layout__body { max-width: none; }
.layout--app .sidebar { background: transparent; }
.page__crumb { font-size: .9rem; margin-bottom: .35rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; margin-bottom: var(--space); }
.tile { display: grid; gap: .25rem; padding: 1rem 1.1rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); color: var(--color-text); }
.tile:hover { border-color: var(--color-primary); text-decoration: none; }
.tile__label { font-size: .85rem; color: var(--color-muted); }
.tile__value { font-size: 1.6rem; font-weight: 700; }
.tile__value small { font-size: .9rem; font-weight: 500; color: var(--color-muted); }

.checklist { margin: 0; padding-left: 1.25rem; display: grid; gap: .4rem; }

.source-list { display: grid; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.source-list__row { display: grid; grid-template-columns: 1fr; gap: .35rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--color-border); color: var(--color-text); }
.source-list__row:last-child { border-bottom: 0; }
.source-list__row:hover { background: var(--color-bg); text-decoration: none; }
.source-list__name { font-weight: 700; display: grid; }
.source-list__name small { font-weight: 500; color: var(--color-muted); font-size: .8rem; }
.source-list__text { color: var(--color-muted); font-size: .92rem; }
@media (min-width: 900px) {
  .source-list__row { grid-template-columns: 14rem 1fr auto; align-items: center; gap: 1.5rem; }
}

.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: var(--space); border-bottom: 1px solid var(--color-border); }
.tabs__tab { padding: .55rem .9rem; color: var(--color-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs__tab:hover { color: var(--color-text); text-decoration: none; }
.tabs__tab--active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

.report-form__group { border: 0; padding: 0; margin: 0 0 1.25rem; }
.report-form__group legend { font-weight: 700; margin-bottom: .5rem; }
.report-form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.report-form__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.field-picker { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.field-picker h3 { font-size: .9rem; color: var(--color-muted); margin-bottom: .4rem; }
@media (min-width: 900px) { .field-picker { grid-template-columns: 1fr 1fr; } }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .3rem .9rem; max-height: 18rem; overflow: auto; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .92rem; cursor: pointer; }

.table--data td, .table--data th { white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.section--highlight { border-color: var(--color-primary); }

.guideline-list { list-style: none; margin: 0; padding: 0; }
.guideline-list__item { padding: 1rem 0; border-bottom: 1px solid var(--color-border); }
.guideline-list__item:last-child { border-bottom: 0; }
.guideline-list__scope { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .85rem; color: var(--color-muted); margin-bottom: .4rem; }
.guideline-list__text { margin-bottom: .4rem; }

.consent-list { margin: 0 0 1.25rem; padding-left: 1.2rem; display: grid; gap: .3rem; }


/* -- App polish shared with the site ------------------------------------------ */
.section { border-radius: var(--radius); box-shadow: none; }
.tile, .source-list, .card { border-radius: var(--radius); }
.sidebar__link { border-radius: var(--radius-pill); padding: .5rem .9rem; }
.sidebar__link--active { background: var(--color-info-bg); color: var(--color-primary); box-shadow: none; }
.layout--app, .layout--auth { background: var(--color-bg); }
.site-header--app { background: var(--color-surface); }
.page__title { letter-spacing: -.025em; font-weight: 600; }
.field__input { border-radius: var(--radius-small); }
.guideline-card__tags .tag, .guideline-card__tags code { font-family: inherit; font-size: .8rem; padding: .2rem .65rem; border-radius: var(--radius-pill); background: var(--color-surface-alt); border: 0; }
.auth__terms { font-size: .85rem; margin: 1rem 0 0; }
