/* ─────────────────────────────────────────────────────────────────────────────
   Funzor · Ark Console — dark technical theme for the static control-plane UI.
   Dependency-free, system fonts only, no external assets.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #070a0e;
  --bg-elev: #0b1016;
  --bg-elev-2: #0f161e;
  --bg-input: #080d12;
  --panel: #0c1219;
  --line: #1c2631;
  --line-soft: #151d26;
  --text: #d8e2ea;
  --text-dim: #8e9daa;
  --text-mute: #5b6a77;
  --accent: #5eead4;
  --accent-2: #7dd3fc;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #93c5fd;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --header-h: 60px;
  --maxw: 1260px;
  --focus-ring: 0 0 0 2px rgba(94, 234, 212, 0.55);
}

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

/* biome-ignore lint/style/noImportantStyles: hidden must override component display rules such as .login/.app */
[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(920px 460px at 12% -12%, rgba(94, 234, 212, 0.09), transparent 62%),
    radial-gradient(760px 420px at 88% -4%, rgba(125, 211, 252, 0.06), transparent 58%),
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size:
    auto,
    auto,
    52px 52px,
    52px 52px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(94, 234, 212, 0.25);
  color: #eafffb;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

.muted {
  color: var(--text-mute);
}

.nowrap {
  white-space: nowrap;
}

.num {
  font-family: var(--mono);
  text-align: right;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
}

.skip-link:focus {
  top: 12px;
}

.noscript {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 24px auto;
  max-width: 640px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text-dim);
}

/* ── Brand ──────────────────────────────────────────────────────────────── */

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  align-self: center;
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--accent);
  border-radius: 3px;
  transform: rotate(45deg) scale(0.74);
  box-shadow:
    inset 0 0 10px rgba(94, 234, 212, 0.35),
    0 0 14px rgba(94, 234, 212, 0.16);
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 1px;
  background: var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 8px var(--accent);
}

.brand-word {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}

/* ── Login ──────────────────────────────────────────────────────────────── */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
}

.login-card {
  width: min(430px, 100%);
  padding: 34px 32px 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

.login-brand {
  margin-bottom: 22px;
}

.login-brand .brand-word {
  font-size: 18px;
}

.login-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.login-lead {
  margin: 0 0 20px;
  color: var(--text-dim);
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.token-row {
  display: flex;
  gap: 8px;
}

.token-row input {
  flex: 1;
  min-width: 0;
}

.login-foot {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--text-mute);
  font-size: 11.5px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.08s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(180deg, #71f0dc, #3ed3bd);
  border-color: rgba(94, 234, 212, 0.7);
  color: #04120f;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #8bf5e4, #4be0c9);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.015);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: #2a3946;
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger {
  background: linear-gradient(180deg, #f88080, #e25555);
  border-color: rgba(248, 113, 113, 0.7);
  color: #1a0505;
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #ff9a9a, #eb6666);
}

.btn-danger-ghost {
  border-color: rgba(248, 113, 113, 0.35);
  color: #f9a8a8;
  background: rgba(248, 113, 113, 0.07);
}

.btn-danger-ghost:hover:not(:disabled) {
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.btn.is-busy::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

/* ── App shell / header ─────────────────────────────────────────────────── */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 10, 14, 0.82);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(12px);
}

.app-header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--header-h);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 30px);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.app-nav a {
  padding: 6px 11px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.app-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.app-nav a[aria-current="page"] {
  color: var(--accent);
  background: rgba(94, 234, 212, 0.08);
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.16);
}

.app-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
}

.health-pill .dot,
.follow-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
  flex: 0 0 auto;
}

.health-pill.is-ok .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.12);
}

.health-pill.is-down .dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

.health-pill.is-ok {
  color: #9fe8b8;
  border-color: rgba(74, 222, 128, 0.22);
}

.health-pill.is-down {
  color: #f3a4a4;
  border-color: rgba(248, 113, 113, 0.24);
}

.principal {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.principal-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.role-badge,
.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.role-badge {
  color: var(--accent-2);
  border-color: rgba(125, 211, 252, 0.25);
  background: rgba(125, 211, 252, 0.06);
}

.chip--muted {
  color: var(--text-mute);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 1.5px;
  background: var(--text-dim);
  border-radius: 2px;
  transition: transform 0.15s ease;
}

.main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 32px) clamp(14px, 3vw, 30px) 56px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  align-items: center;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 14px clamp(14px, 3vw, 30px) 22px;
  border-top: 1px solid var(--line-soft);
  color: var(--text-mute);
  font-size: 11px;
}

.app-footer .mono {
  margin-left: auto;
  opacity: 0.8;
}

/* ── Page headers / toolbars ────────────────────────────────────────────── */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head-text {
  min-width: 0;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 650;
  letter-spacing: -0.015em;
}

.page-subtitle {
  margin: 5px 0 0;
  color: var(--text-dim);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--text-dim);
  font-size: 12px;
}

.back-link:hover {
  color: var(--text);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-note {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 12.5px;
}

.hint-line {
  margin: 0;
  color: var(--text-mute);
  font-size: 12px;
}

.link {
  color: var(--accent-2);
  font-size: 12.5px;
  white-space: nowrap;
}

.dot-sep {
  color: var(--text-mute);
}

/* ── Panels / cards ─────────────────────────────────────────────────────── */

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0) 60%), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel-count {
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 11px;
}

.health-strip {
  display: flex;
  align-items: center;
  gap: 10px 22px;
  flex-wrap: wrap;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--bg-elev);
  font-size: 12.5px;
  color: var(--text-dim);
}

.health-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* biome-ignore lint/style/noDescendingSpecificity: dot variants are scoped to their own component */
.health-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.health-status.is-ok {
  color: var(--ok);
}

.health-status.is-ok .dot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.1);
}

.health-status.is-down {
  color: var(--danger);
}

.health-status.is-down .dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.1);
}

.health-item code {
  color: var(--text);
}

.health-refresh {
  margin-left: auto;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 15px 16px 13px;
  border-top: 2px solid transparent;
  transition: border-color 0.15s ease;
}

.stat-card:hover {
  border-top-color: rgba(94, 234, 212, 0.35);
}

.stat-label {
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.stat-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-hint {
  color: var(--text-dim);
  font-size: 11.5px;
}

.stat-card--warn {
  border-top-color: rgba(251, 191, 36, 0.3);
}

.stat-card--warn .stat-value {
  color: var(--warn);
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* ── Tables ─────────────────────────────────────────────────────────────── */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 10px 14px;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
}

.data-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--line-soft);
  vertical-align: middle;
}

.data-table tbody tr:first-child td {
  border-top: 0;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.022);
}

.row-click {
  cursor: pointer;
}

.row-click:focus-visible {
  outline-offset: -2px;
}

.cell-task {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
  max-width: 380px;
}

.cell-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}

.cell-sub {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10.5px;
}

.cell-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
  display: inline-block;
  vertical-align: bottom;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

/* ── Badges / chips / priority ──────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.badge--muted {
  color: var(--text-mute);
  background: rgba(255, 255, 255, 0.025);
}

.badge--info {
  color: #a8c7f7;
  border-color: rgba(147, 197, 253, 0.24);
  background: rgba(147, 197, 253, 0.07);
}

.badge--ok {
  color: #93e7ad;
  border-color: rgba(74, 222, 128, 0.26);
  background: rgba(74, 222, 128, 0.07);
}

.badge--warn {
  color: #fbd88c;
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.07);
}

.badge--danger {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}

.badge--live {
  color: var(--accent);
  border-color: rgba(94, 234, 212, 0.32);
  background: rgba(94, 234, 212, 0.08);
}

.badge--live .badge-dot {
  animation: pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(94, 234, 212, 0.8);
}

.priority {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.priority--high {
  color: var(--accent-2);
}

.priority--low {
  color: var(--text-mute);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */

.form-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent), var(--bg-elev);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field--wide {
  grid-column: span 2;
}

.field-label {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-hint {
  margin: 0;
  color: var(--text-mute);
  font-size: 11.5px;
}

.field-hint code {
  color: var(--text-dim);
}

input:not([type="checkbox"]),
textarea,
.select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

input::placeholder,
textarea::placeholder {
  color: #46535f;
}

input:not([type="checkbox"]):focus,
textarea:focus,
.select:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: var(--focus-ring);
}

input:disabled,
textarea:disabled,
.select:disabled {
  opacity: 0.55;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  min-width: 150px;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, #6f7f8c 50%),
    linear-gradient(135deg, #6f7f8c 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.field .select {
  width: 100%;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.check-column {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 3px;
}

.form-actions {
  grid-column: span 2;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 2px;
}

.form-error {
  grid-column: span 2;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-left: 3px solid var(--danger);
  border-radius: 7px;
  background: rgba(248, 113, 113, 0.07);
  color: #fca5a5;
  font-size: 12.5px;
}

/* ── Project cards ──────────────────────────────────────────────────────── */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease,
    background-color 0.15s ease;
}

.project-card:hover,
.project-card:focus-visible {
  border-color: rgba(94, 234, 212, 0.32);
  transform: translateY(-1px);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.project-name {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-desc {
  margin: 0;
  min-height: 38px;
  color: var(--text-dim);
  font-size: 12.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-meta {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 4px 10px;
  margin: 0;
  font-size: 11.5px;
}

.project-meta dt {
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding-top: 1px;
}

.project-meta dd {
  margin: 0;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-mute);
  font-size: 11.5px;
}

/* ── JSON details ───────────────────────────────────────────────────────── */

details.json {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #070b10;
  padding: 0 10px;
}

details.json > summary {
  padding: 7px 0;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

details.json > summary::-webkit-details-marker {
  display: none;
}

details.json > summary::before {
  content: "▸ ";
  color: var(--text-mute);
}

details.json[open] > summary::before {
  content: "▾ ";
}

details.json > summary:hover {
  color: var(--text-dim);
}

.json-text {
  margin: 0 0 10px;
  max-height: 300px;
  overflow: auto;
  color: #a9b9c7;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Approvals ──────────────────────────────────────────────────────────── */

.approval-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.approval-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.approval-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.approval-title-wrap {
  min-width: 0;
}

.approval-title {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 600;
}

.approval-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--text-mute);
  font-size: 11.5px;
}

.approval-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}

.approval-actions {
  display: flex;
  gap: 8px;
}

/* ── Run detail / timeline ──────────────────────────────────────────────── */

.run-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 24px;
  margin: 0;
}

.meta-item {
  min-width: 0;
}

.meta-grid dt {
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.meta-grid dd {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 12.5px;
  word-break: break-word;
}

.meta-strong {
  font-weight: 600;
}

.run-note {
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
}

.run-note--error {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.05);
}

.run-note-title {
  margin: 0 0 6px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.run-note-text {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  white-space: pre-wrap;
}

.run-error {
  margin: 0;
  color: #fca5a5;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
}

.run-flag {
  margin: 0;
  padding: 8px 12px;
  border: 1px dashed rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  color: #fbd88c;
  font-size: 12px;
}

.follow-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.follow-pill.is-live {
  color: var(--accent);
  border-color: rgba(94, 234, 212, 0.3);
  background: rgba(94, 234, 212, 0.07);
}

.follow-pill.is-live .dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14);
  animation: pulse 1.6s ease-in-out infinite;
}

.follow-pill.is-connecting .dot {
  background: var(--text-mute);
  animation: pulse 1.2s ease-in-out infinite;
}

.follow-pill.is-polling {
  color: #fbd88c;
  border-color: rgba(251, 191, 36, 0.28);
}

.follow-pill.is-polling .dot {
  background: var(--warn);
}

.follow-pill.is-finished {
  color: var(--text-dim);
}

.follow-pill.is-finished .dot {
  background: var(--text-mute);
}

.follow-pill.is-offline {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.3);
}

.follow-pill.is-offline .dot {
  background: var(--danger);
}

.event-scroll {
  max-height: 560px;
  overflow: auto;
  padding: 4px 16px 10px;
}

.event-list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}

.event-item {
  position: relative;
  margin-left: 5px;
  padding: 9px 0 9px 22px;
  border-left: 1px solid var(--line);
}

.event-item::before {
  content: "";
  position: absolute;
  left: -4.5px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tone-color, var(--text-mute));
  border: 1px solid var(--bg-elev);
  box-shadow: 0 0 8px color-mix(in srgb, var(--tone-color, var(--text-mute)) 55%, transparent);
}

.event-item[data-tone="ok"] {
  --tone-color: var(--ok);
}

.event-item[data-tone="danger"] {
  --tone-color: var(--danger);
}

.event-item[data-tone="warn"] {
  --tone-color: var(--warn);
}

.event-item[data-tone="info"] {
  --tone-color: var(--info);
}

.event-item[data-tone="muted"] {
  --tone-color: var(--text-mute);
}

.event-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
}

.event-time {
  flex: 0 0 auto;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10.5px;
}

.event-summary {
  color: var(--text-dim);
  font-size: 12.5px;
  word-break: break-word;
}

.event-payload {
  margin-top: 7px;
}

.empty-inline {
  margin: 0;
  padding: 14px 2px;
  color: var(--text-mute);
  font-size: 12.5px;
}

/* ── Loading / empty / error states ─────────────────────────────────────── */

.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, #101820 25%, #17222d 37%, #101820 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease infinite;
}

.skeleton--label {
  width: 46%;
  height: 10px;
}

.skeleton--value {
  width: 30%;
  height: 26px;
  margin: 4px 0;
}

.skeleton--hint {
  width: 60%;
  height: 10px;
}

.skeleton-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}

.skeleton-block .skeleton {
  height: 13px;
}

.skeleton-block .skeleton:nth-child(2) {
  width: 88%;
}

.skeleton-block .skeleton:nth-child(3) {
  width: 72%;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}

.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 44px 20px;
  text-align: center;
}

.empty-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.empty-hint {
  margin: 0;
  max-width: 420px;
  color: var(--text-mute);
  font-size: 12.5px;
}

.empty-action {
  margin-top: 8px;
}

.error-state {
  color: #fca5a5;
}

.error-state .empty-hint {
  color: #f3a4a4;
}

.error-state .btn {
  margin-top: 8px;
}

/* ── Toasts ─────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: 9px;
  background: #0d141b;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12.5px;
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
}

.toast--error {
  border-left-color: var(--danger);
}

.toast--success {
  border-left-color: var(--ok);
}

.toast--warn {
  border-left-color: var(--warn);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.toast-dot {
  width: 6px;
  height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--info);
  flex: 0 0 auto;
}

.toast--error .toast-dot {
  background: var(--danger);
}

.toast--success .toast-dot {
  background: var(--ok);
}

.toast--warn .toast-dot {
  background: var(--warn);
}

.toast-text {
  min-width: 0;
  word-break: break-word;
}

/* ── Modal ──────────────────────────────────────────────────────────────── */

.modal {
  width: min(480px, calc(100vw - 28px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #0b1118;
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(2, 5, 8, 0.72);
  backdrop-filter: blur(3px);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.modal-message {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  white-space: pre-line;
}

.modal-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 4px;
}

/* ── Task detail / review gate / plan launcher ──────────────────────────── */

.cell-title-btn {
  align-self: flex-start;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.55;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.cell-title-btn:hover {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chip--warn {
  color: #fbd88c;
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.07);
}

.project-plan-btn {
  padding: 4px 9px;
  font-size: 11.5px;
}

.task-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 56vh;
  overflow: auto;
  padding-right: 4px;
}

.task-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.task-detail-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.task-detail-meta .meta-item {
  min-width: 0;
}

.task-detail-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.task-detail-title {
  margin: 0;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.task-detail-desc {
  margin: 0;
  max-height: 160px;
  overflow: auto;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-detail-note {
  margin: 0;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10.5px;
}

.detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li {
  padding: 2px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-word;
}

/* ── Animations ─────────────────────────────────────────────────────────── */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  /* biome-ignore lint/style/noImportantStyles: reduce-motion must override component animations */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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

@media (max-width: 1100px) {
  .brand-sub {
    display: none;
  }

  .principal-name {
    max-width: 110px;
  }

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

@media (max-width: 900px) {
  .app-header-inner {
    gap: 12px;
  }

  .app-nav a {
    padding: 6px 8px;
    font-size: 12.5px;
  }

  .health-pill {
    display: none;
  }

  .principal-name {
    max-width: 90px;
  }
}

@media (max-width: 760px) {
  .nav-toggle {
    display: flex;
  }

  .app-nav {
    display: none;
    position: absolute;
    top: calc(var(--header-h) - 2px);
    left: 12px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #0b1118;
    box-shadow: var(--shadow);
    z-index: 50;
  }

  .app-nav.is-open {
    display: flex;
  }

  .app-nav a {
    padding: 10px 12px;
    font-size: 13px;
  }

  .role-badge {
    display: none;
  }

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

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

  .field--wide,
  .form-actions,
  .form-error {
    grid-column: span 1;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .btn {
    flex: 1;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .page-actions .btn {
    flex: 0 0 auto;
  }

  .approval-head {
    flex-direction: column;
  }

  .approval-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .approval-actions {
    justify-content: flex-end;
  }

  .health-refresh {
    display: none;
  }

  .event-scroll {
    max-height: 60vh;
    padding: 4px 12px 10px;
  }

  .app-footer .mono {
    margin-left: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .login-card {
    padding: 26px 20px 22px;
  }

  .toasts {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }
}
