/*
 * EUCL Metering Assistant - design system.
 * Red brand theme on the dashboard layout of the approved mockup:
 * dark maroon sidebar, white topbar, card-based content, split login, hero landing.
 * All sizes in rem so the A- / A / A+ text scaling in Settings keeps working.
 */

:root {
  /* brand */
  --brand: #d42a2a;
  --brand-strong: #b01f1f;
  --brand-soft: #fdecec;
  --brand-ring: rgba(212, 42, 42, .25);

  /* surfaces */
  --bg: #f1f3f7;
  --surface: #ffffff;
  --surface-alt: #f7f8fa;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;

  /* ink */
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;

  /* sidebar */
  --side-bg: #2b0a0c;
  --side-bg-2: #200708;
  --side-ink: #f3dcdc;
  --side-muted: #c9a3a4;
  --side-line: rgba(255, 255, 255, .09);

  /* semantic */
  --green: #16a34a;   --green-bg: #e8f6ec;
  --orange: #d97706;  --orange-bg: #fcf0de;
  --red: #d42a2a;     --red-bg: #fbe9e9;
  --purple: #7c3aed;  --purple-bg: #f0ebfc;
  --gray: #98a2b3;    --gray-bg: #f2f4f7;

  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem;
  --text-scale: 1;
}

* { box-sizing: border-box; }

html { font-size: calc(16px * var(--text-scale)); }

body {
  margin: 0;
  font-family: "Segoe UI", "Inter", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: .875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; color: var(--ink); }
p { margin: 0; }
a { color: var(--brand); }
button { font-family: inherit; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.mono { font-family: "Cascadia Mono", Consolas, "Courier New", monospace; font-size: .8125rem; }
.num { font-variant-numeric: tabular-nums; }

/* ============================================================ icons */
.ic { width: 1.125rem; height: 1.125rem; stroke: currentColor; fill: none;
      stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic--sm { width: .9375rem; height: .9375rem; }
.ic--lg { width: 1.5rem; height: 1.5rem; }

/* ============================================================ logo */
.logo { display: inline-flex; align-items: center; gap: .625rem; }
.logo__mark {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--brand); display: grid; place-items: center; flex: none;
}
.logo__mark svg { width: 1.375rem; height: 1.375rem; fill: #fff; }
.logo__text { line-height: 1.15; }
.logo__org { font-size: 1.25rem; font-weight: 800; letter-spacing: .01em; color: var(--ink); }
.logo__app { font-size: .6875rem; font-weight: 600; color: var(--muted); }
.logo--light .logo__org { color: #fff; }
.logo--light .logo__app { color: var(--side-muted); }

/* ============================================================ gate: landing */
.gate { min-height: 100vh; }

.land__nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.land__nav-in {
  max-width: 75rem; margin: 0 auto; padding: .75rem 1.5rem;
  display: flex; align-items: center; gap: 2rem;
}
.land__links { display: flex; gap: 1.75rem; margin-left: 2.5rem; }
.land__links button {
  background: none; border: 0; cursor: pointer;
  font-size: .8125rem; font-weight: 600; color: var(--ink-2); padding: .25rem 0;
}
.land__links button:hover { color: var(--brand); }
.land__nav .btn { margin-left: auto; }

.land__hero {
  position: relative; color: #fff; overflow: hidden;
  background:
    linear-gradient(90deg, #1d0506 0%, rgba(29, 5, 6, .96) 30%, rgba(29, 5, 6, .72) 55%, rgba(29, 5, 6, .28) 78%, rgba(29, 5, 6, .12) 100%),
    url("/assets/hero-technician.jpg") center 30% / cover no-repeat;
  min-height: calc(100vh - 4.0625rem);
  display: flex;
}
.land__hero-in { max-width: 75rem; margin: 0 auto; padding: 4rem 1.5rem 3.5rem; width: 100%; }
.land__hero h1 {
  color: #fff; font-size: 2.75rem; line-height: 1.15; font-weight: 800; letter-spacing: -.01em;
}
.land__lede { margin-top: 1.25rem; max-width: 30rem; font-size: .9375rem; color: rgba(255, 255, 255, .88); }

.land__features {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 2rem; margin-top: 3rem; max-width: 44rem;
}
.land__feature { padding-left: 1.5rem; border-left: 1px solid rgba(255, 255, 255, .22); }
.land__feature:first-child { padding-left: 0; border-left: 0; }
.land__feature .ic { width: 1.625rem; height: 1.625rem; stroke-width: 1.6; }
.land__feature h3 { color: #fff; font-size: .9375rem; font-weight: 700; margin: .625rem 0 .375rem; }
.land__feature p { font-size: .75rem; color: rgba(255, 255, 255, .72); }

.land__cta { display: flex; gap: .875rem; margin-top: 3rem; }

/* ============================================================ gate: login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: #e8ebf0 url("/assets/login-meter.jpg") center / cover no-repeat fixed;
  padding: 1.5rem;
}
.login-wrap::before {
  content: ""; position: fixed; inset: 0; background: rgba(241, 243, 247, .82);
}
.login-card {
  position: relative; width: min(60rem, 100%); min-height: 34rem;
  display: grid; grid-template-columns: 1.15fr .85fr;
  background: var(--surface); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.login-form { padding: 2.75rem 3.25rem 1.25rem; display: flex; flex-direction: column; }
.login-form .logo { justify-content: center; margin-bottom: 2.25rem; }
.login-form h2 { font-size: 1.375rem; font-weight: 800; }
.login-form .sub { color: var(--muted); font-size: .8125rem; margin: .25rem 0 1.5rem; }
.login-form .field { margin-bottom: .875rem; }
.login-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: .25rem 0 1.25rem; font-size: .75rem;
}
.login-row label { display: inline-flex; gap: .4375rem; align-items: center; color: var(--ink-2); cursor: pointer; }
.login-row a, .login-row button.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand); font-size: .75rem; font-weight: 600;
}
.login-err { color: var(--red); font-size: .75rem; margin-bottom: .75rem; min-height: 1rem; }
.login-foot { margin-top: auto; padding-top: 1.5rem; text-align: center; }
.login-foot .small { font-size: .6875rem; color: var(--muted); }
.login-note { text-align: center; font-size: .6875rem; color: var(--muted); margin-bottom: .875rem; }

.login-side {
  position: relative; color: #fff; padding: 2rem;
  display: flex; flex-direction: column; justify-content: center; gap: .75rem;
  background:
    linear-gradient(200deg, rgba(29, 5, 6, .55), rgba(29, 5, 6, .88)),
    url("/assets/login-meter.jpg") center / cover no-repeat;
}
.login-side h3 { color: #fff; font-size: 1.375rem; font-weight: 800; line-height: 1.3; }
.login-side p { font-size: .8125rem; color: rgba(255, 255, 255, .82); max-width: 15rem; }

/* input with leading icon (login) */
.input-ic { position: relative; }
.input-ic .ic {
  position: absolute; left: .75rem; top: 50%; translate: 0 -50%;
  width: 1rem; height: 1rem; stroke: var(--muted);
}
.input-ic input { padding-left: 2.25rem; }
.input-ic .eye {
  position: absolute; right: .5rem; top: 50%; translate: 0 -50%;
  background: none; border: 0; cursor: pointer; padding: .25rem; color: var(--muted);
  display: grid; place-items: center;
}

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

.sidebar {
  width: 15rem; flex: none; background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar__brand {
  padding: 1.125rem 1.25rem; border-bottom: 1px solid var(--side-line);
  display: flex; align-items: center; gap: .625rem;
}
.sidebar__brand .logo__mark { width: 2.25rem; height: 2.25rem; }
.sidebar__brand .logo__org { color: #fff; font-size: 1.125rem; }
.sidebar__brand .logo__app { color: var(--side-muted); }

.sidebar__user {
  display: flex; gap: .625rem; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--side-line);
}
.avatar {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; flex: none;
  background: #4b1215; color: #ffd9d9; display: grid; place-items: center;
  font-size: .8125rem; font-weight: 700;
}
.sidebar__user .nm { font-size: .8125rem; font-weight: 700; color: #fff; line-height: 1.3; }
.sidebar__user .rl { font-size: .6875rem; color: var(--side-muted); }
.sidebar__user .st { display: inline-flex; align-items: center; gap: .3125rem; font-size: .625rem; color: var(--side-muted); }
.sidebar__user .st i { width: .4375rem; height: .4375rem; border-radius: 50%; background: var(--green); }
.sidebar__user .st i.st--learn { background: #4da3ff; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: .75rem 0; }
.navitem {
  display: flex; align-items: center; gap: .6875rem; width: calc(100% - 1.5rem);
  margin: .125rem .75rem; padding: .5625rem .75rem; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--side-ink); cursor: pointer;
  font-size: .8125rem; font-weight: 600; text-align: left;
}
.navitem:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.navitem[aria-current="page"] { background: var(--brand); color: #fff; }
.navitem .ic { width: 1.0625rem; height: 1.0625rem; stroke-width: 1.9; }
.navitem .badge {
  margin-left: auto; background: var(--brand); color: #fff; border-radius: 999px;
  font-size: .625rem; font-weight: 700; padding: .0625rem .4375rem;
}
.navitem[aria-current="page"] .badge { background: rgba(255, 255, 255, .25); }

.sidebar__foot { padding: .875rem 1.25rem; border-top: 1px solid var(--side-line); }
.sidebar__foot button {
  display: flex; align-items: center; gap: .625rem; background: none; border: 0;
  color: var(--side-ink); font-size: .8125rem; font-weight: 600; cursor: pointer; padding: .25rem 0;
}
.sidebar__foot button:hover { color: #fff; }

.app__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 3.5rem; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
  position: sticky; top: 0; z-index: 20;
}
.iconbtn {
  background: none; border: 0; cursor: pointer; color: var(--ink-2);
  width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm);
  display: grid; place-items: center; position: relative;
}
.iconbtn:hover { background: var(--surface-alt); }
.iconbtn .badge {
  position: absolute; top: .25rem; right: .25rem; min-width: .9375rem; height: .9375rem;
  border-radius: 999px; background: var(--brand); color: #fff;
  font-size: .5625rem; font-weight: 700; display: grid; place-items: center; padding: 0 .1875rem;
}
.topbar__spacer { flex: 1; }
.topbar__date { color: var(--muted); font-size: .75rem; }
.topbar__time { color: var(--ink-2); font-size: .75rem; font-weight: 700; }

.main { flex: 1; min-width: 0; padding: 1.5rem 1.75rem 2.5rem; }
.main:focus { outline: none; }

/* bell popover */
.pop {
  position: fixed; top: 3.75rem; right: 1.25rem; width: 19rem; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: .875rem; font-size: .8125rem;
}
.pop h4 { font-size: .8125rem; margin-bottom: .5rem; }
.pop .rowline { display: flex; justify-content: space-between; padding: .3125rem 0; color: var(--ink-2); }
.pop .rowline b { color: var(--ink); }

/* ============================================================ dashboard blocks */
.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.375rem; font-weight: 800; letter-spacing: -.01em; }
.page-head p { color: var(--muted); font-size: .8125rem; margin-top: .25rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stats--3 { grid-template-columns: repeat(3, 1fr); }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.125rem 1.25rem;
}
.stat-card__top { display: flex; align-items: center; gap: .75rem; }
.stat-ic {
  width: 2.375rem; height: 2.375rem; border-radius: var(--radius-sm);
  display: grid; place-items: center; flex: none;
}
.stat-ic .ic { width: 1.1875rem; height: 1.1875rem; }
.stat-ic--green { background: var(--green-bg); color: var(--green); }
.stat-ic--orange { background: var(--orange-bg); color: var(--orange); }
.stat-ic--red { background: var(--red-bg); color: var(--red); }
.stat-ic--purple { background: var(--purple-bg); color: var(--purple); }
.stat-card__label { font-size: .75rem; color: var(--muted); font-weight: 600; }
.stat-card__value { font-size: 1.625rem; font-weight: 800; margin-top: .625rem; color: var(--ink); }
.stat-card__value.small { font-size: 1rem; font-weight: 700; }

.donut {
  --pct: 0;
  width: 3.5rem; height: 3.5rem; border-radius: 50%; flex: none;
  background: conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--gray-bg) 0);
  display: grid; place-items: center; margin-top: .5rem;
}
.donut::before {
  content: attr(data-label); width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--surface); display: grid; place-items: center;
  font-size: .6875rem; font-weight: 800; color: var(--ink);
}

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-top: 1.25rem; padding: 1.25rem 1.25rem 1.375rem;
}
.panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.panel__head h2 { font-size: .9375rem; font-weight: 800; }
.panel__head a, .panel__head button.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand); font-size: .75rem; font-weight: 700;
}

.qa-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.qa-tile {
  background: var(--surface-alt); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 1.25rem 1rem; text-align: center; cursor: pointer; color: inherit; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: .375rem;
}
.qa-tile:hover { border-color: var(--brand); background: var(--brand-soft); }
.qa-tile .ic { width: 1.375rem; height: 1.375rem; color: var(--brand); stroke-width: 1.8; }
.qa-tile b { font-size: .8125rem; }
.qa-tile span { font-size: .6875rem; color: var(--muted); line-height: 1.4; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: .8125rem; }
table.data th {
  text-align: left; background: var(--surface-alt); color: var(--ink-2);
  font-size: .6875rem; font-weight: 700; text-transform: none; letter-spacing: .01em;
  padding: .625rem .875rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: .625rem .875rem; border-bottom: 1px solid var(--border); color: var(--ink-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--surface-alt); }
table.data td .link, table.data .link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand); font-size: .75rem; font-weight: 700;
}

/* help banner */
.helpbar {
  margin-top: 1.25rem; background: var(--brand-soft); border: 1px solid #f6d3d3;
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.helpbar__ic {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--brand);
  color: #fff; display: grid; place-items: center; flex: none;
}
.helpbar b { display: block; font-size: .8125rem; }
.helpbar p { font-size: .75rem; color: var(--ink-2); }
.helpbar .btn { margin-left: auto; flex: none; }

/* learning path */
.path { display: flex; flex-direction: column; }
.path-row {
  display: flex; align-items: center; gap: .875rem; padding: .75rem .25rem;
  border-bottom: 1px solid var(--border); background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.path-row:last-child { border-bottom: 0; }
.path-row:hover { background: var(--surface-alt); }
.path-row[disabled] { cursor: not-allowed; opacity: .75; }
.path-row__idx { width: 1rem; color: var(--muted); font-size: .75rem; font-weight: 700; text-align: center; flex: none; }
.path-row__ic {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: .8125rem; font-weight: 800; color: #fff;
}
.path-row__ic--done { background: var(--green); }
.path-row__ic--active { background: var(--brand); }
.path-row__ic--locked { background: var(--gray); }
.path-row__tx { flex: 1; min-width: 0; }
.path-row__tx b { display: block; font-size: .8125rem; }
.path-row__tx span { font-size: .6875rem; color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: .3125rem; flex: none;
  border-radius: 999px; font-size: .625rem; font-weight: 700; padding: .25rem .625rem;
}
.pill .ic { width: .75rem; height: .75rem; stroke-width: 2.4; }
.pill--green { background: var(--green-bg); color: var(--green); }
.pill--red { background: var(--red-bg); color: var(--red); }
.pill--gray { background: var(--gray-bg); color: var(--muted); }

.quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .875rem; }
.quick-tile {
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 1rem .5rem; display: flex; flex-direction: column; align-items: center; gap: .5rem;
  cursor: pointer; font: inherit; color: inherit; text-align: center;
}
.quick-tile:hover { border-color: var(--brand); color: var(--brand); }
.quick-tile .ic { width: 1.375rem; height: 1.375rem; color: var(--brand); stroke-width: 1.8; }
.quick-tile span { font-size: .6875rem; font-weight: 600; color: var(--ink-2); }
.quick-tile:hover span { color: var(--brand); }

/* ============================================================ generic view scaffolding */
.view { max-width: 62rem; margin: 0 auto; }
.view--wide { max-width: 78rem; }
.view__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.view__head h1 { font-size: 1.375rem; font-weight: 800; }
.view__head p { color: var(--muted); font-size: .8125rem; margin-top: .25rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem;
}
.card--flush { padding: 0; overflow: hidden; }
.card--info { background: var(--surface-alt); }
.card__head {
  padding: .875rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.card__head h2, .card__head h3 { font-size: .9375rem; font-weight: 800; }
.card__body { padding: 1.25rem; }

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }

/* ============================================================ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: .5rem 1rem; font-size: .8125rem; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--surface-alt); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn--danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn--danger:hover { background: var(--brand-strong); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn--ghost:hover { background: var(--brand-soft); }
.btn--sm { padding: .3125rem .625rem; font-size: .75rem; border-radius: .375rem; }
.btn--lg { padding: .6875rem 1.5rem; font-size: .875rem; }
.btn--outline-light { background: transparent; border-color: rgba(255, 255, 255, .55); color: #fff; }
.btn--outline-light:hover { background: rgba(255, 255, 255, .1); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: .3125rem; margin-bottom: .875rem; }
.field__label { font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.field__hint { font-size: .6875rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: .5rem .75rem; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand-ring); border-color: var(--brand);
}
input[type="checkbox"] { width: auto; accent-color: var(--brand); }
textarea { min-height: 5rem; resize: vertical; }
.input--scan { font-size: 1.125rem; padding: .875rem 1rem; }

.filters { display: flex; gap: .875rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters .field { margin-bottom: 0; flex: 1 1 12rem; }

.seg { display: inline-flex; background: var(--gray-bg); border-radius: var(--radius-sm); padding: .1875rem; gap: .1875rem; }
.seg__opt {
  border: 0; background: none; cursor: pointer; border-radius: .375rem;
  padding: .3125rem .75rem; font-size: .75rem; font-weight: 600; color: var(--muted);
}
.seg__opt[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ============================================================ chips / tags / badges */
.chip {
  display: inline-flex; align-items: center; gap: .25rem;
  border-radius: .375rem; padding: .1875rem .5rem;
  font-size: .6875rem; font-weight: 700;
  background: var(--gray-bg); color: var(--ink-2);
}
.chip--pass, .chip--completed, .chip--approved, .chip--confirmed, .chip--done, .chip--synced { background: var(--green-bg); color: var(--green); }
.chip--fail, .chip--failed, .chip--rejected, .chip--fault { background: var(--red-bg); color: var(--red); }
.chip--pending, .chip--syncing, .chip--in_progress, .chip--blocked, .chip--needs_verification, .chip--observed, .chip--identified { background: var(--orange-bg); color: var(--orange); }
.chip--not_tested, .chip--draft, .chip--plain { background: var(--gray-bg); color: var(--muted); }
.chip--info { background: var(--brand-soft); color: var(--brand); }

.tag {
  display: inline-flex; align-items: center; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: .625rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: .1875rem .5625rem;
}
.tag--warn { background: var(--orange-bg); color: var(--orange); }
.tag--mode-WORK { background: var(--green-bg); color: var(--green); }
.tag--mode-TRAINING, .tag--mode-SIMULATION { background: var(--purple-bg); color: var(--purple); }

.verify { font-size: .625rem; font-weight: 700; border-radius: .375rem; padding: .125rem .4375rem; }
.verify--confirmed { background: var(--green-bg); color: var(--green); }
.verify--needs_verification, .verify--observed { background: var(--orange-bg); color: var(--orange); }

.dot { display: inline-flex; align-items: center; gap: .375rem; font-size: .6875rem; font-weight: 600; color: var(--muted); }
.dot::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--gray); }
.dot--online::before { background: var(--green); }
.dot--offline::before { background: var(--orange); }

.code-chip {
  font-family: Consolas, monospace; background: var(--gray-bg); border: 1px solid var(--border);
  border-radius: .375rem; padding: .125rem .4375rem; font-size: .75rem;
}

/* ============================================================ notices / empty / progress */
.notice {
  display: flex; gap: .625rem; align-items: flex-start;
  background: var(--brand-soft); border: 1px solid #f6d3d3; border-radius: var(--radius-sm);
  padding: .75rem 1rem; font-size: .8125rem; color: var(--ink-2); margin-bottom: 1rem;
}
.notice--warn { background: var(--orange-bg); border-color: #f3ddb8; }
.notice--danger { background: var(--red-bg); border-color: #f3c2c2; }
.notice strong { display: block; color: var(--ink); font-size: .8125rem; }

.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty h3 { font-size: .9375rem; margin-bottom: .375rem; color: var(--ink-2); }
.empty p { font-size: .8125rem; margin-bottom: 1rem; }

.progress { background: var(--gray-bg); border-radius: 999px; height: .5rem; overflow: hidden; }
.progress__bar { height: 100%; background: var(--brand); border-radius: 999px; }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat__label { font-size: .75rem; color: var(--muted); font-weight: 600; }
.stat__value { font-size: 1.5rem; font-weight: 800; margin-top: .25rem; }
.big-value { font-size: 2rem; font-weight: 800; }

/* ============================================================ session / procedure blocks */
.session-item {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  padding: .75rem 1.25rem; border: 0; border-bottom: 1px solid var(--border);
  background: none; cursor: pointer; font: inherit; color: inherit; text-align: left;
}
.session-item:hover { background: var(--surface-alt); }
.session-item__id { font-weight: 700; font-size: .8125rem; }
.session-item__meta { font-size: .75rem; color: var(--muted); }

.proc { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .75rem; overflow: hidden; }
.proc__head {
  display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem;
  background: var(--surface-alt); cursor: pointer; border: 0; width: 100%; font: inherit; text-align: left;
}
.proc__title { font-size: .8125rem; font-weight: 700; flex: 1; }
.proc__codes { display: flex; gap: .375rem; flex-wrap: wrap; padding: 0 1rem .25rem; }
.proc__detail { padding: .75rem 1rem; border-top: 1px solid var(--border); }
.proc__expected { font-size: .75rem; color: var(--muted); }

.pick { display: flex; gap: .5rem; flex-wrap: wrap; }
.pick button {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px;
  padding: .3125rem .75rem; font-size: .75rem; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.pick button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.eqCheck { display: flex; gap: .5rem; align-items: center; font-size: .8125rem; padding: .25rem 0; }

.learn-layout { display: grid; grid-template-columns: 20rem 1fr; gap: 1rem; align-items: start; }

/* ============================================================ prose (lessons / knowledge) */
.prose { font-size: .875rem; color: var(--ink-2); max-width: 46rem; }
.prose h2 { font-size: 1.25rem; font-weight: 800; margin: 1rem 0 .5rem; }
.prose h3 { font-size: 1.0625rem; font-weight: 700; margin: 1rem 0 .5rem; }
.prose h4 { font-size: .9375rem; font-weight: 700; margin: .875rem 0 .375rem; }
.prose p { margin: .5rem 0; }
.prose ul, .prose ol { margin: .5rem 0; padding-left: 1.25rem; }
.prose li { margin: .25rem 0; }
.prose code { background: var(--gray-bg); border-radius: .25rem; padding: .0625rem .3125rem; font-size: .8125em; }
.prose pre { background: var(--side-bg-2); color: #f5e7e7; border-radius: var(--radius-sm); padding: .875rem 1rem; overflow-x: auto; }
.prose pre code { background: none; color: inherit; }
.prose blockquote { border-left: 3px solid var(--brand); margin: .75rem 0; padding: .25rem 1rem; color: var(--muted); }
.prose strong { color: var(--ink); }

/* ============================================================ modal / toasts */
.modal {
  border: 0; border-radius: 12px; padding: 0; width: min(38rem, calc(100vw - 2rem));
  box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(16, 24, 40, .45); }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal__head h2 { font-size: 1rem; font-weight: 800; }
.modal__body { padding: 1.25rem; max-height: 60vh; overflow-y: auto; }
.modal__foot { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .625rem; }

.toasts { position: fixed; bottom: 1.25rem; right: 1.25rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; }
.toast {
  background: var(--side-bg-2); color: #fff; border-radius: var(--radius-sm);
  padding: .625rem 1rem; font-size: .8125rem; box-shadow: var(--shadow-lg);
  border-left: 3px solid var(--brand);
  animation: toast-in .18s ease-out;
}
.toast--ok { border-left-color: var(--green); }
.toast--warn { border-left-color: var(--orange); }
.toast--err { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; translate: 0 .375rem; } }

/* ============================================================ responsive */
@media (max-width: 62rem) {
  .stats, .qa-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .learn-layout { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .land__features { grid-template-columns: 1fr; gap: 1.25rem; }
  .land__feature { border-left: 0; padding-left: 0; }
}

@media (max-width: 48rem) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; translate: -100% 0; transition: translate .2s ease;
    box-shadow: var(--shadow-lg);
  }
  .app--nav-open .sidebar { translate: 0 0; }
  .stats, .qa-grid, .grid--2 { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 1rem; }
  .land__hero h1 { font-size: 2rem; }
  .land__links { display: none; }
}

@media print {
  .sidebar, .topbar, .toasts, .helpbar { display: none !important; }
  .main { padding: 0; }
  .card, .panel { box-shadow: none; }
}

/* ============================================================ marketing site */
/* The dead-looking hamburger only appears where it actually does something
   (small screens, where the sidebar is off-canvas). */
#menuBtn { display: none; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .375rem;
  font-size: .6875rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand);
}
.eyebrow .ic { width: .875rem; height: .875rem; }
.eyebrow--light { color: #ff9a9a; }

.land__brand { text-decoration: none; }
.land__links { display: flex; gap: 1.75rem; margin-left: 2.5rem; }
.land__links a {
  text-decoration: none; font-size: .8125rem; font-weight: 600;
  color: var(--ink-2); padding: .25rem 0; position: relative;
}
.land__links a:hover { color: var(--brand); }
.land__links a.is-active { color: var(--brand); }
.land__links a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.125rem;
  height: 2px; background: var(--brand); border-radius: 2px;
}
.land__nav .btn { text-decoration: none; }

.bolt-divider { background: var(--bg); line-height: 0; }
.bolt-divider svg { width: 100%; height: 2.5rem; display: block; }
.bolt-divider path { fill: none; stroke: var(--brand); stroke-width: 2; opacity: .45; }

.land__section { padding: 4rem 0; background: var(--bg); }
.land__section--dark {
  background: linear-gradient(180deg, #2b0a0c, #200708); color: var(--side-ink);
}
.land__section--dark h2, .land__section--dark h3 { color: #fff; }
.section-in { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }
.section-head { max-width: 46rem; margin-bottom: 2.5rem; }
.section-head--center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head h2 { font-size: 1.875rem; font-weight: 800; letter-spacing: -.01em; margin: .5rem 0 .75rem; }
.section-head .lede { color: var(--muted); font-size: .9375rem; }
.land__section--dark .section-head .lede { color: rgba(255, 255, 255, .75); }

.page-hero {
  color: #fff; padding: 4rem 0 3.5rem; position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 380px at 82% -20%, rgba(212, 42, 42, .38), transparent 62%),
    linear-gradient(135deg, #2b0a0c, #1d0506 58%, #160405);
}
.page-hero h1 {
  color: #fff; font-size: 2.25rem; font-weight: 800; line-height: 1.15;
  letter-spacing: -.01em; margin: .75rem 0 1rem;
}
.page-hero .lede { color: rgba(255, 255, 255, .82); max-width: 40rem; font-size: 1rem; margin-bottom: 1.75rem; }
.page-hero .btn { text-decoration: none; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; margin-top: 3rem; }
.split--rev .split__tx { order: 2; }
.split--rev .split__visual { order: 1; }
.split__tx h3 { font-size: 1.375rem; font-weight: 800; margin: .75rem 0; }
.split__tx p { color: var(--ink-2); margin-bottom: .75rem; }
.split__tx .tag { margin-bottom: .25rem; }
.split__visual { display: flex; justify-content: center; }

.ticks { list-style: none; padding: 0; margin: 1rem 0; }
.ticks li { position: relative; padding-left: 1.75rem; margin: .5rem 0; color: var(--ink-2); font-size: .875rem; }
.ticks li::before {
  content: "\2713"; position: absolute; left: 0; top: 0;
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  font-size: .75rem; font-weight: 800; display: grid; place-items: center;
}

/* device mockups */
.mock { flex: none; }
.mock__screen img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mock--laptop { width: min(34rem, 100%); }
.mock--laptop .mock__screen {
  border: .625rem solid #1b1b1f; border-bottom-width: .75rem; border-radius: .75rem .75rem 0 0;
  background: #000; overflow: hidden; aspect-ratio: 16 / 10; box-shadow: var(--shadow-lg);
}
.mock--laptop .mock__base {
  height: .875rem; margin: 0 -1.5rem;
  background: linear-gradient(#2c2c31, #141416);
  border-radius: 0 0 1.125rem 1.125rem; box-shadow: var(--shadow);
}
.mock--phone {
  position: relative; width: 16.25rem; padding: .625rem;
  background: #141416; border-radius: 1.875rem; box-shadow: var(--shadow-lg);
}
.mock--phone .mock__notch {
  position: absolute; top: .625rem; left: 50%; translate: -50% 0;
  width: 5.625rem; height: 1rem; background: #141416;
  border-radius: 0 0 .625rem .625rem; z-index: 2;
}
.mock--phone .mock__screen {
  border-radius: 1.375rem; overflow: hidden; aspect-ratio: 9 / 19; background: #000;
}
.mock--phone .mock__screen img { object-position: top center; }

.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; margin-bottom: 1rem; }
.step {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.step__n {
  flex: none; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: .9375rem;
}
.step h3 { font-size: 1rem; font-weight: 800; margin-bottom: .25rem; }
.step p { color: var(--muted); font-size: .8125rem; }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.feature-card .ic { width: 1.75rem; height: 1.75rem; color: var(--brand); stroke-width: 1.7; }
.feature-card h3 { font-size: 1rem; margin: .75rem 0 .5rem; }
.feature-card p { font-size: .8125rem; color: var(--muted); }
.land__section--dark .feature-card {
  background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .12); box-shadow: none;
}
.land__section--dark .feature-card h3 { color: #fff; }
.land__section--dark .feature-card p { color: rgba(255, 255, 255, .72); }

.cta-band { background: linear-gradient(120deg, var(--brand), var(--brand-strong)); color: #fff; padding: 3rem 0; }
.cta-band__in { display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.cta-band h2 { color: #fff; font-size: 1.625rem; font-weight: 800; }
.cta-band p { color: rgba(255, 255, 255, .92); margin-top: .5rem; max-width: 34rem; }
.cta-band__btns { display: flex; gap: .75rem; flex: none; }
.cta-band .btn { text-decoration: none; }
.cta-band .btn--primary { background: #fff; color: var(--brand); border-color: #fff; }
.cta-band .btn--primary:hover { background: #ffecec; border-color: #ffecec; }

.support-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.support-card {
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius); padding: 1.5rem;
}
.support-card .ic { width: 1.5rem; height: 1.5rem; color: #ff9a9a; }
.support-card h3 { color: #fff; font-size: 1rem; margin: .75rem 0 .5rem; }
.support-card p { color: rgba(255, 255, 255, .75); font-size: .8125rem; }
.support-card a { color: #ffbcbc; }

.about-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: .5rem 1.25rem; width: 100%; max-width: 22rem;
}
.about-panel__row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .875rem 0; border-bottom: 1px solid var(--border); font-size: .8125rem;
}
.about-panel__row:last-child { border-bottom: 0; }
.about-panel__row span { color: var(--muted); }
.about-panel__row b { color: var(--ink); font-weight: 700; text-align: right; }

.safetynote { margin-top: 2.5rem; }

/* footer */
.land__footer { background: #1a0506; color: var(--side-muted); }
.footer-in {
  max-width: 72rem; margin: 0 auto; padding: 3rem 1.5rem 0;
  display: grid; grid-template-columns: 1.4fr 2fr; gap: 2.5rem;
}
.footer-brand .logo__org { color: #fff; }
.footer-brand p { margin-top: 1rem; font-size: .8125rem; max-width: 22rem; color: rgba(255, 255, 255, .6); }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.footer-cols h4 { color: #fff; font-size: .8125rem; margin-bottom: .75rem; }
.footer-cols a {
  display: block; color: rgba(255, 255, 255, .6); font-size: .8125rem;
  text-decoration: none; padding: .25rem 0;
}
.footer-cols a:hover { color: #fff; }
.footer-base {
  max-width: 72rem; margin: 2.5rem auto 0; padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, .1);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-size: .75rem; color: rgba(255, 255, 255, .5);
}
.footer-note { max-width: 34rem; }

/* login / join / admin tweaks */
.login-logo { display: flex; justify-content: center; text-decoration: none; margin-bottom: 2.25rem; }
.login-logo .logo { margin-bottom: 0; }
.login-card--single { grid-template-columns: 1fr; width: min(30rem, 100%); min-height: 0; }
.admin-card { width: min(42rem, 100%); }
.admin-gen { display: grid; grid-template-columns: 1fr 1fr auto; gap: .75rem; align-items: end; margin-bottom: 1.25rem; }
.admin-gen .field { margin-bottom: 0; }
.admin-newkey {
  background: var(--brand-soft); border: 1px solid #f6d3d3;
  border-radius: var(--radius-sm); padding: .875rem 1rem; margin-bottom: 1.25rem;
}
.keyline { display: flex; gap: .5rem; align-items: center; margin-top: .375rem; }
.keyline code {
  font-family: Consolas, monospace; font-size: 1rem; font-weight: 700; letter-spacing: .04em;
  background: #fff; border: 1px solid var(--border); border-radius: .375rem;
  padding: .375rem .625rem; flex: 1; min-width: 0; overflow-x: auto;
}
.admin-list__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.admin-list__head h3 { font-size: .9375rem; font-weight: 800; }
#invRows { overflow-x: auto; }
#invRows table.data { font-size: .75rem; }

@media (max-width: 62rem) {
  .split { grid-template-columns: 1fr; gap: 2rem; }
  .split--rev .split__tx, .split--rev .split__visual { order: 0; }
  .steps { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .support-grid { grid-template-columns: 1fr; }
  .cta-band__in { flex-direction: column; align-items: flex-start; }
  .footer-in { grid-template-columns: 1fr; gap: 2rem; }
  .admin-gen { grid-template-columns: 1fr; }
}

@media (max-width: 48rem) {
  #menuBtn { display: grid; }
  .land__nav-in { gap: 1rem; padding: .625rem 1rem; }
  .land__links { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .section-in { padding: 0 1.125rem; }
  .land__section { padding: 2.75rem 0; }
  .page-hero { padding: 2.75rem 0; }
  .page-hero h1 { font-size: 1.75rem; }
  .section-head h2 { font-size: 1.5rem; }
  .mock--phone { width: 13.75rem; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .footer-base { flex-direction: column; }
}
