/* Mountain Valley Roleplay CMS - forum-style dark theme, blue/grey/black */
:root {
  --bg: #0d1014;
  --surface: #14181e;
  --surface-2: #1a1f27;
  --head: #171c24;
  --border: #232a34;
  --text: #dfe5ec;
  --text-muted: #8a94a3;
  --blue: #4a8eba;
  --blue-hover: #61a3cd;
  --blue-deep: #2e6a94;
  --open: #4caf7d;
  --closed: #b0574f;
  --pending: #c9a24b;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.shell { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- Brand bar ---------- */
.brandbar {
  background-size: cover; background-position: center;
  border-bottom: 1px solid var(--border);
}
.brandbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); }
.brand-logo { height: 58px; width: auto; filter: drop-shadow(0 2px 8px rgba(0,0,0,.5)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: 'Bebas Neue', sans-serif; font-size: 34px; letter-spacing: 2px; }
.brand-name em { font-style: normal; color: var(--blue); }
.brand-tag { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.brand-user { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; color: var(--text); }
.user-chip:hover strong { color: var(--blue); }
.user-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; width: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--blue-deep); color: #fff; font-weight: 700; font-size: 15px;
  object-fit: cover; border: 1px solid var(--border);
}
.avatar-sm { height: 24px; width: 24px; font-size: 12px; }
.avatar-lg { height: 96px; width: 96px; font-size: 40px; }
.cell-user { display: inline-flex; align-items: center; gap: 8px; }
.profile { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.profile-info { flex: 1; min-width: 240px; }
.profile-name { font-family: 'Bebas Neue', sans-serif; font-size: 32px; letter-spacing: 1.5px; margin: 0 0 6px; line-height: 1; }
.profile-rows .stat-row:last-child { border-bottom: none; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 13px; }
.review-head { display: flex; gap: 14px; align-items: flex-start; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta small { color: var(--text-muted); font-size: 11.5px; }
.inline { display: inline; }

/* ---------- Nav bar ---------- */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.nav-inner { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; }
.nav-tab {
  display: inline-flex; align-items: center;
  padding: 13px 15px; color: var(--text-muted);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.nav-spacer { flex: 1; }
.nav-ext { font-size: 13px; }

/* ---------- Announcement ---------- */
.announce {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding: 11px 16px;
  background: linear-gradient(90deg, var(--blue-deep), var(--blue));
  color: #fff; font-weight: 700; font-size: 14px;
  border-radius: var(--radius);
}
a.announce:hover { color: #fff; filter: brightness(1.08); }

/* ---------- Layout ---------- */
.page { flex: 1; padding-top: 22px; padding-bottom: 56px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.main-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.sidebar { display: flex; flex-direction: column; gap: 20px; }

.page-head { margin-bottom: 18px; }
.page-title { font-family: 'Bebas Neue', sans-serif; font-size: 34px; letter-spacing: 1.5px; margin: 0 0 2px; line-height: 1.05; }
.muted { color: var(--text-muted); }
.center { text-align: center; }

.flash { margin-top: 16px; padding: 10px 14px; border-radius: var(--radius); font-weight: 500; font-size: 14px; }
.flash-success { background: rgba(76,175,125,.1); border: 1px solid rgba(76,175,125,.35); color: #8fd6b1; }
.flash-error { background: rgba(176,87,79,.1); border: 1px solid rgba(176,87,79,.35); color: #e0938c; }

/* ---------- Widgets / cards ---------- */
.widget, .card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.widget-head {
  margin: 0; padding: 10px 14px;
  background: var(--head); border-bottom: 1px solid var(--border);
  font-family: 'Barlow', sans-serif; font-size: 13px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--text);
  display: flex; align-items: center; gap: 9px;
}
.widget-head::before {
  content: ''; width: 12px; height: 10px; flex-shrink: 0;
  background: repeating-linear-gradient(to bottom, var(--blue) 0 2px, transparent 2px 4px);
}
.widget-body { padding: 16px; }
.card { padding: 18px; }
.card-title { font-family: 'Bebas Neue', sans-serif; font-size: 23px; letter-spacing: 1px; margin: 0 0 8px; line-height: 1.1; }
.card-sub, .mini-head {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted); margin: 18px 0 8px; font-weight: 700;
}
.block-head {
  font-family: 'Bebas Neue', sans-serif; font-size: 26px; letter-spacing: 1.5px;
  margin: 0 0 14px; line-height: 1.1;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.block { margin-top: 4px; }

/* ---------- Welcome ---------- */
.welcome {
  text-align: center; padding: 40px 24px 36px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.welcome-logo { height: 96px; width: auto; margin-bottom: 6px; }
.welcome-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(52px, 8vw, 84px); letter-spacing: 6px; line-height: 1; margin: 6px 0 10px;
  background: linear-gradient(180deg, #7db6da, var(--blue) 55%, var(--blue-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.welcome-text { color: var(--text-muted); max-width: 640px; margin: 0 auto 22px; font-size: 15.5px; }
.welcome-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: 1px solid transparent; cursor: pointer; text-align: center;
  font-family: 'Barlow', sans-serif; font-weight: 700; font-size: 14px;
  padding: 9px 18px; border-radius: var(--radius);
  transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--blue); color: #0b0e12; }
.btn-primary:hover { background: var(--blue-hover); color: #0b0e12; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { display: block; width: 100%; }
.btn-accept { background: var(--open); color: #08110c; }
.btn-accept:hover { filter: brightness(1.1); }
.btn-deny { background: transparent; color: var(--closed); border-color: var(--closed); }
.btn-deny:hover { background: rgba(176,87,79,.15); }

/* ---------- Department cards ---------- */
.dept-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.dept-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .15s;
}
.dept-card:hover { border-color: var(--blue); }
.dept-media {
  height: 140px; position: relative;
  background: linear-gradient(135deg, #1a1f27, #10141a);
  background-size: cover; background-position: center;
}
.dept-media::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(13,16,20,.88), rgba(13,16,20,.05));
}
.dept-logo {
  position: absolute; left: 12px; bottom: -20px; z-index: 2;
  height: 58px; width: 58px; object-fit: contain;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px;
}
.dept-body { padding: 30px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.dept-code { font-size: 11.5px; font-weight: 700; letter-spacing: 2px; color: var(--blue); text-transform: uppercase; }
.dept-name { margin: 0; font-size: 16px; line-height: 1.3; }
.dept-desc { margin: 0; color: var(--text-muted); font-size: 13.5px; flex: 1; }
.dept-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 4px; width: fit-content; text-transform: capitalize;
}
.badge-open, .badge-accepted { background: rgba(76,175,125,.12); color: var(--open); border: 1px solid rgba(76,175,125,.35); }
.badge-closed, .badge-denied { background: rgba(176,87,79,.12); color: var(--closed); border: 1px solid rgba(176,87,79,.35); }
.badge-pending { background: rgba(201,162,75,.12); color: var(--pending); border: 1px solid rgba(201,162,75,.35); }
.text-open { color: var(--open); } .text-closed { color: var(--closed); }

/* ---------- Sidebar widgets ---------- */
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.stat-row strong { font-size: 15px; }
.stat-sub { font-size: 13px; color: var(--text-muted); }
.stat-sub strong { font-size: 13.5px; color: var(--text); }
.newest { display: flex; align-items: center; gap: 10px; padding-top: 12px; }
.newest-label { text-transform: uppercase; letter-spacing: 1px; font-size: 10.5px; color: var(--text-muted); }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

.quick-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.quick-link {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 9px 12px; border-radius: var(--radius); color: var(--text); font-weight: 600; font-size: 14px;
}
.quick-link:hover { border-color: var(--blue); color: var(--blue); }

.dept-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.dept-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 8px 14px 8px 8px; border-radius: var(--radius); color: var(--text);
}
.dept-chip:hover { border-color: var(--blue); }
.dept-chip img { height: 34px; width: 34px; object-fit: contain; }
.dept-chip span { display: flex; flex-direction: column; line-height: 1.2; }
.dept-chip small { font-size: 11.5px; font-weight: 700; }

.list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: var(--radius); font-size: 14px;
}
.list-row .muted { font-size: 12.5px; word-break: break-all; }
.list-note { font-size: 13px; color: var(--text-muted); padding: 0 12px 4px; }

.role-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 2px 7px; border-radius: 4px; }
.role-supervisor { background: rgba(201,162,75,.15); color: var(--pending); }
.role-admin { background: rgba(74,142,186,.15); color: var(--blue); }
.role-staff { background: rgba(224,224,224,.12); color: #e8ecf1; }
.role-member { background: var(--surface-2); color: var(--text-muted); }

/* ---------- Forms ---------- */
.auth-wrap { display: flex; justify-content: center; padding-top: 12px; }
.auth-card { width: 100%; max-width: 420px; }
.form-card { width: 100%; max-width: 640px; }
.stack { display: flex; flex-direction: column; gap: 13px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field input, .field textarea, .field select, .review-note, .search-bar input, .add-question input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 12px; font-family: 'Barlow', sans-serif; font-size: 14.5px;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); outline: none; }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.check input { accent-color: var(--blue); width: 16px; height: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }
.form-error { background: rgba(176,87,79,.1); border: 1px solid rgba(176,87,79,.35); color: #e0938c; padding: 9px 12px; border-radius: var(--radius); font-size: 14px; }
.form-success { background: rgba(76,175,125,.1); border: 1px solid rgba(76,175,125,.35); color: #8fd6b1; padding: 9px 12px; border-radius: var(--radius); font-size: 14px; }

/* ---------- Grids reused by panels ---------- */
.dash-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card-wide { grid-column: 1 / -1; }
.apply-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.apply-card { display: flex; align-items: center; gap: 12px; padding: 13px 15px; }
.apply-logo { height: 44px; width: 44px; object-fit: contain; flex-shrink: 0; }
.apply-info { display: flex; flex-direction: column; flex: 1; line-height: 1.3; }
.apply-info .muted { font-size: 13px; }
.form-dept { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }

/* ---------- Supervisor ---------- */
.review-card { margin-bottom: 16px; }
.qa-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.qa { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.qa-q { font-weight: 700; font-size: 13.5px; color: var(--blue); margin-bottom: 3px; }
.qa-a { white-space: pre-wrap; font-size: 14.5px; }
.review-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.review-note { flex: 1; min-width: 220px; }
.section { margin-top: 34px; }
.section-title {
  font-family: 'Bebas Neue', sans-serif; font-size: 26px; letter-spacing: 1.5px;
  margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); line-height: 1.1;
}

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border);
  background: var(--head);
}
.table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-form select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 8px; font-family: 'Barlow', sans-serif; font-size: 13px;
}
.td-actions, .th-actions { text-align: right; white-space: nowrap; }
.td-actions form { margin-left: 4px; }
.reserved-tag { font-size: 10.5px; font-weight: 700; color: var(--pending); text-transform: uppercase; letter-spacing: .5px; }
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.search-bar input { width: 280px; }

/* ---------- Staff ---------- */
.staff-dept-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.staff-dept-head .card-title { margin: 0; flex: 1; }
.add-question { display: flex; gap: 8px; margin-top: 10px; }
.add-question input { flex: 1; }

/* ---------- Footer ---------- */
.footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 16px 20px; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px;
}
.footer-inner { display: contents; }
.footer-links { display: flex; gap: 16px; }

@media (max-width: 640px) {
  .brand-logo { height: 44px; }
  .brand-name { font-size: 26px; }
  .table { display: block; overflow-x: auto; }
}

.link-code {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px dashed var(--blue);
  border-radius: var(--radius); padding: 12px 16px; margin: 10px 0 12px;
}
.link-code-value {
  font-family: 'Bebas Neue', sans-serif; font-size: 26px; letter-spacing: 3px; color: var(--blue); line-height: 1;
}

/* ---------- Primary / reserve ---------- */
.badge-primary { background: rgba(74,142,186,.14); color: var(--blue); border: 1px solid rgba(74,142,186,.4); }
.badge-reserve { background: rgba(138,148,163,.14); color: var(--text-muted); border: 1px solid rgba(138,148,163,.4); }
.slot-pick { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.field-legend { font-size: 13px; font-weight: 600; color: var(--text-muted); padding: 0; margin-bottom: 2px; }
.slot-option {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
}
.slot-option:hover { border-color: var(--blue); }
.slot-option:has(input:checked) { border-color: var(--blue); background: rgba(74,142,186,.08); }
.slot-option input { accent-color: var(--blue); margin-top: 3px; }
.slot-option span { display: flex; flex-direction: column; line-height: 1.35; }
.slot-option small { color: var(--text-muted); font-size: 12.5px; }
.reserve-select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 6px; font-family: 'Barlow', sans-serif; font-size: 12.5px;
  max-width: 110px; height: 30px;
}

/* ---------- Discord login ---------- */
.btn-discord { background: #5865f2; color: #fff; }
.btn-discord:hover { background: #6b76f5; color: #fff; }
.or-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  margin: 14px 0;
}
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.pd-preview { display: flex; align-items: center; gap: 14px; margin: 8px 0 12px; }
.pd-preview .avatar-lg { height: 64px; width: 64px; }
