:root {
  color-scheme: dark;
  --bg: #101217;
  --bg-2: #151923;
  --panel: #1b202b;
  --panel-2: #242a36;
  --panel-3: #2d3442;
  --text: #f4f7fb;
  --muted: #a6b1c2;
  --line: #384252;
  --accent: #6aa8ff;
  --accent-2: #2ed3b7;
  --accent-3: #f6b44b;
  --danger: #ff6b81;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
  --shadow-soft: 0 14px 36px rgba(0, 0, 0, .2);
  --sidebar-width: 286px;
}

* {
  scrollbar-color: color-mix(in srgb, var(--accent) 45%, var(--panel-3)) var(--bg);
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(106, 168, 255, .08), transparent 36%),
    linear-gradient(225deg, rgba(46, 211, 183, .08), transparent 34%),
    var(--bg);
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .75), transparent 82%);
}

a {
  color: var(--accent);
}

a:hover {
  color: #b6d4ff;
}

.skip {
  background: var(--accent);
  color: #07111e;
  border-radius: var(--radius);
  padding: .6rem .8rem;
}

.command-public main {
  width: 100%;
  margin: 0;
  padding: clamp(12px, 2vw, 22px);
}

.command-public .login {
  position: relative;
  min-height: calc(100vh - clamp(24px, 4vw, 44px));
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 440px);
  align-items: stretch;
  gap: clamp(1rem, 4vw, 4.5rem);
  overflow: hidden;
  padding: clamp(24px, 5vw, 58px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(106, 168, 255, .1), transparent 48%),
    linear-gradient(180deg, #1d2838, #15222b 55%, #11181f);
  box-shadow: var(--shadow);
}

.command-public .login::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 10px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
}

.command-public .login > div {
  align-self: center;
  max-width: 820px;
}

.command-public .login h1 {
  max-width: 840px;
  margin: .35rem 0 1.2rem;
  color: var(--text);
  font-size: clamp(2.7rem, 7vw, 6.4rem);
  font-weight: 900;
  line-height: .96;
}

.command-public .login p:not(.eyebrow) {
  max-width: 660px;
  color: #dbe7f7;
  font-size: clamp(1rem, 2vw, 1.28rem);
}

.command-public .login form.panel {
  align-self: center;
  display: grid;
  gap: .85rem;
  padding: clamp(18px, 3vw, 26px);
  background: rgba(27, 32, 43, .92);
  border-color: rgba(178, 196, 222, .18);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .32);
}

.command-public .login button {
  width: fit-content;
  min-width: 120px;
}

.command-shell .topbar {
  position: fixed;
  inset: 16px auto 16px 16px;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(178, 196, 222, .16);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(27, 32, 43, .96), rgba(17, 21, 29, .98));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: .75rem;
  color: var(--text);
}

.brand::before {
  content: "N";
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06111e;
  font-weight: 950;
  box-shadow: 0 16px 36px rgba(46, 211, 183, .22);
}

.brand-main,
.brand-sub {
  display: block;
  min-width: 0;
}

.brand-main {
  font-weight: 900;
  letter-spacing: 0;
}

.brand-sub {
  margin-top: .1rem;
  color: var(--muted);
  font-size: .82rem;
}

.command-shell nav {
  display: grid;
  align-content: start;
  gap: .35rem;
  overflow-y: auto;
  padding-right: .2rem;
  scrollbar-width: none;
}

.command-shell nav::-webkit-scrollbar {
  display: none;
}

.command-shell nav a,
.command-shell .logout-button {
  position: relative;
  justify-content: flex-start;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #d8e0ec;
  box-shadow: none;
  font-weight: 800;
}

.command-shell nav a {
  padding: .62rem .75rem .62rem 1rem;
}

.command-shell nav a::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}

.command-shell nav a:hover,
.command-shell nav a.active,
.command-shell .logout-button:hover {
  border-color: rgba(106, 168, 255, .28);
  background: rgba(106, 168, 255, .1);
  color: #fff;
  transform: none;
}

.command-shell nav a.active::before {
  background: var(--accent-2);
  box-shadow: 0 0 0 5px rgba(46, 211, 183, .1);
}

.nav-section {
  margin: .9rem .25rem .2rem;
  color: var(--accent-3);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.logout-form {
  margin-top: auto;
}

.command-shell .logout-button {
  width: 100%;
  border-color: rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
}

.command-shell main {
  width: auto;
  max-width: none;
  min-height: 100vh;
  margin: 0 0 0 calc(var(--sidebar-width) + 32px);
  padding: clamp(18px, 3vw, 34px);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: clamp(18px, 3vw, 30px);
  overflow: hidden;
  border: 1px solid rgba(178, 196, 222, .16);
  border-radius: 12px;
  background:
    linear-gradient(120deg, rgba(106, 168, 255, .14), transparent 46%),
    linear-gradient(180deg, rgba(36, 42, 54, .95), rgba(27, 32, 43, .95));
  box-shadow: var(--shadow-soft);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
}

.hero h1 {
  margin-bottom: .5rem;
  color: var(--text);
  font-size: clamp(2rem, 5vw, 4.4rem);
  font-weight: 900;
}

.hero p:last-child {
  max-width: 780px;
  margin-bottom: 0;
  color: #d5deeb;
}

.eyebrow {
  color: var(--accent-2);
  font-size: .78rem;
  font-weight: 950;
  letter-spacing: 0;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .9rem;
  margin: 1rem 0;
}

.cards article {
  position: relative;
  min-height: 128px;
  overflow: hidden;
  border: 1px solid rgba(178, 196, 222, .14);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(36, 42, 54, .98), rgba(27, 32, 43, .98));
  box-shadow: var(--shadow-soft);
}

.cards article::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.cards span {
  color: var(--muted);
  font-weight: 800;
}

.cards strong {
  display: block;
  margin-top: .65rem;
  color: var(--text);
  font-size: clamp(1.65rem, 4vw, 2.45rem);
  line-height: 1;
}

.grid.two {
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, .72fr);
  gap: 1rem;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel,
.list-item,
.script-card,
details {
  border-color: rgba(178, 196, 222, .15);
  background: rgba(27, 32, 43, .94);
  box-shadow: var(--shadow-soft);
}

.panel {
  border-radius: 12px;
  padding: clamp(16px, 2.2vw, 24px);
  margin-bottom: 1rem;
}

.panel h1,
.panel h2,
.panel h3 {
  color: var(--text);
}

.quick-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.quick,
.button,
button {
  min-height: 42px;
  border-radius: var(--radius);
  border-color: rgba(178, 196, 222, .18);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 850;
  box-shadow: none;
}

.quick:hover,
.button:hover,
button:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-2));
  color: #fff;
  transform: translateY(-1px);
}

button.primary,
.button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06111e;
  box-shadow: 0 18px 38px rgba(46, 211, 183, .16);
}

button:focus-visible,
.button:focus-visible,
.quick:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(106, 168, 255, .25);
  outline-offset: 2px;
}

.list-item,
.script-card {
  border-radius: var(--radius);
  padding: 1rem;
  margin: .75rem 0;
}

.insight.warning {
  border-left: 4px solid var(--accent-3);
}

.insight.critical {
  border-left: 4px solid var(--danger);
}

.warning,
.flash {
  border-color: rgba(246, 180, 75, .38);
  background: rgba(246, 180, 75, .12);
  color: #ffe4b8;
}

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

.muted,
.empty {
  color: var(--muted);
}

details {
  margin: 1rem 0;
  padding: .9rem;
  border-radius: 10px;
}

details[open] {
  background: rgba(36, 42, 54, .86);
}

summary {
  color: var(--accent-2);
  font-weight: 900;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
}

label {
  color: var(--muted);
  font-weight: 820;
}

input,
select,
textarea {
  min-height: 44px;
  border-color: rgba(178, 196, 222, .18);
  border-radius: var(--radius);
  background: #111722;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(106, 168, 255, .18);
}

textarea {
  min-height: 120px;
}

.script-card textarea {
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.search {
  max-width: 520px;
  margin-bottom: 1rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(178, 196, 222, .15);
  border-radius: 10px;
  background: rgba(17, 23, 34, .72);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom-color: rgba(178, 196, 222, .12);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #222936;
  color: #c8d4e5;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: #e9eef6;
}

tr:hover td {
  background: rgba(106, 168, 255, .055);
}

.pill {
  border-color: rgba(106, 168, 255, .32);
  background: rgba(106, 168, 255, .12);
  color: #cbe0ff;
  font-weight: 850;
}

.check {
  padding: .5rem 0;
}

@media (max-width: 1080px) {
  .command-shell .topbar {
    position: sticky;
    inset: 0 auto auto 0;
    width: 100%;
    border-radius: 0;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: .8rem 1rem;
  }

  .command-shell nav {
    display: flex;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: .1rem;
  }

  .command-shell nav a {
    white-space: nowrap;
  }

  .nav-section,
  .brand-sub {
    display: none;
  }

  .logout-form {
    margin-top: 0;
  }

  .command-shell .logout-button {
    width: auto;
    white-space: nowrap;
  }

  .command-shell main {
    margin-left: 0;
  }

  .grid.two,
  .command-public .login {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .command-shell .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .brand::before {
    width: 38px;
    height: 38px;
  }

  .command-shell nav {
    width: 100%;
  }

  .command-shell main,
  .command-public main {
    padding: 10px;
  }

  .command-public .login {
    padding: 18px;
  }

  .command-public .login h1 {
    font-size: clamp(2.1rem, 12vw, 3.6rem);
  }

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

  .section-head {
    display: grid;
    grid-template-columns: 1fr;
  }

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

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