:root {
  --ink: #e8edf5;
  --muted: #8f9bad;
  --faint: #596579;
  --surface: #111722;
  --surface-2: #171f2c;
  --surface-3: #1d2736;
  --line: #283447;
  --bg: #090d14;
  --accent: #ff6a3d;
  --accent-soft: rgba(255, 106, 61, .12);
  --green: #55d39a;
  --yellow: #f2c66d;
  --red: #ff6b76;
  --blue: #78a6ff;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -10%, rgba(255, 106, 61, .12), transparent 32rem),
    radial-gradient(circle at 90% 15%, rgba(120, 166, 255, .08), transparent 28rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(40, 52, 71, .78);
  background: rgba(9, 13, 20, .82);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 750; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: #120c09;
  background: var(--accent);
  box-shadow: 0 10px 28px rgba(255, 106, 61, .22);
  font-size: 14px;
  letter-spacing: -.04em;
}
.brand-copy small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.brand-copy strong { font-size: 15px; }

.nav { display: flex; align-items: center; gap: 6px; }
.nav a {
  padding: 9px 13px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}
.nav a:hover, .nav a.active { color: var(--ink); background: var(--surface-2); }

.user-pill { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
}

main { padding: 72px 0 90px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 790px; margin-bottom: 18px; font-size: clamp(42px, 7vw, 76px); line-height: .98; letter-spacing: -.055em; }
.lede { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: clamp(17px, 2vw, 20px); line-height: 1.65; }

.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 64px 0 20px; }
.section-head h2 { margin-bottom: 5px; font-size: 24px; letter-spacing: -.03em; }
.section-head p { margin-bottom: 0; color: var(--muted); font-size: 14px; }

.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.module-card, .panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(23, 31, 44, .96), rgba(15, 21, 31, .96));
  box-shadow: var(--shadow);
}
.module-card { position: relative; min-height: 280px; padding: 28px; overflow: hidden; }
.module-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  bottom: -90px;
  border-radius: 50%;
  background: var(--glow, rgba(255, 106, 61, .11));
  filter: blur(4px);
}
.module-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.module-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-3);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: -.03em;
}
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status.ready::before { background: var(--green); box-shadow: 0 0 0 5px rgba(85, 211, 154, .08); }
.module-card h3 { position: relative; z-index: 1; margin: 42px 0 10px; font-size: 25px; letter-spacing: -.03em; }
.module-card p { position: relative; z-index: 1; max-width: 460px; min-height: 52px; color: var(--muted); line-height: 1.6; }
.module-foot { position: relative; z-index: 1; margin-top: 24px; }

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface-2);
  text-decoration: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}
.btn:hover { border-color: #3b4a61; background: var(--surface-3); }
.btn-primary { border-color: var(--accent); color: #160b07; background: var(--accent); }
.btn-primary:hover { border-color: #ff825f; background: #ff825f; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(255, 107, 118, .35); color: #ff9ba3; background: rgba(255, 107, 118, .08); }
.btn-small { min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 12px; }

.panel { padding: 24px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.panel-head h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 26px 0; }
.stat { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(23, 31, 44, .66); }
.stat small { display: block; margin-bottom: 9px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.stat strong { font-size: 24px; letter-spacing: -.04em; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
label { color: #c3ccda; font-size: 12px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: #0d131d;
  padding: 11px 13px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 110px; resize: vertical; }
.hint { color: var(--faint); font-size: 11px; line-height: 1.5; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }

.flash { margin-bottom: 20px; padding: 13px 15px; border: 1px solid rgba(85, 211, 154, .28); border-radius: 11px; color: #b9f3d8; background: rgba(85, 211, 154, .08); font-size: 13px; }
.flash.error { border-color: rgba(255, 107, 118, .3); color: #ffc0c5; background: rgba(255, 107, 118, .08); }

.monitor-list, .result-list { display: grid; gap: 12px; }
.monitor, .result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(13, 19, 29, .68);
}
.monitor h3, .result h3 { margin: 0 0 5px; font-size: 14px; }
.monitor p, .result p { margin: 0; color: var(--muted); font-size: 12px; }
.monitor-actions, .result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.result { align-items: flex-start; }
.result-copy { min-width: 0; flex: 1; }
.result h3 a { text-decoration: none; }
.result h3 a:hover { color: var(--accent); }
.result-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 7px; color: var(--faint); font-size: 11px; }
.result-body { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-height: 1.55; }

.empty { padding: 34px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }
.connection { display: flex; align-items: center; gap: 14px; }
.connection-mark { width: 11px; height: 11px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 7px rgba(85, 211, 154, .09); }
.connection strong { display: block; margin-bottom: 2px; }
.connection small { color: var(--muted); }
.setup-steps { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.8; font-size: 13px; }
.setup-steps strong { color: var(--ink); }

.modal { display: none; position: fixed; inset: 0; z-index: 50; place-items: center; padding: 24px; background: rgba(2, 5, 10, .78); backdrop-filter: blur(8px); }
.modal.open { display: grid; }
.modal-card { width: min(620px, 100%); padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.close { border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 22px; }

footer { padding: 0 0 40px; color: var(--faint); font-size: 12px; text-align: center; }

@media (max-width: 840px) {
  .module-grid, .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-row { display: block; }
  .hero-actions { margin-top: 28px; }
  .nav { display: none; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 1180px); }
  main { padding-top: 46px; }
  h1 { font-size: 42px; }
  .user-pill span { display: none; }
  .stats { grid-template-columns: 1fr; }
  .monitor, .result, .panel-head { align-items: stretch; flex-direction: column; }
  .monitor-actions, .result-actions { justify-content: flex-start; }
}
