@font-face {
  font-family: "IBM Plex Mono";
  src: url("/ui/fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/ui/fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/ui/fonts/ibm-plex-mono-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/ui/fonts/ibm-plex-sans-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/ui/fonts/ibm-plex-sans-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/ui/fonts/ibm-plex-sans-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #03113f;
  --ink-2: #061f74;
  --surface: rgba(6, 32, 96, 0.72);
  --surface-strong: rgba(7, 27, 82, 0.94);
  --surface-soft: rgba(220, 242, 255, 0.08);
  --paper: #f7fbff;
  --text: #e9f6ff;
  --muted: #a8c5e8;
  --faint: #6d91c7;
  --line: rgba(211, 235, 255, 0.2);
  --line-soft: rgba(211, 235, 255, 0.11);
  --green: #6ff4ff;
  --green-2: #d8fbff;
  --amber: #efb45b;
  --red: #ef715d;
  --blue: #1b6dff;
  --violet: #8aa7ff;
  --shadow: 0 24px 80px rgba(0, 18, 70, 0.42);
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --r: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  min-height: 100%;
}

/* color-scheme: dark makes the canvas (overscroll / any area the body gradient
   doesn't cover) paint near-black. Anchor it to the gradient's bottom color so
   there's no black gap below the content. */
html {
  background-color: #020b31;
}

body {
  background:
    repeating-linear-gradient(90deg, rgba(116, 229, 255, 0.1) 0 18px, rgba(13, 74, 202, 0.16) 18px 38px, rgba(4, 26, 91, 0.54) 38px 74px),
    linear-gradient(90deg, rgba(211, 235, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(211, 235, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #041b60 0%, #06236f 46%, #020b31 100%);
  background-size: 180px 100%, 64px 64px, 64px 64px, 100% 100%;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 24%, transparent 76%, rgba(111, 244, 255, 0.14)),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(255, 255, 255, 0.045) 31px 32px),
    linear-gradient(180deg, transparent 0%, rgba(1, 6, 31, 0.58) 100%);
  mix-blend-mode: screen;
  opacity: 0.72;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.86), rgba(95, 217, 255, 0.48) 28%, rgba(4, 26, 106, 0.96) 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0 18px, rgba(0, 129, 255, 0.82) 18px 42px, rgba(0, 28, 117, 0.96) 42px 76px);
  transform-origin: top;
  animation: console-curtain 920ms cubic-bezier(0.7, 0, 0.2, 1) 80ms forwards;
}

@keyframes console-curtain {
  0% { opacity: 1; transform: scaleY(1); filter: blur(0); }
  62% { opacity: 0.96; transform: scaleY(0.34); }
  100% { opacity: 0; transform: scaleY(0); filter: blur(10px); visibility: hidden; }
}

@keyframes console-in {
  from { opacity: 0; transform: translateY(18px); filter: blur(10px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

::selection {
  color: #071009;
  background: var(--green);
}

a { color: inherit; }

.app {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 14px;
}

.app.connecting {
  display: block;
  padding: 0;
}

.app.connecting .main {
  max-width: none;
  padding: 0;
}

.main {
  min-width: 0;
  max-width: 1220px;
  padding: 2px 0 56px;
}

.sidebar {
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 28px);
  padding: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(4, 29, 93, 0.88), rgba(3, 13, 55, 0.86));
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: console-in 680ms cubic-bezier(0.22, 1, 0.36, 1) 260ms both;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0 18px, rgba(38, 148, 255, 0.12) 18px 38px, transparent 38px 74px),
    linear-gradient(90deg, rgba(111, 244, 255, 0.17), transparent 34%),
    repeating-linear-gradient(180deg, rgba(211, 235, 255, 0.055) 0 1px, transparent 1px 42px);
  opacity: 0.62;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.wordmark-dot {
  width: 16px;
  height: 16px;
  position: relative;
  border: 1px solid rgba(113, 232, 167, 0.72);
  background:
    linear-gradient(90deg, transparent 44%, var(--green) 44% 56%, transparent 56%),
    linear-gradient(180deg, transparent 44%, var(--green) 44% 56%, transparent 56%);
}

.wordmark-dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(239, 180, 91, 0.6);
}

.wordmark-text {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--paper);
}

.nav {
  display: grid;
  gap: 5px;
  margin-top: 18px;
}

.nav a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  transition: background-color 170ms ease, border-color 170ms ease, color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

.nav a:hover {
  color: var(--paper);
  border-color: rgba(111, 244, 255, 0.36);
  background: rgba(111, 244, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(111, 244, 255, 0.12);
  transform: translateX(4px);
}

.nav a.active {
  color: #03113f;
  border-color: rgba(247, 251, 255, 0.72);
  background:
    linear-gradient(90deg, rgba(247, 251, 255, 0.96), rgba(111, 244, 255, 0.88));
  box-shadow: 0 18px 40px rgba(0, 91, 255, 0.22);
}

.nav-key {
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.nav a.active .nav-key { color: rgba(7, 16, 9, 0.72); }

.sidebar-foot {
  position: relative;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
}

.sidebar-foot .org-name,
.sidebar-foot .org-slug {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-foot .org-name {
  color: var(--paper);
  font-weight: 600;
}

.sidebar-foot .org-slug {
  margin-top: 2px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.foot-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.sidebar-foot .foot-link {
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 11px;
}

.sidebar-foot .foot-link::after {
  display: none;
}

.sidebar-foot .foot-link:hover {
  color: var(--green);
  background: transparent;
}

.sidebar-foot .foot-link:last-child:hover { color: var(--red); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 4px 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: console-in 620ms cubic-bezier(0.22, 1, 0.36, 1) 340ms both;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: lowercase;
}

.page-title::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid var(--green);
  background: rgba(113, 232, 167, 0.18);
  box-shadow: inset 0 0 0 3px rgba(113, 232, 167, 0.18);
}

.page-desc {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(3, 31, 101, 0.5);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
  transition: border-color 170ms ease, background-color 170ms ease, box-shadow 170ms ease;
}

.topbar-status:hover {
  background: rgba(12, 76, 176, 0.34);
  border-color: rgba(111, 244, 255, 0.36);
  box-shadow: 0 18px 48px rgba(0, 91, 255, 0.2);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--faint);
  border: 1px solid rgba(232, 226, 207, 0.28);
}

.status-dot.ok {
  background: var(--green);
  border-color: rgba(113, 232, 167, 0.78);
}

.status-dot.bad {
  background: var(--red);
  border-color: rgba(239, 113, 93, 0.78);
}

.view {
  display: grid;
  gap: 14px;
}

.section {
  background:
    linear-gradient(180deg, rgba(220, 242, 255, 0.12), rgba(220, 242, 255, 0.035)),
    var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  animation: rise-in 430ms var(--ease) both;
}

.section:hover {
  border-color: rgba(111, 244, 255, 0.34);
  box-shadow: 0 30px 90px rgba(0, 91, 255, 0.24);
  transform: translateY(-2px);
}

.section:nth-child(2) { animation-delay: 35ms; }
.section:nth-child(3) { animation-delay: 70ms; }
.section:nth-child(4) { animation-delay: 105ms; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  background:
    linear-gradient(90deg, rgba(111, 244, 255, 0.17), transparent 45%),
    rgba(3, 13, 55, 0.2);
}

.section-title {
  margin: 0;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-title::before {
  content: "[";
  color: var(--green);
  margin-right: 4px;
}

.section-title::after {
  content: "]";
  color: var(--green);
  margin-left: 4px;
}

.section-desc {
  margin: 0;
  padding: 12px 16px 0;
  color: var(--muted);
  font-size: 12.5px;
}

.section-body {
  padding: 16px;
  overflow-x: auto;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(144px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.stat {
  min-height: 104px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(220, 242, 255, 0.08), rgba(220, 242, 255, 0.025)),
    rgba(3, 13, 55, 0.3);
  transition: background-color 170ms ease, transform 170ms ease;
}

.stat:hover {
  background-color: rgba(18, 84, 190, 0.24);
  transform: translateY(-2px);
}

.stat-value {
  color: var(--paper);
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.stat-label {
  margin-top: 12px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  counter-reset: line;
  font-size: 12.5px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0 14px 10px 0;
  color: var(--faint);
  background: rgba(5, 28, 88, 0.96);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

th:first-child { padding-left: 40px; }

td {
  padding: 11px 14px 11px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

tbody tr {
  counter-increment: line;
  transition: background-color 140ms ease;
}

tbody tr:last-child td { border-bottom: 0; }

tbody tr:hover td {
  background: rgba(111, 244, 255, 0.075);
}

tbody tr.clickable { cursor: pointer; }

td:first-child::before {
  content: counter(line, decimal-leading-zero);
  display: inline-block;
  width: 26px;
  margin-right: 14px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
  opacity: 0.72;
}

tr.row-selected td {
  background: rgba(113, 232, 167, 0.07);
}

tr.row-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--green);
}

tr.row-selected td:first-child::before {
  content: ">";
  color: var(--green);
  opacity: 1;
}

th:last-child,
td:last-child { padding-right: 0; }

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.actions { text-align: right; }

.cell-link {
  color: var(--green-2);
  text-decoration: none;
}

.cell-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.mono {
  font-family: var(--mono);
  font-size: 11.5px;
}

.dim { color: var(--muted); }
.faint { color: var(--faint); }

.severity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

.severity::before {
  content: "";
  width: 7px;
  height: 7px;
  background: currentColor;
}

.severity.critical { color: var(--red); }
.severity.high { color: #f09454; }
.severity.medium { color: var(--amber); }
.severity.low { color: var(--blue); }
.severity.info { color: var(--faint); }

button,
.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  color: var(--paper);
  overflow: hidden;
  background: rgba(220, 242, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  transition: background-color 170ms ease, border-color 170ms ease, color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

button::after,
.button::after {
  content: "";
  position: absolute;
  inset: -140% -42%;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.44) 48%, transparent 58%);
  transform: translateX(-66%) rotate(8deg);
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

button:hover {
  color: #ffffff;
  background: rgba(111, 244, 255, 0.12);
  border-color: rgba(111, 244, 255, 0.38);
  box-shadow: 0 18px 48px rgba(0, 91, 255, 0.22);
  transform: translateY(-2px);
}

button:hover::after,
.button:hover::after { transform: translateX(66%) rotate(8deg); }

button.primary {
  color: #03113f;
  background: #ffffff;
  border-color: rgba(247, 251, 255, 0.88);
  font-weight: 600;
}

button.primary:hover {
  color: #03113f;
  background: var(--green-2);
}

button.quiet-danger {
  min-height: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
}

button.quiet-danger::after {
  display: none;
}

button.quiet-danger:hover {
  color: var(--red);
  background: transparent;
  transform: none;
}

button:disabled {
  cursor: default;
  opacity: 0.48;
  transform: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  color: var(--paper);
  background: rgba(1, 7, 36, 0.54);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

input::placeholder { color: var(--faint); }

input:hover,
select:hover {
  border-color: rgba(111, 244, 255, 0.32);
}

input:focus,
select:focus {
  outline: 0;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(111, 244, 255, 0.18), 0 18px 44px rgba(0, 91, 255, 0.18);
  background: rgba(1, 7, 36, 0.86);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.field { margin-bottom: 12px; }

.panel {
  max-width: 760px;
  padding: 14px;
  background: rgba(3, 13, 55, 0.34);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  transition: border-color 170ms ease, background-color 170ms ease, box-shadow 170ms ease;
}

.panel:hover {
  background: rgba(12, 76, 176, 0.22);
  border-color: rgba(111, 244, 255, 0.32);
  box-shadow: 0 18px 54px rgba(0, 91, 255, 0.18);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.form-row .field { margin-bottom: 0; }
.form-row button { white-space: nowrap; }

.usage {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.usage-track {
  position: relative;
  flex: 1;
  height: 7px;
  overflow: hidden;
  background: rgba(220, 242, 255, 0.1);
  border: 1px solid rgba(220, 242, 255, 0.1);
}

.usage-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 18px, rgba(1, 7, 36, 0.42) 18px 19px);
}

.usage-fill {
  position: relative;
  z-index: 1;
  height: 100%;
  background: var(--green);
}

.usage-fill.warn { background: var(--amber); }
.usage-fill.over { background: var(--red); }

.usage-pct {
  width: 44px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 4px;
  animation: rise-in 360ms var(--ease) both;
}

.toolbar input {
  max-width: 340px;
}

.toolbar .spacer { flex: 1; }

.connect-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    repeating-linear-gradient(90deg, rgba(116, 229, 255, 0.1) 0 18px, rgba(13, 74, 202, 0.16) 18px 38px, rgba(4, 26, 91, 0.54) 38px 74px),
    linear-gradient(90deg, rgba(211, 235, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(211, 235, 255, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, rgba(111, 244, 255, 0.15), transparent 32%),
    var(--ink);
  background-size: 180px 100%, 48px 48px, 48px 48px, 100% 100%, 100% 100%;
}

.connect-box {
  width: min(420px, 100%);
  padding: 26px;
  background: linear-gradient(180deg, rgba(10, 48, 130, 0.72), rgba(3, 13, 55, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  animation: console-in 760ms var(--ease) 320ms both;
}

.connect-box:hover {
  border-color: rgba(111, 244, 255, 0.42);
  box-shadow: 0 30px 100px rgba(0, 91, 255, 0.3);
  transform: translateY(-3px);
}

.connect-box .wordmark { min-height: 32px; }

.connect-box h1 {
  margin: 20px 0 6px;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: lowercase;
}

.connect-box p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.notice {
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.notice.error {
  color: var(--red);
}

.notice.ok {
  color: var(--green);
}

.notice-flash::before { content: "ok: "; }

.notice-flash {
  animation: flash-fade 4s ease forwards;
}

@keyframes flash-fade {
  0%, 72% { opacity: 1; }
  100% { opacity: 0; }
}

.empty,
.loading {
  padding: 18px 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

.empty::before,
.loading::before {
  content: "// ";
}

.loading::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 6px;
  vertical-align: text-bottom;
  background: var(--faint);
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.18; }
}

.cmd-hint {
  display: inline-block;
  max-width: 100%;
  padding: 10px 12px;
  overflow-x: auto;
  color: var(--muted);
  background: rgba(1, 7, 36, 0.54);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
  user-select: all;
}

.cmd-prompt {
  color: var(--green);
  user-select: none;
}

.confirm-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.confirm-yes,
.confirm-no {
  min-height: 24px;
  padding: 0 8px;
  font-size: 11px;
}

.confirm-yes {
  color: var(--red);
  border-color: rgba(239, 113, 93, 0.42);
}

.keymap-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(8, 9, 7, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.keymap-panel {
  width: min(340px, calc(100vw - 32px));
  padding: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  animation: rise-in 200ms var(--ease) both;
}

.keymap-title {
  margin-bottom: 14px;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.keymap-list {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px 14px;
  margin: 0;
}

.keymap-list dt,
.keymap-list dd {
  margin: 0;
  font-size: 12px;
}

.keymap-list dd { color: var(--muted); }

kbd {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  color: var(--paper);
  background: rgba(234, 228, 210, 0.07);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
}

.keymap-foot {
  margin-top: 16px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  animation: rise-in 360ms var(--ease) both;
}

.detail-head .back {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
}

.detail-head .back::before {
  content: "< ";
  color: var(--green);
}

.detail-head .back:hover { color: var(--paper); }

.kv {
  display: grid;
  grid-template-columns: minmax(110px, 150px) 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 12.5px;
}

.kv dt {
  margin: 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: lowercase;
}

.kv dd {
  margin: 0;
  color: var(--text);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
  background: rgba(234, 228, 210, 0.14);
  border: 2px solid transparent;
  border-radius: 6px;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover { background-color: rgba(234, 228, 210, 0.24); }

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-foot {
    margin-top: 16px;
  }

  .topbar {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body { font-size: 12.5px; }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav a {
    min-height: 34px;
  }

  .page-title {
    font-size: 21px;
  }

  .topbar-status {
    width: 100%;
  }

  .section-head,
  .section-body,
  .section-desc {
    padding-left: 12px;
    padding-right: 12px;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .stat {
    min-height: 92px;
    padding: 12px;
  }

  .stat-value {
    font-size: 20px;
  }

  .toolbar input {
    max-width: none;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .usage {
    min-width: 170px;
  }
}

body {
  background:
    linear-gradient(180deg, #071a3a 0%, #061532 48%, #081b3b 100%);
}

body::before {
  background:
    linear-gradient(90deg, rgba(111, 244, 255, 0.08), transparent 24%, transparent 76%, rgba(255, 255, 255, 0.06)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(2, 9, 35, 0.44));
  mix-blend-mode: normal;
  opacity: 1;
}

body::after {
  background: #071a3a;
  animation: console-fade 460ms ease-out 80ms forwards;
}

@keyframes console-fade {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

.sidebar,
.section,
.connect-box,
.keymap-panel {
  background: rgba(8, 31, 76, 0.68);
  border-color: rgba(221, 236, 255, 0.16);
  box-shadow: 0 24px 72px rgba(2, 9, 35, 0.3);
}

.sidebar::before {
  background:
    linear-gradient(135deg, rgba(111, 244, 255, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 42%);
  opacity: 1;
}

.connect-wrap {
  background:
    linear-gradient(135deg, rgba(111, 244, 255, 0.1), transparent 32%),
    linear-gradient(180deg, #071a3a, #061532);
}

.section:hover,
.connect-box:hover,
.panel:hover,
.topbar-status:hover {
  background: rgba(11, 47, 110, 0.72);
  border-color: rgba(141, 244, 255, 0.36);
  box-shadow: 0 28px 86px rgba(2, 9, 35, 0.34);
}

.nav a:hover {
  background: rgba(141, 244, 255, 0.1);
  border-color: rgba(141, 244, 255, 0.32);
}

.nav a.active,
button.primary {
  color: #061532;
  background: #f8fbff;
  border-color: rgba(248, 251, 255, 0.82);
}

button.primary:hover {
  color: #061532;
  background: #dff8ff;
}

button::after,
.button::after {
  display: none;
}

button:hover,
.button:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 46px rgba(2, 9, 35, 0.28);
}

button.quiet-danger:hover,
.sidebar-foot .foot-link:hover {
  box-shadow: none;
  transform: none;
}

tbody tr:hover td {
  background: rgba(141, 244, 255, 0.08);
}

.stat:hover,
.panel:hover {
  transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* Viewer (read-only) keys never see admin-only controls. */
body.role-viewer .admin-only { display: none !important; }

.role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
}
.role-badge.role-admin { color: var(--green-2); border-color: rgba(111, 244, 255, 0.5); }
.role-badge.role-viewer { color: var(--muted); }
.new-key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.key-actions { display: inline-flex; align-items: center; gap: 8px; }
.key-actions .key-role,
.owner-select { width: auto; min-height: 28px; padding: 0 26px 0 8px; font-size: 11px; }
/* Admins edit the owner via the dropdown; viewers just see the email. */
body:not(.role-viewer) .owner-text { display: none; }
.new-key { word-break: break-all; flex: 1; min-width: 240px; }
.new-key-row button { flex: none; min-height: 30px; padding: 0 12px; }
.new-key-countdown { font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

/* GitHub repo manager */
.repo-add { max-width: 760px; }

.repo-add-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.repo-add-input {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  padding: 10px 11px;
  color: var(--paper);
  background: rgba(1, 7, 36, 0.54);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.repo-add-input::placeholder { color: var(--faint); }
.repo-add-input:hover { border-color: rgba(111, 244, 255, 0.32); }

.repo-add-input:focus {
  outline: 0;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(111, 244, 255, 0.18), 0 18px 44px rgba(0, 91, 255, 0.18);
  background: rgba(1, 7, 36, 0.86);
}

.repo-add-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.repo-add-hint { font-size: 11px; }

.repo-install {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 760px;
  padding: 13px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: rgba(12, 76, 176, 0.14);
}

.repo-install-title { font-weight: 600; }
.repo-install-desc { font-size: 12px; margin-top: 2px; }

.repo-install-btn {
  flex: none;
  padding: 0 16px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  color: var(--ink);
  background: var(--green);
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  transition: filter 140ms ease, box-shadow 140ms ease;
}

.repo-install-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 0 0 3px rgba(111, 244, 255, 0.18);
}

.repo-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
