/* Collabo — the one and only stylesheet.
 *
 * Principles (DECISIONS.md, 2026-09-20):
 *   pale blue gradient background, white rounded cards on top,
 *   sky blue #2e86de as the single accent, system font, airy spacing,
 *   sidebar navigation that collapses on small screens, no framework.
 *
 * Everything is driven by the tokens below. Change a colour here, not in a rule.
 */

/* ---------- tokens ---------- */
:root {
  --blue:        #2e86de;
  --blue-deep:   #1b6fc2;   /* hover, links */
  --blue-ink:    #17457a;   /* headings */
  --blue-tint:   #e6f1fb;   /* active nav, soft highlights */
  --blue-pale:   #eef5fc;   /* top of the page gradient */

  --ink:         #1f2933;
  --muted:       #64707d;
  --line:        #dfe7ef;
  --card:        #ffffff;

  --ok-bg:  #e3f5e8;  --ok-ink:  #1e6b34;
  --warn-bg:#fff1dc;  --warn-ink:#9a5b00;
  --bad-bg: #fde8e6;  --bad-ink: #a33a2b;
  --off-bg: #eef1f4;  --off-ink: #55606b;

  --radius:       12px;   /* cards */
  --radius-small:  8px;   /* buttons, fields, nav items */
  --shadow: 0 1px 2px rgba(23, 69, 122, .06), 0 6px 20px rgba(23, 69, 122, .06);

  --sidebar-width: 15rem;
  --space: 1.5rem;

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #fff linear-gradient(180deg, var(--blue-pale) 0%, #fff 55rem) no-repeat;
}

h1, h2, h3 { color: var(--blue-ink); line-height: 1.25; margin: 0 0 .75rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--blue-deep); }

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

/* ---------- app shell: sidebar + content ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding: var(--space) 1rem;
  background: rgba(255, 255, 255, .7);
  border-right: 1px solid var(--line);
}

.brand {
  display: block;
  padding: 0 .75rem 1.25rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blue-ink);
  text-decoration: none;
}

.nav { display: flex; flex-direction: column; gap: .25rem; }

.nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-small);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}
.nav a:hover { background: var(--blue-tint); }
.nav a.active { background: var(--blue-tint); color: var(--blue-deep); }
.nav svg { width: 1.15rem; height: 1.15rem; flex: none; stroke: currentColor; fill: none; stroke-width: 2; }

.sidebar-user {
  margin-top: auto;
  padding: 1rem .75rem 0;
  border-top: 1px solid var(--line);
  font-size: .9rem;
}
.sidebar-user strong { display: block; }

.content {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space);
}

.content-inner { max-width: 64rem; margin: 0 auto; }

/* mobile top bar, hidden on wide screens */
.topbar { display: none; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space) 2rem;
  margin-bottom: var(--space);
}

/* ---------- auth pages (no sidebar) ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space) 1rem;
}
.auth .card { width: 100%; max-width: 26rem; }
.auth .brand { text-align: center; padding: 0 0 1rem; }

/* ---------- forms ---------- */
label { display: block; margin: 1rem 0 .3rem; font-weight: 600; }

input[type="email"], input[type="password"], input[type="text"],
input[type="date"], input[type="time"], input[type="number"], select, textarea {
  width: 100%;
  padding: .6rem .75rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

form.inline { display: inline; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: .6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); }
.btn-block { display: block; width: 100%; margin-top: 1.25rem; }
.btn-link { padding: .2rem .4rem; background: none; color: var(--blue-deep); text-decoration: underline; }

/* ---------- alerts & badges ---------- */
.alert { padding: .75rem 1rem; border-radius: var(--radius-small); margin: 0 0 1rem; }
.alert-success { background: var(--ok-bg);  color: var(--ok-ink); }
.alert-error   { background: var(--bad-bg); color: var(--bad-ink); }
ul.alert { padding-left: 2rem; }

.badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-not-yet { background: var(--off-bg);  color: var(--off-ink); }
.badge-redo    { background: var(--warn-bg); color: var(--warn-ink); }
.badge-check, .badge-ready { background: var(--ok-bg); color: var(--ok-ink); }

/* ---------- small text ---------- */
ul.rules  { color: var(--muted); font-size: .95rem; padding-left: 1.25rem; }
.fineprint { margin: 1.5rem 0 0; font-size: .8rem; font-style: italic; color: var(--muted); text-align: center; }

/* ---------- mobile: sidebar becomes a drawer ---------- */
@media (max-width: 56rem) {
  .shell { display: block; }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: rgba(255, 255, 255, .85);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; font-size: 1.15rem; }

  .menu-toggle {
    padding: .4rem .6rem;
    font: inherit;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    cursor: pointer;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    background: #fff;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; }

  .backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgba(23, 69, 122, .25);
  }
  body.nav-open .backdrop { display: block; }

  .content { padding: 1rem; }
  .card { padding: 1.25rem 1.25rem; }
}

/* ---------- page structure ---------- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.page-head h1 { margin-bottom: 0; }
.crumbs { margin: 0 0 .25rem; font-size: .9rem; }
.spaced { margin-top: 2rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space); align-items: start; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.actions { margin-top: 1.5rem; }

/* ---------- sidebar extras ---------- */
.switcher { padding: 0 .75rem 1rem; font-size: .9rem; }
.switcher label { margin: 0 0 .25rem; font-weight: 500; font-size: .8rem; }
.switcher select { padding: .45rem .6rem; }
.nav-heading {
  display: block;
  margin: 1.25rem .75rem .35rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- tables & facts ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem .6rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ---------- more badges & buttons ---------- */
.badge-draft    { background: var(--off-bg);   color: var(--off-ink); }
.badge-active   { background: var(--ok-bg);    color: var(--ok-ink); }
.badge-archived { background: var(--warn-bg);  color: var(--warn-ink); }
.btn-danger { background: var(--bad-bg); color: var(--bad-ink); }
.btn-danger:hover { background: #f8d7d3; }

@media (max-width: 56rem) {
  .grid-2 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; gap: 0 }
  .facts dt { margin-top: .5rem; }
  .table { display: block; overflow-x: auto; }
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .25rem; margin: 0 0 var(--space); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a, .tabs .tab-disabled {
  padding: .55rem .9rem;
  border-radius: var(--radius-small) var(--radius-small) 0 0;
  text-decoration: none;
  font-weight: 500;
  color: var(--ink);
}
.tabs a:hover { background: var(--blue-tint); }
.tabs a.active { color: var(--blue-deep); box-shadow: inset 0 -2px 0 var(--blue); }
.tabs .tab-disabled { color: var(--muted); opacity: .6; cursor: default; }

.grid-wide-left { grid-template-columns: 2fr 1fr; }
.card-narrow-left { max-width: 28rem; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a { margin-right: .5rem; }
.btn-link-danger { color: var(--bad-ink); }
.small { font-size: .9rem; }
@media (max-width: 56rem) { .grid-wide-left { grid-template-columns: 1fr; } }

/* ---------- sortable headers, states ---------- */
.table th.sortable a { color: inherit; text-decoration: none; }
.table th.sortable a:hover { color: var(--blue-deep); }
.sort-mark::after { content: ' ↕'; opacity: .35; }
.sorted-asc  .sort-mark::after { content: ' ↑'; opacity: 1; }
.sorted-desc .sort-mark::after { content: ' ↓'; opacity: 1; }
.row-off td { color: var(--muted); }
.badge-active              { background: var(--ok-bg);   color: var(--ok-ink); }
.badge-first-login-pending { background: var(--blue-tint); color: var(--blue-deep); }
.badge-deactivated         { background: var(--off-bg);  color: var(--off-ink); }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
label.check input { width: auto; }

/* ---------- teams ---------- */
.team-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.team-head h2 { margin-bottom: .5rem; }
.badge-leader { background: var(--blue-tint); color: var(--blue-deep); margin-left: .35rem; }
form.move { display: inline-flex; gap: .35rem; align-items: center; }
form.move select { width: auto; padding: .35rem .5rem; font-size: .9rem; }
.btn-small { padding: .35rem .7rem; font-size: .9rem; background: var(--blue-tint); color: var(--blue-deep); }
ul.plain { padding-left: 1.1rem; margin: 0 0 .5rem; }

/* team member rows: actions may wrap, selects stay compact */
.team .table td { vertical-align: middle; }
.team .row-actions { white-space: normal; text-align: right; }
.team .row-actions form { margin: .15rem 0 .15rem .5rem; vertical-align: middle; }
form.move select { width: auto; max-width: 10rem; }

/* ---------- import ---------- */
.btn-secondary { background: var(--blue-tint); color: var(--blue-deep); }
.btn-secondary:hover { background: #d7e8f8; }
input[type="file"] { display: block; font: inherit; }
textarea { min-height: 8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
ol.plain-ol { padding-left: 1.25rem; }
ul.problems { color: var(--bad-ink); margin: .3rem 0 0; }
.badge + .badge { margin-left: .35rem; }

/* ---------- checklist ---------- */
.checklist-category .num-col { width: 3rem; white-space: nowrap; }
.checklist-category .table td { vertical-align: top; }
.checklist-category .row-actions { white-space: normal; text-align: right; }
.checklist-category .row-actions form { margin: .15rem 0 .15rem .35rem; }
.attachment { margin: .25rem 0 .75rem; }
.attachment form.attach { display: inline; }
.attachment input[type="file"] { display: inline; font-size: .85rem; max-width: 16rem; }
form.add-item { margin-top: .75rem; }
form.add-item input[type="text"] { flex: 1 1 14rem; }
.btn[disabled] { opacity: .35; cursor: default; }

/* ---------- avatars & profile ---------- */
.avatar { display: inline-block; border-radius: 50%; object-fit: cover; background: var(--blue-tint); color: var(--blue-deep); font-weight: 700; text-align: center; flex: none; }
.avatar-small { width: 36px; height: 36px; line-height: 36px; font-size: .85rem; }
.avatar-large { width: 128px; height: 128px; line-height: 128px; font-size: 2.5rem; }
.user-link { display: flex; gap: .6rem; align-items: center; color: inherit; text-decoration: none; padding: .4rem .5rem; margin: 0 -.5rem .25rem; border-radius: var(--radius-small); }
.user-link:hover, .user-link.active { background: var(--blue-tint); }
.user-link strong { display: block; line-height: 1.2; }
.photo-row { align-items: flex-start; gap: 1.5rem; }
.photo-row > div { flex: 1 1 14rem; }

.centered { text-align: center; margin-top: 1rem; }
.auth label.check { margin-top: 1rem; }
.badge-locked { background: var(--bad-bg); color: var(--bad-ink); }

/* ---------- submissions & comments ---------- */
.hidden-field { display: none; }
.badge-new { background: var(--blue); color: #fff; }
.is-new { background: var(--blue-tint); }
.submission-list { list-style: none; margin: 0; padding: 0; }
.submission { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem .75rem; margin: 0 -.75rem; border-bottom: 1px solid var(--line); border-radius: var(--radius-small); }
.submission:last-child { border-bottom: 0; }
.submission-title { font-weight: 600; font-size: 1.05rem; }
.submission-side { text-align: right; flex: none; max-width: 14rem; }
.file-card { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment { padding: .75rem; margin: 0 -.75rem .5rem; border-radius: var(--radius-small); border-bottom: 1px solid var(--line); }
.comment-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.comment-head > div { flex: 1 1 auto; }
.comment-hide { margin-left: auto; }
.rich p { margin: 0 0 .5rem; }
.rich blockquote { margin: .5rem 0; padding-left: .9rem; border-left: 3px solid var(--line); color: var(--muted); }
.rich pre { background: var(--off-bg); padding: .6rem .8rem; border-radius: var(--radius-small); overflow-x: auto; }
.quill-editor { background: #fff; border-radius: 0 0 var(--radius-small) var(--radius-small); min-height: 7rem; }
.ql-toolbar.ql-snow { border-radius: var(--radius-small) var(--radius-small) 0 0; border-color: var(--line); }
.ql-container.ql-snow { border-color: var(--line); font: inherit; }
.team-table tr.is-new td { background: var(--blue-tint); }
.team-table tr.is-new td:first-child { border-radius: var(--radius-small) 0 0 var(--radius-small); }
.team-table tr.is-new td:last-child { border-radius: 0 var(--radius-small) var(--radius-small) 0; }
@media (max-width: 56rem) { .submission { flex-direction: column; } .submission-side { text-align: left; max-width: none; } }

/* ---------- team checklist ---------- */
.checklist-summary { margin: 0; }
.checklist td { vertical-align: top; }
.checklist .num-col { width: 3rem; white-space: nowrap; }
.checklist .status-col { white-space: nowrap; width: 6rem; }
.checklist tr.status-redo td { background: var(--warn-bg); }
.checklist tr.status-ready td:first-child { border-left: 3px solid var(--ok-ink); }
.remark { margin: .25rem 0; padding: .35rem .6rem; background: #fff; border-left: 3px solid var(--warn-ink); border-radius: 0 var(--radius-small) var(--radius-small) 0; }
.history summary { cursor: pointer; color: var(--blue-deep); }
.history ul { padding-left: 1rem; margin: .3rem 0 0; }
.attachment-link { margin-left: .5rem; font-weight: 400; }
.status-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.status-form select { width: auto; padding: .35rem .5rem; font-size: .9rem; }
.set-status { min-width: 12rem; }
.nowrap { white-space: nowrap; }
.plain-link { text-decoration: none; }
@media (max-width: 56rem) { .set-status { min-width: 0; } }

/* ---------- coaching ---------- */
.group-row td { background: var(--blue-pale); padding-top: .5rem; padding-bottom: .5rem; }

/* ---------- peer evaluation ---------- */
.progress-strip { margin-left: auto; display: flex; gap: .4rem; align-items: center; padding: .4rem 0; }
.peer-name { display: flex; align-items: center; gap: .6rem; }
form.stars { display: inline-flex; gap: .15rem; }
form.stars input { position: absolute; opacity: 0; width: 0; height: 0; }
.star { font-size: 1.6rem; line-height: 1; color: var(--line); cursor: pointer; }
.star.on, form.stars:hover .star { color: #f0b429; }
form.stars .star:hover ~ .star { color: var(--line); }
.avg { color: #b07c00; }
.dist { white-space: nowrap; }
.dist-cell { display: inline-block; min-width: 2rem; text-align: center; padding: .1rem .3rem; margin-right: .2rem; background: var(--off-bg); border-radius: var(--radius-small); font-variant-numeric: tabular-nums; }
.alert-card { border-left: 4px solid var(--warn-ink); }
tr.status-redo td { background: var(--warn-bg); }
@media (max-width: 56rem) { .progress-strip { width: 100%; margin-left: 0; } }

/* ---------- coaching layout ---------- */
.plan-form { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: flex-end; }
.plan-form .field { flex: 1 1 12rem; }
.plan-form .field-time { flex: 0 1 8rem; }
.plan-form .field-submit { flex: 0 0 auto; }
.plan-form label { margin-top: .5rem; }
.plan-form .btn { margin-top: .5rem; }
.slot-list { list-style: none; margin: 0; padding: 0; }
.slot-row { display: flex; align-items: center; gap: 1rem; padding: .6rem .5rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.slot-row:last-child { border-bottom: 0; }
.slot-row.booked { background: var(--blue-pale); }
.slot-date { flex: 0 0 11rem; }
.slot-time { flex: 0 0 7.5rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.slot-teacher { flex: 0 0 11rem; }
.slot-booking { flex: 1 1 12rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.slot-actions { flex: 0 0 auto; margin-left: auto; white-space: nowrap; }
.slot-day { margin: 1rem 0 .5rem; font-size: 1rem; color: var(--blue-ink); }
.slot-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.slot-btn { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .5rem .8rem; font: inherit; background: var(--blue-tint); color: var(--blue-ink); border: 1px solid transparent; border-radius: var(--radius-small); cursor: pointer; text-align: left; }
.slot-btn:hover { border-color: var(--blue); background: #fff; }
.slot-btn-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.slot-btn-teacher { font-size: .85rem; color: var(--muted); }
@media (max-width: 56rem) { .slot-date, .slot-time, .slot-teacher { flex-basis: auto; } .slot-actions { margin-left: 0; width: 100%; } }

/* ---------- team header & student cards ---------- */
.team-members { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; padding: 1rem 1.5rem; }
.member { display: flex; flex-direction: column; align-items: center; text-align: center; width: 7.5rem; gap: .25rem; }
.member.me .member-name { color: var(--blue-deep); }
.member-name { font-weight: 600; line-height: 1.2; }
.avatar-medium { width: 72px; height: 72px; line-height: 72px; font-size: 1.5rem; }
.cards-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space); margin-bottom: var(--space); }
.card.mini { display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.25rem; margin: 0; text-decoration: none; color: inherit; }
.card.mini:hover { box-shadow: 0 2px 4px rgba(23,69,122,.1), 0 8px 24px rgba(23,69,122,.1); }
.mini-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mini-action { border-left: 4px solid var(--blue); }
.mini-muted strong { color: var(--muted); font-weight: 500; }
@media (max-width: 56rem) { .cards-row { grid-template-columns: 1fr; } .member { width: 5.5rem; } }
