:root {
  color-scheme: dark;
  --intergalactic-black: #151515;
  --zenon-green: #6FF34D;
  --quasar-blue: #0061EB;
  --plasma-pink: #F91690;
  --syrius-green: #00D557;
  --bg: var(--intergalactic-black);
  --surface: #1b1b1b;
  --surface-raised: #242424;
  --line: rgba(255, 255, 255, .12);
  --text: #f7f7f7;
  --muted: #a8a8a8;
  --accent: var(--zenon-green);
  --warning: var(--plasma-pink);
  --danger: var(--plasma-pink);
  --status-orange: #F5A524;
  --status-red: #FF5A5F;
  --shadow: 0 18px 60px rgba(0, 0, 0, .24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 90% -10%, rgba(0, 97, 235, .22), transparent 32rem),
    radial-gradient(circle at 8% 26%, rgba(111, 243, 77, .08), transparent 28rem),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
}

button, input, select { font: inherit; }
button, select, input { color: inherit; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(21, 21, 21, .88);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner, .page-shell, .site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.2rem, 4vw, 1.7rem); letter-spacing: -.03em; }
h2 { font-size: 1.15rem; letter-spacing: -.02em; }
.eyebrow {
  color: var(--accent);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.muted { color: var(--muted); font-size: .82rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.health-badge, .status-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .72rem;
  font-weight: 800;
  padding: 7px 10px;
  white-space: nowrap;
}
.health-badge::before, .status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.health-badge.green, .health-badge.healthy, .status-badge.active { color: var(--zenon-green); background: rgba(111, 243, 77, .09); border-color: rgba(111, 243, 77, .28); }
.health-badge.orange, .health-badge.stale { color: var(--status-orange); background: rgba(245, 165, 36, .12); border-color: rgba(245, 165, 36, .34); }
.status-badge.inactive { color: var(--plasma-pink); background: rgba(249, 22, 144, .10); border-color: rgba(249, 22, 144, .3); }
.health-badge.red, .health-badge.error, .health-badge.reorg, .status-badge.dismantled { color: var(--status-red); background: rgba(255, 90, 95, .11); border-color: rgba(255, 90, 95, .34); }
.health-badge.unknown { color: var(--muted); }

.page-shell { padding: 28px 0 48px; }
.hero-grid, .metric-grid, .content-grid { display: grid; gap: 12px; }
.hero-card, .metric-card, .section-block {
  background: linear-gradient(145deg, rgba(36, 36, 36, .96), rgba(27, 27, 27, .98));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.hero-card { min-height: 150px; padding: 22px; position: relative; overflow: hidden; }
.hero-card::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  right: -54px;
  bottom: -70px;
  background: rgba(111, 243, 77, .12);
}
.epoch-card::after { background: rgba(0, 97, 235, .22); }
.momentum-card { border-color: rgba(0, 97, 235, .32); }
.card-label, .metric-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hero-value {
  font-size: clamp(2.3rem, 10vw, 4rem);
  font-weight: 850;
  letter-spacing: -.08em;
  line-height: 1;
  margin: 16px 0 10px;
}
.skeleton {
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, .06) 25%,
    rgba(111, 243, 77, .16) 50%,
    rgba(255, 255, 255, .06) 75%
  );
  background-size: 220% 100%;
  border-radius: 8px;
  display: block;
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skeleton-hero-value {
  height: clamp(2.3rem, 10vw, 4rem);
  margin: 16px 0 10px;
  width: 4.4ch;
}
.skeleton-update { height: 13px; width: 180px; }
.skeleton-metric { height: 28px; margin-top: 5px; width: 58px; }
.skeleton-count { height: 13px; width: 72px; }
.metric-grid { grid-template-columns: repeat(3, 1fr); margin: 18px 0; }
.metric-card { padding: 16px; }
.metric-card strong { display: block; font-size: 1.75rem; margin-top: 5px; }
.metric-card:first-child strong { color: var(--quasar-blue); }
.metric-card.positive strong { color: var(--accent); }
.metric-card.warning strong { color: var(--warning); }

.section-block { margin-top: 18px; padding: 20px; }
.content-grid { row-gap: 18px; }
.content-grid > .section-block { margin-top: 0; }
.section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.toolbar { display: grid; gap: 9px; margin-bottom: 14px; }
.search-box input, .select-box select {
  width: 100%;
  background: rgba(21, 21, 21, .82);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  padding: 11px 12px;
}
.search-box input:focus, .select-box select:focus { border-color: var(--quasar-blue); box-shadow: 0 0 0 3px rgba(0, 97, 235, .16); }
.pillar-list { display: grid; gap: 13px; }
.loading-skeleton-grid { display: grid; gap: 13px; }
.skeleton-card {
  background: linear-gradient(145deg, rgba(31, 31, 31, .96), rgba(21, 21, 21, .92));
  border: 1px solid rgba(0, 97, 235, .28);
  border-radius: 14px;
  min-height: 238px;
  padding: 18px;
}
.skeleton-card-top {
  align-items: center;
  display: flex;
  justify-content: space-between;
}
.skeleton-rank { height: 12px; width: 28px; }
.skeleton-badge { border-radius: 999px; height: 28px; width: 70px; }
.skeleton-name { height: 19px; margin: 18px 0 10px; width: 46%; }
.skeleton-address { height: 10px; width: 72%; }
.skeleton-stat-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 17px;
}
.skeleton-stat { border-radius: 10px; height: 48px; }
.skeleton-performance { height: 106px; margin-top: 7px; }
.pillar-card {
  border: 1px solid rgba(0, 97, 235, .28);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(31, 31, 31, .96), rgba(21, 21, 21, .92));
  min-height: 178px;
  padding: 18px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.pillar-card:hover { border-color: rgba(111, 243, 77, .58); box-shadow: 0 12px 30px rgba(0, 0, 0, .24); transform: translateY(-1px); }
.pillar-card-top, .pillar-title-row, .event-top {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.pillar-title-row { justify-content: flex-start; margin: 8px 0; }
.rank {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
  min-width: 28px;
}
.pillar-name {
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pillar-address {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .67rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pillar-stats {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 13px;
}
.stat-item {
  background: linear-gradient(90deg, rgba(111, 243, 77, .08), rgba(0, 97, 235, .12));
  border: 1px solid rgba(111, 243, 77, .2);
  border-radius: 10px;
  min-width: 0;
  min-height: 48px;
  padding: 9px 10px;
}
.performance-stat { grid-column: 1 / -1; margin-top: 6px; }
.stat-label {
  color: var(--muted);
  display: block;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: normal;
}
.stat-item strong {
  color: var(--text);
  display: block;
  font-size: .8rem;
  line-height: 1.2;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.performance-value { color: var(--zenon-green); font-size: .9rem; }
.performance-value.empty { color: var(--muted); }
.performance-chart {
  align-items: end;
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(30, minmax(2px, 1fr));
  height: 44px;
  margin-top: 10px;
  padding: 0 1px;
}
.performance-bar {
  align-self: end;
  border-radius: 3px 3px 1px 1px;
  display: block;
  min-height: 4px;
  transition: height .3s ease, background-color .3s ease;
}
.performance-bar.high { background: var(--zenon-green); }
.performance-bar.medium { background: var(--quasar-blue); }
.performance-bar.low { background: var(--plasma-pink); }
.performance-bar.no-data {
  background: rgba(255, 255, 255, .16);
  min-height: 8px;
}
.performance-chart-empty {
  align-self: center;
  color: var(--muted);
  font-size: .72rem;
  grid-column: 1 / -1;
}
.performance-chart-axis {
  color: var(--muted);
  display: flex;
  font-size: .6rem;
  justify-content: space-between;
  margin-top: 4px;
  text-transform: uppercase;
}
.empty-state { color: var(--muted); padding: 28px 8px; text-align: center; }

.epoch-list, .event-list, .loading-skeleton-list { display: grid; gap: 8px; }
.skeleton-list-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 110px;
  height: 60px;
  min-height: 60px;
  padding: 10px 0;
}
.skeleton-list-title { height: 16px; width: 46%; }
.skeleton-list-time { height: 12px; justify-self: end; width: 92px; }
.skeleton-event-row { grid-template-rows: 16px 13px; }
.skeleton-event-row .skeleton-event-detail {
  grid-column: 1 / -1;
  height: 13px;
  width: 68%;
}
.epoch-row, .event-row {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
.epoch-row:last-child, .event-row:last-child { border-bottom: 0; }
.epoch-number { font-size: 1rem; font-weight: 850; }
.epoch-estimated {
  color: var(--plasma-pink);
  display: block;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .08em;
  margin-top: 2px;
  text-transform: uppercase;
}
.event-type { color: var(--quasar-blue); font-size: .74rem; font-weight: 800; }
.event-detail { font-size: .84rem; margin-top: 4px; }
.event-time { color: var(--muted); font-size: .72rem; }

.detail-section { scroll-margin-top: 95px; }
.detail-summary { display: grid; gap: 9px; grid-template-columns: repeat(2, 1fr); margin-bottom: 18px; }
.detail-stat { border: 1px solid var(--line); border-radius: 11px; padding: 10px; }
.detail-stat span { color: var(--muted); display: block; font-size: .68rem; text-transform: uppercase; }
.detail-stat strong { display: block; margin-top: 3px; }
.ghost-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  padding: 8px 10px;
  text-decoration: none;
}
.ghost-button:hover { border-color: var(--zenon-green); color: var(--text); }
.history-table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 620px; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; }
th { color: var(--muted); font-size: .68rem; text-transform: uppercase; }
td { font-size: .78rem; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: .72rem;
  justify-content: space-between;
  padding: 18px 0 28px;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

@media (min-width: 680px) {
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { grid-template-columns: 1fr 220px; }
  .content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .detail-summary { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 389px) {
  .pillar-stats, .skeleton-stat-grid { grid-template-columns: 1fr; }
}

@media (max-width: 959px) {
  .loading-skeleton-grid .skeleton-card:nth-child(n + 3) { display: none; }
}

@media (min-width: 960px) {
  .page-shell { padding-top: 42px; }
  .hero-card { min-height: 180px; padding: 28px; }
  .section-block { padding: 24px; }
  .pillar-list, .loading-skeleton-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loading-skeleton-grid { grid-column: 1 / -1; }
  .skeleton-card { min-height: 380px; }
  .skeleton-performance { height: 132px; }
  .detail-summary { grid-template-columns: repeat(6, 1fr); }
}

.header-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.site-nav { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; }
.user-identity { align-items: center; display: flex; gap: 8px; min-width: 0; }
.user-identity i { color: var(--accent); font-size: .9rem; }
.user-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-action-link { gap: 8px; white-space: nowrap; }
.site-nav a { color: var(--muted); font-size: .72rem; font-weight: 800; text-decoration: none; }
.site-nav a:hover { color: var(--accent); }
.site-nav .login-link {
  align-items: center;
  border: 1px solid rgba(111, 243, 77, .28);
  border-radius: 999px;
  display: inline-flex;
  gap: 7px;
  padding: 8px 11px;
  transition: background-color .2s, border-color .2s, color .2s;
}
.site-nav .login-link:hover { background: rgba(111, 243, 77, .09); border-color: rgba(111, 243, 77, .58); color: var(--text); }
.site-nav .login-link i { color: var(--accent); font-size: .78rem; }
.narrow-shell { max-width: 900px; }
.admin-shell { max-width: 1280px; }
.admin-layout { align-items: start; display: grid; gap: 18px; }
.admin-menu {
  background: linear-gradient(145deg, rgba(36, 36, 36, .96), rgba(27, 27, 27, .98));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
  padding: 14px;
}
.admin-menu-heading { padding: 3px 8px 12px; }
.admin-menu-heading h2 { margin-top: 4px; }
.admin-menu-title { min-width: 0; }
.admin-menu-toggle {
  align-items: center;
  background: rgba(21, 21, 21, .5);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  display: none;
  font-size: .74rem;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  padding: 9px 10px;
  white-space: nowrap;
}
.admin-menu-toggle:hover { border-color: rgba(111, 243, 77, .58); color: var(--text); }
.admin-menu-toggle > i:first-child { color: var(--accent); }
.menu-chevron { transition: transform .2s ease; }
.admin-menu.is-open .menu-chevron { transform: rotate(180deg); }
.admin-menu-links { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: thin; }
.admin-menu-link {
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: .74rem;
  font-weight: 800;
  gap: 8px;
  padding: 9px 10px;
  text-decoration: none;
  white-space: nowrap;
}
.admin-menu-link i { color: var(--muted); font-size: .78rem; width: 1rem; }
.admin-menu-link:hover { color: var(--text); }
.admin-menu-link:hover i, .admin-menu-link.is-active, .admin-menu-link.is-active i { color: var(--accent); }
.admin-menu-link.is-active { border-bottom-color: var(--accent); }

@media (max-width: 959px) {
  .admin-menu { padding: 12px; }
  .admin-menu-heading {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 3px 4px;
  }
  .admin-menu-toggle { display: inline-flex; }
  .admin-menu-links {
    display: none;
    flex-direction: column;
    gap: 3px;
    overflow: visible;
    padding-top: 10px;
  }
  .admin-menu.is-open .admin-menu-links { display: flex; }
  .admin-menu-link {
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 8px;
    flex: 0 0 auto;
    padding: 10px 11px;
    white-space: normal;
  }
  .admin-menu-link.is-active {
    background: rgba(111, 243, 77, .08);
    border-left-color: var(--accent);
  }
}

.admin-content { min-width: 0; }
.admin-content > .section-block { scroll-margin-top: 104px; }
.admin-content > .section-block:first-child { margin-top: 0; }
.auth-shell {
  align-items: center;
  background:
    radial-gradient(circle at 50% 0, rgba(0, 97, 235, .18), transparent 34rem),
    radial-gradient(circle at 0 100%, rgba(111, 243, 77, .08), transparent 28rem);
  display: grid;
  min-height: 100vh;
  padding: 32px 20px;
}
.auth-card { margin: 0 auto; max-width: 540px; overflow: hidden; padding: 28px 20px; position: relative; width: 100%; }
.auth-card::before { background: linear-gradient(90deg, var(--quasar-blue), var(--accent)); content: ""; height: 3px; inset: 0 0 auto; position: absolute; }
.auth-brand { align-items: center; color: var(--text); display: flex; font-size: .78rem; font-weight: 800; gap: 10px; letter-spacing: .03em; margin-bottom: 30px; }
.auth-brand-icon { align-items: center; background: linear-gradient(145deg, rgba(0, 97, 235, .28), rgba(111, 243, 77, .18)); border: 1px solid rgba(111, 243, 77, .32); border-radius: 12px; color: var(--accent); display: inline-flex; height: 36px; justify-content: center; width: 36px; }
.auth-card h1 { font-size: clamp(1.7rem, 5vw, 2.25rem); letter-spacing: -.05em; margin: 8px 0 9px; }
.auth-card > a { display: inline-block; margin-top: 18px; }
.form-stack, .form-grid { display: grid; gap: 13px; margin-top: 20px; }
.form-grid { grid-template-columns: 1fr; }
.form-stack label, .form-grid label {
  align-items: center;
  color: var(--muted);
  display: grid;
  font-size: .72rem;
  font-weight: 800;
  gap: 7px;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}
.field-label { min-width: 0; }
.form-stack input, .form-stack select, .form-grid input, .form-grid select, .code-editor {
  background: rgba(21, 21, 21, .82); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; min-width: 0; outline: 0; padding: 11px 12px; width: 100%;
}
.form-stack input:focus, .form-stack select:focus, .form-grid input:focus, .form-grid select:focus, .code-editor:focus { border-color: var(--quasar-blue); box-shadow: 0 0 0 3px rgba(0, 97, 235, .16); }
.form-grid input[readonly] { color: var(--muted); opacity: .8; }
.form-stack .primary-button { width: 100%; }
.full-width { grid-column: 1 / -1; }
.checkbox-label { align-items: center; display: flex !important; gap: 8px !important; grid-template-columns: auto 1fr; }
.checkbox-label input { accent-color: var(--accent); background: transparent; border: 0; padding: 0; width: auto; }
.form-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }
.primary-button, .ghost-button { border-radius: 9px; cursor: pointer; font: inherit; font-size: .76rem; font-weight: 800; padding: 9px 12px; }
.primary-button i { margin-right: 5px; }
.primary-button { background: var(--accent); border: 1px solid var(--accent); color: #101510; }
.primary-button:hover { filter: brightness(1.08); }
.small-button { padding: 6px 9px; }
.form-message { color: var(--accent); min-height: 1.2em; }
.form-message.error { color: var(--plasma-pink); }
.table-wrap { overflow-x: auto; margin-top: 20px; }
.table-wrap table { min-width: 700px; }
.table-wrap small { color: var(--muted); display: block; font-size: .68rem; margin-top: 3px; }
.code-editor { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; min-height: 360px; resize: vertical; }
.log-viewer { background: rgba(10, 10, 10, .75); border: 1px solid var(--line); border-radius: 10px; color: #c9eec2; font: .72rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 420px; min-height: 110px; overflow: auto; padding: 13px; white-space: pre-wrap; word-break: break-word; }
.admin-shell h3 { font-size: .9rem; margin: 24px 0 10px; }
.settings-form { display: grid; gap: 26px; margin-top: 8px; }
.settings-category { border-top: 1px solid var(--line); padding-top: 22px; }
.settings-category:first-child { border-top: 0; padding-top: 0; }
.settings-category-heading { margin-bottom: 14px; }
.settings-category-heading h3 { margin: 4px 0 0; }
.settings-grid { display: grid; gap: 15px; grid-template-columns: 1fr; }
.setting-field { display: grid; gap: 6px; min-width: 0; }
.setting-field-wide { grid-column: 1 / -1; }
.setting-label { color: var(--text); display: block; font-size: .76rem; font-weight: 800; }
.setting-help { color: var(--muted); display: block; font-size: .7rem; font-weight: 500; line-height: 1.45; }
.settings-form input:not([type="checkbox"]), .settings-form select, .settings-form textarea {
  background: rgba(21, 21, 21, .82); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; min-width: 0; outline: 0; padding: 11px 12px; width: 100%;
}
.settings-form textarea { min-height: 76px; resize: vertical; }
.settings-form input:not([type="checkbox"]):focus, .settings-form select:focus, .settings-form textarea:focus { border-color: var(--quasar-blue); box-shadow: 0 0 0 3px rgba(0, 97, 235, .16); }
.setting-toggle { align-items: flex-start; background: linear-gradient(145deg, rgba(36, 36, 36, .7), rgba(27, 27, 27, .82)); border: 1px solid var(--line); border-radius: 11px; display: flex; gap: 10px; min-width: 0; padding: 12px; }
.setting-toggle input { accent-color: var(--accent); flex: 0 0 auto; height: 17px; margin: 2px 0 0; width: 17px; }
.setting-toggle > span { display: grid; gap: 4px; min-width: 0; }
.event-options { border: 1px solid var(--line); border-radius: 11px; margin: 0; min-width: 0; padding: 13px; }
.event-options legend { color: var(--text); font-size: .76rem; font-weight: 800; padding: 0 5px; }
.event-options > .setting-help { margin: 0 0 9px; }
.checkbox-grid { display: grid; gap: 7px; grid-template-columns: 1fr; }
.checkbox-grid label { align-items: center; color: var(--muted); display: flex; font-size: .76rem; font-weight: 700; gap: 8px; min-width: 0; padding: 4px 0; }
.checkbox-grid input { accent-color: var(--accent); background: transparent; border: 0; flex: 0 0 auto; height: 17px; margin: 0; padding: 0; width: 17px; }
.settings-form-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.settings-restart-note { margin-top: 14px; }
.toast-container { bottom: 20px; display: grid; gap: 10px; max-height: min(70vh, 520px); max-width: min(380px, calc(100% - 32px)); overflow-y: auto; pointer-events: none; position: fixed; right: 20px; z-index: 50; }
.toast { align-items: flex-start; background: linear-gradient(145deg, rgba(36, 36, 36, .98), rgba(27, 27, 27, .98)); border: 1px solid rgba(111, 243, 77, .35); border-radius: 12px; box-shadow: 0 18px 45px rgba(0, 0, 0, .4); display: flex; gap: 10px; min-width: 260px; overflow: hidden; padding: 14px 40px 16px 15px; pointer-events: auto; position: relative; transform: translateY(0); transition: opacity .22s ease, transform .22s ease; }
.toast.error { border-color: rgba(249, 22, 144, .5); }
.toast-content { color: var(--text); font-size: .78rem; line-height: 1.4; }
.toast-close { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 1.15rem; line-height: 1; padding: 2px; position: absolute; right: 11px; top: 9px; }
.toast-close:hover { color: var(--text); }
.toast-progress { background: var(--accent); bottom: 0; height: 3px; left: 0; position: absolute; transform: scaleX(1); transform-origin: left; width: 100%; }
.toast.error .toast-progress { background: var(--plasma-pink); }
.toast-progress.is-running { transform: scaleX(0); transition: transform 10s linear; }
.toast.is-closing { opacity: 0; transform: translateY(8px); }

@media (max-width: 679px) {
  .site-header .header-inner {
    align-items: stretch;
    flex-direction: column;
    min-height: 0;
    padding: 14px 0;
  }
  .header-actions { gap: 8px; width: 100%; }
  .dashboard-header .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .dashboard-header .site-nav { justify-self: start; }
  .dashboard-header .health-badge { justify-self: end; }
  .portal-header .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .portal-header .user-identity { min-width: 0; }
  .portal-header .header-action-link { min-width: 0; }
  .full-width { grid-column: auto; }
  .table-wrap table { min-width: 620px; }
  .toast-container { bottom: 12px; left: 12px; max-width: none; right: 12px; }
  .toast { min-width: 0; }
}

@media (min-width: 680px) {
  .auth-card { padding: 34px 36px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checkbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-stack label, .form-grid label {
    column-gap: 16px;
    grid-template-columns: 142px minmax(0, 1fr);
  }
  .form-stack .primary-button { margin-left: 158px; width: calc(100% - 158px); }
}

@media (min-width: 960px) {
  .admin-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 24px; }
  .admin-menu { position: sticky; top: 100px; }
  .admin-menu-links { display: grid; overflow-x: visible; }
  .admin-menu-link { border-bottom: 0; border-left: 2px solid transparent; }
  .admin-menu-link.is-active { border-left-color: var(--accent); }
}
