:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef4f3;
  --ink: #152026;
  --muted: #687780;
  --line: #dce4e8;
  --accent: #0f766e;
  --accent-dark: #0a5c56;
  --blue: #2563eb;
  --amber: #b45309;
  --shadow: 0 16px 40px rgba(21, 32, 38, .08);
}

* { box-sizing: border-box; }

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

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

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

button:hover,
.nav a:hover {
  border-color: #b8c7ce;
  background: #f8fbfb;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.primary:hover { background: var(--accent-dark); }

.ghost {
  background: transparent;
  color: var(--accent-dark);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-size: 14px;
  font-weight: 850;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 720;
}

.nav a.active {
  border-color: #c7dddd;
  background: var(--surface-2);
  color: var(--accent-dark);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 86px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 248, .92);
  backdrop-filter: blur(14px);
}

.topbar h1,
.topbar p,
.hero-panel h2,
.panel h3 {
  margin: 0;
}

.topbar h1 {
  margin-top: 3px;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--amber);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: .04em;
  text-transform: uppercase;
}

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

.session-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.icon-button {
  display: none;
  width: 42px;
  padding: 0;
}

.content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 20px;
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 230px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.96), rgba(255,255,255,.76)),
    url("assets/hero-pattern.svg");
  background-position: center;
  background-size: cover;
  box-shadow: var(--shadow);
}

.landing-hero {
  min-height: 340px;
}

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

.hero-panel h2 {
  max-width: 760px;
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

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

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

.metric,
.panel,
.price-card,
.table-card,
.quiz-frame {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(21, 32, 38, .03);
}

.metric,
.panel,
.price-card,
.quiz-frame {
  padding: 20px;
}

.metric span,
.price-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metric strong,
.price-card strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 30px;
  line-height: 1;
}

.metric small {
  color: var(--muted);
}

.layout-two {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h3 {
  margin: 0;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline div {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 12px;
  align-items: baseline;
}

.timeline span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

.timeline p {
  margin: 0;
}

.details {
  display: grid;
  gap: 12px;
  margin: 0;
}

.details div,
.table-row,
.quiz-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.details dt,
.quiz-meta,
.table-head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.details dd {
  margin: 0;
  font-weight: 780;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef2ff;
  color: var(--blue);
  font-size: 12px;
}

.badge.success {
  background: #e8f6f2;
  color: var(--accent-dark);
}

.form-card,
.compact-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
  color: var(--ink);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.notice,
.upload-zone,
.auth-message {
  border: 1px dashed #b8c7ce;
  border-radius: 8px;
  background: #f8fbfb;
}

.notice,
.auth-message {
  margin-top: 18px;
  padding: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-message {
  margin-top: 0;
  border-color: #c7dddd;
}

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

.feature-list p {
  margin: 0;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}

body.is-authenticated [data-public-only] {
  display: none;
}

.table-card {
  overflow: hidden;
}

.table-row {
  grid-template-columns: 1.2fr 1fr .7fr .7fr;
  padding: 15px 18px;
  border-top: 1px solid var(--line);
}

.table-row:first-child {
  border-top: 0;
  background: #fbfcfd;
}

.quiz-frame {
  display: grid;
  gap: 22px;
  max-width: 850px;
}

.quiz-frame h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.answer-grid button {
  justify-content: flex-start;
  min-height: 58px;
  text-align: left;
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.price-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.price-card.featured {
  border-color: #8bc8c1;
  box-shadow: var(--shadow);
}

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

body.nav-open .sidebar {
  transform: translateX(0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .18s ease;
  }

  .icon-button {
    display: inline-grid;
    place-items: center;
  }

  .metric-grid,
  .pricing-grid,
  .admin-grid,
  .layout-two {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    display: none;
  }

  .hero-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 18px;
  }

  .topbar {
    padding: 16px 18px;
  }

  .hero-panel h2,
  .quiz-frame h2 {
    font-size: 25px;
  }

  .answer-grid,
  .form-row,
  .table-row {
    grid-template-columns: 1fr;
  }
}
