/* ---------- theme ---------- */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d23;
  --muted: #5f6673;
  --border: #e2e5ea;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --accent-soft: #eef0ff;
  --danger: #b42318;
  --danger-soft: #fef1f0;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --neutral-soft: #f0f2f5;
  --pink: #c11574;
  --pink-soft: #fdf2fa;
  --hero-from: #4f46e5; /* the accent */
  --hero-to: #7c3aed;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --radius: 10px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b21;
    --text: #e7e9ee;
    --muted: #9aa1ad;
    --border: #2a2f38;
    --accent: #818cf8;
    --accent-text: #0f1115;
    --accent-soft: #23264a;
    --danger: #f97066;
    --danger-soft: #3a1d1b;
    --success: #47cd89;
    --success-soft: #133024;
    --warning: #fdb022;
    --warning-soft: #352a12;
    --neutral-soft: #242830;
    --pink: #f670c7;
    --pink-soft: #3a1a30;
    --hero-from: #4338ca; /* deeper than the dark-mode accent, so white text stays readable */
    --hero-to: #6d28d9;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);

    color-scheme: dark;
  }
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2 { line-height: 1.2; }
h2 { font-size: 1.35rem; margin: 0 0 1rem; }

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

.brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent);
  white-space: nowrap;
}
.topbar .brand { flex-shrink: 0; }

.brand-icon { margin-right: 0.3em; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- buttons & inputs ---------- */

.button {
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.button:hover { border-color: var(--muted); }
.button:disabled { opacity: 0.6; cursor: default; }

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.button.primary:hover { filter: brightness(1.08); }

.button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--surface);
}

.link-button {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
}
.link-button:hover { text-decoration: underline; }

.button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 1rem 0 0.35rem;
}

input {
  width: 100%;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

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

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 24rem;
  padding: 2rem 1.5rem;
}
.login-card h1 { font-size: 1.75rem; margin: 0 0 0.25rem; }
.login-card p { margin: 0 0 0.5rem; }
.login-card .button { width: 100%; margin-top: 1.25rem; padding: 0.65rem; }

.success {
  margin: 1rem 0 0;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.9rem;
}

.error {
  margin: 1rem 0 0;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.9rem;
}

/* ---------- signed-in shell ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-size: 1.15rem; }

.who {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

/* The user's name doubles as the button that opens "Your account". */
.user-name {
  font: inherit;
  font-weight: 600;
  min-width: 0;
  padding: 0.25rem 0.35rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-name:hover { background: var(--neutral-soft); }
.user-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot { text-align: center; margin-top: 30vh; }

.badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.content {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
.content.wide { max-width: 72rem; } /* the coordinator dashboard */

.placeholder {
  padding: 2rem 1.5rem;
  color: var(--muted);
  text-align: center;
}
.placeholder p { margin: 0; }

/* ---------- checklist ---------- */

.page-head { margin-bottom: 1rem; }
.page-head h2 { margin-bottom: 0.25rem; }
.page-head p { margin: 0; }

/* ---------- new-hire welcome hero ---------- */

.hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--hero-from), var(--hero-to));
  color: #fff;
  box-shadow: var(--shadow);
}
.hero-text { min-width: 0; }
.hero h2 { margin: 0 0 0.35rem; font-size: 1.6rem; color: #fff; }
.hero p { margin: 0; }
.hero-meta { margin-top: 0.35rem !important; opacity: 0.85; font-size: 0.95rem; }
/* Wrap only between "1 of 11 done" and "· Manager: …", never inside either. */
#progress-text, #hero-manager { white-space: nowrap; }

/* Progress ring: a conic gradient (--p is the percent) cut into a ring with a radial mask. */
.ring {
  --p: 0;
  position: relative;
  flex-shrink: 0;
  width: 6.5rem;
  height: 6.5rem;
  display: grid;
  place-items: center;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, 0.25) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 0.6rem), #000 calc(100% - 0.55rem));
  mask: radial-gradient(farthest-side, transparent calc(100% - 0.6rem), #000 calc(100% - 0.55rem));
}
.ring-percent { position: relative; font-size: 1.35rem; font-weight: 700; }

.checklist-heading { margin: 0 0 1rem; }

/* ---------- "Ask Liftoff" assistant (mockup) ---------- */

.assistant { padding: 1.25rem; margin-bottom: 1.75rem; }
.assistant-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.assistant-head h3 { margin: 0 0.25rem 0 0; font-size: 1.1rem; }
.ai-chip { background: var(--accent-soft); color: var(--accent); }

.messages { display: flex; flex-direction: column; gap: 0.6rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.message {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--neutral-soft);
}
.avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
}
.avatar-user { background: var(--surface); color: var(--accent); border: 1px solid var(--border); }
.avatar-bot { background: linear-gradient(120deg, var(--hero-from), var(--hero-to)); font-size: 1.1rem; }
.message-body { min-width: 0; }
.message-who { display: block; margin-bottom: 0.15rem; }
.message-text { margin: 0; }

.ask-input { cursor: not-allowed; opacity: 0.7; }

.progress {
  height: 0.6rem;
  border-radius: 999px;
  background: var(--neutral-soft);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.week-group { margin-bottom: 1.75rem; }

.week-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

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

.task {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.task:first-child { border-top: 0; }

.task-check {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.task-check:disabled { cursor: default; }

.task-body { min-width: 0; flex: 1; }

.task-title {
  display: block;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.task-check:disabled + .task-body .task-title { cursor: default; }
.status-done .task-title { color: var(--muted); text-decoration: line-through; }

.task-desc {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.925rem;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.owner,
.chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.owner { border: 1px solid var(--border); color: var(--muted); }
.owner-new_hire { border-color: var(--accent); color: var(--accent); }

.chip-not_started { background: var(--neutral-soft); color: var(--muted); }
.chip-in_progress { background: var(--warning-soft); color: var(--warning); }
.chip-done { background: var(--success-soft); color: var(--success); }
.chip-blocked { background: var(--danger-soft); color: var(--danger); }

.task-note {
  margin: 0.6rem 0 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
}

.flag { margin-top: 0.6rem; }

.flag-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.flag-form input { flex: 1 1 14rem; padding: 0.45rem 0.65rem; }
.flag-form .button { padding: 0.45rem 0.8rem; font-size: 0.9rem; }

#checklist-error { margin: 0 0 1rem; }

/* ---------- coordinator dashboard ---------- */

.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.dash-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.picker label { margin: 0 0 0.3rem; font-size: 0.8rem; color: var(--muted); }

select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#cohort-picker { min-width: 15rem; }

#dashboard-error { margin: 0 0 1rem; }

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
}

.kpi-label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }

.table-card { overflow: hidden; }

.roster {
  width: 100%;
  border-collapse: collapse;
}

.roster th,
.roster td {
  text-align: left;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.roster thead th {
  border-top: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--neutral-soft);
}

.roster-row { cursor: pointer; }
.roster-row:hover { background: var(--accent-soft); }

.roster-name { font-size: 1rem; text-align: left; }

.roster-person { display: flex; align-items: center; gap: 0.7rem; }

/* Initials avatars. Deep, saturated colors so white initials stay readable in light and dark mode. */
.avatar-circle {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--avatar);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
/* Six clearly different hues, so any two people on the roster look distinct. */
.avatar-color-0 { --avatar: #7c3aed; } /* violet */
.avatar-color-1 { --avatar: #c2410c; } /* orange */
.avatar-color-2 { --avatar: #0369a1; } /* sky */
.avatar-color-3 { --avatar: #be185d; } /* rose */
.avatar-color-4 { --avatar: #15803d; } /* green */
.avatar-color-5 { --avatar: #475569; } /* slate */

.roster-empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }

.col-percent { width: 9rem; }
.col-percent span { font-weight: 600; font-size: 0.9rem; }
.progress.mini { height: 0.35rem; margin-top: 0.3rem; }

.roster-blocked { background: var(--danger-soft); color: var(--danger); }
.roster-behind { background: var(--warning-soft); color: var(--warning); }
.roster-on_track { background: var(--success-soft); color: var(--success); }

/* ---------- Liftoff week agenda (mockup) ---------- */

.agenda { margin-top: 1.5rem; padding: 1.25rem; }

.agenda-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.1rem;
}
.agenda-title-row { display: flex; align-items: center; gap: 0.6rem; }
.agenda-head h3 { margin: 0; font-size: 1.1rem; }
.preview-chip { background: var(--neutral-soft); color: var(--muted); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--muted);
}
.legend li { display: flex; align-items: center; gap: 0.4rem; }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 999px; background: var(--session-color); }

/* Each category sets one color, used by the legend dot and the session's left edge. */
.cat-technical { --session-color: var(--accent); }
.cat-ai { --session-color: var(--pink); }
.cat-social { --session-color: var(--success); }
.cat-logistics { --session-color: var(--warning); }

/* The full week side by side on wide screens; one day per row below that (no 4 + 1 wrap). */
.agenda-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem 0.75rem;
}
@media (max-width: 900px) {
  .agenda-grid { grid-template-columns: 1fr; }
}

.agenda-day-name {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.agenda-date { font-weight: 600; text-transform: none; letter-spacing: 0; opacity: 0.8; }

.agenda-sessions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.session {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--session-color);
  border-radius: 6px;
  background: var(--neutral-soft);
}
.session-title { font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.session-meta { font-size: 0.8rem; color: var(--muted); }
.tbd-chip { background: var(--warning-soft); color: var(--warning); padding: 0.05rem 0.45rem; }

.agenda-empty { margin: 0; }

/* ---------- side panel ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.45);
  z-index: 10;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(32rem, 100%);
  overflow-y: auto;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  padding: 1.25rem;
  z-index: 11;
}

body.panel-open { overflow: hidden; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.panel-head h2 { margin: 0 0 0.2rem; }
.panel-head p { margin: 0; }
.panel-head .button { flex-shrink: 0; padding: 0.35rem 0.65rem; }

.panel-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 1.25rem;
}

#panel-error { margin: 0 0 1rem; }

.panel .week-group { margin-bottom: 1.25rem; }

.panel-task {
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.8rem 1rem;
}
.panel-task .task-title { cursor: default; font-size: 0.95rem; }
.panel-task .task-meta { margin-top: 0.35rem; }
.panel-task .task-note { margin-top: 0.5rem; }

.status-select {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
  border-color: transparent;
}
.status-select.chip-not_started { background: var(--neutral-soft); color: var(--muted); }
.status-select.chip-in_progress { background: var(--warning-soft); color: var(--warning); }
.status-select.chip-done { background: var(--success-soft); color: var(--success); }
.status-select.chip-blocked { background: var(--danger-soft); color: var(--danger); }
.status-select:disabled { opacity: 0.6; }

/* ---------- add new hire ---------- */

.add-panel { width: min(26rem, 100%); }
.add-panel .panel-head { align-items: center; }
.add-panel .panel-head h2 { margin: 0; }
.add-panel select { width: 100%; }
.optional { font-weight: 400; color: var(--muted); }
.add-submit { width: 100%; margin-top: 1.25rem; }
#add-error { margin: 1rem 0 0; }

.add-done-text { margin: 1.25rem 0 0.6rem; }

.temp-password {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.temp-password code {
  flex: 1;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
  user-select: all;
}

.add-done-note { font-size: 0.875rem; }

.account-email { margin: 0.25rem 0 1.25rem; overflow-wrap: anywhere; }
.form-title { font-size: 1rem; margin: 0; }
#password-error, #password-success { margin: 1rem 0 0; }
#dashboard-loading { margin: 0 0 1rem; }
.add-done-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ---------- phone width ---------- */

@media (max-width: 480px) {
  .topbar { padding: 0.6rem 1rem; gap: 0.5rem; }
  .who { gap: 0.4rem; font-size: 0.9rem; }
  .who .button { padding: 0.4rem 0.6rem; }
  .who .badge { display: none; } /* the page title already says which view this is */
  .content { padding-top: 1rem; }
  .task { padding: 0.9rem 1rem; }
  .hero { gap: 1rem; padding: 1.1rem 1.1rem; align-items: flex-start; }
  .hero h2 { font-size: 1.3rem; }
  .ring { width: 4.75rem; height: 4.75rem; }
  .ring-percent { font-size: 1.05rem; }
  .assistant { padding: 1rem; }
  .message { padding: 0.75rem; gap: 0.65rem; }
  .kpis { gap: 0.5rem; }
  .kpi { padding: 0.75rem; }
  .kpi-label { font-size: 0.75rem; }
  .kpi-value { font-size: 1.4rem; }
  .dash-actions, .picker, #cohort-picker, #add-hire-button { width: 100%; min-width: 0; }
  .col-team, .col-manager { display: none; }
  .roster th, .roster td { padding: 0.7rem 0.75rem; }
  .col-percent { width: 4.5rem; }
  .roster-person { gap: 0.5rem; }
  .avatar-circle { width: 1.9rem; height: 1.9rem; font-size: 0.72rem; }
  .panel { padding: 1rem; }
  .panel-task { flex-wrap: wrap; }
}
