:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --ink: #152033;
  --muted: #5f6d7f;
  --line: #d7deea;
  --blue: #2457c5;
  --green: #0a7a4f;
  --amber: #a35d00;
  --red: #b42318;
  --rail: 76px;
  --drawer: 340px;
  --shadow: 0 16px 38px rgba(26, 38, 63, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

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

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--rail) var(--drawer) minmax(0, 1fr);
  grid-template-areas: "rail drawer main";
}

body[data-drawer="closed"] .shell {
  grid-template-columns: var(--rail) 0 minmax(0, 1fr);
}

.rail {
  grid-area: rail;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 10px;
  background: #182134;
  color: #f8fbff;
  z-index: 4;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  font-weight: 900;
}

.rail-divider {
  width: 34px;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  margin: 4px 0;
}

.rail-spacer {
  flex: 1;
}

.rail-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d5deed;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.rail-btn.active,
.rail-btn:hover {
  background: #ffffff;
  color: #172033;
}

.drawer {
  grid-area: drawer;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface);
  transition: width 160ms ease;
}

body[data-drawer="closed"] .drawer {
  width: 0;
  border-right: 0;
}

.drawer-inner {
  width: var(--drawer);
  height: 100vh;
  overflow-y: auto;
  padding: 18px;
}

.drawer h2,
.drawer h3 {
  margin: 0;
}

.drawer-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.drawer-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.drawer-close {
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.glance-list {
  display: grid;
  gap: 10px;
}

.glance {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.glance strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.glance-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.drawer-nav {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.drawer-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 8px 10px;
}

.drawer-link.active,
.drawer-link:hover {
  border-color: #b9c8ea;
  background: #f1f5ff;
}

.main {
  grid-area: main;
  min-width: 0;
  padding: 22px;
}

.main-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 6px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.06;
}

.topbar p,
.section-lede {
  color: var(--muted);
  line-height: 1.55;
}

.segment {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.segment button,
.segment a {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment button:last-child,
.segment a:last-child {
  border-right: 0;
}

.segment .active,
.segment button:hover,
.segment a:hover {
  color: var(--blue);
  background: #f1f5ff;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

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

.metric {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.metric-foot {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ok {
  color: var(--green);
}

.warn {
  color: var(--amber);
}

.bad {
  color: var(--red);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #edf5ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.badge.ok {
  background: #eefaf4;
}

.badge.warn {
  background: #fff5e6;
}

.badge.bad {
  background: #fff0ef;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  min-height: 42px;
  border: 1px solid #b9c8ea;
  border-radius: 8px;
  background: #f1f5ff;
  color: #1748af;
  padding: 9px 13px;
  font-weight: 900;
}

.btn.primary {
  border-color: #1748af;
  background: #1748af;
  color: #fff;
}

.btn.danger {
  border-color: #f2c3bd;
  background: #fff0ef;
  color: var(--red);
}

.spark {
  height: 72px;
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 4px;
  align-items: end;
}

.spark span {
  display: block;
  border-radius: 5px 5px 0 0;
  background: #b9c8ea;
}

.login-wrap,
.landing-wrap {
  min-height: 100vh;
  padding: 26px;
}

.landing-nav {
  width: min(1180px, 100%);
  margin: 0 auto 28px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.landing-hero {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  gap: 28px;
  align-items: center;
}

.hero-copy {
  padding: 28px 0;
}

.hero-copy h1 {
  font-size: clamp(38px, 6vw, 72px);
}

.hero-copy p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.58;
}

.product-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafd;
}

.preview-body {
  padding: 16px;
}

.login-card {
  width: min(460px, 100%);
  margin: 9vh auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.notice {
  border: 1px solid #f0d1a0;
  border-radius: 8px;
  background: #fff8ec;
  color: #704100;
  padding: 12px;
  margin-top: 14px;
  line-height: 1.45;
}

.faq {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.faq button {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  padding: 10px 12px;
  font-weight: 900;
}

.faq p {
  display: none;
  margin: 0;
  padding: 0 12px 12px;
  color: var(--muted);
  line-height: 1.5;
}

.faq .open p {
  display: block;
}

.overlay {
  display: none;
}

@media (max-width: 980px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  :root {
    --rail: 54px;
    --drawer: 300px;
  }

  .shell,
  body[data-drawer="closed"] .shell {
    grid-template-columns: var(--rail) minmax(0, 1fr);
    grid-template-areas: "rail main";
  }

  .drawer {
    position: fixed;
    left: var(--rail);
    top: 0;
    bottom: 0;
    width: var(--drawer);
    z-index: 7;
    box-shadow: var(--shadow);
  }

  body[data-drawer="closed"] .drawer {
    transform: translateX(calc(-1 * var(--drawer)));
    width: var(--drawer);
  }

  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 24, 42, 0.28);
    z-index: 6;
  }

  body[data-drawer="open"] .overlay {
    display: block;
  }

  .main {
    padding: 14px;
  }
}

@media (max-width: 620px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .landing-nav {
    display: block;
  }

  .segment,
  .actions {
    margin-top: 12px;
  }
}
