:root {
  --bg-0: #030806;
  --bg-1: #081510;
  --bg-2: #0b1b15;
  --line-soft: rgba(53, 128, 97, 0.26);
  --line-mid: rgba(53, 128, 97, 0.5);
  --text: #def8ea;
  --muted: #89ad9d;
  --accent: #18bd89;
  --accent-deep: #0b7a55;
  --card: rgba(8, 20, 15, 0.68);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Sora", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 680px at -20% -18%, rgba(24, 189, 137, 0.19), transparent),
    radial-gradient(980px 560px at 110% 120%, rgba(11, 122, 85, 0.16), transparent),
    linear-gradient(165deg, var(--bg-0), var(--bg-1) 60%, var(--bg-2));
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: radial-gradient(rgba(255, 255, 255, 0.18) 0.8px, transparent 0.8px);
  background-size: 4px 4px;
}

.container {
  width: min(1160px, calc(100% - 34px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(4, 11, 8, 0.66);
  border-bottom: 1px solid rgba(53, 128, 97, 0.18);
}

.topbar-inner {
  padding: 10px 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.45rem;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.nav-links a {
  color: #b8e8d4;
  text-decoration: none;
  font-size: 0.92rem;
}

.nav-links a:hover {
  color: #e7fff5;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page {
  position: relative;
  z-index: 1;
  padding: 10px 0 34px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid rgba(53, 128, 97, 0.2);
  background: transparent;
  padding: 16px 0 18px;
}

.hero-logo {
  width: min(200px, 36vw);
  max-width: 200px;
  display: block;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.4));
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 6px 0 0;
  font-family: "Space Grotesk", "Sora", sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.lead {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.generated {
  position: absolute;
  right: 0;
  top: 0;
  margin: 0;
  color: #8fbca8;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  opacity: 0.92;
}

.plans {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  border-bottom: 1px solid rgba(53, 128, 97, 0.16);
  padding: 8px 0 14px;
}

.plans.single-plan {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.plan-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 4px 0;
}

.plan-name {
  margin: 0;
  color: #a3ddc6;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 700;
}

.plan-price {
  margin: 6px 0 0;
  font-size: 1.18rem;
  font-weight: 700;
}

.plan-card p {
  color: var(--muted);
}

.plan-btn {
  margin-top: 8px;
}

.plan-actions {
  margin-top: 8px;
}

.plan-active-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(24, 189, 137, 0.44);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #d6ffee;
  letter-spacing: 0.03em;
}

.plan-card.is-active .plan-name,
.plan-card.is-active .plan-price {
  color: #e9fff5;
}

.plan-card.is-active .plan-price {
  text-shadow: 0 0 24px rgba(24, 189, 137, 0.34);
}

.mode-row {
  margin-top: 8px;
  border-bottom: 1px solid rgba(53, 128, 97, 0.16);
  padding: 10px 0 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.mode-tabs {
  display: flex;
  gap: 8px;
}

.mode-tab {
  border: 1px solid rgba(53, 128, 97, 0.45);
  border-radius: 999px;
  background: transparent;
  color: #9fd9c1;
  font: inherit;
  font-size: 0.82rem;
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.mode-tab:hover {
  border-color: rgba(24, 189, 137, 0.7);
  color: #dbfff1;
}

.mode-tab.is-active {
  background: rgba(24, 189, 137, 0.16);
  border-color: rgba(24, 189, 137, 0.9);
  color: #ecfff7;
}

.mode-info p {
  margin: 0;
  color: #afd9c6;
  font-size: 0.86rem;
}

.mode-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-notice {
  margin-top: 8px;
  padding: 2px 0;
  color: #bde9d6;
  font-size: 0.88rem;
}

.owner-panel {
  margin-top: 10px;
}

.user-sim-panel {
  margin-top: 10px;
}

.user-sim-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
}

.user-sim-field {
  display: grid;
  gap: 5px;
}

.user-sim-field span {
  font-size: 0.83rem;
  color: #a9d3bf;
}

.user-sim-field input,
.user-sim-field select {
  border: 1px solid rgba(53, 128, 97, 0.45);
  border-radius: 8px;
  background: rgba(4, 11, 8, 0.7);
  color: #eafff5;
  padding: 8px 10px;
  font: inherit;
}

.user-sim-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.owner-risk-line {
  margin: 0 0 8px;
  color: #c9efdf;
  font-size: 0.9rem;
  line-height: 1.6;
}

.owner-risk-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.owner-risk-kpis .kpi-card {
  border: 1px solid rgba(53, 128, 97, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(7, 18, 13, 0.45);
}

.owner-ticket-cell {
  min-width: 280px;
  color: #d4f5e7;
  font-size: 0.81rem;
  line-height: 1.45;
}

.user-ticket-cell {
  min-width: 300px;
}

.owner-ticket-empty {
  color: #88af9e;
}

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

.kpi-card {
  border: 0;
  border-bottom: 1px solid rgba(53, 128, 97, 0.16);
  border-radius: 0;
  background: transparent;
  padding: 6px 0 10px;
}

.kpi-label {
  margin: 0;
  color: #99baa9;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

.kpi-value {
  margin: 5px 0 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #e6fff4;
}

.kpi-card.is-reason .kpi-value {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.panel {
  margin-top: 10px;
  border: 0;
  border-top: 1px solid rgba(53, 128, 97, 0.16);
  border-radius: 0;
  background: transparent;
  padding: 12px 0 8px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.panel-head h2 {
  margin: 0;
  font-family: "Space Grotesk", "Sora", sans-serif;
  font-size: 1.2rem;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  margin-top: 2px;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 6px;
  text-align: left;
  border-bottom: 1px solid rgba(53, 128, 97, 0.14);
}

th {
  color: #afe8d1;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.status-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.chip-tp {
  background: #63d8ae;
  color: #073121;
}

.chip-sl {
  background: #f39999;
  color: #3d1414;
}

.chip-time {
  background: #d9e0dc;
  color: #233029;
}

.chip-unexecuted {
  background: #e2d8ff;
  color: #2a1d4f;
}

.chip-open {
  background: #a8d9f3;
  color: #0d2f45;
}

.quality-note {
  margin: 8px 0 0;
  color: #84a896;
  font-size: 0.82rem;
}

.sim-form {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 10px;
  align-items: end;
}

.sim-field {
  display: grid;
  gap: 5px;
}

.sim-field label {
  font-size: 0.83rem;
  color: #a9d3bf;
}

.sim-field input {
  border: 1px solid rgba(53, 128, 97, 0.45);
  border-radius: 8px;
  background: rgba(4, 11, 8, 0.7);
  color: #eafff5;
  padding: 8px 10px;
  font: inherit;
}

.runner-panel p {
  margin: 0;
  color: #bde3d2;
  line-height: 1.65;
  font-size: 0.92rem;
}

.footer {
  margin-top: 12px;
  color: #82a496;
  border-top: 1px solid rgba(53, 128, 97, 0.16);
  padding-top: 10px;
}

.footer p {
  margin: 0 0 6px;
}

.footer a {
  color: #aee9d0;
  text-decoration: none;
  border-bottom: 1px solid rgba(24, 189, 137, 0.34);
}

.footer a:hover {
  color: #e9fff6;
  border-bottom-color: rgba(24, 189, 137, 0.88);
}

.error {
  color: #f09a9a;
  min-height: 1.2em;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  color: #effff8;
  text-decoration: none;
  background: linear-gradient(145deg, var(--accent-deep), var(--accent));
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(53, 128, 97, 0.4);
  color: #d9f7ea;
}

.btn-secondary:hover {
  border-color: rgba(24, 189, 137, 0.95);
  background: rgba(24, 189, 137, 0.12);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 980px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 8px;
  }

  .nav-links {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

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

  .generated {
    position: static;
    margin-top: 8px;
    font-size: 0.82rem;
  }

  .plans {
    grid-template-columns: 1fr;
  }

  .mode-row {
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .mode-actions {
    width: 100%;
    flex-wrap: wrap;
  }

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

  .owner-risk-kpis {
    grid-template-columns: 1fr;
  }

  .user-sim-controls {
    grid-template-columns: 1fr;
  }

  .user-sim-kpis {
    grid-template-columns: 1fr;
  }

  .sim-form {
    grid-template-columns: 1fr;
  }
}

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