:root {
  color-scheme: dark;
  --bg: #11100d;
  --bg-soft: #171813;
  --surface: rgba(31, 34, 28, 0.86);
  --surface-strong: rgba(40, 43, 35, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --line: rgba(246, 241, 224, 0.12);
  --line-strong: rgba(246, 241, 224, 0.2);
  --text: #f7f3ea;
  --muted: #b9b1a2;
  --subtle: #80786b;
  --accent: #98efc6;
  --accent-strong: #47d99a;
  --gold: #e7c873;
  --danger: #ff8f9c;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body::selection {
  background: rgba(152, 239, 198, 0.35);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.portal-shell,
.site-shell {
  position: relative;
  overflow-x: hidden;
  background:
    linear-gradient(140deg, #11100d 0%, #151711 42%, #11161a 100%);
}

.portal-shell::before,
.site-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(115deg, rgba(152, 239, 198, 0.06), transparent 38%, rgba(231, 200, 115, 0.05));
  background-size: 72px 72px, 72px 72px, auto;
  opacity: 0.42;
  mask-image: linear-gradient(to bottom, black 0%, transparent 86%);
}

.page-wrap {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 0.75rem;
}

.brand-minimal {
  width: fit-content;
}

.brand-mark {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(152, 239, 198, 0.35);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(152, 239, 198, 0.2), rgba(231, 200, 115, 0.08)),
    rgba(255, 255, 255, 0.04);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.95rem;
  letter-spacing: 0;
}

.brand small {
  margin-top: 0.12rem;
  color: var(--subtle);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.top-actions,
.hero-actions,
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-actions > a:not(.button) {
  color: var(--muted);
  font-size: 0.92rem;
}

.button,
.login-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  border-radius: 8px;
  padding: 0.8rem 1.05rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.button:hover,
.login-form button:hover {
  transform: translateY(-1px);
}

.button-primary,
.login-form button {
  border-color: rgba(152, 239, 198, 0.45);
  background: var(--accent);
  color: #10130f;
  box-shadow: 0 18px 45px rgba(71, 217, 154, 0.18);
}

.button-ghost {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

.button-quiet {
  border-color: rgba(246, 241, 224, 0.14);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(21rem, 28rem);
  gap: clamp(1.4rem, 4vw, 4rem);
  align-items: center;
  min-height: calc(100vh - 7rem);
  padding: 3rem 0 2rem;
}

.hero-copy {
  max-width: 46rem;
}

.hero-title {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(4rem, 8.4vw, 7.8rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.9;
}

.hero-lead {
  max-width: 42rem;
  margin: 1.55rem 0 0;
  color: #ded8cc;
  font-size: clamp(1.08rem, 1.9vw, 1.38rem);
  line-height: 1.65;
}

.personality-line {
  margin: 1rem 0 0;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-actions {
  flex-wrap: wrap;
  margin-top: 2rem;
}

.command-panel,
.login-panel,
.dash-card,
.module-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.command-panel {
  padding: 1.2rem;
}

.panel-header,
.card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-header span,
.card-label,
.eyebrow {
  display: block;
  color: var(--subtle);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-header strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.2rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.9rem;
  border-radius: 999px;
  padding: 0.35rem 0.72rem;
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-pill.online {
  border-color: rgba(152, 239, 198, 0.35);
  background: rgba(71, 217, 154, 0.13);
  color: var(--accent);
}

.status-pill.pending {
  border-color: rgba(231, 200, 115, 0.38);
  background: rgba(231, 200, 115, 0.11);
  color: var(--gold);
}

.status-pill.offline {
  border-color: rgba(255, 143, 156, 0.4);
  background: rgba(255, 143, 156, 0.12);
  color: var(--danger);
}

.overview-list,
.file-list,
.note-list,
.system-lines {
  display: grid;
  gap: 0.75rem;
}

.overview-list {
  margin-top: 1.15rem;
}

.overview-row,
.file-list div,
.note-list div,
.system-lines div,
.metric-grid div,
.trust-list div,
.status-strip div {
  border: 1px solid rgba(246, 241, 224, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.overview-row,
.file-list div,
.system-lines div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem;
}

.overview-row span,
.file-list span,
.system-lines span,
.metric-grid span,
.trust-list span,
.status-strip span,
.note-list span {
  color: var(--subtle);
  font-size: 0.82rem;
}

.overview-row strong,
.file-list strong,
.system-lines strong,
.metric-grid strong,
.trust-list strong,
.status-strip strong {
  color: var(--text);
  font-size: 0.92rem;
  text-align: right;
}

.module-band {
  padding: 3rem 0 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.1rem;
}

.section-heading h2 {
  max-width: 40rem;
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1;
}

.section-heading p {
  max-width: 27rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.module-card {
  min-height: 14rem;
  padding: 1.25rem;
}

.module-index {
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 900;
}

.module-card h3 {
  margin: 1.7rem 0 0.75rem;
  font-size: 1.35rem;
}

.module-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.login-wrap {
  padding-bottom: 2rem;
}

.login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem);
  gap: clamp(1.4rem, 4vw, 4rem);
  align-items: center;
  min-height: calc(100vh - 6rem);
  padding: 3rem 0;
}

.login-centered {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 6rem);
  padding: 3rem 0;
}

.login-centered .login-panel {
  width: min(100%, 28rem);
}

.login-intro h1 {
  max-width: 42rem;
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.2rem);
  font-weight: 900;
  line-height: 0.95;
}

.login-intro p {
  max-width: 36rem;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.trust-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 2rem;
}

.trust-list div {
  padding: 0.9rem;
}

.trust-list span,
.trust-list strong {
  display: block;
  text-align: left;
}

.trust-list strong {
  margin-top: 0.35rem;
}

.login-panel {
  padding: 1.25rem;
}

.login-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.login-form label {
  display: grid;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  padding: 0.95rem;
  outline: none;
}

.login-form input:focus {
  border-color: rgba(152, 239, 198, 0.65);
  box-shadow: 0 0 0 3px rgba(152, 239, 198, 0.11);
}

.login-form button {
  width: 100%;
}

.error {
  margin: 0;
  border: 1px solid rgba(255, 143, 156, 0.42);
  border-radius: 8px;
  background: rgba(255, 143, 156, 0.1);
  color: #ffd7dc;
  padding: 0.75rem;
}

.fine-print {
  margin: 1.1rem 0 0;
  color: var(--subtle);
  font-size: 0.86rem;
  line-height: 1.55;
}

.dashboard-shell {
  background: linear-gradient(135deg, #11100d 0%, #151711 48%, #10161a 100%);
}

.dashboard-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(17, 16, 13, 0.84);
  padding: 1.2rem;
  backdrop-filter: blur(18px);
}

.side-brand {
  margin-bottom: 1.35rem;
}

.nav-links {
  display: grid;
  gap: 0.35rem;
}

.nav-links a {
  border-radius: 8px;
  color: var(--muted);
  padding: 0.8rem 0.85rem;
  font-size: 0.93rem;
  transition: background 160ms ease, color 160ms ease;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.signout-link {
  margin-top: auto;
}

.dashboard-main {
  min-width: 0;
  padding: clamp(1rem, 3vw, 2rem);
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.5rem;
}

.dashboard-header h1 {
  margin: 0.45rem 0 0;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  font-weight: 900;
  line-height: 0.95;
}

.dashboard-header p:not(.eyebrow) {
  max-width: 42rem;
  margin: 0.9rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.status-strip div {
  min-height: 5.4rem;
  padding: 0.95rem;
}

.status-strip span,
.status-strip strong {
  display: block;
  text-align: left;
}

.status-strip strong {
  margin-top: 0.35rem;
  font-size: 1rem;
}

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

.dash-card {
  min-width: 0;
  min-height: 18rem;
  padding: 1.2rem;
}

.dash-card-large,
.dash-card-wide {
  grid-column: span 1;
}

.dash-card h2 {
  margin: 1rem 0 0.7rem;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.05;
}

.dash-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.metric-grid div {
  min-width: 0;
  padding: 0.85rem;
}

.metric-grid span,
.metric-grid strong {
  display: block;
  text-align: left;
}

.metric-grid strong {
  margin-top: 0.3rem;
  overflow-wrap: anywhere;
}

.file-list {
  margin: 1rem 0;
}

.compact-list {
  max-height: 17rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.note-list {
  margin-top: 1rem;
}

.note-list div {
  padding: 0.9rem;
}

.note-list strong,
.note-list span {
  display: block;
}

.note-list strong {
  color: var(--text);
}

.note-list span {
  margin-top: 0.25rem;
  line-height: 1.55;
}

.system-lines {
  margin-top: 1rem;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.quick-links a {
  display: flex;
  align-items: center;
  min-height: 3.1rem;
  border: 1px solid rgba(246, 241, 224, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  padding: 0.85rem;
  font-weight: 750;
  overflow-wrap: anywhere;
  transition: background 160ms ease, border-color 160ms ease;
}

.quick-links a:hover {
  border-color: rgba(152, 239, 198, 0.35);
  background: rgba(152, 239, 198, 0.08);
}

@media (max-width: 980px) {
  .hero-grid,
  .login-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .module-grid,
  .trust-list,
  .status-strip,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: relative;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .signout-link {
    margin-top: 1rem;
  }

  .dashboard-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .page-wrap {
    width: min(100% - 1rem, 42rem);
    padding-bottom: 2rem;
  }

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

  .top-actions,
  .hero-actions,
  .header-actions {
    width: 100%;
  }

  .top-actions {
    justify-content: space-between;
  }

  .button,
  .login-form button {
    width: 100%;
  }

  .top-actions .button {
    width: auto;
  }

  .hero-title {
    font-size: clamp(3.2rem, 15vw, 4.35rem);
  }

  .login-intro h1 {
    font-size: clamp(2.65rem, 13vw, 4rem);
  }

  .command-panel,
  .login-panel,
  .dash-card,
  .module-card {
    padding: 1rem;
  }

  .metric-grid,
  .quick-links,
  .nav-links {
    grid-template-columns: 1fr;
  }

  .dashboard-main {
    padding: 1rem 0.75rem 1.4rem;
  }

  .side-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    padding: 0.8rem;
  }

  .side-brand {
    margin-bottom: 0;
  }

  .side-nav .signout-link {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    min-height: 2.45rem;
    padding: 0.65rem 0.9rem;
  }

  .side-nav .nav-links {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  .side-nav .nav-links a {
    flex: 0 0 auto;
    border: 1px solid rgba(246, 241, 224, 0.08);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.65rem 0.75rem;
    white-space: nowrap;
  }

  .dashboard-header h1 {
    font-size: clamp(2.2rem, 12vw, 3.3rem);
  }

  .overview-row,
  .file-list div,
  .system-lines div {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-row strong,
  .file-list strong,
  .system-lines strong {
    text-align: left;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  .command-panel,
  .login-panel,
  .dash-card,
  .module-card,
  .side-nav {
    background: var(--surface-strong);
  }
}
