/* Victoria Police Portal — Navy theme with sidebar layout */

:root {
  --bg-deep: #0c1528;
  --bg-page: #0f1a2e;
  --bg-sidebar: #060e1c;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
  --bg-surface: #132038;
  --bg-card: rgba(16, 28, 48, 0.82);
  --bg-elevated: rgba(22, 38, 64, 0.75);
  --border: rgba(100, 140, 200, 0.14);
  --border-accent: rgba(72, 130, 220, 0.4);
  --text: #e8eef8;
  --text-muted: #8fa3c4;
  --text-dim: #5c7294;
  --accent: #4d8cff;
  --accent-hover: #3b7aed;
  --accent-glow: rgba(77, 140, 255, 0.22);
  --purple: #7c6cf0;
  --success: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 260px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg-deep);
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
.muted { color: var(--text-muted); }

/* ── Network background ─────────────────────── */
.network-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.network-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(77, 140, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 140, 255, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 20%, transparent 75%);
}

.network-bg-svg {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0.55;
  animation: network-drift 90s linear infinite;
}

@keyframes network-drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-1.5%, 1%) scale(1.02); }
  100% { transform: translate(0, 0) scale(1); }
}

.network-lines { opacity: 0.7; }
.network-nodes { animation: node-pulse 4s ease-in-out infinite; }

@keyframes node-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}

/* ── App shell & sidebar ────────────────────── */
.app-body { position: relative; }

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  height: 40px;
  width: auto;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.sidebar-brand-title {
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  letter-spacing: 0.01em;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text);
}

.sidebar-link.is-active {
  background: rgba(77, 140, 255, 0.15);
  color: #fff;
  border: 1px solid var(--border-accent);
}

.sidebar-link-icon {
  width: 18px;
  text-align: center;
  font-size: 13px;
  opacity: 0.85;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 8px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 4px 12px 6px;
}

.sidebar-footer {
  padding: 14px 12px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-accent);
  object-fit: cover;
}

.sidebar-user-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  font-weight: 700;
  font-size: 14px;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-rank {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-tier {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-tier--leadership {
  color: var(--accent);
}

.sidebar-user-tier--senior {
  color: var(--purple);
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--accent);
}

.sidebar-logout-form { margin: 0; }

.sidebar-logout-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-logout-btn:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  position: relative;
}

/* Legacy top header — hidden when using sidebar */
.site-header { display: none; }

/* ── Layout ─────────────────────────────────── */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 28px 60px;
  position: relative;
  z-index: 1;
}

@media (max-width: 900px) {
  :root { --sidebar-w: 72px; }
  .sidebar-brand-text,
  .sidebar-link span:not(.sidebar-link-icon),
  .sidebar-section-label,
  .sidebar-user-info,
  .sidebar-logout-btn { display: none; }
  .sidebar-brand { padding: 16px 8px; justify-content: center; }
  .sidebar-brand-link { justify-content: center; }
  .sidebar-link { justify-content: center; padding: 12px; }
  .sidebar-user { justify-content: center; }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 500;
}

.back-link:hover { text-decoration: underline; }

/* ── Cards ──────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover { border-color: var(--border-accent); }

.card-static:hover { border-color: var(--border); box-shadow: none; }

.text-link {
  color: var(--accent);
  font-weight: 600;
}
.text-link:hover { text-decoration: underline; }

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover { background: rgba(51, 65, 85, 0.8); border-color: rgba(148, 163, 184, 0.3); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover { color: #fff; background: var(--bg-elevated); }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

.btn-discord {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  background: #5865F2;
  border-color: #5865F2;
  color: #fff;
}

.btn-discord:hover {
  background: #4752C4;
  border-color: #4752C4;
  box-shadow: 0 0 24px rgba(88, 101, 242, 0.35);
}

/* ── Forms ──────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, select, textarea {
  font-family: var(--font);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 10px 14px;
  background: rgba(2, 6, 23, 0.5);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { min-height: 80px; resize: vertical; }

.search-input {
  min-width: 260px;
  max-width: 360px;
}

/* ── Badges ─────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.3);
}

/* ── Flash messages ─────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  white-space: pre-line;
  text-align: center;
  font-size: 14px;
}

.flash.error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.flash.success {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

/* ── Login page ─────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-deep);
  position: relative;
}

.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(77, 140, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 140, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
  backdrop-filter: blur(12px);
}

.login-logo img { height: 56px; margin-bottom: 16px; }

.login-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
}

.login-card .muted { margin-bottom: 28px; font-size: 14px; line-height: 1.5; }
.login-footer { margin-top: 20px; font-size: 12px; }

/* ── Certifications grid ────────────────────── */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.cert-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.cert-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cert-card h3 { margin: 0; font-size: 17px; font-weight: 700; }
.cert-desc { font-size: 13px; margin: 0; line-height: 1.4; }
.cert-link { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 4px; }

/* ── Roster ─────────────────────────────────── */
.roster-section { margin-bottom: 16px; }

.roster-rank-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.roster-empty { font-size: 13px; margin: 0; }

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.roster-member {
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.roster-member-name { font-weight: 600; font-size: 14px; }
.roster-member-callsign { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.roster-member-notes { font-size: 12px; margin-top: 4px; }

/* ── Staff roster page ──────────────────────── */
.staff-roster-header { margin-bottom: 20px; }

.staff-roster-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
}

.staff-roster-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}

.staff-roster-stat strong {
  color: var(--text);
  font-weight: 700;
}

.staff-roster-stat-divider {
  color: var(--text-dim);
}

.staff-roster-sync { font-size: 13px; }

.staff-roster-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 20px;
}

.staff-roster-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}

.staff-roster-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
  pointer-events: none;
}

.staff-roster-search {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding-left: 38px;
  background: rgba(2, 6, 23, 0.45);
}

.staff-roster-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.staff-roster-board {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.staff-rank-block {
  padding: 0;
  overflow: hidden;
  border-color: rgba(77, 140, 255, 0.12);
  background: linear-gradient(135deg, rgba(16, 28, 48, 0.92) 0%, rgba(12, 21, 40, 0.88) 100%);
}

.staff-rank-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(77, 140, 255, 0.04);
}

.staff-rank-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}

.staff-rank-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(77, 140, 255, 0.12);
  border: 1px solid rgba(77, 140, 255, 0.22);
}

.staff-member-grid {
  padding: 16px 20px 20px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.staff-member-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.35);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.staff-member-card:hover {
  border-color: var(--border-accent);
  background: rgba(77, 140, 255, 0.06);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.staff-member-card.roster-member--with-actions {
  flex-direction: row;
}

.staff-member-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.staff-member-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(77, 140, 255, 0.2);
}

.staff-member-avatar--photo {
  display: block;
  object-fit: cover;
}

.staff-member-avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(145deg, rgba(77, 140, 255, 0.85), rgba(124, 108, 240, 0.75));
}

.staff-member-body {
  min-width: 0;
  flex: 1;
}

.staff-member-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.staff-member-card:hover .staff-member-name {
  color: var(--accent);
}

.staff-member-callsign {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 13px;
}

.staff-member-status {
  margin-top: 4px;
}

.staff-member-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.staff-member-card:hover .staff-member-actions {
  opacity: 1;
}

.staff-member-actions form { margin: 0; }

.staff-roster-no-results {
  text-align: center;
  margin-top: 8px;
  font-size: 14px;
}

/* ── Org-chart roster ───────────────────────── */
.staff-roster-orgchart {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.orgchart-panel {
  padding: 20px 20px 16px;
  overflow: hidden;
}

.orgchart-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Leadership lane — executives + unassigned commanders */
.orgchart-leadership-lane {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.orgchart-leader-card {
  width: min(240px, 100%);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.35);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.orgchart-leader-card:hover {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(15, 23, 42, 0.5);
}

.orgchart-leader-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
}

.orgchart-leader-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.orgchart-leader-avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent);
}

.orgchart-leader-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.orgchart-leader-rank {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.orgchart-leader-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orgchart-leader-callsign {
  font-weight: 500;
  color: var(--text-muted);
}

/* Overwatch tiers + division tree */
.orgchart-tree {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.orgchart-tier {
  display: grid;
  grid-template-columns: repeat(var(--division-count, 3), minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  margin-bottom: 12px;
}

.orgchart-tier-slot {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-width: 0;
}

.orgchart-tier-slot--linked {
  position: relative;
  padding-bottom: 20px;
}

.orgchart-tier-slot--linked::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 20px;
  background: linear-gradient(
    to bottom,
    rgba(148, 163, 184, 0.5),
    rgba(148, 163, 184, 0.25)
  );
}

.orgchart-tier--commander .orgchart-leader-card {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.06);
}

.orgchart-tier--inspector .orgchart-leader-card {
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(59, 130, 246, 0.06);
}

.orgchart-rail {
  height: 2px;
  margin: 0 8%;
  background: rgba(148, 163, 184, 0.28);
  flex-shrink: 0;
}

.orgchart-division-row {
  display: grid;
  grid-template-columns: repeat(var(--division-count, 3), minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  padding-top: 16px;
}

.orgchart-division-col {
  overflow: hidden;
  min-width: 0;
  min-height: 120px;
}

.orgchart-empty-division {
  padding: 16px 14px;
  font-size: 13px;
  text-align: center;
}

.orgchart-rank-block {
  padding: 0 14px 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.orgchart-rank-block:first-of-type {
  border-top: none;
}

.orgchart-rank-label {
  margin: 12px 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.orgchart-member-grid {
  gap: 8px;
}

.orgchart-special-roster {
  padding: 0;
}

.orgchart-special-roster .staff-member-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  padding: 0 16px 16px;
}

.orgchart-special-roster .orgchart-section-header {
  padding: 14px 16px 0;
}

.division-config-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.division-config-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.division-config-name {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.division-role-input {
  flex: 1 1 200px;
  min-width: 160px;
}

.division-issues-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 14px 18px;
}

.division-issues-stat {
  font-size: 14px;
}

.division-issues-list {
  padding: 0;
  overflow: hidden;
}

.division-issue-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto minmax(220px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.division-issue-row:last-child {
  border-bottom: none;
}

.division-issue-officer {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.division-issue-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.division-issue-avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent);
}

.division-issue-name {
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

.division-issue-name:hover {
  color: var(--accent);
}

.division-issue-meta {
  font-size: 12px;
  margin-top: 4px;
}

.division-issue-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.division-issue-select {
  min-width: 180px;
}

.division-issue-sync,
.division-sync-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.division-issue-note {
  font-size: 12px;
  margin: 0;
  text-align: right;
}

.division-form,
.callsign-form {
  min-width: 220px;
}

.duty-hours-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.duty-hours-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 18px;
}

.duty-hours-filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
  width: 100%;
}

.duty-period-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.duty-period-field {
  margin: 0;
  min-width: 140px;
}

.duty-period-field--dates {
  display: none;
}

.duty-period-field--dates.is-visible {
  display: block;
}

.duty-period-apply {
  align-self: flex-end;
}

.duty-hours-toolbar .duty-hours-summary {
  margin-top: 12px;
}

.officer-duty-period-form.duty-hours-filters {
  justify-content: flex-end;
}

.duty-hours-table-wrap {
  overflow-x: auto;
  padding: 0;
}

.duty-hours-table {
  width: 100%;
}

.duty-hours-row--warn td {
  background: rgba(251, 191, 36, 0.04);
}

.officer-duty-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.officer-duty-period-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.officer-duty-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.officer-duty-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.officer-duty-total-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.duty-shifts-scroll {
  --duty-shift-row-height: 44px;
  --duty-shift-header-height: 38px;
  --duty-shift-visible-rows: 8;
  max-height: calc(
    var(--duty-shift-header-height) +
    var(--duty-shift-row-height) * var(--duty-shift-visible-rows)
  );
  overflow-y: auto;
  margin-top: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: var(--radius);
}

.duty-shifts-scroll .duty-shifts-table {
  margin: 0;
}

.duty-shifts-scroll .duty-shifts-table thead th {
  position: sticky;
  top: 0;
  background: var(--card-bg, rgba(16, 28, 48, 0.98));
  z-index: 1;
}

.roster-month-duty {
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.duty-hours-tier--low {
  color: #f87171;
}

.duty-hours-tier--mid {
  color: #fbbf24;
}

.duty-hours-tier--high {
  color: #4ade80;
}

.inspector-assign-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.inspector-assign-item:last-child {
  border-bottom: none;
}

.division-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.staff-roster-empty .text-link { color: var(--accent); }

.btn-icon-sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
  border-radius: 8px;
}

/* ── Rank management ────────────────────────── */
.rank-add-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 12px;
  align-items: end;
}

.cert-rank-edit-row,
.cert-rank-add-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.cert-rank-edit-row select,
.cert-rank-add-row select {
  min-width: 160px;
}

.rank-inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.rank-list { display: flex; flex-direction: column; gap: 8px; }

.rank-edit-row, .rank-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.rank-edit-row input, .rank-add-row input { flex: 1; min-width: 160px; }

/* ── Tables ─────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

/* ── Empty state ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h2 { margin: 0 0 8px; font-size: 20px; }

/* ── Modals ─────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}

.modal {
  width: min(520px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

/* ── Officer profile ────────────────────────── */
.profile-header-inner {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--border-accent);
  object-fit: cover;
  flex-shrink: 0;
}

.profile-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.profile-header-info { flex: 1; min-width: 200px; }
.profile-header-info h1 { margin: 0 0 8px; font-size: 24px; }
.profile-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-service-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.profile-stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.profile-stat-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.profile-stat-since { font-size: 12px; }
.profile-discord { margin-top: 8px; font-size: 13px; }

.profile-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.profile-two-col > .card {
  margin-top: 0;
  min-width: 0;
}

.profile-two-col .note-add-form {
  max-width: none;
}

.profile-two-col .note-list {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.profile-two-col .cert-assign-list {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}
.discord-id {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: rgba(2, 6, 23, 0.5);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.callsign-form { min-width: 200px; }
.section-title { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
.section-divider { margin: 20px 0; border: none; border-top: 1px solid var(--border); }

.roster-member-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.roster-member-link:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

.roster-member-link-inner {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.roster-member-link-inner:hover .roster-member-name {
  color: var(--accent);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.35);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn-icon:hover {
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.1);
}

.btn-icon-danger {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.btn-icon-danger:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.16);
}

.roster-member--with-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.roster-member-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.roster-member-top form {
  margin: 0;
  flex-shrink: 0;
}

.roster-member-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon-promote {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.btn-icon-promote:hover {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.16);
}

.btn-icon-demote {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.btn-icon-demote:hover {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.16);
}

.cert-assign-list { display: flex; flex-direction: column; gap: 8px; }
.cert-assign-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(2, 6, 23, 0.35);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.cert-assign-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.note-add-form { display: grid; gap: 12px; max-width: 640px; }
.note-list { display: grid; gap: 12px; margin-top: 4px; }

.note-card {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.35);
}

.note-commendation { border-color: rgba(34, 197, 94, 0.35); }
.note-warning { border-color: rgba(245, 158, 11, 0.35); }
.note-misconduct { border-color: rgba(239, 68, 68, 0.35); }

.note-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.note-narrative {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.note-edit-details summary { list-style: none; }
.note-edit-details summary::-webkit-details-marker { display: none; }

/* ── Applications ───────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.12);
}
.status-pending { color: #fbbf24; border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.1); }
.status-approved { color: #4ade80; border-color: rgba(34, 197, 94, 0.35); background: rgba(34, 197, 94, 0.1); }
.status-denied { color: #f87171; border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }
.status-awaiting_induction { color: #60a5fa; border-color: rgba(59, 130, 246, 0.35); background: rgba(59, 130, 246, 0.1); }
.status-awaiting_completion { color: #60a5fa; border-color: rgba(59, 130, 246, 0.35); background: rgba(59, 130, 246, 0.1); }
.status-inducted { color: #a78bfa; border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.1); }
.status-completed { color: #a78bfa; border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.1); }

.badge-success {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

.app-table-wrap { overflow-x: auto; }
.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.app-table th,
.app-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.app-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.app-open-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.app-open-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.35);
}
.app-open-card h3 { margin: 0 0 8px; font-size: 16px; }
.app-open-desc,
.app-open-instructions {
  font-size: 13px;
  margin: 0 0 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.app-form { max-width: 640px; display: grid; gap: 14px; }
.required-mark { color: var(--danger); }

.app-answers { display: grid; gap: 12px; }
.app-answer-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.35);
}
.app-answer-q { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.app-answer-a { white-space: pre-wrap; font-size: 14px; line-height: 1.5; }

.vote-list { display: grid; gap: 8px; }
.vote-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

.app-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.app-deny-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.app-deny-form input { min-width: 220px; }

.app-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.question-list { display: grid; gap: 8px; }
.question-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.35);
}

.question-add-form {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: end;
}

.app-settings-form { max-width: 640px; }

.app-settings-list { display: grid; gap: 12px; }
.app-settings-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.35);
}
.app-settings-card.is-saving { opacity: 0.65; pointer-events: none; }
.app-settings-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 6px 16px;
  align-items: start;
}
.app-settings-grid .app-settings-view {
  display: contents;
}
.app-settings-grid .app-settings-meta {
  grid-column: 1;
  grid-row: 2;
}
.app-settings-grid .app-settings-desc-edit {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
}
.app-settings-grid .app-settings-desc-form {
  grid-column: 1 / -1;
  grid-row: 2;
}
.app-settings-toggle {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
}
.app-settings-cert-name {
  grid-column: 1;
  grid-row: 1;
}
.app-settings-meta {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.app-settings-desc-edit {
  flex-shrink: 0;
  min-width: 48px;
}
.app-settings-desc-form textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
}
.app-settings-desc-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text-muted, #94a3b8);
}
.app-settings-desc-empty {
  margin: 0;
  font-size: 14px;
}
.app-settings-desc-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.app-settings-cert-name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.app-settings-cert-name:hover { color: var(--accent); }
.app-settings-status {
  font-size: 12px;
  flex-shrink: 0;
  line-height: 1.5;
  padding-top: 1px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(148, 163, 184, 0.35);
  border-radius: 26px;
  transition: background 0.2s ease;
}
.toggle-slider::before {
  position: absolute;
  content: '';
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent, #3b82f6);
}
.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 2px;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .cert-assign-form { grid-template-columns: 1fr; }
  .rank-add-form { grid-template-columns: 1fr; }
  .cert-rank-edit-row,
  .cert-rank-add-row { grid-template-columns: 1fr; }
  .question-add-form { grid-template-columns: 1fr; }
  .app-deny-form { flex-direction: column; align-items: stretch; }
  .header-nav { display: none; }
  .header-inner { gap: 12px; }
  .user-info { display: none; }
  .page-header h1 { font-size: 22px; }
  .search-input { min-width: 100%; max-width: 100%; }
  .staff-roster-toolbar { flex-direction: column; align-items: stretch; }
  .staff-roster-search-wrap { max-width: none; }
  .staff-roster-toolbar-actions { justify-content: flex-end; }
  .orgchart-tier,
  .orgchart-division-row { grid-template-columns: 1fr; }
  .orgchart-tier-slot { grid-column: 1 / -1 !important; }
  .orgchart-leadership-lane { gap: 10px; }
  .orgchart-rail { margin: 0 4%; }
  .division-issue-row { grid-template-columns: 1fr; }
  .division-issue-form { justify-content: flex-start; }
  .division-issue-note { text-align: left; }
  .staff-member-grid { grid-template-columns: 1fr; padding: 14px; }
  .staff-rank-header { padding: 12px 14px; }
  .profile-two-col { grid-template-columns: 1fr; }
  .profile-two-col .note-list,
  .profile-two-col .cert-assign-list { max-height: none; overflow: visible; }
  .rt-student-list-head { display: none; }
  .rt-student-row { grid-template-columns: 1fr; gap: 12px; }
  .rt-col-stages { justify-content: flex-start; }
  .rt-stage-grid { grid-template-columns: 1fr; }
  .rt-comment-form-row { flex-direction: column; align-items: stretch; }
}

/* ── Recruit training ───────────────────────── */
.rt-header { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rt-graduated-rank-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(77, 140, 255, 0.15);
  color: var(--accent);
  margin-left: 6px;
  vertical-align: middle;
}
.rt-graduated-meta { font-size: 12px; margin: 6px 0 0; }
.rt-finals-hint--readonly {
  border-color: rgba(77, 140, 255, 0.25);
  background: rgba(77, 140, 255, 0.08);
}
.rt-task-toggles--readonly { gap: 8px; }
.rt-task-status {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(100, 140, 200, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: transparent;
  flex-shrink: 0;
}
.rt-task-status.is-ticked {
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}
.rt-task-status--final {
  width: auto;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.rt-task-status--final.is-ticked {
  color: #f97316;
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.15);
}
.rt-student-callsign { display: block; }
.rt-finals-hint {
  font-size: 13px;
  margin: -8px 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}
.rt-finals-hint--active {
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.08);
  color: #fdba74;
}
.rt-back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.rt-back-link:hover { color: var(--accent); }

.rt-student-list { padding: 0; overflow: hidden; }
.rt-student-list-head,
.rt-student-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
}
.rt-student-list-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}
.rt-student-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.rt-student-row:last-child { border-bottom: none; }
.rt-student-row:hover { background: var(--bg-sidebar-hover); }

.rt-col-student {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.rt-student-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.rt-student-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-muted);
}
.rt-student-avatar--inline {
  width: 28px;
  height: 28px;
  vertical-align: middle;
  margin-right: 6px;
}
.rt-student-name { display: block; font-weight: 600; font-size: 15px; }
.rt-student-callsign { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.rt-col-stages {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rt-stage-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--rt-stage-color, var(--border));
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
.rt-stage-ring-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}
.rt-stage-ring--empty {
  border-color: rgba(100, 140, 200, 0.25);
  opacity: 0.65;
}
.rt-stage-ring--partial {
  border-color: var(--rt-stage-color);
  box-shadow: 0 0 12px color-mix(in srgb, var(--rt-stage-color) 35%, transparent);
}
.rt-stage-ring--complete {
  background: var(--rt-stage-color);
  border-color: var(--rt-stage-color);
  box-shadow: 0 0 16px color-mix(in srgb, var(--rt-stage-color) 45%, transparent);
}
.rt-stage-ring--complete .rt-stage-ring-label { color: #0c1528; }

.rt-overall-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.rt-overall-pill--done {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--success);
}

.rt-student-subtitle { margin-top: 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

.rt-stage-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.rt-stage-card { padding: 0; overflow: hidden; }
.rt-stage-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--rt-stage-color) 12%, transparent);
}
.rt-stage-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--rt-stage-color);
}
.rt-stage-card-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 10px;
  border-radius: 999px;
}

.rt-task-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}
.rt-task-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(100, 140, 200, 0.08);
}
.rt-task-row:last-child { border-bottom: none; }
.rt-task-row--done .rt-task-title { color: var(--success); }
.rt-task-main {
  display: flex;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.rt-task-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: rgba(100, 140, 200, 0.1);
  color: var(--text-muted);
}
.rt-task-row--done .rt-task-icon {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}
.rt-task-text { min-width: 0; }
.rt-task-title { display: block; font-weight: 600; font-size: 14px; }
.rt-task-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.45;
}
.rt-task-note {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  font-style: italic;
}
.rt-task-note--empty { display: none; }

.rt-task-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(100, 140, 200, 0.3);
  background: transparent;
  color: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  padding: 0;
}
.rt-task-toggle:hover {
  border-color: var(--accent);
  background: rgba(77, 140, 255, 0.1);
}
.rt-task-toggle.is-ticked {
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.2);
  color: var(--success);
}
.rt-task-toggle-inner {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.rt-task-toggle:not(.is-ticked) .rt-task-toggle-inner { opacity: 0; }
.rt-task-toggle.is-ticked .rt-task-toggle-inner { opacity: 1; }

.rt-task-toggles {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.rt-task-toggle--final {
  width: auto;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.rt-task-toggle--final .rt-task-toggle-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.rt-task-toggle--final.is-ticked {
  color: #f97316;
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.15);
}
.rt-task-toggle--final.is-ticked .rt-task-toggle-label { color: #f97316; }
.rt-task-toggle--hidden {
  display: none !important;
}
.rt-task-note--final {
  color: color-mix(in srgb, #f97316 70%, var(--text-dim));
}

.rt-comments { margin-top: 0; }
.rt-comments-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.rt-comments-header h2 { margin: 0; font-size: 16px; }
.rt-comment-form { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.rt-comment-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.rt-comment-stage {
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.rt-comment-fto-only {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.rt-comment-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.rt-comment-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}
.rt-comment-item {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(100, 140, 200, 0.08);
}
.rt-comment-item:last-child { border-bottom: none; }
.rt-comment-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
}
.rt-comment-stage-tag,
.rt-comment-fto-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(77, 140, 255, 0.15);
  color: var(--accent);
}
.rt-comment-fto-tag {
  background: rgba(124, 108, 240, 0.15);
  color: var(--purple);
}
.rt-comment-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.rt-comment-empty { padding: 24px 18px; text-align: center; }
.rt-empty { text-align: center; padding: 48px 24px; }
