:root {
  --ink: #17233f;
  --muted: #647084;
  --line: #dce6ef;
  --soft: #f6f9fc;
  --blue: #1f78ff;
  --green: #0f766e;
  --yellow: #ffcf3f;
  --red: #ef6357;
  --shadow: 0 16px 38px rgba(23, 35, 63, 0.09);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font: inherit; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 22px;
  background: #10213f;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand, .login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), #58b72c);
  color: white;
  font-weight: 900;
}
.brand span { display: block; color: #b8c5d8; font-size: 0.84rem; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a, .logout {
  padding: 12px 14px;
  border-radius: 12px;
  color: #dfe8f5;
}
.sidebar nav a:hover, .logout:hover { background: rgba(255,255,255,0.1); }
.logout { margin-top: auto; }

.main {
  margin-left: 250px;
  padding: 28px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}
.topbar h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 3rem); }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.user-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: white;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #fff6df, #eaf4ff);
}
.login-card {
  width: min(440px, 100%);
  padding: 30px;
  border-radius: 24px;
  background: white;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0; }
.login-card p { color: var(--muted); }

.alert {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #dcfce7;
  color: #166534;
  font-weight: 800;
}
.alert.error { background: #fee2e2; color: #991b1b; }

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat, .panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.stat { padding: 22px; }
.stat span { color: var(--muted); font-weight: 800; }
.stat strong { display: block; margin-top: 8px; font-size: 2.2rem; }

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.quick-actions a {
  padding: 13px 16px;
  border-radius: 999px;
  background: #10213f;
  color: white;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.pipeline div, .slot-card, .package-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbff;
}
.pipeline span, .slot-card small, .package-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}
.pipeline strong {
  display: block;
  margin-top: 4px;
  font-size: 1.8rem;
}

.availability-grid, .package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.learning-list {
  display: grid;
  gap: 16px;
}
.learning-module {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbff;
  overflow: hidden;
}
.module-head, .lesson-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
}
.module-head {
  border-bottom: 1px solid var(--line);
  background: white;
}
.module-head span, .resource-list span, .question-list span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}
.module-head h3 {
  margin: 4px 0;
}
.module-head p, .lesson-row p {
  margin: 6px 0;
  color: var(--muted);
}
.lesson-row {
  border-bottom: 1px solid var(--line);
}
.lesson-row:last-child {
  border-bottom: 0;
}
.lesson-row small {
  display: block;
  margin-top: 4px;
}
.resource-list, .question-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.resource-pill, .question-list div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--line);
}
.filter-row {
  display: flex;
  gap: 12px;
  align-items: end;
}
.muted { color: var(--muted); }
.slot-card strong, .slot-card span {
  display: block;
}
.slot-card span {
  margin-top: 6px;
  font-size: 1.3rem;
  font-weight: 900;
}
.slot-card p {
  margin: 8px 0;
}
.package-card h3 {
  margin: 8px 0;
}
.package-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 0;
}
.package-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}
.package-card dd {
  margin: 0;
  font-weight: 900;
}

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.panel { padding: 20px; margin-bottom: 18px; }
.panel h2 { margin-top: 0; }
.form-panel summary {
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  background: white;
  color: var(--ink);
}
textarea { min-height: 86px; resize: vertical; }
.wide { grid-column: 1 / -1; }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  background: #e8eef6;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}
.btn.primary { background: linear-gradient(135deg, var(--green), var(--blue)); color: white; }
.btn.small { padding: 8px 12px; font-size: 0.86rem; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-size: 0.84rem; text-transform: uppercase; }
small { color: var(--muted); }
.link { color: var(--green); font-weight: 900; }
.link.danger {
  border: 0;
  padding: 0;
  background: transparent;
  color: #b91c1c;
  cursor: pointer;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.actions form { margin: 0; }
.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eaf4ff;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 900;
}
.badge-paid, .badge-active, .badge-converted, .badge-completed { background: #dcfce7; color: #166534; }
.badge-lost, .badge-no-show, .badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-hot, .badge-payment-pending, .badge-payment-link-sent { background: #fff4d6; color: #92400e; }
.inline-form {
  display: grid;
  gap: 8px;
  min-width: 240px;
}
.inline-form textarea { min-height: 52px; }

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    border-radius: 0 0 22px 22px;
  }
  .sidebar nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main { margin-left: 0; padding: 18px; }
  .cards, .grid.two, .form-grid, .availability-grid, .package-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .sidebar nav, .cards, .grid.two, .form-grid, .availability-grid, .package-grid, .pipeline { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .module-head, .lesson-row, .filter-row { flex-direction: column; align-items: stretch; }
  .panel { padding: 16px; }
}
