/* =========================================
   THE KING EMPIRE — Black 0026 Gold Design System
   Background: #000000 | Primary: #F9D33C | Active: #0057E1
   Font: Black Ops One (stencil headings), Helvetica/Arial (body)
   Border radius: 0px | Border: 2px solid #F9D33C
   ========================================= */

/* ── GOOGLE FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Black+Ops+One&display=swap');

/* ── RESET & BASE ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── DESIGN TOKENS ── */
:root {
  --black:         #000000;
  --gold:          #F9D33C;
  --gold-dim:      rgba(249, 211, 60, 0.6);
  --blue-active:   #0057E1;
  --white:         #FFFFFF;

  --bg-primary:    #000000;
  --bg-card:       #111111;
  --bg-card-hover: #1a1a1a;
  --gold-border:   #F9D33C;
  --gold-glow:     rgba(249, 211, 60, 0.08);

  --text-primary:  #F9D33C;
  --text-muted:    rgba(249, 211, 60, 0.5);
  --text-body:     #cccccc;

  --danger:        #ef4444;
  --danger-dim:    rgba(239, 68, 68, 0.15);

  --status-active:    #4ade80;
  --status-active-bg: rgba(74, 222, 128, 0.1);
  --status-inactive:  #f87171;
  --status-inactive-bg: rgba(248, 113, 113, 0.1);
  --status-graduated: #60a5fa;
  --status-graduated-bg: rgba(96, 165, 250, 0.1);
  --status-paused:    #fbbf24;
  --status-paused-bg: rgba(251, 191, 36, 0.1);
}

/* ── TYPOGRAPHY ── */
body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--black);
  color: var(--text-body);
  line-height: 1.6;
  min-height: 100vh;
}

/* Stencil headings */
h1, h2, h3, .stencil {
  font-family: 'Black Ops One', cursive;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── LAYOUT ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── NAVIGATION GRID ── */
.nav-grid {
  width: 220px;
  flex-shrink: 0;
  background: #0a0a0a;
  border-right: 2px solid var(--gold);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 8px;
}

.nav-brand {
  font-family: 'Black Ops One', cursive;
  font-size: 0.85rem;
  color: var(--gold);
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.1em;
  padding: 8px 4px 16px;
  border-bottom: 1px solid rgba(249, 211, 60, 0.3);
  margin-bottom: 8px;
  line-height: 1.3;
}

.nav-btn {
  display: block;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--gold);
  color: var(--black);
}

.nav-btn.active {
  background: var(--blue-active);
  color: var(--white);
  border-color: var(--blue-active);
}

/* ── MAIN CONTENT ── */
.content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 2px solid var(--gold);
  background: var(--black);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-title {
  font-family: 'Black Ops One', cursive;
  font-size: 0.9rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.top-bar-links {
  display: flex;
  gap: 16px;
}

.top-bar-links a {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.top-bar-links a:hover { color: var(--gold); }

.main-content {
  flex: 1;
  padding: 48px 40px;
}

/* ── PAGE HEADING ── */
.page-heading {
  margin-bottom: 40px;
}

.page-heading h1 {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.page-heading-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

/* ── STATS ROW ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  border: 2px solid var(--gold);
  padding: 24px 20px;
  background: var(--black);
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 700;
}

.stat-value {
  font-family: 'Black Ops One', cursive;
  font-size: 2.2rem;
  color: var(--gold);
  line-height: 1;
}

.stat-value.gold { color: var(--gold); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: 2px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:hover {
  background: var(--gold);
  color: var(--black);
}

.btn-primary {
  background: var(--gold);
  color: var(--black);
}

.btn-primary:hover {
  background: #ffe566;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(249, 211, 60, 0.3);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: rgba(249, 211, 60, 0.08);
  border-color: var(--gold);
  color: var(--gold);
}

.btn-danger {
  background: var(--danger-dim);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: var(--white);
}

/* ── REMINDER BANNER ── */
.reminder-banner {
  display: none;
  border: 2px solid var(--gold);
  margin-bottom: 32px;
  background: #0a0a0a;
}

.reminder-banner.visible { display: block; }

.reminder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
}

.reminder-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reminder-icon { font-size: 1rem; }

.reminder-label {
  font-family: 'Black Ops One', cursive;
  font-size: 0.85rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.reminder-count {
  background: var(--gold);
  color: var(--black);
  font-family: 'Black Ops One', cursive;
  font-size: 0.7rem;
  padding: 2px 8px;
}

.reminder-chevron { color: var(--gold); font-size: 0.8rem; transition: transform 0.2s; }
.reminder-banner.expanded .reminder-chevron { transform: rotate(180deg); }

.reminder-body {
  display: none;
  border-top: 1px solid rgba(249, 211, 60, 0.3);
  padding: 0 20px 16px;
}

.reminder-banner.expanded .reminder-body { display: block; }

.reminder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(249, 211, 60, 0.1);
  gap: 16px;
}

.reminder-item:last-child { border-bottom: none; }

.reminder-item-info { flex: 1; min-width: 0; }

.reminder-item-name {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.reminder-item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.reminder-item-days {
  font-size: 0.78rem;
  color: #fbbf24;
  font-weight: 700;
  flex-shrink: 0;
}

.btn-followup {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 16px;
  background: rgba(249, 211, 60, 0.08);
  color: var(--gold);
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-followup:hover { background: var(--gold); color: var(--black); }

.reminder-empty {
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ── CONTROLS BAR ── */
.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--gold);
  color: var(--gold);
  padding: 10px 16px 10px 40px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s;
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { background: #1a1a1a; box-shadow: 0 0 0 1px var(--gold); }

.filter-btn {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 18px;
  border: 2px solid var(--gold);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover { background: rgba(249, 211, 60, 0.08); }
.filter-btn.active { background: var(--gold); color: var(--black); }

/* ── TABLE ── */
.table-wrap {
  border: 2px solid var(--gold);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.table-wrap > table {
  min-width: 480px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #0a0a0a;
  border-bottom: 2px solid var(--gold);
}

th {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 20px;
  text-align: left;
}

tbody tr {
  border-bottom: 1px solid rgba(249, 211, 60, 0.1);
  transition: background 0.15s;
  cursor: pointer;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }

td {
  padding: 16px 20px;
  font-size: 0.875rem;
  vertical-align: middle;
}

.td-name { font-weight: 700; color: var(--gold); }
.td-secondary { color: var(--text-body); font-size: 0.83rem; }
.td-muted { color: var(--text-muted); font-size: 0.83rem; }

/* ── STATUS PILL ── */
.status-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid;
}

.status-active    { background: var(--status-active-bg);    color: var(--status-active);    border-color: var(--status-active); }
.status-inactive  { background: var(--status-inactive-bg);  color: var(--status-inactive);  border-color: var(--status-inactive); }
.status-graduated { background: var(--status-graduated-bg); color: var(--status-graduated); border-color: var(--status-graduated); }
.status-paused    { background: var(--status-paused-bg);     color: var(--status-paused);    border-color: var(--status-paused); }

/* ── ACTION CELL ── */
.actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  background: transparent;
  border: 1px solid rgba(249, 211, 60, 0.4);
  color: var(--text-muted);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: Arial, Helvetica, sans-serif;
  transition: all 0.2s;
}

.icon-btn:hover { background: var(--gold); color: var(--black); border-color: var(--gold); }
.icon-btn.danger:hover { background: var(--danger); color: var(--white); border-color: var(--danger); }

/* ── EMPTY STATE ── */
.empty-state {
  padding: 80px 40px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 16px; opacity: 0.4; }
.empty-title { font-family: 'Black Ops One', cursive; font-size: 1.1rem; color: var(--gold); margin-bottom: 8px; }
.empty-sub { font-size: 0.875rem; margin-bottom: 24px; }

/* ── MODAL ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 2px solid var(--gold);
}

.modal-title {
  font-family: 'Black Ops One', cursive;
  font-size: 1rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
  line-height: 1;
}

.modal-close:hover { color: var(--gold); }
.modal-body { padding: 28px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-label .required { color: var(--gold); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--black);
  border: 2px solid var(--gold);
  color: var(--gold);
  padding: 10px 14px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  background: #1a1a1a;
  box-shadow: 0 0 0 1px var(--gold);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(249,211,60,0.4)' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option { background: var(--bg-card); color: var(--gold); }
.form-textarea { resize: vertical; min-height: 90px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px;
  border-top: 2px solid var(--gold);
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--bg-card);
  border: 2px solid var(--gold);
  padding: 14px 20px;
  font-size: 0.875rem;
  color: var(--gold);
  z-index: 500;
  display: none;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.toast.show { display: flex; }
.toast.success { border-color: rgba(74, 222, 128, 0.5); }
.toast.error { border-color: rgba(239, 68, 68, 0.5); }

.toast-dot {
  width: 6px; height: 6px;
  flex-shrink: 0;
}

.toast.success .toast-dot { background: var(--status-active); }
.toast.error .toast-dot { background: var(--danger); }

/* ── DETAIL PANEL ── */
.detail-panel {
  display: none;
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 420px;
  background: var(--bg-card);
  border-left: 2px solid var(--gold);
  z-index: 150;
  overflow-y: auto;
  padding: 32px 28px;
}

.detail-panel.open { display: block; }

.detail-close {
  position: absolute;
  top: 20px; right: 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.detail-close:hover { color: var(--gold); }

.detail-name {
  font-family: 'Black Ops One', cursive;
  font-size: 1.5rem;
  margin-bottom: 6px;
  margin-top: 8px;
  padding-right: 32px;
  color: var(--gold);
}

.detail-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(249, 211, 60, 0.2);
}

.detail-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.detail-value {
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.6;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 32px;
}

/* ── LOADING ── */
.loading {
  padding: 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}

/* ── SECTION HEADING ── */
.section-heading {
  font-family: 'Black Ops One', cursive;
  font-size: 1.4rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gold);
}

/* ── FORM SECTION ── */
.form-section {
  margin-bottom: 32px;
}

.form-section-title {
  font-family: 'Black Ops One', cursive;
  font-size: 0.9rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

/* ── RADIO / CHECKBOX ── */
.radio-group {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-body);
  cursor: pointer;
}

.radio-label input[type="radio"],
.radio-label input[type="checkbox"] {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
}

/* ── SELECTED TAG ── */
.tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  background: var(--gold-glow);
  color: var(--gold);
  border: 1px solid rgba(249, 211, 60, 0.4);
}

/* ── CARD GRID ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  border: 2px solid var(--gold);
  padding: 20px;
  background: var(--black);
  transition: background 0.2s;
}

.card:hover { background: var(--bg-card); }

/* ── RESPONSIVE ── */

/* Tablet — 769px–1279px (off-canvas sidebar + hamburger, like mobile) */
@media (min-width: 769px) and (max-width: 1279px) {
  .app-shell { flex-direction: column; }
  .aims-shell { flex-direction: column; }
  .main-wrap { margin-left: 0; }
  .main-content { padding: 24px 20px; }
  .page-header { flex-direction: column; }
  .stats-row,
  .form-row,
  .kpi-grid,
  .kpi-row { grid-template-columns: repeat(2, 1fr); }

  #aims-sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    width: 220px;
    transition: left 0.25s ease;
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0,0,0,0.6);
  }
  #aims-sidebar.open { left: 0; }
  .sidebar-hamburger { display: flex; }
  .top-bar-links { display: none; }
  .sidebar-btn { font-size: 0.78rem; padding: 12px 14px; }
  body.sidebar-open { overflow: hidden; }

  .notif-dropdown {
    position: fixed;
    right: 8px;
    top: 60px;
    width: calc(100vw - 32px);
    max-width: 360px;
  }
}

@media (max-width: 768px) {
  .nav-grid {
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
    padding: 12px;
    gap: 6px;
  }

  .nav-brand { width: 100%; padding-bottom: 12px; margin-bottom: 4px; font-size: 0.7rem; }

  .nav-btn {
    padding: 10px 12px;
    font-size: 0.7rem;
    flex: 1 1 calc(33% - 6px);
    min-width: 100px;
  }

  .app-shell { flex-direction: column; }
  .main-content { padding: 24px 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .detail-panel { width: 100%; }

  /* Tables horizontally scroll inside .table-wrap instead of hiding columns */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* 44px minimum touch targets */
  button, .btn, .sidebar-btn, .nav-btn {
    min-height: 44px;
  }

  /* iOS zoom prevention — 16px+ on inputs */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="datetime-local"], input[type="number"], input[type="search"],
  input[type="tel"], input[type="url"],
  textarea, .form-input, .form-select, .search-input {
    font-size: 16px;
  }

  html { -webkit-text-size-adjust: 100%; }

  /* Modals collapse to viewport edge-to-edge */
  .overlay { padding: 12px; }
  .modal-overlay, .notif-dropdown {
    max-width: calc(100vw - 16px);
  }

  /* Mobile sidebar scroll lock */
  body.sidebar-open { overflow: hidden; }
  body.modal-open { overflow: hidden; }
}

@media (max-width: 480px) {
  .nav-btn { flex: 1 1 calc(50% - 6px); }
  .stats-row { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .page-heading h1 { font-size: 1.6rem; }
}

/* ── AIMS LEFT SIDEBAR (replaces nav-grid on all AIMS pages) ───────────────── */
#aims-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #0a0a0a;
  border-right: 2px solid var(--gold);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 20px 12px 16px;
  gap: 6px;
  z-index: 100;
}

.sidebar-brand {
  font-family: 'Black Ops One', cursive;
  font-size: 1.2rem;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 8px 4px 16px;
  border-bottom: 1px solid rgba(249, 211, 60, 0.3);
  margin-bottom: 4px;
}

.sidebar-user {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 8px 12px;
  letter-spacing: 0.05em;
  word-break: break-all;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-btn {
  display: block;
  width: 100%;
  padding: 11px 14px;
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-btn:hover {
  background: var(--gold);
  color: var(--black);
}

.sidebar-btn.active {
  background: var(--blue-active);
  color: var(--white);
  border-color: var(--blue-active);
}

.sidebar-btn-logout {
  border-color: rgba(239, 68, 68, 0.4);
  color: rgba(239, 68, 68, 0.7);
  margin-top: 8px;
}

.sidebar-btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

/* Hamburger — only visible on mobile; fixed so it sits over the page, not the off-screen sidebar */
.sidebar-hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 350;
  background: rgba(10, 10, 10, 0.92);
  border: 2px solid var(--gold);
  padding: 10px 12px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.sidebar-hamburger:focus-visible {
  outline: 2px solid var(--blue-active);
  outline-offset: 2px;
}

.sidebar-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gold);
}

/* AIMS page layout */
.aims-shell {
  display: flex;
  min-height: 100vh;
}

.aims-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Wrapper used by pages that don't use .aims-shell: gives 220px gutter on desktop, full width on phones */
.main-wrap {
  margin-left: 220px;
}

/* ── NOTIFICATION BELL ─────────────────────────────────────────────────── */
.notif-bell-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 2px 8px;
  border-top: 1px solid rgba(249, 211, 60, 0.3);
  margin-top: 4px;
}

.notif-bell-btn {
  position: relative;
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
  padding: 8px 10px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-bell-btn:hover {
  background: var(--gold);
  color: var(--black);
}

.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: var(--white);
  font-family: 'Black Ops One', cursive;
  font-size: 0.6rem;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.sidebar-btn { position: relative; }

.dm-badge {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: var(--gold);
  color: var(--black);
  font-family: 'Black Ops One', cursive;
  font-size: 0.6rem;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
  pointer-events: none;
}

.finance-tab-badge {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: var(--gold);
  color: var(--black);
  font-family: 'Black Ops One', cursive;
  font-size: 0.6rem;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
  pointer-events: none;
}

.finance-status-popover { left: auto; right: 8px; }

.finance-status-popover .status-pill {
  margin-left: 6px;
  vertical-align: middle;
}

.status-pending  { background: rgba(251, 191, 36, 0.12); color: #fbbf24; border-color: #fbbf24; }
.status-approved { background: rgba(96, 165, 250, 0.12); color: #60a5fa; border-color: #60a5fa; }
.status-denied   { background: rgba(248, 113, 113, 0.12); color: #f87171; border-color: #f87171; }
.status-paid     { background: rgba(74, 222, 128, 0.12); color: #4ade80; border-color: #4ade80; }

.notif-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 360px;
  background: var(--bg-card);
  border: 2px solid var(--gold);
  z-index: 300;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}

.notif-dropdown.open { display: block; }

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 2px solid var(--gold);
}

.notif-dropdown-header span {
  font-family: 'Black Ops One', cursive;
  font-size: 0.85rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.notif-dropdown-body {
  max-height: 420px;
  overflow-y: auto;
}

.notif-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 20px;
  font-size: 0.83rem;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(249, 211, 60, 0.1);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:last-child { border-bottom: none; }

.notif-item:hover { background: var(--bg-card-hover); }

.notif-item.unread { background: var(--gold-glow); }

.notif-item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  line-height: 1.4;
}

.notif-item-body { flex: 1; min-width: 0; }

.notif-item-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.3;
}

.notif-item-text {
  font-size: 0.78rem;
  color: var(--text-body);
  margin-top: 2px;
  line-height: 1.4;
}

.notif-item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.notif-item-link {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.notif-item-link:hover { text-decoration: underline; }

.notif-mark-all-btn {
  background: transparent;
  border: 1px solid rgba(249, 211, 60, 0.3);
  color: var(--text-muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.notif-mark-all-btn:hover {
  background: rgba(249, 211, 60, 0.08);
  border-color: var(--gold);
  color: var(--gold);
}

/* Sidebar backdrop — hidden by default, shown on mobile when sidebar open */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 150;
  cursor: pointer;
}

.sidebar-backdrop.open { display: block; }

/* Mobile responsive */
@media (max-width: 768px) {
  #aims-sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    width: 220px;
    transition: left 0.25s ease;
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0,0,0,0.6);
  }

  #aims-sidebar.open { left: 0; }

  .sidebar-hamburger { display: flex; }

  /* Hide horizontal top-bar links on phones so they don't overflow under the hamburger */
  .top-bar-links { display: none; }

  .aims-shell { flex-direction: column; }

  .main-wrap { margin-left: 0; }

  .sidebar-btn { font-size: 0.78rem; padding: 12px 14px; }

  .notif-dropdown {
    position: fixed;
    right: 8px;
    top: 60px;
    width: calc(100vw - 16px);
    max-width: 360px;
  }
}

/* ── Comms / Chat surface (shared by /aims/communications and /aims/chat) ── */
.comm-layout { display: flex; height: calc(100vh - 60px); overflow: hidden; }

/* Left panel: mode selector + sidebar */
.comm-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 2px solid var(--gold);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: #0a0a0a;
}
.comm-mode-tabs { display: flex; flex-direction: column; gap: 4px; padding: 16px; }
.comm-mode-btn {
  font-family: 'Black Ops One', cursive;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding: 10px 12px;
  background: transparent;
  border: 2px solid transparent;
  color: rgba(249,211,60,0.5);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  text-transform: uppercase;
}
.comm-mode-btn:hover { color: var(--gold); border-color: rgba(249,211,60,0.3); }
.comm-mode-btn.active { color: var(--gold); border-color: var(--gold); background: rgba(249,211,60,0.08); }

.comm-section-divider { border: none; border-top: 1px solid rgba(249,211,60,0.2); margin: 8px 0; }

.comm-sidebar-label {
  font-family: 'Black Ops One', cursive;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: rgba(249,211,60,0.3);
  padding: 4px 16px;
  text-transform: uppercase;
}

/* DM / channel list items */
.comm-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  position: relative;
}
.comm-list-item:hover { background: rgba(249,211,60,0.05); border-left-color: rgba(249,211,60,0.4); }
.comm-list-item.active { background: rgba(249,211,60,0.08); border-left-color: var(--gold); }
.comm-list-item.unread::after {
  content: '';
  position: absolute;
  right: 16px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
}
.comm-list-item .item-icon {
  font-size: 1rem;
  color: var(--gold);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.comm-list-item .item-name {
  font-size: 0.8rem;
  color: var(--text-body);
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comm-list-item .item-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comm-list-item .item-meta { font-size: 0.65rem; color: var(--text-muted); margin-left: auto; flex-shrink: 0; }

/* Main content panel */
.comm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Channel / DM header */
.comm-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(249,211,60,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
}
.comm-header-icon { font-size: 1.4rem; color: var(--gold); }
.comm-header-name {
  font-family: 'Black Ops One', cursive;
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.05em;
}
.comm-header-desc { font-size: 0.75rem; color: var(--text-muted); margin-left: 8px; }
.comm-header-actions { margin-left: auto; display: flex; gap: 8px; }

/* Messages area */
.comm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comm-msg {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 0;
  transition: background 0.1s;
}
.comm-msg:hover { background: rgba(249,211,60,0.04); }
.comm-msg-avatar {
  width: 32px; height: 32px;
  background: #222;
  border: 1px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Black Ops One', cursive;
  font-size: 0.75rem;
  color: var(--gold);
  flex-shrink: 0;
  margin-top: 2px;
}
.comm-msg-body { flex: 1; min-width: 0; }
.comm-msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.comm-msg-sender { font-size: 0.8rem; font-weight: 700; color: var(--gold); }
.comm-msg-time { font-size: 0.65rem; color: var(--text-muted); }
.comm-msg-text { font-size: 0.85rem; color: var(--text-body); line-height: 1.5; word-wrap: break-word; }
.comm-msg.mine .comm-msg-avatar { border-color: var(--blue-active); color: var(--blue-active); }
.comm-msg.mine .comm-msg-sender { color: var(--blue-active); }
.comm-msg.mine { background: rgba(0,87,225,0.05); }

/* Announcements */
.comm-msg.announcement {
  border: 1px solid rgba(249,211,60,0.2);
  background: rgba(249,211,60,0.04);
  padding: 12px 16px;
}
.comm-msg.announcement .comm-msg-avatar {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}
.comm-msg.announcement.pinned { border-color: var(--gold); background: rgba(249,211,60,0.08); }
.comm-msg.announcement .comm-msg-text { color: rgba(249,211,60,0.7); font-size: 0.75rem; }

/* Compose area */
.comm-compose {
  padding: 12px 20px;
  border-top: 2px solid rgba(249,211,60,0.15);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.comm-compose textarea {
  flex: 1;
  background: #111;
  border: 2px solid rgba(249,211,60,0.3);
  color: var(--text-body);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85rem;
  padding: 10px 12px;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s;
}
.comm-compose textarea:focus { border-color: var(--gold); }
.comm-compose textarea::placeholder { color: var(--text-muted); }

/* Empty state */
.comm-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
}
.comm-empty-icon { font-size: 3rem; opacity: 0.3; }
.comm-empty-title { font-family: 'Black Ops One', cursive; font-size: 0.9rem; color: rgba(249,211,60,0.4); letter-spacing: 0.1em; }
.comm-empty-sub { font-size: 0.78rem; text-align: center; max-width: 280px; }

/* Notification badge in header */
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--gold);
  color: #000;
  font-family: 'Black Ops One', cursive;
  font-size: 0.6rem;
  border-radius: 9px;
  vertical-align: middle;
}

/* DM search */
.dm-search-wrap {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(249,211,60,0.1);
}
.dm-search-input {
  width: 100%;
  background: #111;
  border: 1px solid rgba(249,211,60,0.3);
  color: var(--text-body);
  font-size: 0.8rem;
  padding: 7px 10px;
  outline: none;
}
.dm-search-input:focus { border-color: var(--gold); }
.dm-search-input::placeholder { color: var(--text-muted); }

/* Scrollbar styling */
.comm-sidebar::-webkit-scrollbar,
.comm-messages::-webkit-scrollbar { width: 4px; }
.comm-sidebar::-webkit-scrollbar-track,
.comm-messages::-webkit-scrollbar-track { background: transparent; }
.comm-sidebar::-webkit-scrollbar-thumb,
.comm-messages::-webkit-scrollbar-thumb { background: rgba(249,211,60,0.2); }

/* Mode container */
.mode-dms, .mode-channels, .mode-announcements, .mode-notifications { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.mode-dms.active, .mode-channels.active, .mode-announcements.active, .mode-notifications.active { display: flex; }

/* Members picker dropdown */
.member-picker-wrap { position: relative; }
.member-picker-input {
  width: 100%;
  background: #111;
  border: 1px solid rgba(249,211,60,0.3);
  color: var(--text-body);
  font-size: 0.8rem;
  padding: 7px 10px;
  outline: none;
}
.member-picker-input:focus { border-color: var(--gold); }
.member-picker-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: #111;
  border: 1px solid rgba(249,211,60,0.4);
  border-top: none;
  z-index: 10;
  max-height: 180px;
  overflow-y: auto;
}
.member-picker-item {
  padding: 8px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-body);
}
.member-picker-item:hover { background: rgba(249,211,60,0.1); color: var(--gold); }