:root {
  --surface: #fbf9f8;
  --surface-low: #f5f3f3;
  --surface-container: #efeded;
  --surface-high: #e9e8e7;
  --surface-highest: #e4e2e2;
  --on-surface: #1b1c1c;
  --secondary: #5f5e5e;
  --outline: #926f6b;
  --outline-variant: #e7bdb8;
  --primary: #ba0013;
  --primary-strong: #e31e24;
  --primary-soft: #ffdad6;
  --tertiary: #0057ba;
  --tertiary-soft: #d8e2ff;
  --inverse: #1d1f1f;
  --inverse-on: #f2f0f0;
  --success: #13b95a;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
}

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

button,
input {
  font: inherit;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.dot-grid {
  background-image: radial-gradient(rgba(146, 111, 107, 0.22) 1px, transparent 1px);
  background-size: 28px 28px;
}

.dex-shell {
  min-height: 100vh;
}

.dex-topbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--outline-variant);
  background: rgba(251, 249, 248, 0.94);
  padding: 0 30px;
  box-shadow: 0 1px 8px rgba(27, 28, 28, 0.04);
  backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right,
.top-nav,
.global-search,
.panel-header,
.pulse-list a,
.attention-card a,
.dex-footer,
.footer nav {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 34px;
}

.brand-title {
  color: var(--primary);
  font-size: 22px;
  font-weight: 800;
  white-space: nowrap;
}

.top-nav {
  gap: 24px;
}

.top-nav a {
  height: 64px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: #464646;
  font-size: 16px;
  font-weight: 600;
}

.top-nav a.is-active,
.top-nav a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.topbar-right {
  gap: 10px;
}

.global-search {
  width: min(300px, 24vw);
  height: 40px;
  gap: 10px;
  border-radius: 999px;
  background: var(--surface-container);
  padding: 0 14px;
  color: var(--secondary);
}

.global-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--on-surface);
}

.icon-button,
.avatar {
  position: relative;
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--secondary);
  cursor: pointer;
}

.icon-button:hover,
.avatar:hover {
  background: var(--surface-high);
}

.has-alert::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.avatar {
  border: 1px solid var(--outline-variant);
  background: var(--primary-soft);
  color: var(--primary);
}

.dex-sidebar {
  position: fixed;
  z-index: 30;
  top: 64px;
  bottom: 0;
  left: 0;
  width: 236px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  border-right: 1px solid var(--outline-variant);
  background: var(--surface-low);
  padding: 24px 20px 20px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section p {
  margin: 0 0 5px;
  color: var(--secondary);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-section a,
.terminal-launch {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  color: var(--secondary);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  padding: 0 14px;
}

.nav-section a:hover {
  background: var(--surface-high);
  color: var(--on-surface);
}

.nav-section a.is-active {
  background: var(--primary-strong);
  color: #fffafa;
}

.nav-bottom {
  margin-top: auto;
  border-top: 1px solid var(--outline-variant);
  padding-top: 20px;
}

.terminal-launch {
  width: 100%;
  justify-content: center;
  border: 0;
  background: var(--primary);
  color: white;
  cursor: pointer;
}

.dex-main {
  min-height: 100vh;
  margin-left: 236px;
  padding-top: 64px;
}

.dashboard-section,
.knowledge-section,
.directory-section,
.marketplace-section {
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 40px;
}

.knowledge-section,
.directory-section,
.marketplace-section {
  padding-top: 42px;
  padding-bottom: 42px;
}

.page-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.page-intro h1,
.section-head h2,
.market-hero h2 {
  margin: 0;
  font-size: 40px;
  line-height: 48px;
  letter-spacing: 0;
}

.page-intro p,
.section-head p,
.market-hero p {
  margin: 8px 0 0;
  color: var(--secondary);
  font-size: 16px;
  line-height: 24px;
}

.stat-strip {
  display: flex;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-highest);
}

.stat-strip div {
  min-width: 136px;
  padding: 14px 16px;
}

.stat-strip div + div {
  border-left: 1px solid var(--outline-variant);
}

.stat-strip span,
.panel-header span,
.terminal-head span,
.security-rating span,
.section-head span,
.subsidiary-card span,
.market-hero span,
.project-metrics span,
.progress-row span {
  color: var(--secondary);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-strip strong {
  display: block;
  color: var(--primary);
  font-family: var(--mono);
  font-size: 26px;
  line-height: 32px;
}

.dashboard-grid,
.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 24px;
}

.panel,
.quick-grid a,
.kb-card,
.subsidiary-card,
.tool-categories article,
.app-list article {
  border: 1px solid var(--outline-variant);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 18px rgba(27, 28, 28, 0.035);
}

.panel {
  padding: 24px;
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.panel-header h2,
.quick-access h2,
.project-card h2,
.attention-card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 22px;
}

.pulse-list {
  display: grid;
  gap: 18px;
}

.pulse-list a {
  display: grid;
  grid-template-columns: 46px 1fr 22px;
  gap: 24px;
  min-height: 62px;
}

.pulse-list strong,
.attention-card strong {
  display: block;
  color: #111;
  font-size: 17px;
  line-height: 1.35;
}

.pulse-list small {
  display: block;
  margin-top: 4px;
  color: var(--secondary);
}

.update-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 6px;
}

.update-icon.red {
  background: var(--primary-soft);
  color: var(--primary);
}

.update-icon.blue {
  background: var(--tertiary-soft);
  color: var(--tertiary);
}

.update-icon.green {
  background: #d9fbe7;
  color: #008c45;
}

.terminal-card {
  min-height: 252px;
  border-radius: 12px;
  background: #191b1b;
  color: var(--inverse-on);
  padding: 24px;
  box-shadow: 0 12px 28px rgba(27, 28, 28, 0.22);
}

.terminal-head,
.security-rating {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-head strong {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #36db74;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

.terminal-head i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #27d66d;
}

.terminal-card p {
  color: #43d779;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
}

.terminal-card p:first-of-type,
.terminal-card p:last-of-type {
  color: #fff;
}

.security-rating {
  margin-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 22px;
}

.security-rating strong {
  font-size: 26px;
}

.quick-access {
  margin-top: 24px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.quick-grid a {
  display: grid;
  min-height: 132px;
  place-items: center;
  align-content: center;
  gap: 12px;
  font-family: var(--mono);
  font-weight: 700;
}

.quick-grid .material-symbols-outlined {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-high);
}

.quick-grid a.custom {
  background: rgba(255, 218, 214, 0.34);
  color: var(--primary);
}

.lower-grid {
  margin-top: 24px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-container);
  margin-top: 10px;
}

.progress-track i {
  display: block;
  height: 100%;
  background: var(--primary);
}

.project-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 28px;
}

.project-metrics div {
  border-radius: 8px;
  background: var(--surface-container);
  padding: 16px;
}

.project-metrics strong {
  display: block;
  color: var(--primary);
  font-size: 26px;
}

.attention-card {
  display: grid;
  gap: 14px;
}

.attention-card a {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 16px;
  min-height: 56px;
  border: 1px solid rgba(227, 30, 36, 0.16);
  border-radius: 8px;
  padding: 0 16px;
}

.attention-card em {
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  padding: 6px 9px;
  text-transform: uppercase;
}

.section-head {
  max-width: 820px;
  margin-bottom: 24px;
}

.section-head.centered {
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

.section-head.compact {
  margin-top: 24px;
  margin-bottom: 16px;
}

.section-head span,
.market-hero span,
.kb-card > span,
.subsidiary-card span {
  color: var(--primary);
  font-weight: 700;
}

.ai-search {
  position: relative;
  display: flex;
  max-width: 740px;
  min-height: 58px;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: white;
  padding: 7px 7px 7px 20px;
  box-shadow: 0 12px 34px rgba(27, 28, 28, 0.12);
}

.ai-search > .material-symbols-outlined {
  color: var(--primary);
}

.ai-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.ai-search button,
.market-hero a,
.app-list a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0 18px;
  text-transform: uppercase;
}

.suggested-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 14px 0 30px;
  color: var(--primary);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.suggested-links span {
  color: var(--secondary);
}

.knowledge-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 20px;
}

.kb-card {
  min-height: 198px;
  padding: 22px;
}

.kb-card div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.kb-card em {
  color: var(--secondary);
  font-family: var(--mono);
  font-size: 12px;
  font-style: normal;
}

.kb-card .material-symbols-outlined {
  color: var(--primary);
  font-size: 30px;
}

.kb-card h3,
.subsidiary-card h3,
.pipeline-card h3,
.app-list h3 {
  margin: 20px 0 8px;
  font-size: 20px;
  line-height: 1.25;
}

.kb-card p,
.subsidiary-card p,
.pipeline-card p,
.app-list p,
.tool-categories p {
  color: var(--secondary);
  line-height: 1.48;
  font-size: 14px;
}

.kb-card footer,
.kb-card a,
.subsidiary-card a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  border-top: 1px solid var(--outline-variant);
  padding-top: 14px;
  color: var(--primary);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.kb-wide {
  grid-column: span 2;
  min-height: 172px;
}

.chip-row {
  justify-content: flex-start !important;
  flex-wrap: wrap;
  margin-top: 18px;
}

.chip-row i {
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--secondary);
  font-family: var(--mono);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  padding: 7px 12px;
  text-transform: uppercase;
}

.directory-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pills button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-high);
  color: var(--secondary);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 0 16px;
  text-transform: uppercase;
}

.filter-pills button.is-active {
  background: var(--primary);
  color: white;
}

.mini-stats {
  display: flex;
  gap: 24px;
  text-align: right;
}

.mini-stats span {
  display: block;
  color: var(--secondary);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

.mini-stats strong {
  display: block;
  color: var(--primary);
  font-size: 22px;
}

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

.subsidiary-card {
  min-height: 212px;
  padding: 20px;
}

.subsidiary-card.featured {
  grid-column: span 2;
}

.market-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 28px;
  align-items: center;
  overflow: hidden;
  border-radius: 16px;
  background: var(--inverse);
  color: white;
  padding: 32px;
}

.market-hero h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.market-hero p {
  color: #d7d7d7;
  max-width: 620px;
  margin-bottom: 22px;
}

.pipeline-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 24px;
}

.pipeline-card .material-symbols-outlined {
  color: var(--primary-soft);
  font-size: 32px;
}

.pipeline-card strong,
.app-list strong {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(19, 185, 90, 0.14);
  color: #0b7c3b;
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 10px;
  text-transform: uppercase;
}

.pipeline-card small,
.pipeline-card em {
  display: block;
  margin-top: 12px;
  color: #bfbfbf;
  font-family: var(--mono);
  font-style: normal;
  text-transform: uppercase;
}

.tool-categories {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tool-categories article {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
}

.tool-categories .material-symbols-outlined {
  color: var(--primary);
  font-size: 28px;
}

.app-list {
  display: grid;
  gap: 12px;
}

.app-list article {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto auto 38px;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.app-list article > .material-symbols-outlined {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.app-list h3,
.app-list p {
  margin: 0;
}

.app-list strong.maintenance {
  background: rgba(227, 30, 36, 0.14);
  color: var(--primary);
}

.app-list button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--secondary);
}

.dex-footer {
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--outline-variant);
  background: var(--surface);
  color: var(--secondary);
  padding: 22px 40px;
}

.dex-footer strong {
  color: var(--primary);
}

.dex-footer nav {
  gap: 18px;
}

@media (max-width: 1180px) {
  .dex-topbar {
    padding: 0 20px;
  }

  .top-nav {
    gap: 16px;
  }

  .global-search {
    display: none;
  }

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

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

  .kb-large,
  .kb-wide,
  .subsidiary-card.featured {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .dex-sidebar {
    display: none;
  }

  .dex-main {
    margin-left: 0;
  }

  .dashboard-grid,
  .lower-grid,
  .market-hero {
    grid-template-columns: 1fr;
  }

  .page-intro,
  .directory-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .mini-stats {
    text-align: left;
  }

  .quick-grid,
  .subsidiary-grid,
  .tool-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-list article {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .app-list strong,
  .app-list a,
  .app-list button {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .dex-topbar {
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .topbar-left {
    width: 100%;
    justify-content: space-between;
    gap: 16px;
  }

  .top-nav {
    overflow-x: auto;
  }

  .top-nav a {
    height: 40px;
    font-size: 14px;
  }

  .dex-main {
    padding-top: 104px;
  }

  .dashboard-section,
  .knowledge-section,
  .directory-section,
  .marketplace-section {
    padding: 32px 16px;
  }

  .page-intro h1,
  .section-head h2,
  .market-hero h2 {
    font-size: 32px;
    line-height: 40px;
  }

  .stat-strip,
  .quick-grid,
  .knowledge-grid,
  .subsidiary-grid,
  .tool-categories,
  .project-metrics {
    grid-template-columns: 1fr;
  }

  .stat-strip,
  .mini-stats {
    flex-direction: column;
  }

  .kb-large,
  .kb-wide,
  .subsidiary-card.featured {
    grid-column: auto;
  }

  .ai-search {
    border-radius: 12px;
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .pulse-list a,
  .attention-card a {
    grid-template-columns: 42px 1fr;
  }

  .pulse-list a > .material-symbols-outlined,
  .attention-card em {
    grid-column: 2;
  }

  .market-hero {
    padding: 28px;
  }

  .dex-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 16px;
  }
}
