/* SessionManagement — Instructor/Admin console. Standalone light theme (no external deps), echoing the
   project's Evo-UI light look: white cards, soft shadows, rounded corners, one indigo accent. */
:root {
  --bg: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --border: #e2e6f0;
  --text: #1d2433;
  --text-muted: #6b7588;
  --accent: #3b5bdb;
  --accent-strong: #2f49b0;
  --accent-soft: #eaeefc;
  --success: #2f9e44;
  --success-soft: #e8f6ec;
  --danger: #e03131;
  --danger-soft: #fdecec;
  --warn: #f08c00;
  --warn-soft: #fff4e2;
  --gold: #f1b005;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .04), 0 8px 24px rgba(20, 30, 60, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; letter-spacing: -.2px; display: flex; align-items: center; gap: 10px; }
.topbar .brand .logo {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #6741d9);
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 800;
}
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--text-muted); font-size: 13.5px; }

/* ---------- Layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 26px 22px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin: 4px 0 20px; }
.page-head h1 { font-size: 22px; margin: 0; letter-spacing: -.3px; }
.page-head .sub { color: var(--text-muted); font-size: 14px; }
.page-head .spacer { flex: 1; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--text-muted); }
.center-narrow { max-width: 420px; margin: 7vh auto 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.card h2 { font-size: 16px; margin: 0 0 14px; letter-spacing: -.2px; }
.card h2.with-sub { margin-bottom: 4px; }
.card .card-sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 14px; }
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font: inherit;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
input:focus, select:focus {
  outline: none; border-color: var(--accent);
  background: #fff; box-shadow: 0 0 0 3px var(--accent-soft);
}
.field { margin-bottom: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .04s, opacity .12s;
}
.btn:hover { background: #eef0f6; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.success { background: var(--success); color: #fff; }
.btn.success:hover { filter: brightness(.95); }
.btn.outline { background: #fff; border-color: var(--border); }
.btn.outline:hover { background: var(--surface-2); }
.btn.danger-ghost { background: #fff; border-color: var(--danger-soft); color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge.planning { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.badge.locked { background: var(--warn-soft); color: #b45309; border-color: transparent; }
.badge.finished { background: var(--surface-2); color: var(--text-muted); }
.badge.bot { background: #f0ecfb; color: #6741d9; border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; letter-spacing: 1px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; }
thead th {
  background: var(--surface-2); color: var(--text-muted);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
tbody tr { border-top: 1px solid var(--border); }
tbody tr:first-child { border-top: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.winner { background: linear-gradient(90deg, rgba(241,176,5,.10), transparent 60%); }
tr.winner td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.rank { font-weight: 800; color: var(--text-muted); }
.profit-pos { color: var(--success); font-weight: 700; }
.profit-neg { color: var(--danger); font-weight: 700; }

/* ---------- Sessions list ---------- */
.session-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.session-card .title { font-weight: 700; font-size: 15.5px; }
.session-card .meta { color: var(--text-muted); font-size: 13px; margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.session-card .spacer { flex: 1; }
.empty { text-align: center; color: var(--text-muted); padding: 40px 20px; }

/* ---------- KPI header for the session control view ---------- */
.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; min-width: 110px; }
.kpi .k { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.kpi .v { font-size: 18px; font-weight: 800; letter-spacing: -.3px; margin-top: 2px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast {
  padding: 12px 16px; border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow);
  border-left: 4px solid var(--accent); max-width: 360px; font-size: 14px; animation: slidein .15s ease;
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--success); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-weight: 600; font-size: 13.5px; margin-bottom: 14px; cursor: pointer; }
.back-link:hover { color: var(--text); }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.hint { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }
