/* ───── 1edge admin — brand-aligned design system ───── */
/* Kit 2026-09-02: two faces only. JetBrains Mono for labels, values, nav and
   headings; Inter for running text. Syne (the old display face) is gone —
   `--display` now resolves to the mono stack so every old rule follows. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Surface */
  --black: #050505;
  --bg: #0a0a0a;
  --bg-elev: #111111;
  --bg-elev-2: #181818;
  --bg-sidebar: #060606;
  --border: #1c1c1c;
  --border-strong: #2a2a2a;

  /* Text */
  --text: #f0f0f0;
  --text-soft: #cdcdcd;
  --muted: #7a7a7a;
  --muted-2: #4a4a4a;

  /* Brand */
  --green: #4ade4a;
  --green-hover: #5fff5f;
  --green-dim: #1a5c1a;
  --green-glow: rgba(74,222,74,0.12);
  --green-glow-2: rgba(74,222,74,0.04);
  --orange: #ff6b00;
  --orange-hover: #ff8533;
  --orange-dim: #7a3300;
  --orange-glow: rgba(255,107,0,0.12);

  /* Semantic */
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: var(--green);
  --primary: var(--green);

  /* Fonts (kit 2026-09-02) */
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --body: var(--sans);
  --display: var(--mono);        /* the old Syne token — every heading/number that used it is mono now */
  --font-handle: var(--mono);    /* @handles are identifiers, not prose */

  /* Kit surfaces + accents used by the shell and the rebuilt pages */
  --bg-on: #13131a;              /* selected row / open module */
  --border-2: #2a2a31;           /* kbd, inputs on elevated cards */
  --gold: #ffd23f;               /* waiting / needs a second person */
  --info: #38bdf8;
  --sev-k: #3a3a44;              /* the quiet severity stripe */
  --danger-glow: rgba(239,68,68,0.12);
  --gold-glow: rgba(255,210,63,0.12);

  /* Radii + rhythm */
  --r-sm: 5px;
  --r: 8px;
  --r-lg: 10px;
  --r-xl: 12px;
  --pad: 12px;
  --gap: 12px;

  /* Layout */
  --sidebar-w: 232px;

  /* Legacy compatibility — pre-facelift inline styles in HTML reference these */
  --accent: var(--green);
  --accent-fade: var(--green-glow);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; }

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-hover); }

::selection { background: var(--green-glow); color: var(--text); }

/* ───── Sidebar ───── */
aside.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo {
  height: 22px;
  width: auto;
  filter: brightness(1.05);
}
.sidebar-logo-fallback {
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.sidebar-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  background: var(--orange-glow);
  border: 1px solid var(--orange-dim);
  padding: 2px 6px;
  border-radius: 3px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar-nav .nav-group-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 14px 12px 6px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 5px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sidebar-nav a:hover {
  background: var(--bg-elev);
  color: var(--text);
}
.sidebar-nav a.active {
  background: var(--green-glow-2);
  color: var(--green);
  border-left-color: var(--green);
}
.sidebar-nav a .nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
}
.sidebar-nav a.active .nav-dot {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

.sidebar-session {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.session-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.session-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green) 0%, var(--orange) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 12px;
  color: var(--black);
  text-transform: uppercase;
  flex-shrink: 0;
}
.session-info { display: flex; flex-direction: column; min-width: 0; }
.session-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.session-pk {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}
.session-meta .signout {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
}
.session-meta .signout:hover { color: var(--orange); }

/* ───── Main content area ───── */
main {
  flex: 1;
  padding: 36px 44px;
  max-width: 1180px;
  width: 100%;
}
main.center { max-width: 480px; margin: 64px auto; padding: 0 24px; }

h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--text);
}
h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 28px 0 12px;
  color: var(--muted);
}

main > p:first-of-type {
  color: var(--muted);
  margin-top: 4px;
  margin-bottom: 24px;
  max-width: 760px;
}
main > p strong { color: var(--text); }

/* ───── Cards ───── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 18px;
  position: relative;
}
.card > h2:first-child { margin-top: 0; }

/* ───── Buttons ───── */
button { font-family: var(--body); }

button.primary {
  background: var(--green);
  color: var(--black);
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s, box-shadow 0.15s;
}
button.primary:hover { background: var(--green-hover); box-shadow: 0 0 16px var(--green-glow); }
button.primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

button.danger {
  background: var(--orange);
  color: var(--black);
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s;
}
button.danger:hover { background: var(--orange-hover); }
button.danger:disabled { opacity: 0.45; cursor: not-allowed; }

button.ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--body);
  font-weight: 500;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
button.ghost:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-glow-2);
}
button.ghost:disabled { opacity: 0.45; cursor: not-allowed; }

/* ───── Forms ───── */
input[type="text"], input[type="number"], textarea, select {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 11px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow-2);
}

.wallet-buttons { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.error { color: var(--orange); margin-top: 12px; font-size: 13px; }
.success { color: var(--green); margin-top: 12px; font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 10px; line-height: 1.5; }

/* ───── Audit table ───── */
table.audit {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-family: var(--mono);
}
table.audit th, table.audit td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.audit th {
  color: var(--muted-2);
  font-weight: 500;
  font-family: var(--mono);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
  background: var(--bg);
}
table.audit td.pk { color: var(--green); }
table.audit td.result.success { color: var(--green); }
table.audit td.result.rejected { color: var(--orange); }
table.audit td.payload {
  color: var(--muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.audit td.reason {
  color: var(--text);
  max-width: 320px;
  white-space: normal;
  word-break: break-word;
  font-family: var(--body);
  font-size: 12.5px;
  line-height: 1.4;
}
table.audit tr:hover td { background: var(--bg-elev-2); }
table.audit tr.clickable { cursor: pointer; }
table.audit tr.clickable:hover td { background: var(--green-glow-2); }

/* ───── Filters bar ───── */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input, .filters select {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 11px;
  border-radius: 5px;
  font-size: 12px;
  font-family: var(--mono);
}
.filters input:focus, .filters select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow-2);
}

/* ───── Sign-in page ───── */
.signin-hero {
  text-align: center;
  margin-bottom: 28px;
}
.signin-hero .logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}
.signin-hero img { height: 32px; filter: brightness(1.1); }
.signin-hero .admin-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--orange);
  background: var(--orange-glow);
  border: 1px solid var(--orange-dim);
  padding: 3px 9px;
  border-radius: 4px;
}
.signin-hero .subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

/* Subtle fingerprint backdrop on sign-in only */
body.signin-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url('1edge_logo_fingerprint.jpg');
  background-size: 720px auto;
  background-position: right -120px center;
  background-repeat: no-repeat;
  opacity: 0.04;
  filter: saturate(0) brightness(1.6);
  pointer-events: none;
  z-index: 0;
}
body.signin-bg main { position: relative; z-index: 1; }

/* ───── Status pills ───── */
.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.status-pill.ok { color: var(--green); background: var(--green-glow); border: 1px solid var(--green-dim); }
.status-pill.danger { color: var(--orange); background: var(--orange-glow); border: 1px solid var(--orange-dim); }

/* Hidden utility used by pages */
.hidden { display: none !important; }

/* ───── Pool ticker autocomplete (attached to pool-address inputs) ───── */
.pool-autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0;
  max-height: 320px; overflow-y: auto;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  z-index: 100; margin-top: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.pool-ac-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.pool-ac-row:last-child { border-bottom: none; }
.pool-ac-row:hover { background: var(--green-glow-2); }
.pool-ac-icon { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.pool-ac-icon-placeholder { background: var(--bg-elev); border: 1px solid var(--border); }
.pool-ac-info { flex: 1; min-width: 0; }
.pool-ac-symbol { font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--text); }
.pool-ac-name { font-family: var(--body); font-size: 11px; color: var(--muted); }
.pool-ac-status {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-2);
}
.pool-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12px; }

/* ───── Responsive ───── */

/* Tablet + small laptop: sidebar collapses into a horizontal top strip. */
@media (max-width: 900px) {
  body { flex-direction: column; }
  aside.sidebar {
    width: 100%;
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    z-index: 50;
  }
  .sidebar-brand {
    padding: 12px 16px;
    border-bottom: none;
    border-right: 1px solid var(--border);
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-nav .nav-group-label { display: none; }
  .sidebar-nav a {
    border-left: none;
    border-bottom: 2px solid transparent;
    margin-left: 0;
    white-space: nowrap;
    padding: 8px 12px;
    flex-shrink: 0;
  }
  .sidebar-nav a .nav-dot { display: none; }
  .sidebar-nav a.active {
    border-left: none;
    border-bottom-color: var(--green);
  }
  .sidebar-session {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    border-top: 1px solid var(--border);
  }
  main { padding: 24px 20px; max-width: 100%; }
  h1 { font-size: 22px; }

  /* Hide low-priority audit columns to keep horizontal scroll manageable. */
  .col-payload { display: none; }

  /* Mobile drawer: collapse the sidebar nav; tap the hamburger to toggle open. */
  .sidebar-brand { cursor: default; }
  .sidebar-hamburger {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    background: transparent; border: 1px solid var(--border-strong);
    color: var(--text); padding: 8px 9px; border-radius: 5px;
    cursor: pointer; margin-left: auto;
    width: 36px; height: 32px;
    transition: border-color 0.15s, background 0.15s;
  }
  .sidebar-hamburger:hover { border-color: var(--green); background: var(--green-glow-2); }
  .hamburger-line {
    display: block; width: 16px; height: 2px; background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
    margin: 0 auto;
  }
  body.ionav .sidebar-hamburger { border-color: var(--green); color: var(--green); }
  body.ionav .sidebar-hamburger .hamburger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.ionav .sidebar-hamburger .hamburger-line:nth-child(2) { opacity: 0; }
  body.ionav .sidebar-hamburger .hamburger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .sidebar-nav {
    padding: 0;
    flex-direction: column;
    max-height: 0;
    overflow-y: hidden;
    transition: max-height 0.2s ease-in;
  }
  .sidebar-nav .nav-group-label { display: block; padding: 12px 12px 4px; }
  .sidebar-nav a {
    border-left: none;
    border-bottom: none;
    border-top: 2px solid transparent;
  }
  .sidebar-nav a.active { border-top: 2px solid var(--green); }
  /* Drawer open: the aside becomes a full-height column — brand pinned at the
     top, session pinned at the bottom, the nav scrolling between them.

     It used to size itself to its content: 952px on a 390x844 phone, inside a
     `position: sticky` element with `top: 0`. A sticky box taller than the
     viewport just stays pinned, so the bottom 108px — the last two nav items
     and the whole Sign out block — sat below the viewport edge with no way to
     reach them. Scrolling the nav internally did not help either: its own
     bottom 56px was off-screen too. */
  body.ionav aside.sidebar {
    height: 100vh;   /* fallback for browsers without dvh */
    height: 100dvh;  /* iOS: excludes the URL bar, which 100vh wrongly includes */
    overflow: hidden;
  }
  body.ionav .sidebar-brand,
  body.ionav .sidebar-session { flex: 0 0 auto; }
  body.ionav .sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;       /* a flex item will not shrink below its content without this */
    max-height: 100dvh;  /* animates open from 0; the flex line does the real sizing */
    overflow-y: auto;
    overscroll-behavior: contain;  /* don't chain the scroll to the page behind */
    -webkit-overflow-scrolling: touch;
  }
  /* Stop the page behind the drawer scrolling under the fingers. body's
     overflow propagates to the viewport while html's stays visible. */
  body.ionav { overflow: hidden; }
}

/* Hamburger hidden on desktop only — must use a media query so it doesn't
   override the display:flex inside (max-width: 900px) which sits earlier
   in the source order. */
@media (min-width: 901px) {
  .sidebar-hamburger { display: none; }
}

/* Phone: tighter padding, full-width inputs/buttons, bigger touch targets. */
@media (max-width: 600px) {
  main { padding: 18px 14px; }
  main.center { padding: 32px 16px; margin-top: 24px; }
  h1 { font-size: 20px; }
  h2 { font-size: 12px; margin: 20px 0 10px; }

  .card { padding: 16px 14px; border-radius: 8px; }

  /* 16px inputs prevent iOS Safari auto-zoom on focus. Pair with broader hits. */
  input[type="text"], input[type="number"], textarea, select {
    font-size: 16px !important;
    padding: 11px 12px;
  }
  .filters input, .filters select { font-size: 14px; padding: 8px 10px; }

  /* Inline `max-width:680px` on forms — override so they fill the viewport. */
  form > div[style*="max-width"] { max-width: 100% !important; }
  textarea[style*="max-width"], input[style*="max-width"] { max-width: 100% !important; }

  /* Buttons get bigger tap targets + full-width primary CTAs. */
  button.primary, button.danger {
    width: 100%;
    padding: 14px 18px;
    font-size: 13px;
  }
  button.ghost {
    padding: 11px 16px;
    font-size: 13px;
  }
  /* Lookup-style ghost buttons stay inline (don't fill width). They sit inside forms
     where full-width feels wrong. Identifiable by NOT being the only button in row. */
  form button.ghost { width: auto; }

  /* Filters bar: stack inputs, full-width controls. */
  .filters { flex-direction: column; align-items: stretch; gap: 6px; }
  .filters input, .filters select { width: 100%; }
  .filters button { width: 100%; margin-left: 0 !important; }

  /* Audit table compaction: smaller cells, hide non-essentials. */
  table.audit { font-size: 11.5px; }
  table.audit th, table.audit td { padding: 7px 8px; }
  .col-error, .col-target { display: none; }
  table.audit td.reason { max-width: 200px; font-size: 11.5px; }

  /* Sidebar session row gets cramped — drop the meta text and keep the avatar+name+signout. */
  .sidebar-session { gap: 8px; }
  .sidebar-session .session-meta span { display: none; }
}

/* Tiny phones (<400px): drop the brand badge so logo fits cleanly. */
@media (max-width: 400px) {
  .sidebar-badge { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Facelift 2026-08-27 — readability + navigation, especially on phones.
   Appended so it wins by source order; nothing above was removed.
   ═══════════════════════════════════════════════════════════════════════ */
html, body { font-size: 15px; line-height: 1.55; }
main { padding: 32px 40px; }
h1 { font-size: 26px; margin-bottom: 8px; }
h2 { font-size: 12.5px; letter-spacing: 0.14em; }
main > p:first-of-type { font-size: 14px; line-height: 1.6; margin-bottom: 22px; }
.card { padding: 20px; border-radius: 12px; margin-bottom: 16px; }
label, .label { color: var(--text-soft); }
button.primary, button.danger, button.ghost { min-height: 38px; border-radius: 8px; }
input[type="text"], input[type="number"], textarea, select { border-radius: 8px; }
/* tables live inside their card and scroll sideways there, never squashed */
.card:has(> table) { padding: 0; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13.5px; }
tr:last-child td { border-bottom: none; }

/* sidebar (desktop): calmer groups, a pill for the active page */
.sidebar-nav .nav-group-label { font-size: 10px; letter-spacing: 0.16em; margin-top: 6px; }
.sidebar-nav a { font-size: 13.5px; padding: 8px 12px; margin: 1px 8px; border-radius: 8px; border-left: none; }
.sidebar-nav a.active { background: var(--green-glow); border-left: none; }
.sidebar-current { display: none; }
.sidebar-backdrop { display: none; }

/* ── Phone: a fixed 56px bar (logo · page · ☰) and a real drawer ── */
@media (max-width: 900px) {
  body { display: block; }
  aside.sidebar {
    position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 60;
    display: flex; flex-direction: row; align-items: center;
    border-bottom: 1px solid var(--border); border-right: none;
    background: var(--bg-sidebar); overflow: visible; width: auto;
  }
  .sidebar-brand { display: flex; align-items: center; gap: 10px; width: 100%; height: 56px; padding: 0 12px 0 14px; border: none; }
  .sidebar-logo { height: 20px; }
  .sidebar-badge { display: none; }
  .sidebar-current { display: block; flex: 1; min-width: 0; font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: 0.02em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 8px; border-left: 1px solid var(--border-strong); }
  .sidebar-hamburger { width: 40px; height: 36px; margin-left: 0; }
  .sidebar-nav, .sidebar-session { display: none; }
  main { padding: 72px 14px 32px; }
  main.center { margin-top: 56px; }
  h1 { font-size: 22px; }
  main > p:first-of-type { font-size: 13.5px; }
  .card { padding: 14px; }
  table { min-width: 560px; }

  /* open */
  body.ionav { overflow: hidden; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 59; }
  body.ionav .sidebar-backdrop { display: block; }
  body.ionav aside.sidebar {
    right: auto; width: min(320px, 86vw); height: 100vh; height: 100dvh;
    flex-direction: column; align-items: stretch; border-right: 1px solid var(--border); border-bottom: none;
    box-shadow: 24px 0 60px rgba(0,0,0,0.6);
  }
  body.ionav .sidebar-brand { flex: 0 0 56px; border-bottom: 1px solid var(--border); }
  body.ionav .sidebar-current { display: none; }
  body.ionav .sidebar-hamburger { margin-left: auto; }
  body.ionav .sidebar-nav {
    display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: none;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 6px 0 12px;
  }
  body.ionav .sidebar-nav .nav-group-label { display: block; padding: 14px 16px 4px; }
  body.ionav .sidebar-nav a { display: flex; align-items: center; min-height: 44px; padding: 10px 14px; margin: 0 8px; font-size: 15px; border: none; border-radius: 8px; }
  body.ionav .sidebar-nav a .nav-dot { display: inline-block; }
  body.ionav .sidebar-nav a.active { background: var(--green-glow); border: none; }
  body.ionav .sidebar-session { display: flex; flex: 0 0 auto; flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
  body.ionav .sidebar-session .session-meta { display: flex; justify-content: space-between; align-items: center; }
  body.ionav .sidebar-session .session-meta span { display: inline; }
}
/* desktop sidebar: never clip the last groups — the nav scrolls between brand and session */
@media (min-width: 901px) {
  .sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding-bottom: 8px; }
  .sidebar-nav a { padding: 6px 12px; margin: 0 8px; font-size: 13px; }
  .sidebar-nav .nav-group-label { margin-top: 4px; padding-top: 10px; padding-bottom: 2px; }
}
/* install (PWA) — sidebar, signed-in only */
.install-btn { margin-top: 10px; width: 100%; min-height: 38px; border-radius: 8px; border: 1px solid rgba(74,222,74,0.4); background: var(--green-glow); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.install-btn:hover { border-color: var(--green); }
.pwa-ios-help { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.7); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.pwa-ios-card { background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: 14px; padding: 18px; width: min(420px, 100%); }
.pwa-ios-card h3 { margin: 0 0 10px; font-family: var(--display); font-size: 16px; }
.pwa-ios-card ol { margin: 0 0 14px; padding-left: 20px; color: var(--text-soft); line-height: 1.7; }
.pwa-share { display: inline-block; border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; margin: 0 2px; }

/* ═══════════════════════════════════════════════════════════════════════
   Kit 2026-09-02 — the base every page inherits (phase 2 of the back office).
   Appended so it wins by source order. Labels/headings/values: JetBrains
   Mono, uppercase, tracked. Body: Inter. Cards quiet, radius 10px. Every
   <button> gets the ghost look by default so nothing renders in the
   browser's own white; .primary / .danger / .ghost refine it. Page <style>
   blocks still win over this (they come later in the cascade).
   ═══════════════════════════════════════════════════════════════════════ */
html, body { font-size: 14px; line-height: 1.5; font-family: var(--sans); }
main { padding: 22px 26px 40px; max-width: 1240px; }
h1 { font-family: var(--mono); font-weight: 600; font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--green); margin: 0 0 4px; }
h1 code, h1 span { letter-spacing: 0; text-transform: none; }
h2 { font-family: var(--mono); font-weight: 500; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px; }
h3 { font-family: var(--sans); font-weight: 600; font-size: 14px; margin: 12px 0 6px; color: var(--text); }
main > p:first-of-type { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0 0 16px; max-width: 80ch; }
main > p:first-of-type strong, main > p:first-of-type b { color: var(--text); font-weight: 600; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--text-soft); }
label, .label { color: var(--text-soft); }

.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; margin-bottom: var(--gap); }
.card > h2:first-child { margin-top: 0; }

/* buttons: ghost by default */
button {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.2;
  background: transparent; color: var(--text-soft); border: 1px solid var(--border-strong); border-radius: 7px;
  padding: 7px 11px; min-height: 32px; cursor: pointer; transition: color 0.12s, border-color 0.12s, background 0.12s;
}
button:hover { border-color: var(--green); color: var(--green); background: var(--green-glow-2); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--text-soft); font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; padding: 7px 11px; min-height: 32px; border-radius: 7px; }
button.ghost:hover { border-color: var(--green); color: var(--green); background: var(--green-glow-2); }
button.primary { background: var(--green); color: var(--black); border: 1px solid var(--green); font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; padding: 7px 13px; min-height: 32px; border-radius: 7px; }
button.primary:hover { background: var(--green-hover); border-color: var(--green-hover); color: var(--black); box-shadow: 0 0 14px var(--green-glow); }
button.danger { background: transparent; color: var(--danger); border: 1px solid rgba(239,68,68,0.45); font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; padding: 7px 13px; min-height: 32px; border-radius: 7px; }
button.danger:hover { background: var(--danger-glow); border-color: var(--danger); color: var(--danger); }
button.primary:disabled, button.danger:disabled, button.ghost:disabled { box-shadow: none; }
/* icon-only refresh buttons in the old pages: keep them bare */
button.refresh-btn { font: inherit; letter-spacing: 0; text-transform: none; }
/* the shell's own buttons set their own type; zero-specificity reset so the
   base rule above never leaks into the rail, top bar, tabs, sheets or ⌘K */
:where(aside.ash-rail, .ash-top, .ash-tabs, .ash-sheet, .ash-cmd, .ash-backdrop) button { letter-spacing: 0; text-transform: none; font-size: inherit; min-height: 0; padding: 0; border: none; border-radius: 0; background: none; }
:where(aside.ash-rail, .ash-top, .ash-tabs, .ash-sheet, .ash-cmd) button:hover { background: none; border-color: inherit; color: inherit; }

/* inputs */
input[type="text"], input[type="number"], input[type="email"], input[type="url"], input[type="date"], textarea, select {
  background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--r); padding: 8px 10px; font-family: var(--sans); font-size: 13px; color-scheme: dark;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="date"]:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-glow-2); outline: none; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
.filters input, .filters select { font-family: var(--mono); font-size: 12px; }

/* tables: mono header row, tabular numbers */
th { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; }
td { font-size: 13px; padding: 9px 10px; font-variant-numeric: tabular-nums; }
table.audit { font-size: 12px; }
table.audit th { font-size: 9.5px; letter-spacing: 0.14em; background: transparent; color: var(--muted); }
.status-pill { font-weight: 500; border-radius: 5px; }

/* sign-in page keeps its hero */
.signin-hero .admin-badge { border-radius: 5px; }
.sidebar-logo-fallback, .session-name { font-family: var(--mono); }

@media (max-width: 900px) {
  main { padding: 72px 14px 32px; }
  h1 { font-size: 12px; }
  .card { padding: 12px; }
  table { min-width: 560px; }
  table.ui-table, table.rc-t, table.tm-table { min-width: 0; }
}
@media (max-width: 600px) {
  html, body { font-size: 14px; }
  button.primary, button.danger { width: auto; padding: 9px 14px; font-size: 11px; }
  button.ghost { padding: 8px 12px; font-size: 11px; }
  .filters button { width: 100%; }
}

/* Chain marks (n-admin, 2026-09-29): the homepage's chain-*.svg next to a token. */
.chain-mark { display: inline-block; vertical-align: -2px; border-radius: 50%; flex: none; }
.chain-pill { display: inline-flex; align-items: center; gap: 5px; }
