:root {
  --ep-bg: #040b11;
  --ep-bg-soft: #071620;
  --ep-panel: rgba(10, 29, 40, .82);
  --ep-panel-strong: #0d2330;

  --ep-line: rgba(255, 255, 255, .085);
  --ep-line-strong: rgba(255, 255, 255, .14);

  --ep-text: #f3fafc;
  --ep-muted: #829da8;

  --ep-teal: #42d9d2;
  --ep-teal-bright: #72eee8;
  --ep-teal-soft: rgba(66, 217, 210, .10);

  --ep-shadow:
    0 30px 90px rgba(0, 0, 0, .34),
    0 2px 16px rgba(0, 0, 0, .18);
}

html {
  background: var(--ep-bg);
}

body {
  background:
    radial-gradient(
      circle at 88% -10%,
      rgba(66, 217, 210, .12),
      transparent 31%
    ),
    radial-gradient(
      circle at -8% 78%,
      rgba(32, 101, 133, .11),
      transparent 29%
    ),
    linear-gradient(
      145deg,
      #040a10,
      #07151f 58%,
      #050f16
    );
}

/* ==========================================================
   AUTH / ENTERPRISE ENTRY
   ========================================================== */

.auth-shell {
  position: relative;
  overflow: hidden;
}

.auth-shell::before,
.auth-shell::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border: 1px solid rgba(66, 217, 210, .085);
  border-radius: 50%;
}

.auth-shell::before {
  width: 560px;
  height: 560px;
  right: -210px;
  top: -235px;
}

.auth-shell::after {
  width: 360px;
  height: 360px;
  right: -90px;
  top: -125px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(535px, 100%);
  overflow: hidden;
  padding: 52px;
  border: 1px solid var(--ep-line);
  border-radius: 28px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, .032),
      transparent
    ),
    rgba(7, 21, 30, .90);
  box-shadow:
    0 48px 135px rgba(0, 0, 0, .50),
    inset 0 1px 0 rgba(255, 255, 255, .025);
  backdrop-filter: blur(24px);
}

.auth-card::before {
  content: "ENTERPRISE";
  position: absolute;
  top: 22px;
  right: 22px;
  padding: 6px 9px;
  border: 1px solid rgba(66, 217, 210, .18);
  border-radius: 999px;
  color: var(--ep-teal);
  background: rgba(66, 217, 210, .055);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .14em;
}

.auth-logo {
  width: 184px;
  max-height: 82px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 34px;
}

.auth-card .eyebrow {
  color: var(--ep-teal);
  font-weight: 850;
  letter-spacing: .17em;
}

.auth-card h1 {
  margin-top: 14px;
  font-size: 39px;
  line-height: 1.05;
  letter-spacing: -.042em;
}

.auth-card .muted {
  color: #8ca5af;
  line-height: 1.7;
}

.auth-card label {
  color: #a7bec7;
}

.auth-foot {
  padding-top: 17px;
  border-top: 1px solid var(--ep-line);
  color: #57717c;
}

input,
select,
textarea {
  border-color: var(--ep-line-strong);
  background: rgba(3, 14, 21, .72);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(66, 217, 210, .58);
  box-shadow:
    0 0 0 4px rgba(66, 217, 210, .075);
}

.primary {
  border-color: rgba(66, 217, 210, .42);
  color: #031011;
  background:
    linear-gradient(
      135deg,
      var(--ep-teal-bright),
      var(--ep-teal)
    );
  box-shadow:
    0 12px 32px rgba(66, 217, 210, .13);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 16px 38px rgba(66, 217, 210, .20);
}

.secondary {
  border-color: var(--ep-line-strong);
  background: rgba(255, 255, 255, .025);
}

.secondary:hover {
  border-color: rgba(66, 217, 210, .25);
  background: rgba(66, 217, 210, .045);
}

/* ==========================================================
   APPLICATION SHELL
   ========================================================== */

.app-shell {
  background:
    radial-gradient(
      circle at 84% 0%,
      rgba(66, 217, 210, .055),
      transparent 31%
    );
}

.sidebar {
  border-right-color: var(--ep-line);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, .018),
      transparent 31%
    ),
    rgba(4, 14, 21, .97);
  backdrop-filter: blur(24px);
}

.brand {
  position: relative;
  min-height: 76px;
  padding-right: 75px;
}

.brand img {
  width: 148px;
  max-height: 66px;
  object-fit: contain;
  object-position: left center;
}

.brand::after {
  content: "ENTERPRISE";
  position: absolute;
  right: 0;
  top: 21px;
  padding: 5px 7px;
  border: 1px solid rgba(66, 217, 210, .17);
  border-radius: 999px;
  color: var(--ep-teal);
  background: rgba(66, 217, 210, .052);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: .12em;
}

.nav-item {
  position: relative;
  min-height: 50px;
  padding-left: 49px;
  border-radius: 12px;
  font-weight: 650;
}

.nav-item::before {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid var(--ep-line);
  border-radius: 8px;
  color: #617b86;
  background: rgba(255, 255, 255, .018);
  font-size: 8px;
  font-weight: 850;
}

.nav-item:nth-child(1)::before {
  content: "01";
}

.nav-item:nth-child(2)::before {
  content: "02";
}

.nav-item:nth-child(3)::before {
  content: "03";
}

.nav-item:nth-child(4)::before {
  content: "04";
}

.nav-item:nth-child(5)::before {
  content: "05";
}

#masterNav::before {
  content: "06";
}

.nav-item:hover {
  border-color: rgba(255, 255, 255, .04);
  background: rgba(255, 255, 255, .025);
}

.nav-item.active {
  border-color: rgba(66, 217, 210, .14);
  color: var(--ep-text);
  background:
    linear-gradient(
      90deg,
      rgba(66, 217, 210, .10),
      rgba(66, 217, 210, .018)
    );
}

.nav-item.active::before {
  color: var(--ep-teal);
  border-color: rgba(66, 217, 210, .23);
  background: rgba(66, 217, 210, .065);
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 12px;
  border: 1px solid var(--ep-line);
  border-radius: 14px;
  background:
    radial-gradient(
      circle at 100% 0%,
      rgba(66, 217, 210, .075),
      transparent 56%
    ),
    rgba(255, 255, 255, .018);
}

.sidebar-foot::before {
  content: "SOVEREIGN PLATFORM";
  display: block;
  margin-bottom: 8px;
  color: #607a85;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .12em;
}

.status-dot {
  box-shadow:
    0 0 14px rgba(66, 217, 210, .62);
}

/* ==========================================================
   TOPBAR
   ========================================================== */

.topbar {
  min-height: 92px;
  border-bottom-color: var(--ep-line);
  background: rgba(4, 14, 21, .84);
  backdrop-filter: blur(22px);
}

.topbar .eyebrow {
  color: var(--ep-teal);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .17em;
}

.topbar h2 {
  font-size: 24px;
  letter-spacing: -.035em;
}

.context-select select {
  border-color: var(--ep-line);
  background: rgba(255, 255, 255, .025);
}

.identity {
  padding: 8px 11px;
  border: 1px solid var(--ep-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .018);
}

/* ==========================================================
   HERO
   ========================================================== */

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  padding: 42px;
  border-color: var(--ep-line);
  background:
    radial-gradient(
      circle at 90% 18%,
      rgba(66, 217, 210, .145),
      transparent 27%
    ),
    linear-gradient(
      130deg,
      rgba(17, 47, 62, .86),
      rgba(8, 23, 33, .94)
    );
  box-shadow: var(--ep-shadow);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      rgba(255, 255, 255, .02) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, .02) 1px,
      transparent 1px
    );
  background-size: 54px 54px;
  opacity: .55;
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.hero-card h3 {
  max-width: 760px;
  font-size: clamp(36px, 4vw, 58px);
  line-height: 1.02;
  letter-spacing: -.047em;
}

.hero-card p {
  max-width: 720px;
  color: #9bb2bc;
  line-height: 1.72;
}

.sovereign-badge {
  border: 1px solid rgba(66, 217, 210, .18);
  background:
    radial-gradient(
      circle,
      rgba(66, 217, 210, .15),
      rgba(66, 217, 210, .025)
    );
  box-shadow:
    inset 0 0 58px rgba(66, 217, 210, .04),
    0 20px 50px rgba(0, 0, 0, .16);
}

.sovereign-badge strong {
  color: var(--ep-teal-bright);
}

/* ==========================================================
   METRICS + PANELS
   ========================================================== */

.metrics-grid {
  gap: 13px;
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  border-color: var(--ep-line);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, .024),
      transparent
    ),
    rgba(11, 29, 40, .78);
  box-shadow: var(--ep-shadow);
}

.metric::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 42%;
  height: 2px;
  background:
    linear-gradient(
      90deg,
      var(--ep-teal),
      transparent
    );
  opacity: .58;
}

.metric span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.metric strong {
  margin-top: 15px;
  font-size: clamp(23px, 2.2vw, 31px);
  letter-spacing: -.04em;
}

.panel {
  border-color: var(--ep-line);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, .018),
      transparent
    ),
    rgba(10, 27, 38, .80);
  box-shadow: var(--ep-shadow);
  backdrop-filter: blur(8px);
}

.panel-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ep-line);
}

.panel h3 {
  letter-spacing: -.025em;
}

.key-value > div {
  border-bottom-color: var(--ep-line);
}

/* ==========================================================
   SOVEREIGN AI WORKSPACE
   ========================================================== */

.ai-panel {
  overflow: hidden;
  padding: 0;
}

.ai-panel .panel-head {
  padding: 20px 22px;
  background: rgba(255, 255, 255, .014);
}

.chat-log {
  min-height: 450px;
  max-height: 60vh;
  padding: 27px;
  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(66, 217, 210, .028),
      transparent 42%
    ),
    rgba(3, 13, 20, .36);
}

.message {
  max-width: min(820px, 92%);
}

.message p {
  border-color: var(--ep-line);
  background: rgba(255, 255, 255, .027);
  line-height: 1.72;
}

.message.user p {
  border-color: rgba(66, 217, 210, .14);
  background: rgba(66, 217, 210, .065);
}

.composer {
  padding: 18px;
  border-top: 1px solid var(--ep-line);
  background: rgba(4, 15, 22, .88);
}

.composer textarea {
  min-height: 96px;
  border-color: var(--ep-line-strong);
  background: rgba(2, 11, 17, .64);
}

/* ==========================================================
   DEVELOPER / SECURITY / MASTER
   ========================================================== */

.table-wrap {
  border: 1px solid var(--ep-line);
  border-radius: 13px;
  overflow: auto;
}

th {
  color: #68838e;
  background: rgba(255, 255, 255, .018);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .075em;
  text-transform: uppercase;
}

th,
td {
  border-bottom-color: var(--ep-line);
}

.json-view,
.secret-view {
  border-color: var(--ep-line);
  background: rgba(2, 11, 17, .68);
}

#secretPanel {
  border-color: rgba(255, 123, 123, .18);
  background:
    radial-gradient(
      circle at 100% 0%,
      rgba(255, 123, 123, .055),
      transparent 38%
    ),
    rgba(10, 27, 38, .82);
}

#view-master .panel {
  border-color: rgba(171, 135, 220, .15);
}

#view-master .eyebrow {
  color: #c9a9ee;
}

/* ==========================================================
   TOAST + ACCESSIBILITY
   ========================================================== */

.toast {
  border-color: rgba(66, 217, 210, .20);
  background: rgba(7, 24, 33, .97);
  box-shadow: var(--ep-shadow);
}

button,
input,
select,
textarea {
  transition:
    border-color .18s ease,
    background .18s ease,
    box-shadow .18s ease,
    transform .18s ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(66, 217, 210, .72);
  outline-offset: 2px;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 1050px) {
  .brand {
    padding-right: 0;
  }

  .brand::after {
    display: none;
  }

  .nav-item {
    padding-left: 0;
  }

  .nav-item::before {
    position: static;
    transform: none;
    margin: auto;
  }
}

@media (max-width: 760px) {
  .auth-card {
    padding: 35px 25px;
    border-radius: 22px;
  }

  .auth-card::before {
    top: 15px;
    right: 15px;
  }

  .auth-logo {
    width: 152px;
  }

  .auth-card h1 {
    font-size: 31px;
  }

  .hero-card {
    min-height: 0;
    padding: 28px 22px;
  }

  .hero-card h3 {
    font-size: 36px;
  }

  .nav-item::before {
    width: 28px;
    height: 28px;
  }

  .topbar {
    backdrop-filter: none;
  }

  .chat-log {
    min-height: 390px;
  }
}

@media (max-width: 480px) {
  .hero-card h3 {
    font-size: 31px;
  }
}

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