/* ============================================================================
   SRPMs — Design System
   Professional, squared (zero border-radius) UI. Hand-written, no framework.
   Tokens → base → layout → components → utilities.
   ========================================================================= */

:root {
  /* Surfaces & lines ------------------------------------------------------ */
  --c-bg:        #eef1f6;   /* app canvas */
  --c-surface:   #ffffff;   /* cards, panels */
  --c-surface-2: #f3f5f9;   /* inset / subtle fills */
  --c-surface-3: #e9edf4;   /* hover fills */
  --c-border:    #d7dde7;   /* hairlines */
  --c-border-strong: #c2cad8;

  /* Ink ------------------------------------------------------------------- */
  --c-ink:    #0d1320;      /* near-black brand surface (topbar) */
  --c-ink-2:  #161e2e;
  --c-text:   #131a27;      /* body text */
  --c-muted:  #5d6878;      /* secondary text */
  --c-faint:  #8b96a7;      /* tertiary / on dark muted */

  /* Brand accent ---------------------------------------------------------- */
  --c-primary:      #2150d4;
  --c-primary-d:    #1a3fab;
  --c-primary-dd:   #15348e;
  --c-primary-soft: #e7edfd;
  --c-primary-line: #b9c9f6;

  /* Status ---------------------------------------------------------------- */
  --c-success: #1a8a4f;  --c-success-soft: #e4f6ec; --c-success-line: #b4e2c6;
  --c-danger:  #c5302f;  --c-danger-soft:  #fdeaea; --c-danger-line:  #f3c2c2;
  --c-warning: #b3760a;  --c-warning-soft: #fcf2dd; --c-warning-line: #ecd6a3;

  /* Radius — squared design ---------------------------------------------- */
  --radius: 0;
  --radius-sm: 0;

  /* Elevation ------------------------------------------------------------- */
  --shadow-sm: 0 1px 0 rgba(13, 19, 32, .03), 0 1px 2px rgba(13, 19, 32, .05);
  --shadow:    0 1px 1px rgba(13, 19, 32, .04), 0 6px 18px rgba(13, 19, 32, .07);
  --shadow-lg: 0 2px 4px rgba(13, 19, 32, .05), 0 18px 44px rgba(13, 19, 32, .12);

  /* Rhythm ---------------------------------------------------------------- */
  --space: 16px;
  --maxw: 1140px;
  --topbar-h: 60px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Menlo", Consolas, monospace;
}

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

/* Ensure the hidden attribute always wins over display rules from classes. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--c-text);
  background:
    linear-gradient(180deg, #f6f8fc 0%, var(--c-bg) 280px) no-repeat;
  background-color: var(--c-bg);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
/* Authenticated app shell uses a sidebar layout instead of a column. */
body.has-shell { display: block; background: var(--c-bg); }

h1, h2, h3, h4 { letter-spacing: -.013em; font-weight: 700; color: var(--c-text); }
h1 { line-height: 1.2; }

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-d); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

code, .mono {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  padding: .08em .4em;
  color: var(--c-text);
}

hr { border: none; border-top: 1px solid var(--c-border); margin: 20px 0; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--c-primary); color: #fff; padding: 8px 14px; z-index: 100;
  font-weight: 600;
}
.skip-link:focus { left: 8px; top: 8px; }

/* Icons inherit text color and align with text */
.icon { display: inline-block; vertical-align: -0.18em; stroke: currentColor; flex: none; }

/* Topbar --------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space);
  min-height: var(--topbar-h);
  padding: 0 28px;
  background: var(--c-ink);
  background-image: linear-gradient(180deg, #131b2c 0%, var(--c-ink) 100%);
  border-bottom: 1px solid #000;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 8px 24px rgba(13, 19, 32, .14);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.06rem; letter-spacing: -.01em;
  color: #fff;
}
.brand:hover { color: #fff; text-decoration: none; }
.brand .icon { color: #7fa0ff; }

.topnav { display: flex; align-items: center; gap: 14px; }
.topbar .who { color: #c3cbd9; font-size: .9rem; font-weight: 500; }
.topbar .role-chip { background: rgba(255, 255, 255, .1); color: #e6ebf4; }
.topbar .btn-ghost { color: #d6dce8; }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.topbar a.btn-ghost:hover { text-decoration: none; }

.inline-form { display: inline; margin: 0; }

/* Role chips ----------------------------------------------------------- */
.role-chip {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 8px;
  background: var(--c-surface-3); color: var(--c-muted);
  border-radius: var(--radius-sm);
  vertical-align: middle;
}
.role-admin       { background: #efe6ff; color: #6b29c7; }
.role-coordinator { background: #e0eeff; color: #155fb0; }
.role-supervisor  { background: #e0f4ea; color: #1a7a48; }
.role-student     { background: #ffeede; color: #ab6310; }

/* Layout --------------------------------------------------------------- */
.container {
  width: 100%; max-width: var(--maxw);
  margin: 0 auto; padding: 40px 28px 56px;
  flex: 1;
}
.footer {
  padding: 22px 28px; text-align: center;
  color: var(--c-muted); font-size: .86rem;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
}

/* Messages ------------------------------------------------------------- */
.messages {
  list-style: none; margin: 0 auto; padding: 16px 28px 0;
  max-width: var(--maxw); width: 100%;
}
.message {
  position: relative;
  padding: 12px 16px 12px 18px;
  border: 1px solid transparent;
  border-left-width: 3px;
  margin-bottom: 10px; font-size: .92rem; font-weight: 500;
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
}
.message-success { background: var(--c-success-soft); border-color: var(--c-success-line); border-left-color: var(--c-success); color: #115e35; }
.message-error, .message-danger { background: var(--c-danger-soft); border-color: var(--c-danger-line); border-left-color: var(--c-danger); color: #8f1f1f; }
.message-warning { background: var(--c-warning-soft); border-color: var(--c-warning-line); border-left-color: var(--c-warning); color: #7a5207; }
.message-info { background: var(--c-primary-soft); border-color: var(--c-primary-line); border-left-color: var(--c-primary); color: var(--c-primary-dd); }

/* Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .92rem; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
  padding: 10px 17px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  background: var(--c-surface); color: var(--c-text);
  box-shadow: var(--shadow-sm);
  transition: background .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease, transform .04s ease;
}
.btn:hover { text-decoration: none; background: var(--c-surface-2); border-color: var(--c-border-strong); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--c-primary); border-color: var(--c-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(21, 52, 142, .35), 0 1px 0 rgba(255,255,255,.12) inset;
}
.btn-primary:hover { background: var(--c-primary-d); border-color: var(--c-primary-d); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--c-text); }
.btn-ghost:hover { background: var(--c-surface-3); border-color: transparent; }

.btn-outline { background: transparent; box-shadow: none; border-color: var(--c-border-strong); color: var(--c-text); }
.btn-outline:hover { background: var(--c-surface-2); border-color: var(--c-muted); }

.btn-lg { padding: 13px 26px; font-size: 1rem; }
.btn-sm { padding: 6px 11px; font-size: .82rem; gap: 6px; }
.btn-block { width: 100%; }

/* Cards & grid --------------------------------------------------------- */
.card {
  position: relative;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px;
}

a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Settings logo preview */
.logo-preview { display: flex; gap: 18px; align-items: flex-start; }
.logo-preview img { width: 84px; height: 84px; object-fit: cover; border: 1px solid var(--c-border); flex: none; background: #fff; }
.logo-empty {
  width: 84px; height: 84px; flex: none; display: grid; place-items: center;
  background: var(--c-surface-2); border: 1px solid var(--c-border); color: var(--c-faint);
}
.logo-preview > div { flex: 1; }

/* Relationship marker (supervision map) */
.rel { display: inline-flex; align-items: center; gap: 7px; }
.rel-dot { width: 8px; height: 8px; background: var(--c-success); display: inline-block; }

/* Onboarding empty state */
.onboard { max-width: 720px; }
.onboard-steps { margin: 6px 0 22px; padding-left: 20px; color: var(--c-muted); }
.onboard-steps li { padding: 5px 0; }
.onboard-steps li strong { color: var(--c-text); }

/* Feature cards (also used as nav tiles) ------------------------------- */
.feature { display: flex; flex-direction: column; gap: 10px; }
.feature h3 { font-size: 1.05rem; }
.feature .feature-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--c-primary-soft); color: var(--c-primary-d);
  border: 1px solid var(--c-primary-line);
}
a.card.feature {
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
a.card.feature::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--c-primary); transform: scaleY(0); transform-origin: top;
  transition: transform .18s ease;
}
a.card.feature:hover {
  border-color: var(--c-primary-line);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
a.card.feature:hover::after { transform: scaleY(1); }

/* Hero ----------------------------------------------------------------- */
.hero { text-align: center; padding: 36px 0 18px; }
.hero h1 {
  font-size: clamp(2rem, 4.4vw, 2.85rem);
  margin: 0 0 16px; letter-spacing: -.03em; line-height: 1.08;
}
.hero p {
  color: var(--c-muted); font-size: 1.14rem;
  max-width: 660px; margin: 0 auto 28px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Forms ---------------------------------------------------------------- */
.form { max-width: 440px; margin: 0 auto; }
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 7px; font-size: .9rem; color: var(--c-text); }

.input,
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=tel], input[type=url], input[type=date],
input[type=file], select, textarea {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  font: inherit; font-size: .95rem;
  background: #fff; color: var(--c-text);
  transition: border-color .14s ease, box-shadow .14s ease;
}
input[type=file] { padding: 8px 11px; background: var(--c-surface-2); }
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235d6878' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  padding-right: 34px;
}
.help { color: var(--c-muted); font-size: .84rem; margin-top: 5px; }
.errorlist { list-style: none; padding: 0; margin: 7px 0 0; color: var(--c-danger); font-size: .85rem; font-weight: 500; }

/* Page head ------------------------------------------------------------ */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 28px;
  padding-bottom: 20px; border-bottom: 1px solid var(--c-border);
}
.page-head .page-title, .page-head .page-sub { margin-bottom: 0; }
.page-title { font-size: 1.7rem; margin: 0 0 6px; letter-spacing: -.02em; }
.page-sub { color: var(--c-muted); margin: 0 0 26px; font-size: 1rem; }

/* Tables --------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td {
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--c-border); vertical-align: middle;
}
.table th {
  color: var(--c-muted); font-weight: 700; font-size: .73rem;
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border-strong);
}
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--c-surface-2); }
.table tr:last-child td { border-bottom: none; }

/* Let tables sit flush inside cards */
.card > .table:last-child { margin-bottom: -26px; }
.card > .table { margin-left: -26px; margin-right: -26px; width: calc(100% + 52px); }
.card > .table th:first-child, .card > .table td:first-child { padding-left: 26px; }
.card > .table th:last-child, .card > .table td:last-child { padding-right: 26px; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.inline-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-controls label { font-weight: 600; font-size: .9rem; }
.inline-controls .help { flex-basis: 100%; }

/* Dashboard stat cards ------------------------------------------------- */
.stat-card {
  text-align: left; padding: 22px 24px;
  border-left: 3px solid var(--c-primary);
}
.stat-number { font-size: 2.2rem; font-weight: 800; color: var(--c-text); line-height: 1.05; letter-spacing: -.02em; }
.stat-label  { font-size: .76rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; margin-top: 6px; }

/* Warning / callout card ----------------------------------------------- */
.card-warning {
  border-color: var(--c-warning-line); border-left: 3px solid var(--c-warning);
  background: var(--c-warning-soft); color: #7a5207;
  display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-sm);
}
.card-warning a { color: #7a5207; font-weight: 700; text-decoration: underline; }

/* Coordinator class card ----------------------------------------------- */
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-head h3 { font-size: 1.12rem; }
.section-title {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--c-muted); margin: 32px 0 14px; font-weight: 700;
  display: flex; align-items: center; gap: 12px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--c-border); }

.stats-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .8rem; font-weight: 500;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px; color: var(--c-muted);
}
.stat-pill .icon { color: var(--c-faint); }

/* Get-started / signup ------------------------------------------------- */
.signup {
  display: grid; grid-template-columns: 1fr 1.15fr; gap: 44px;
  align-items: start; max-width: 980px; margin: 8px auto 0;
}
.signup-intro { padding-top: 8px; }
.eyebrow {
  display: inline-block; font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--c-primary-d); background: var(--c-primary-soft);
  border: 1px solid var(--c-primary-line); padding: 4px 10px; margin-bottom: 16px;
}
.signup-intro .page-title { font-size: 1.95rem; }
.signup-points { list-style: none; padding: 0; margin: 22px 0 0; }
.signup-points li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; color: var(--c-text); font-weight: 500;
  border-top: 1px solid var(--c-border);
}
.signup-points li .icon { color: var(--c-success); flex: none; }
.signup-card { padding: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.req { color: var(--c-danger); font-weight: 700; }
@media (max-width: 820px) {
  .signup { grid-template-columns: 1fr; gap: 28px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Outbox / message log ------------------------------------------------- */
.msg { padding: 18px 20px; }
.msg-expired { opacity: .55; }
.msg-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg-subject { font-size: 1rem; }
.msg-to { font-size: .86rem; }
.msg-time { margin-left: auto; font-size: .82rem; white-space: nowrap; }
.msg-body {
  margin: 14px 0 0; padding: 14px 16px;
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  font-family: var(--font-mono); font-size: .85rem; color: var(--c-text);
  white-space: pre-wrap; word-break: break-word; line-height: 1.5;
}
.msg-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.msg-link {
  flex: 1; min-width: 220px; font-family: var(--font-mono); font-size: .82rem;
  padding: 8px 10px; border: 1px solid var(--c-border-strong); background: #fff; color: var(--c-primary-d);
}

/* ===========================================================================
   App shell — sidebar + main (authenticated)
   ======================================================================== */
:root { --sidebar-w: 256px; --appbar-h: 60px; }

.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  display: flex; flex-direction: column; z-index: 60;
  background: linear-gradient(180deg, #131b2c 0%, var(--c-ink) 100%);
  border-right: 1px solid #000;
  color: #c3cbd9;
}
.side-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px; min-height: var(--appbar-h);
  border-bottom: 1px solid rgba(255,255,255,.07);
  color: #fff;
}
.side-brand:hover { text-decoration: none; color: #fff; }
.side-mark {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  background: rgba(94,135,255,.16); border: 1px solid rgba(94,135,255,.32); color: #8fa9ff;
}
.side-logo { width: 38px; height: 38px; object-fit: cover; background: #fff; flex: none; }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.15; overflow: hidden; }
.side-brand-text strong { font-size: .98rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-brand-text small { font-size: .7rem; color: #7e8aa3; text-transform: uppercase; letter-spacing: .08em; }

.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; }
.side-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: #6b7790; padding: 14px 12px 6px;
}
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; color: #b6c0d4; font-weight: 500; font-size: .94rem;
  border-left: 3px solid transparent;
}
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.side-link .icon { color: #7e8aa3; flex: none; }
.side-link.is-active { background: rgba(94,135,255,.14); color: #fff; border-left-color: var(--c-accent, #5e87ff); }
.side-link.is-active .icon { color: #8fa9ff; }

.side-foot {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.avatar {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  background: var(--c-primary); color: #fff; font-weight: 700; font-size: .95rem;
}
.side-user-text { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.side-user-text strong { color: #fff; font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text .role-chip { align-self: flex-start; }

.app-main {
  flex: 1; min-width: 0; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-height: 100vh;
}
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  height: var(--appbar-h); padding: 0 28px;
  background: rgba(255,255,255,.88); backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--c-border);
}
.appbar-title { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; color: var(--c-text); }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* Account menu (top-right) --------------------------------------------- */
.acct { position: relative; }
.acct-btn {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  background: transparent; border: 1px solid transparent; padding: 5px 8px 5px 5px; font: inherit;
}
.acct-btn:hover { background: var(--c-surface-2); border-color: var(--c-border); }
.acct-avatar {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  background: var(--c-primary); color: #fff; font-weight: 700; font-size: .9rem;
}
.acct-avatar.lg { width: 40px; height: 40px; font-size: 1rem; }
.acct-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.acct-name { font-weight: 600; font-size: .88rem; color: var(--c-text); }
.acct-role { font-size: .72rem; color: var(--c-muted); }
.acct-caret { color: var(--c-muted); }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 240px;
  background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-lg); padding: 8px;
}
.acct-head { display: flex; gap: 11px; align-items: center; padding: 8px 10px 12px; border-bottom: 1px solid var(--c-border); margin-bottom: 6px; }
.acct-head-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acct-head-text strong { font-size: .94rem; }
.acct-head-text small { font-size: .75rem; }
.acct-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 11px;
  background: transparent; border: none; font: inherit; font-size: .9rem; color: var(--c-text);
  cursor: pointer; text-align: left;
}
.acct-item:hover { background: var(--c-surface-2); text-decoration: none; }
.acct-signout { color: var(--c-danger); }
@media (max-width: 620px) { .acct-meta { display: none; } }

/* Sidebar collapsible group ------------------------------------------- */
.side-group { margin: 0; }
.side-group > summary { list-style: none; cursor: pointer; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-summary { display: flex; align-items: center; justify-content: space-between; }
.side-summary-label { display: inline-flex; align-items: center; gap: 11px; }
.side-summary.is-parent { color: #fff; }
.side-chevron { transition: transform .18s ease; color: #7e8aa3; }
.side-group[open] > .side-summary .side-chevron { transform: rotate(90deg); }
.side-sub { display: flex; flex-direction: column; padding: 2px 0 4px; }
.side-link-sub { padding-left: 41px; font-size: .9rem; }

/* Tabs ----------------------------------------------------------------- */
.tab-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--c-border); margin-bottom: 22px; flex-wrap: wrap; }
.tab-bar.mb-0 { margin-bottom: 0; border-bottom: none; }
.tab-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px;
  background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  font: inherit; font-weight: 600; font-size: .92rem; color: var(--c-muted); cursor: pointer;
}
.tab-btn:hover { color: var(--c-text); }
.tab-btn.is-active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab-btn .pill { background: var(--c-surface-3); }
.tab-card { padding: 26px; }
.tab-panel { animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.settings-h { margin: 0 0 18px; font-size: 1.05rem; }
.tab-foot { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--c-border); }

/* Toolbar + search ----------------------------------------------------- */
.toolbar-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs-toolbar { justify-content: space-between; border-bottom: 1px solid var(--c-border); padding-bottom: 0; margin-bottom: 20px; }
.search-input {
  width: 280px; max-width: 100%; padding: 9px 13px; border: 1px solid var(--c-border-strong);
  background: #fff; font: inherit; font-size: .92rem;
}
.search-input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }

/* Class chooser cards -------------------------------------------------- */
.class-card { display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, box-shadow .15s, transform .12s; }
.class-card:hover { border-color: var(--c-primary-line); box-shadow: var(--shadow); transform: translateY(-2px); }
.class-card-top { display: flex; align-items: center; justify-content: space-between; }
.class-card h3 { font-size: 1.12rem; }
.class-card-open { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--c-border); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--c-primary); }

/* User table cells ----------------------------------------------------- */
.u-cell { display: flex; align-items: center; gap: 10px; }
.u-avatar { width: 30px; height: 30px; flex: none; display: grid; place-items: center; background: var(--c-primary-soft); color: var(--c-primary-d); font-weight: 700; font-size: .8rem; }
.u-avatar.sup { background: var(--c-success-soft); color: #1a7a48; }

/* ===========================================================================
   Phases engine + editor
   ======================================================================== */
.add-phase { display: flex; gap: 10px; align-items: center; padding: 16px; margin-bottom: 18px; }
.add-phase input { flex: 1; }

.phase-card { margin-bottom: 16px; }
.phase-card.is-sub { box-shadow: none; border-left: 3px solid var(--c-primary-line); margin: 12px 0 0; }
.phase-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.phase-titlewrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.subphases { margin-top: 6px; }

.req-list { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.req-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--c-surface-2); border: 1px solid var(--c-border); }
.req-row .req-title { flex: 1; font-size: .92rem; }
.req-kind { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; flex: none; }
.kind-file { background: #e0eeff; color: #155fb0; }
.kind-text { background: #fff1e0; color: #ab6310; }
.kind-document { background: #efe6ff; color: #6b29c7; }

.phase-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.tool { position: relative; }
.tool > summary { list-style: none; display: inline-flex; }
.tool > summary::-webkit-details-marker { display: none; }
.tool-form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--c-border); background: var(--c-surface-2); max-width: 460px; }
.tool-form input, .tool-form select, .tool-form textarea { width: 100%; }

/* Student / review requirement items */
.phase-view .phase-head { margin-bottom: 6px; }
.subphase-view { border-top: 1px solid var(--c-border); margin-top: 16px; padding-top: 10px; }
.req-item { border: 1px solid var(--c-border); padding: 16px; margin-top: 12px; }
.req-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.req-item-title { flex: 1; }
.req-instructions { margin: 8px 0 0; font-size: .9rem; }
.req-action { margin-top: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.req-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.req-form.col { flex-direction: column; align-items: stretch; width: 100%; }
.req-form textarea { width: 100%; }
.review-form { display: flex; flex-direction: column; gap: 8px; max-width: 620px; }

/* Editor */
.editor { display: flex; flex-direction: column; gap: 12px; }
.editor-bar { position: sticky; top: var(--appbar-h); z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm); }
.editor-bar-left, .editor-bar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.editor-titlewrap { display: flex; flex-direction: column; line-height: 1.2; }
.editor-titlewrap small { font-size: .78rem; }
.editor-stat { font-size: .82rem; font-weight: 600; color: var(--c-muted); display: inline-flex; align-items: center; gap: 5px; background: var(--c-surface-2); border: 1px solid var(--c-border); padding: 4px 9px; white-space: nowrap; }
.editor-stat.ok { color: var(--c-success); border-color: var(--c-success-line); background: var(--c-success-soft); }
.ed-paste { color: var(--c-warning); border-color: var(--c-warning-line); background: var(--c-warning-soft); }
.ed-paste.buzz { animation: buzz .35s; }
@keyframes buzz { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-3px)} 75%{transform:translateX(3px)} }
.editor-save { font-size: .8rem; color: var(--c-muted); min-width: 60px; }
.editor-toolbar {
  position: sticky; top: calc(var(--appbar-h) + 58px); z-index: 24;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px 10px; background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm);
}
.tb-group { display: flex; gap: 2px; align-items: center; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--c-border); }
.tb-group:last-child { border-right: none; }
.editor-toolbar button { min-width: 32px; height: 32px; padding: 0 7px; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: .95rem; color: var(--c-text); border-radius: 0; }
.editor-toolbar button:hover { background: var(--c-surface-2); border-color: var(--c-border); }
.tb-select { height: 32px; padding: 0 8px; font-size: .85rem; border: 1px solid var(--c-border-strong); background: #fff; }
.tb-color { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 32px; height: 32px; border: 1px solid transparent; cursor: pointer; font-weight: 700; }
.tb-color:hover { background: var(--c-surface-2); border-color: var(--c-border); }
.tb-color input[type="color"] { position: absolute; left: 4px; bottom: 2px; width: 24px; height: 6px; border: none; padding: 0; background: none; cursor: pointer; }
.tb-hl span { background: #fff3a3; padding: 0 2px; }
.stat-danger { border-left-color: var(--c-danger); }
.stat-danger .stat-number { color: var(--c-danger); }
.editor-instructions { margin: 0; font-size: .9rem; }
.editor-stage { display: flex; justify-content: center; }
.editor-paper {
  width: 100%; max-width: 820px; min-height: 60vh; background: #fff;
  border: 1px solid var(--c-border); box-shadow: var(--shadow-sm);
  padding: 48px 56px; font-size: 1.02rem; line-height: 1.7; outline: none;
}
.editor-paper:focus { border-color: var(--c-primary-line); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.editor-paper h2 { font-size: 1.4rem; margin: 1em 0 .4em; }
.editor-paper:empty::before { content: attr(aria-label); color: var(--c-faint); }
.editor-foot { font-size: .82rem; display: flex; align-items: center; gap: 6px; }
.editor-hint {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--c-warning); color: #3a2906; font-weight: 600; font-size: .88rem;
  padding: 11px 18px; box-shadow: var(--shadow-lg); z-index: 120; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.editor-hint.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.content { padding: 30px 36px 56px; max-width: 1280px; width: 100%; }
.has-shell .messages { padding: 18px 36px 0; max-width: 1280px; }

/* Mobile nav toggle */
.nav-burger { display: none; flex-direction: column; gap: 4px; cursor: pointer; padding: 6px; }
.nav-burger span { width: 22px; height: 2px; background: var(--c-text); display: block; }
.nav-scrim { display: none; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .app-main { margin-left: 0; }
  .nav-burger { display: flex; }
  #navtoggle:checked ~ .app .sidebar { transform: translateX(0); }
  #navtoggle:checked ~ .app .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(10,15,25,.5);
  }
}

/* ===========================================================================
   Interactive board (drag & drop)
   ======================================================================== */
.board { display: flex; flex-direction: column; gap: 14px; }

.board-bar {
  position: sticky; top: var(--appbar-h); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 16px;
  background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm);
}
.board-bar-left, .board-bar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.stage { display: inline-flex; align-items: center; }
.stage-step {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-faint); padding: 5px 14px; border: 1px solid var(--c-border);
  border-right-width: 0; background: var(--c-surface-2); white-space: nowrap;
}
.stage-step:last-child { border-right-width: 1px; }
.stage-step.done { color: var(--c-success); border-color: var(--c-success-line); background: var(--c-success-soft); }
.stage-step.active { color: #fff; background: var(--c-primary); border-color: var(--c-primary); }

/* Toolbar controls */
.class-switch { padding: 7px 10px; font-weight: 600; font-size: .9rem; max-width: 220px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--c-border-strong); background: var(--c-surface); cursor: pointer; color: var(--c-muted);
}
.icon-btn:hover { background: var(--c-surface-2); color: var(--c-text); }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; min-width: 196px;
  background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; padding: 6px;
}
.menu-pop button, .menu-pop a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: transparent;
  border: none; text-align: left; font: inherit; font-size: .9rem; color: var(--c-text); cursor: pointer; width: 100%;
}
.menu-pop button:hover, .menu-pop a:hover { background: var(--c-surface-2); text-decoration: none; }
.menu-pop .icon { color: var(--c-muted); }

.board-summary { display: flex; gap: 12px; flex-wrap: wrap; }
.board-summary .sum {
  flex: 1; min-width: 120px; background: var(--c-surface); border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-primary); padding: 12px 16px; box-shadow: var(--shadow-sm);
}
.board-summary .sum b { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1; }
.board-summary .sum span { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); font-weight: 700; }

.board-canvas { display: grid; grid-template-columns: 248px 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .board-canvas { grid-template-columns: 1fr; } }

/* Supervisor rail */
.rail {
  position: sticky; top: calc(var(--appbar-h) + 70px);
  background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm);
  padding: 14px; max-height: calc(100vh - var(--appbar-h) - 90px); overflow-y: auto;
}
.rail-head { font-weight: 700; font-size: .9rem; margin-bottom: 10px; display: flex; gap: 6px; align-items: baseline; }
.rail-list { display: flex; flex-direction: column; gap: 8px; }
.rail-hint { font-size: .78rem; margin: 12px 0 0; }

/* Lanes */
.lanes { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; align-items: start; }
.lane { background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm); }
.lane-group { transition: box-shadow .15s ease, border-color .15s ease; }
.lane-group.over { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.lane-pool .lane-body { display: flex; flex-wrap: wrap; gap: 8px; }
.lane-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--c-border); background: var(--c-surface-2);
}
.lane-head strong { font-size: .95rem; }
.lane-head .pill, .pill {
  font-size: .72rem; font-weight: 700; background: var(--c-surface-3); color: var(--c-muted);
  padding: 2px 8px; min-width: 20px; text-align: center;
}
.lane-body { padding: 12px; min-height: 56px; }
.lane-group .lane-body { display: flex; flex-direction: column; gap: 7px; }
.grp-meta { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--c-border); align-items: center; flex-wrap: wrap; }
.grp-area { flex: 1; min-width: 110px; padding: 6px 8px; font-size: .85rem; }
.grp-del { margin-left: auto; border: none; background: transparent; color: var(--c-faint); font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 2px 6px; opacity: 0; transition: opacity .12s ease; }
.lane-group:hover .grp-del, .grp-del:focus-visible { opacity: 1; }
.grp-del:hover { color: var(--c-danger); }

/* Drop targets */
.drop.over { outline: 2px dashed var(--c-primary); outline-offset: -4px; background: var(--c-primary-soft); }
.drop-hint { display: none; color: var(--c-primary-d); font-size: .8rem; font-weight: 600; text-align: center; padding: 8px; }
.drop.over .drop-hint { display: block; }
.empty-note { color: var(--c-faint); font-size: .85rem; }
.empty-note.pad { padding: 24px; text-align: center; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--c-surface); border: 1px solid var(--c-border-strong);
  padding: 7px 9px; font-size: .86rem; cursor: grab; user-select: none;
  box-shadow: 0 1px 0 rgba(16,24,40,.03);
}
.chip:active { cursor: grabbing; }
.chip.dragging { opacity: .45; }
.chip-student { background: #fff; }
.chip-student.is-leader { border-color: var(--c-primary-line); background: var(--c-primary-soft); }
.chip-name { font-weight: 600; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.chip-gpa { font-size: .72rem; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.chip-lead { color: var(--c-primary); }
.chip-star { border: none; background: transparent; color: var(--c-faint); cursor: pointer; font-size: .95rem; padding: 0 2px; margin-left: auto; opacity: 0; transition: opacity .12s ease; }
.chip-student:hover .chip-star, .chip-star:focus-visible { opacity: 1; }
.chip-star:hover { color: var(--c-primary); }
.lane-group .chip-student { width: 100%; }

.chip-sup { flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; }
.chip-sup .chip-name { max-width: 100%; }
.chip-sup .sup-cap { font-size: .72rem; color: var(--c-success); font-weight: 700; }
.chip-sup.is-full .sup-cap { color: var(--c-warning); }
.chip-sup .sup-areas { font-size: .72rem; color: var(--c-muted); }

/* Supervisor slot on a group */
.sup-slot { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px dashed var(--c-border-strong); font-size: .82rem; }
.sup-slot.empty { color: var(--c-faint); }
.sup-slot.has-sup { border-style: solid; border-color: var(--c-success-line); background: var(--c-success-soft); }
.sup-slot-name { font-weight: 600; }
.sup-slot.over { outline: 2px dashed var(--c-primary); outline-offset: 2px; }
.sup-rm { border: none; background: transparent; color: var(--c-faint); cursor: pointer; font-size: 1rem; line-height: 1; }
.sup-rm:hover { color: var(--c-danger); }
.tag-manual { font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; background: #efe6ff; color: #6b29c7; padding: 1px 5px; font-weight: 700; }

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(10,15,25,.5); display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 460px; background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--c-border); }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-x { border: none; background: transparent; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--c-muted); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--c-border); background: var(--c-surface-2); }
.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.chks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; max-height: 160px; overflow-y: auto; border: 1px solid var(--c-border); padding: 8px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 500; }
.preview { display: flex; flex-direction: column; gap: 8px; }
.note { font-size: .85rem; padding: 9px 11px; border: 1px solid transparent; border-left-width: 3px; }
.note-info { background: var(--c-primary-soft); border-color: var(--c-primary-line); color: var(--c-primary-dd); }
.note-warn { background: var(--c-warning-soft); border-color: var(--c-warning-line); color: #7a5207; }
.note-ok { background: var(--c-success-soft); border-color: var(--c-success-line); color: #115e35; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 120;
  padding: 11px 18px; font-weight: 600; font-size: .9rem; color: #fff; box-shadow: var(--shadow-lg);
}
.toast-ok { background: var(--c-success); }
.toast-error { background: var(--c-danger); }

/* Utilities ------------------------------------------------------------ */
.muted { color: var(--c-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.stack > * + * { margin-top: 16px; }
