/**
 * Vice Valley CMS — layout & components (see theme-tokens.css for palette).
 */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--app-bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent, #4f7cff);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover, #6b92ff);
  text-decoration: underline;
}

.layout-public {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(79, 124, 255, 0.12), transparent),
    radial-gradient(800px 400px at 80% 20%, rgba(61, 220, 255, 0.08), transparent), var(--app-bg);
}
.layout-public.has-login-bg {
  background-size: cover;
  background-position: center;
}

.public-shell {
  width: 100%;
  max-width: 440px;
}

.public-shell-wide {
  max-width: 960px;
}

.staff-directory-page .roster-grid {
  margin-top: 1rem;
}

.layout-dashboard {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .layout-dashboard {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .layout-dashboard.nav-open .sidebar {
    transform: translateX(0);
  }
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.85rem;
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.2);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding: 0.35rem 0.5rem;
  font-size: 1.02rem;
  color: var(--text-primary);
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  font-weight: 500;
  font-size: 0.92rem;
}
.nav-link:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-link-active {
  background: var(--accent-soft);
  color: var(--text-primary);
  border-color: rgba(79, 124, 255, 0.35);
  box-shadow: 0 0 20px rgba(79, 124, 255, 0.08);
}
.nav-icon {
  font-size: 1.1rem;
  width: 1.35rem;
  text-align: center;
  opacity: 0.95;
}
.nav-admin {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-secondary);
}
.nav-admin.nav-link-active {
  border-color: rgba(79, 124, 255, 0.35);
}

.main-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-primary);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
}

.topbar-spacer {
  flex: 1;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.user-name {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  padding: 1.5rem 1.75rem 2.5rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.card:hover {
  border-color: rgba(120, 146, 203, 0.28);
}
.table-card:hover {
  border-color: var(--border-primary);
}

.glow {
  box-shadow: 0 0 0 1px rgba(79, 124, 255, 0.28), var(--shadow-card);
}

.page-head {
  margin-bottom: 1.5rem;
}
.page-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.page-subtitle,
.page-head .page-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 52rem;
}
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0 1rem;
}
.section-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.section-header .muted {
  font-size: 0.85rem;
}
.topbar-page-title {
  display: none;
}
@media (min-width: 901px) {
  .topbar-page-title {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
    max-width: min(480px, 42vw);
  }
  .topbar-page-title .tp-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-page-title .tp-sub {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: 1rem;
}
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.stats-grid.small {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.widget-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.widget-card h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.widget-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.widget-link-list li {
  padding: 0.2rem 0;
}

.mini-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}
.mini-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.15rem 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--border-primary);
  background: var(--card-bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  min-height: 2.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover {
  border-color: rgba(120, 146, 203, 0.35);
  background: rgba(79, 124, 255, 0.08);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 5px rgba(79, 124, 255, 0.35);
}
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  filter: none;
}
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
}
.btn-secondary:hover {
  color: var(--text-primary);
}
.btn-ghost {
  background: transparent;
}
.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8125rem;
  min-height: 2rem;
}
.btn-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.btn-lg {
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
}
.btn-discord {
  background: #5865f2;
  border: none;
  color: #fff;
  width: 100%;
}
.danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
}

.input,
textarea.input,
select.input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
  background: var(--card-bg-secondary);
  color: var(--text-primary);
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input:focus,
textarea.input:focus,
select.input:focus {
  outline: none;
  border-color: rgba(79, 124, 255, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
[data-theme='light'] .input,
[data-theme='light'] textarea.input,
[data-theme='light'] select.input {
  background: #fff;
}
textarea.input.tall {
  min-height: 140px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}
.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.form-grid.tight {
  gap: 0.5rem;
}

.table-card {
  padding: 0;
  overflow: hidden;
}
.table-scroll {
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-secondary);
  text-align: left;
  vertical-align: middle;
}
.data-table thead {
  background: rgba(79, 124, 255, 0.06);
}
.data-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom-color: var(--border-primary);
}
.data-table tbody tr {
  background: transparent;
  transition: background 0.15s ease;
}
.data-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.12);
}
.data-table tbody tr:hover {
  background: rgba(79, 124, 255, 0.07);
}
.data-table tbody tr[role='button'],
.data-table tbody tr.row-clickable {
  cursor: pointer;
}
.filters-card {
  background: var(--card-bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.filters-row .input {
  flex: 1 1 180px;
  min-width: 140px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--text-secondary);
  border: 1px solid var(--border-secondary);
}
.chip-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-success);
  border-color: rgba(34, 197, 94, 0.25);
}
.chip-muted {
  background: rgba(111, 124, 158, 0.12);
  color: var(--text-muted);
}
.chip.sm {
  font-size: 0.68rem;
  padding: 0.12rem 0.4rem;
}
.stat-grid-roster {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat-card {
  border-radius: var(--radius-lg);
}
.stat-card:hover {
  box-shadow: var(--shadow-card-hover);
}
.stat-card h3 {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.25rem 0 0;
  color: var(--text-primary);
}
.glow-hover:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(79, 124, 255, 0.28);
  transform: translateY(-1px);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: color-mix(in srgb, var(--badge-color, #94a3b8) 28%, transparent);
  border: 1px solid var(--badge-color, var(--border));
  --badge-color: #94a3b8;
}
.badge.warn {
  background: rgba(251, 191, 36, 0.15);
}
.badge.danger {
  background: rgba(248, 113, 113, 0.15);
}

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: #1e293b;
}
.avatar.sm {
  width: 32px;
  height: 32px;
}
.avatar.md {
  width: 48px;
  height: 48px;
}
.avatar.lg {
  width: 72px;
  height: 72px;
}

.muted {
  color: var(--muted);
}
.fine-print {
  font-size: 0.8rem;
}
.lead {
  font-size: 1.05rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.alert-success {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}
.alert-warn {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}
.alert-error {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.stack.tight {
  gap: 0.35rem;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.inline {
  display: inline;
}
.inline.stack {
  display: inline-flex;
}

.hidden {
  display: none !important;
}

.roster-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.roster-grid.tight {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.roster-card {
  text-align: center;
  cursor: pointer;
  transition: 0.15s ease;
}
.roster-card:hover {
  transform: translateY(-2px);
}

.drawer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 50;
}
.drawer.open {
  opacity: 1;
  pointer-events: auto;
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  border-radius: 0;
  overflow: auto;
  background: var(--card-bg);
  border-left: 1px solid var(--border-primary);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
}
.drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.drawer-close {
  float: right;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

.dept-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.dept-card {
  border-left: 4px solid var(--dept-color, var(--color-primary, #6366f1));
}

.sortable-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sortable-item {
  margin-bottom: 0.5rem;
}
.drag-handle {
  cursor: grab;
  color: var(--muted);
  user-select: none;
}

.matrix-wrap .matrix-table th,
.matrix-wrap .matrix-table td {
  vertical-align: middle;
}
.center {
  text-align: center;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.tab {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.tab.active {
  color: var(--text);
  border-color: var(--color-primary, #6366f1);
}

.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 60;
}
.toast {
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.prose img {
  max-width: 100%;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
}

.setup-wizard {
  max-width: 640px;
  margin: 0 auto;
}
.setup-wizard-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-primary);
}
.setup-status-list {
  margin-top: 0.75rem;
}
.setup-check {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
  background: var(--card-bg-secondary);
  text-align: left;
}
.setup-check-ok {
  border-color: rgba(34, 197, 94, 0.35);
}
.setup-check-bad {
  border-color: rgba(239, 68, 68, 0.35);
}
.setup-check-mark {
  font-weight: 700;
  flex-shrink: 0;
}
.setup-check-ok .setup-check-mark {
  color: var(--status-success);
}
.setup-check-bad .setup-check-mark {
  color: var(--status-danger);
}
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}
.steps li.active {
  color: var(--color-accent, #22d3ee);
  font-weight: 700;
}

.subform td {
  background: rgba(255, 255, 255, 0.02);
}

.dept-banner-wrap {
  margin: -0.5rem -1.5rem 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  max-height: 220px;
}
.dept-banner-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}
@media (max-width: 900px) {
  .dept-banner-wrap {
    margin-left: -1rem;
    margin-right: -1rem;
  }
}

.profile-avatar {
  border-radius: 16px;
  border: 2px solid var(--border);
}
