@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ═══════════════════════════════════════════════════════════════════
   Reports portal — design system
   Palette: #0b2545  #13315c  #134074  #8da9c4  #eef4ed

   A light interface built on three ideas:

   1. Depth carries meaning. The page is tinted, panels are white and
      raised, input wells are tinted and recessed. You can tell what is
      a surface, what is a control, and what is background without
      reading a single label.
   2. One accent. Navy marks the primary action and the current page,
      and nothing else, so it always means "this is the thing".
   3. The navigation is a dark anchor against a light workspace, which
      keeps the two apart at a glance instead of relying on a hairline.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* Palette, darkest to lightest */
  --navy-900: #0b2545;
  --navy-700: #13315c;
  --navy-500: #134074;
  --blue-300: #8da9c4;
  --paper:    #eef4ed;

  /* Surfaces */
  --bg:        var(--paper);
  --surface:   #ffffff;
  --surface-2: #f6f9f8;   /* zebra rows, hover fills */
  --sunken:    #eff4f8;   /* input wells: tinted, so a field reads as recessed */

  /* Lines. Panels take a soft hairline; anything you can type in or click
     takes a firmer one, because that edge is the affordance. */
  --line:       #dbe4ec;
  --line-soft:  #e7eef3;
  --line-firm:  #c3d2e0;
  --line-input: #8da9c4;
  --line-hot:   var(--navy-500);

  /* Text */
  --text:  var(--navy-900);
  --muted: #3f5a7d;
  --dim:   #5c748f;
  --on-dark:       #eef4ed;
  --on-dark-muted: #a9c0d6;

  /* Accent */
  --accent:      var(--navy-500);
  --accent-deep: var(--navy-700);
  --accent-soft: #e4ecf5;
  --accent-tint: rgba(19, 64, 116, .10);

  /* Semantic, chosen to sit beside navy without clashing */
  --go:        #1f7a4d;
  --go-soft:   #e6f4ec;
  --stop:      #b3261e;
  --stop-soft: #fbeae9;
  --warn:      #8a5a00;
  --warn-soft: #fdf3e2;

  --sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r-sm:   8px;
  --r:      12px;
  --r-lg:   18px;
  --r-pill: 999px;

  --rail-w: 260px;
  --top-h:  62px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --shadow:    0 1px 2px rgba(11, 37, 69, .06), 0 4px 12px rgba(11, 37, 69, .06);
  --shadow-md: 0 2px 6px rgba(11, 37, 69, .08), 0 12px 28px rgba(11, 37, 69, .10);
  --shadow-lg: 0 18px 44px rgba(11, 37, 69, .18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; font-weight: 500; transition: color .18s var(--ease); }
a:hover { color: var(--accent-deep); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--accent-soft); color: var(--navy-900); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--blue-300) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--blue-300); border-radius: 10px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ═══ Shell ═══════════════════════════════════════════════════════ */

.shell { display: flex; min-height: 100vh; position: relative; }

/**
 * The rail is deep navy against a light workspace.
 *
 * A white sidebar beside a white-panelled page needs a border to be legible
 * at all, and that border does a lot of work for a very thin line. Making it
 * dark separates navigation from content instantly.
 */
.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  background: var(--navy-900);
  color: var(--on-dark);
  padding: 20px 0 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: margin-left .42s var(--ease), opacity .3s var(--ease);
}

/* Collapsed: slide the rail out of the flow entirely so the canvas reclaims it */
body.nav-collapsed .rail {
  margin-left: calc(var(--rail-w) * -1);
  opacity: 0;
  pointer-events: none;
}

.brand {
  padding: 0 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand .mark {
  width: 36px; height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--navy-500), var(--navy-700));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
  display: grid;
  place-items: center;
}
.brand .mark { position: relative; overflow: hidden; }
.brand .mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, .38) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: sheen 7s var(--ease) infinite;
}
@keyframes sheen { 0%, 72% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
.brand .mark svg { width: 18px; height: 18px; color: #fff; position: relative; z-index: 1; }

.brand b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.25;
  color: #fff;
}
.brand span {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
  margin-top: 2px;
}

.rail-group {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
  padding: 18px 20px 8px;
}

.rail a.item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 12px;
  padding: 10px 12px;
  color: var(--on-dark-muted);
  font-size: 14.5px;
  font-weight: 400;
  border-radius: var(--r-sm);
  position: relative;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.rail a.item:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; transform: translateX(2px); }
.rail a.item svg { width: 17px; height: 17px; flex: 0 0 17px; }

/* The current page is filled, not merely tinted, so it is unmistakable. */
.rail a.item[aria-current='page'] {
  color: #fff;
  background: var(--navy-500);
  font-weight: 600;
}
.rail a.item[aria-current='page']:hover { background: var(--navy-500); }

.rail-foot {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: 12px;
  color: var(--on-dark-muted);
}
.rail-foot .who {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--on-dark-muted);
  word-break: break-all;
  display: block;
  margin-bottom: 10px;
}
.rail-foot form { margin-top: 12px; }
.rail-foot button.ghost {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .22);
  color: #fff;
}
.rail-foot button.ghost:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .38); color: #fff; }
.rail-foot .tag { border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .10); color: #fff; }

/* ═══ Canvas + topbar ════════════════════════════════════════════ */

.canvas {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--top-h);
  flex: 0 0 var(--top-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.nav-toggle {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line-firm);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.nav-toggle::after { display: none; }
.nav-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
  transform: none;
}
.nav-toggle svg { width: 18px; height: 18px; transition: transform .38s var(--ease); }
body.nav-collapsed .nav-toggle svg { transform: rotate(180deg); }
body.nav-collapsed .nav-toggle { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.topbar-back { flex: 0 0 auto; white-space: nowrap; }

.topbar .crumb {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .spacer { flex: 1; }
.topbar .who {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 9px;
}
@media (max-width: 700px) { .topbar .who .email { display: none; } }

.main { flex: 1; min-width: 0; padding: 28px 32px 56px; animation: rise .4s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 24px; }
.page-head h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--text);
}
.page-head p { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; max-width: 66ch; }

/* ═══ Panels & tables ════════════════════════════════════════════ */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 22px;
}
.panel h2 {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
}
.panel .hint { margin: 0 0 18px; color: var(--dim); font-size: 13.5px; max-width: 70ch; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 0 12px 11px 0;
  border-bottom: 1px solid var(--line-firm);
}
td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr { transition: background .16s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td.mono, .mono { font-family: var(--mono); font-size: 12.5px; }

.table-scroll { overflow-x: auto; }

/* ═══ Forms ══════════════════════════════════════════════════════ */

label {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 8px;
}

/**
 * Fields are tinted and recessed against white panels, with a firm border.
 * Two cues rather than one, so there is never a question about where you
 * can type. On focus the well turns white and takes a navy ring, making the
 * active field the brightest thing on the form.
 */
input[type='text'], input[type='email'], select, textarea {
  width: 100%;
  background: var(--sunken);
  border: 1px solid var(--line-input);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
  padding: 11px 13px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-tint);
  background: var(--surface);
}
input::placeholder { color: var(--dim); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b2545' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
  cursor: pointer;
}
select[multiple] { background-image: none; padding-right: 13px; min-height: 138px; cursor: default; }
select[multiple] option { padding: 8px 10px; border-radius: 4px; }
select[multiple] option:checked { background: var(--accent); color: #fff; font-weight: 600; }

.field { margin-bottom: 18px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 20px;
  cursor: pointer;
  transition: background .18s var(--ease), box-shadow .18s var(--ease), transform .12s var(--ease);
}
button:hover, .btn:hover { background: var(--accent-deep); color: #fff; text-decoration: none; box-shadow: var(--shadow); }
button:active, .btn:active { transform: translateY(1px); }

button.ghost, .btn.ghost {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line-firm);
}
button.ghost:hover, .btn.ghost:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}

button.danger {
  background: var(--surface);
  color: var(--stop);
  border: 1px solid var(--stop);
}
button.danger:hover { background: var(--stop); color: #fff; border-color: var(--stop); }

button.sm, .btn.sm { padding: 8px 14px; font-size: 13px; }

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.check:hover { border-color: var(--line-input); background: var(--surface-2); }
.check input { width: auto; accent-color: var(--accent); transform: scale(1.2); cursor: pointer; }
.check label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  flex: 1;
}

/* ═══ Toggle switch ══════════════════════════════════════════════ */

.switch {
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14.5px;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 50px; height: 28px;
  flex: 0 0 50px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  border: 1px solid var(--line-input);
  position: relative;
  transition: background .26s var(--ease), border-color .26s var(--ease);
}
.switch .thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 20px; height: 20px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--blue-300);
  box-shadow: 0 1px 3px rgba(11, 37, 69, .28);
  transition: transform .3s var(--ease), background .26s var(--ease);
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(22px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch .switch-text { font-family: var(--sans); font-size: 14.5px; color: var(--text); font-weight: 400; }

/**
 * A switch, its confirm button and its note.
 *
 * These once relied on margin-top, which an inline-level button ignores, so
 * the button sat flush against the control above. A flex column spaces them
 * regardless of each child's display type.
 */
.setting {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: 18px;
}
.setting .hint { margin: 0; max-width: 70ch; }
.setting .switch { margin: 0; }

/* State banner: what is actually stored, not what the control says. */
.state-banner {
  animation: rise .3s var(--ease) both;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 14px;
  padding: 12px 15px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  border: 1px solid;
}
.state-banner .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: 0 0 8px; }
.state-banner .msg { flex: 1; }
.state-banner strong { font-weight: 600; }
.state-banner code {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(11, 37, 69, .07);
}
.state-banner.locked { border-color: #b7ddc7; background: var(--go-soft); color: #125c37; }
.state-banner.locked .dot { background: var(--go); }
.state-banner.open { border-color: #ecd4a4; background: var(--warn-soft); color: #6d4700; }
.state-banner.open .dot { background: var(--warn); }

/* ═══ Status chips ═══════════════════════════════════════════════ */

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-firm);
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.tag.go     { color: var(--go);   border-color: #b7ddc7; background: var(--go-soft); }
.tag.stop   { color: var(--stop); border-color: #f0c4c1; background: var(--stop-soft); }
.tag.signal { color: var(--accent); border-color: var(--blue-300); background: var(--accent-soft); }

.flash {
  animation: rise .35s var(--ease) both;
  border: 1px solid var(--line-firm);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 13px 17px;
  font-size: 13.5px;
  margin-bottom: 22px;
  border-radius: var(--r-sm);
}

/* ═══ Readout strip ══════════════════════════════════════════════ */

.readout {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px 26px;
  background: var(--surface-2);
}
.readout b { color: var(--muted); font-weight: 600; }
.readout .v { color: var(--text); }
.readout .lamp {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: middle;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.readout .lamp.go { background: var(--go); }
.readout .lamp.stop { background: var(--stop); }

/* ═══ Auth screens ═══════════════════════════════════════════════ */

.solo {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
  background: var(--paper);
}

/* Soft navy washes, kept faint so the card stays the focus. */
.solo .aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .55;
  pointer-events: none;
}
.solo .aurora.a1 {
  width: 620px; height: 620px;
  background: radial-gradient(circle, rgba(19, 64, 116, .22), transparent 68%);
  top: -200px; left: -170px;
  animation: drift1 24s ease-in-out infinite;
}
.solo .aurora.a2 {
  width: 540px; height: 540px;
  background: radial-gradient(circle, rgba(141, 169, 196, .40), transparent 68%);
  bottom: -190px; right: -140px;
  animation: drift2 28s ease-in-out infinite;
}
.solo .aurora.a3 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(11, 37, 69, .10), transparent 70%);
  top: 44%; left: 52%;
  animation: drift3 20s ease-in-out infinite;
}
@keyframes drift1 { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(90px,70px) scale(1.12); } }
@keyframes drift2 { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-80px,-60px) scale(1.1); } }
@keyframes drift3 { 0%, 100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-42%,-58%) scale(1.18); } }

.solo .grid-floor {
  position: absolute;
  inset: auto 0 0;
  height: 44vh;
  background-image:
    linear-gradient(rgba(11, 37, 69, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 37, 69, .05) 1px, transparent 1px);
  background-size: 54px 54px;
  transform: perspective(340px) rotateX(64deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(to top, #000 5%, transparent 78%);
  -webkit-mask-image: linear-gradient(to top, #000 5%, transparent 78%);
  animation: floor 10s linear infinite;
  pointer-events: none;
}
@keyframes floor { from { background-position: 0 0, 0 0; } to { background-position: 0 54px, 54px 0; } }

.solo .scan { display: none; }

.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 38px;
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-lg);
  animation: cardIn .6s var(--ease) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* A highlight travelling along the card's top edge, so the screen is not
   completely still while someone waits for a link. */
.card::before {
  content: '';
  position: absolute;
  top: -1px; left: 14%; right: 14%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: edge 4.5s ease-in-out infinite;
}
@keyframes edge { 0%, 100% { opacity: .2; } 50% { opacity: .9; } }

.card .logo-lockup { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.card .logo-lockup .mark {
  width: 44px; height: 44px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--navy-500), var(--navy-900));
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  animation: breathe 4.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 2px 8px rgba(11, 37, 69, .16); }
  50%      { box-shadow: 0 6px 20px rgba(19, 64, 116, .34); }
}
.card .logo-lockup .mark svg { width: 22px; height: 22px; color: #fff; }
.card .logo-lockup .eyebrow { margin: 0; }

.card .eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.card h1 {
  margin: 0 0 11px;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--text);
}
.card p.lede { margin: 0 0 26px; color: var(--muted); font-size: 14.5px; }
.card .readout { margin-top: 26px; }
.card form button[type='submit'] { width: 100%; margin-top: 4px; }

/* Staggered entrance for the card's contents */
.stagger > * { animation: rise .5s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .06s; }
.stagger > *:nth-child(2) { animation-delay: .12s; }
.stagger > *:nth-child(3) { animation-delay: .18s; }
.stagger > *:nth-child(4) { animation-delay: .24s; }
.stagger > *:nth-child(5) { animation-delay: .30s; }
.stagger > *:nth-child(6) { animation-delay: .36s; }

.err {
  border: 1px solid #f0c4c1;
  border-left: 3px solid var(--stop);
  background: var(--stop-soft);
  color: #8c1d18;
  padding: 12px 15px;
  font-size: 13.5px;
  margin-bottom: 18px;
  border-radius: var(--r-sm);
}

.progress {
  height: 4px;
  border-radius: 4px;
  background: var(--sunken);
  overflow: hidden;
  margin: 4px 0 22px;
}
.progress span {
  display: block;
  height: 100%;
  width: 38%;
  border-radius: 4px;
  background: var(--accent);
  animation: slide 1.5s ease-in-out infinite;
}
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(360%); } }

/* ═══ Report canvas ══════════════════════════════════════════════ */

.main.is-report { padding: 0; display: flex; flex-direction: column; }

.report-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}
.report-bar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.report-bar .spacer { flex: 1; }
.report-bar .notice { margin: 0; font-size: 12px; white-space: nowrap; }
@media (max-width: 900px) { .report-bar .notice { display: none; } }

.frame-wrap {
  flex: 1;
  min-height: 0;
  border: 0;
  overflow: hidden;
  background: var(--paper);
  position: relative;
}
.frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.frame-wrap > div { width: 100%; height: 100%; }

/* Fullscreen: hide chrome entirely and let the report own the viewport */
body.report-full .rail,
body.report-full .topbar,
body.report-full .report-bar { display: none; }
body.report-full .main.is-report { height: 100vh; }
body.report-full { overflow: hidden; }

.fs-exit {
  position: fixed;
  top: 14px; right: 16px;
  z-index: 60;
  display: none;
  box-shadow: var(--shadow-md);
}
body.report-full .fs-exit { display: inline-flex; }

.notice { font-size: 13px; color: var(--dim); max-width: 78ch; }

/* ═══ Report on a phone ══════════════════════════════════════════ */

/**
 * dvh/dvw track the viewport that is actually visible as mobile browser
 * chrome collapses. vh/vw do not: on iOS they resolve to the taller
 * "toolbars hidden" viewport, so a canvas sized with them extends past the
 * bottom of the screen. The vh/vw pair is kept first as a fallback.
 */
@media (max-width: 900px) {
  .main.is-report {
    min-height: calc(100vh - var(--top-h));
    min-height: calc(100dvh - var(--top-h));
  }

  body.report-full .main.is-report {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    width: 100dvw;
    height: 100dvh;
    z-index: 70;
    min-height: 0;
    animation: none;
  }
}

/**
 * Held upright, the canvas is laid out in a landscape box and rotated onto
 * the screen so the report gets the long edge. Turning the phone makes this
 * stop matching, and the rule above fills the screen natively.
 */
@media (max-width: 900px) and (orientation: portrait) {
  body.report-full .main.is-report {
    width: 100vh;
    height: 100vw;
    width: 100dvh;
    height: 100dvw;
    transform-origin: 0 0;
    transform: rotate(90deg) translateY(-100vw);
    transform: rotate(90deg) translateY(-100dvw);
  }
}

/* ═══ Empty states & tiles ═══════════════════════════════════════ */

.empty {
  border: 1px dashed var(--line-firm);
  border-radius: var(--r);
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
  background: var(--surface-2);
}
.empty a { display: inline-block; margin-top: 10px; }
.empty .icon { display: block; margin: 0 auto 14px; width: 32px; height: 32px; color: var(--blue-300); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px;
  color: var(--text);
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.tile { position: relative; overflow: hidden; }
.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--accent-tint), transparent 45%);
  opacity: 0;
  transition: opacity .28s var(--ease);
  pointer-events: none;
}
.tile:hover::after { opacity: 1; }
.tile b, .tile .meta { position: relative; z-index: 1; }

.tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.tile b { display: block; font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.tile .meta {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 7px;
}
.tile:hover .meta { color: var(--accent); }
.tile .meta .arrow { transition: transform .2s var(--ease); }
.tile:hover .meta .arrow { transform: translateX(4px); }

/* A panel whose action cannot be undone. */
.danger-zone { border-color: #f0c4c1; }
.danger-zone h2 { color: var(--stop); }

/* ═══ Responsive ═════════════════════════════════════════════════ */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(11, 37, 69, .45);
  backdrop-filter: blur(2px);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s var(--ease);
}

@media (max-width: 900px) {
  :root { --rail-w: 270px; }

  /**
   * Off-canvas drawer, closed by default.
   *
   * The closed state lives in CSS rather than being applied by script on
   * load. Previously the rail rendered open and only slid away once ui.js
   * ran, so every page load flashed the drawer over the content. Opening is
   * the state that needs a class, not closing.
   */
  .rail {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    margin-left: 0 !important;
    opacity: 1 !important;
    transform: translateX(-100%);
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    transition: transform .3s var(--ease);
  }
  body.nav-open .rail { transform: translateX(0); pointer-events: auto; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }

  /* The page behind a drawer should not scroll under it. */
  body.nav-open { overflow: hidden; }

  .main { padding: 20px 16px 44px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .report-bar { padding: 11px 16px; }

  .page-head h1 { font-size: 23px; }
  .panel { padding: 18px 16px; }

  /* The breadcrumb goes first: the heading below already says where you are,
     and the back link needs the room. */
  .topbar .crumb { display: none; }

  /**
   * Tables become stacked cards.
   *
   * A six column account table cannot be read on a phone, and side scrolling
   * hides exactly the columns that matter. Each row becomes a block and each
   * cell carries its own label from the data-label attribute.
   */
  .table-scroll { overflow-x: visible; }
  .panel table,
  .panel thead,
  .panel tbody,
  .panel th,
  .panel td,
  .panel tr { display: block; }

  .panel thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

  .panel tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--surface);
  }
  .panel tbody tr:hover { background: var(--surface); }

  .panel td {
    border: 0;
    padding: 6px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    text-align: right;
  }
  .panel td::before {
    content: attr(data-label);
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    flex: 0 0 auto;
  }
  .panel td[data-label='']::before { content: none; }
  .panel td[data-label=''] { justify-content: flex-end; padding-top: 10px; }

  /* Comfortable touch targets, and full-width actions that are easy to hit.
     44px is the size a finger reliably hits; the desktop sizes fall short. */
  button, .btn { padding: 13px 18px; min-height: 44px; }
  button.sm, .btn.sm { padding: 10px 14px; min-height: 42px; }
  .nav-toggle { width: 44px; height: 44px; flex: 0 0 44px; min-height: 0; }
  .panel > form > button[type='submit'] { width: 100%; }
  .setting button { width: 100%; }

  .row { gap: 0; }
  .row > * { flex: 1 1 100%; }

  /* 16px stops iOS zooming the page when a field takes focus. */
  input[type='text'], input[type='email'], select, textarea { font-size: 16px; }

  .readout { font-size: 11px; gap: 6px 14px; }
  .card { padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
