/* Bootcamp Organiser — dark, quiet, tight.
   One stylesheet for all four front ends, so the viewer, the planner, the
   organiser and the admin screen cannot drift apart visually. */

:root {
  --bg: #08090a;
  --bg-elevated: #0f1011;
  --surface: #131415;
  --surface-hover: #18191b;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);

  --text: #f7f8f8;
  --text-secondary: #b4b8bf;
  --text-muted: #8a8f98;
  --text-faint: #62666d;

  --accent: #5e6ad2;
  --accent-hover: #6b76dd;
  --accent-soft: rgba(94, 106, 210, 0.14);
  --positive: #4cb782;
  --warning: #f2c94c;
  --danger: #eb5757;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 32px rgba(0, 0, 0, 0.35);

  --page-max: 1600px;
  --page-gutter: 24px;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.02em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }

a { color: var(--text-secondary); text-decoration: none; }
a:hover { color: var(--text); }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
}

/* ------------------------------------------------------------- chrome -- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 52px;
  padding: 0 var(--page-gutter);
  background: rgba(8, 9, 10, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 560;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}

.brand .mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.nav { display: flex; gap: 2px; margin-left: 6px; }

.nav a {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}

.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.active { background: var(--surface); color: var(--text); }

.topbar .spacer { flex: 1; }

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 22px var(--page-gutter) 80px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-head .grow { flex: 1; min-width: 220px; }
.subtle { color: var(--text-muted); font-size: 13px; }
.faint { color: var(--text-faint); }

/* ------------------------------------------------------------ surfaces -- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.card + .card { margin-top: 14px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head .grow { flex: 1; min-width: 0; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* --------------------------------------------------------------- stats -- */

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.stat .value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 560;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat .value.small { font-size: 16px; }
.stat .hint { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.stat.good .value { color: var(--positive); }
.stat.warn .value { color: var(--warning); }
.stat.bad .value { color: var(--danger); }

/* ------------------------------------------------------------ controls -- */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}

button:hover, .btn:hover { background: var(--surface-hover); border-color: rgba(255, 255, 255, 0.2); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button.primary, .btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  font-weight: 500;
}

button.primary:hover, .btn.primary:hover { background: var(--accent-hover); }

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

button.ghost:hover { background: var(--surface-hover); color: var(--text); }

button.danger { color: var(--danger); }
button.danger:hover { background: rgba(235, 87, 87, 0.1); border-color: rgba(235, 87, 87, 0.35); }
button.sm, .btn.sm { height: 25px; padding: 0 9px; font-size: 12px; }
button.lg { height: 36px; padding: 0 18px; font-size: 14px; }

input, select, textarea {
  width: 100%;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

textarea { min-height: 72px; resize: vertical; line-height: 1.55; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }
select { appearance: none; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

label.field { display: block; }

label.field > span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

label.field .err { color: var(--danger); font-size: 12px; margin-top: 3px; display: block; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.form-grid .wide { grid-column: 1 / -1; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.search input {
  border: none;
  background: none;
  padding: 0;
  height: auto;
  min-height: 0;
}

.search input:focus { box-shadow: none; }
.search svg { flex: none; color: var(--text-faint); }

/* -------------------------------------------------------------- tables -- */

.table-wrap { overflow-x: auto; margin: 0 -16px -16px; padding: 0 16px 16px; }

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

th {
  padding: 7px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { margin-left: 4px; }

.empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* --------------------------------------------------------------- chips -- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  text-transform: capitalize;
}

.badge.dot::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge.ok, .badge.published, .badge.confirmed, .badge.paid, .badge.present,
.badge.issued, .badge.active, .badge.delivered, .badge.completed, .badge.graded, .badge.done, .badge.booked {
  color: var(--positive);
  border-color: rgba(76, 183, 130, 0.35);
  background: rgba(76, 183, 130, 0.09);
}

.badge.warn, .badge.draft, .badge.applied, .badge.planned, .badge.pending,
.badge.waitlisted, .badge.partial, .badge.invited, .badge.open, .badge.at_risk,
.badge.prospect, .badge.requested, .badge.scheduled, .badge.late, .badge.submitted {
  color: var(--warning);
  border-color: rgba(242, 201, 76, 0.3);
  background: rgba(242, 201, 76, 0.07);
}

.badge.bad, .badge.cancelled, .badge.rejected, .badge.revoked, .badge.absent,
.badge.dropped, .badge.declined, .badge.missed, .badge.failed, .badge.void, .badge.suspended {
  color: var(--danger);
  border-color: rgba(235, 87, 87, 0.3);
  background: rgba(235, 87, 87, 0.07);
}

.badge.accent { color: var(--accent); border-color: rgba(94, 106, 210, 0.4); background: var(--accent-soft); }

.tags { display: flex; gap: 5px; flex-wrap: wrap; }

.tag {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- tabs -- */

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  scrollbar-width: thin;
}

.tabs button {
  height: 30px;
  border: none;
  background: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--text-muted);
  font-size: 13px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs button:hover { background: var(--surface-hover); color: var(--text); }

.tabs button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: none;
}

.tabs .count {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--bg-elevated);
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- dialog -- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: start center;
  padding: 48px 16px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
}

.dialog {
  width: 100%;
  max-width: 620px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.dialog.wide { max-width: 940px; }

.dialog header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.dialog header .grow { flex: 1; }
.dialog .body { padding: 18px; }

.dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* --------------------------------------------------------------- toast -- */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  min-width: 240px;
  max-width: 400px;
  padding: 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-card);
  font-size: 13px;
  animation: rise 0.16s ease;
}

.toast.ok { border-left: 3px solid var(--positive); }
.toast.err { border-left: 3px solid var(--danger); }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* -------------------------------------------------------------- viewer -- */

.hero {
  padding: 46px 0 30px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.hero h1 { font-size: 34px; letter-spacing: -0.035em; max-width: 18ch; }
.hero p { margin-top: 10px; color: var(--text-secondary); max-width: 58ch; font-size: 15px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.filters select, .filters input { width: auto; min-width: 130px; }
.filters .search { flex: 1; min-width: 240px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }

.bootcamp-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.14s ease, transform 0.14s ease;
}

.bootcamp-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.bootcamp-card h3 { font-size: 16px; }
.bootcamp-card .summary { color: var(--text-muted); font-size: 13px; flex: 1; }

.bootcamp-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.price { font-size: 15px; font-weight: 560; color: var(--text); font-variant-numeric: tabular-nums; }

.detail-head {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.detail-head .grow { flex: 1; min-width: 260px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; }

ul.ticks { margin: 0; padding: 0; list-style: none; }

ul.ticks li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

ul.ticks li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 7px;
  width: 5px;
  height: 9px;
  border: solid var(--positive);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(42deg);
}

details.module {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--bg-elevated);
}

details.module > summary {
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  font-weight: 500;
}

details.module > summary::-webkit-details-marker { display: none; }
details.module > summary::before { content: "›"; color: var(--text-faint); transition: transform 0.15s ease; }
details.module[open] > summary::before { transform: rotate(90deg); }
details.module .inner { padding: 0 14px 12px 32px; }

.lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

.lesson:first-child { border-top: none; }
.lesson .grow { flex: 1; }

/* ------------------------------------------------------------- planner -- */

.timeline { display: flex; flex-direction: column; gap: 10px; }

.timeline-day {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: start;
}

.timeline-day .date {
  position: sticky;
  top: 60px;
  padding-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.35;
}

.timeline-day .date strong { display: block; color: var(--text); font-size: 15px; font-weight: 560; }

.slot {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 7px;
}

.slot.delivered { border-left-color: var(--positive); }
.slot.cancelled { border-left-color: var(--danger); opacity: 0.55; }
.slot .time { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.slot .grow { flex: 1; min-width: 0; }
.slot .title { font-weight: 500; }

.module-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 7px;
}

.module-row .grow { flex: 1; min-width: 0; }
.module-row .handle { color: var(--text-faint); cursor: grab; user-select: none; font-size: 15px; }
.module-row.dragging { opacity: 0.45; }
.module-row.drop-target { border-color: var(--accent); }

.lesson-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px 6px 36px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.lesson-row:hover { background: var(--surface-hover); }
.lesson-row .grow { flex: 1; min-width: 0; }

.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-elevated);
  overflow: hidden;
  border: 1px solid var(--border);
}

.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.good > span { background: var(--positive); }
.bar.warn > span { background: var(--warning); }
.bar.bad > span { background: var(--danger); }

.notice {
  padding: 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  font-size: 13px;
  color: var(--text-secondary);
}

.notice.warn { border-color: rgba(242, 201, 76, 0.35); background: rgba(242, 201, 76, 0.06); }
.notice.bad { border-color: rgba(235, 87, 87, 0.35); background: rgba(235, 87, 87, 0.06); }
.notice.ok { border-color: rgba(76, 183, 130, 0.35); background: rgba(76, 183, 130, 0.06); }

/* --------------------------------------------------------------- login -- */

.login-shell { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 360px; }

.skeleton {
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface), var(--surface-hover), var(--surface));
  background-size: 200% 100%;
  animation: shimmer 1.1s infinite linear;
}

@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 720px) {
  :root { --page-gutter: 16px; }
  .hero { padding: 30px 0 22px; }
  .hero h1 { font-size: 26px; }
  .timeline-day { grid-template-columns: 1fr; }
  .timeline-day .date { position: static; text-align: left; }
  .nav a { padding: 5px 7px; font-size: 12px; }
}
