/* === DESIGN TOKENS === */
:root {
  --red: #C8102E;
  --red-dark: #9e0c23;
  --red-glow: rgba(200, 16, 46, 0.25);
  --red-soft: rgba(200, 16, 46, 0.12);
  --gold: #F5A623;
  --gold-soft: rgba(245, 166, 35, 0.15);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.15);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.15);

  --bg: #0a0a0f;
  --bg-2: #111118;
  --bg-3: #18181f;
  --bg-4: #1e1e28;
  --border: rgba(255,255,255,0.07);
  --border-bright: rgba(255,255,255,0.12);

  --text: #f4f4f8;
  --text-2: #a0a0b0;
  --text-3: #64647a;

  --sidebar-w: 240px;
  --topbar-h: 64px;
  --radius: 14px;
  --radius-sm: 8px;

  --font: 'Inter', -apple-system, sans-serif;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-red: 0 4px 24px rgba(200,16,46,0.3);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 99px; }

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-logo svg { width: 36px; height: 36px; }

.brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: 1px;
  display: block;
}

.brand-sub {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.18s ease;
  cursor: pointer;
  position: relative;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-item:hover {
  background: var(--bg-3);
  color: var(--text);
}

.nav-item.active {
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--red);
  border-radius: 0 4px 4px 0;
}

.badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.user-role {
  font-size: 11px;
  color: var(--text-3);
  display: block;
}

/* === MAIN === */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* === TOPBAR === */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 6px;
}
.menu-toggle svg { width: 22px; height: 22px; }

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.season-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--bg-4);
  border: 1px solid var(--border-bright);
  padding: 4px 12px;
  border-radius: 99px;
}

.notification-btn {
  position: relative;
  cursor: pointer;
  padding: 6px;
  color: var(--text-2);
}
.notification-btn svg { width: 20px; height: 20px; }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-2);
}

/* === PAGE LAYOUT === */
.page {
  display: none;
  padding: 28px;
  flex: 1;
  animation: fadeIn 0.3s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.page-sub {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 4px;
}

/* === BUTTONS === */
.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--red);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-red);
}
.btn-primary svg { width: 15px; height: 15px; }
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

/* === KPI CARDS === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.kpi-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }

.kpi-card.kpi-primary {
  background: linear-gradient(135deg, rgba(200,16,46,0.15) 0%, var(--bg-3) 100%);
  border-color: rgba(200,16,46,0.3);
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.03), transparent 70%);
}

.kpi-icon {
  width: 46px; height: 46px;
  background: var(--red-soft);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--red);
}
.kpi-icon svg { width: 22px; height: 22px; }

.kpi-icon.kpi-icon-gold { background: var(--gold-soft); color: var(--gold); }
.kpi-icon.kpi-icon-green { background: var(--green-soft); color: var(--green); }

.kpi-data { flex: 1; min-width: 0; }

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
}

.kpi-suffix, .kpi-prefix {
  position: absolute;
  top: 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.kpi-prefix { right: auto; }
.kpi-suffix { right: 22px; top: 22px; }

.kpi-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

.kpi-delta {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}
.kpi-delta.positive { color: var(--green); }
.kpi-delta.negative { color: var(--red); }

/* === CHARTS === */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.chart-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-3);
}

.legend-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.legend-dot.red { background: var(--red); }
.legend-dot.white { background: rgba(255,255,255,0.3); }

.donut-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 10%);
  text-align: center;
  pointer-events: none;
}

.donut-pct {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.donut-text {
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
  margin-top: 2px;
}

/* === ALERTS === */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.alert-item {
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.alert-dot.red { background: var(--red); }
.alert-dot.gold { background: var(--gold); }

.alert-text {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

.alert-text strong { color: var(--text); }

/* === SITES GRID === */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.site-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.site-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(200,16,46,0.15);
}

.site-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.site-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.site-city {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.compliance-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.compliance-badge.green { background: var(--green-soft); color: var(--green); }
.compliance-badge.gold { background: var(--gold-soft); color: var(--gold); }
.compliance-badge.red { background: var(--red-soft); color: var(--red); }

.site-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.site-stat {
  background: var(--bg-4);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.site-stat-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.site-stat-label {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
}

.site-progress {
  margin-top: 12px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.progress-bar {
  height: 5px;
  background: var(--bg-4);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), #ff4d6d);
  border-radius: 99px;
  transition: width 1s ease;
}
.progress-fill.green { background: linear-gradient(90deg, var(--green), #4ade80); }
.progress-fill.gold { background: linear-gradient(90deg, var(--gold), #fbbf24); }

/* === SEARCH BAR === */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}

.search-bar svg { width: 15px; height: 15px; color: var(--text-3); flex-shrink: 0; }

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  width: 200px;
}
.search-bar input::placeholder { color: var(--text-3); }

.filter-select {
  background: var(--bg-3);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--text-2);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}

/* === DATA TABLE === */
.table-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.data-table thead {
  background: var(--bg-4);
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 13px 16px;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.data-table tbody tr:hover td { background: var(--bg-4); }
.data-table tbody tr:last-child td { border-bottom: none; }

.student-name {
  font-weight: 600;
  color: var(--text);
}

.gpa-chip {
  display: inline-block;
  font-weight: 700;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 6px;
}
.gpa-high { color: var(--green); background: var(--green-soft); }
.gpa-mid { color: var(--gold); background: var(--gold-soft); }
.gpa-low { color: var(--red); background: var(--red-soft); }

.status-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 99px;
}
.status-pill.on-track { background: var(--green-soft); color: var(--green); }
.status-pill.at-risk { background: var(--red-soft); color: var(--red); }
.status-pill.scholarship { background: var(--gold-soft); color: var(--gold); }

/* === GRANTS === */
.grants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.grant-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.2s;
}
.grant-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }

.grant-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.grant-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.grant-funder {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
}

.grant-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--green);
}

.grant-metrics {
  display: grid;
  gap: 10px;
}

.grant-metric {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.grant-metric-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.grant-metric-name { color: var(--text-3); }
.grant-metric-pct { color: var(--text); font-weight: 600; }

.grant-bar {
  height: 6px;
  background: var(--bg-4);
  border-radius: 99px;
  overflow: hidden;
}

.grant-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1.2s ease;
}

.grant-deadline {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}
.grant-deadline span { color: var(--gold); font-weight: 600; }

/* === STAT PILLS === */
.stat-pills {
  display: flex;
  gap: 10px;
  align-items: center;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
}
.stat-pill.red { background: var(--red-soft); color: var(--red); }
.stat-pill.gray { background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border); }
.stat-pill.blue { background: var(--blue-soft); color: var(--blue); }
.stat-pill.green { background: var(--green-soft); color: var(--green); }

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .stat-pills { flex-wrap: wrap; }
}

/* === MODAL & CONTRACT === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.modal-container {
  background: var(--bg-2);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  width: 95%;
  max-width: 1200px;
  height: 92vh;
  max-height: 950px;
  min-height: 450px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: auto;
}

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

.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover { color: var(--red); }

.modal-body {
  padding: 32px 32px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  background: var(--bg-3);
  flex: 1 1 auto;
  min-height: 0;
}

.modal-body h3 {
  color: var(--text);
  margin: 24px 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.modal-body p { margin-bottom: 16px; }

/* === TIER SELECTION === */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 16px 0 24px;
}

.tier-card {
  background: var(--bg-4);
  border: 2px solid var(--border-bright);
  padding: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 0;
}

.tier-card:hover {
  border-color: var(--text-3);
}

.tier-card.selected {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.05);
}

.tier-card.selected::after {
  content: '✓ SELECTED';
  position: absolute;
  top: 16px;
  right: 16px;
  color: var(--green);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 1px;
}

.tier-title {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 800;
}

.tier-card.selected .tier-title {
  color: var(--green) !important;
}

.modal-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  background: var(--bg-2);
}

/* Beautiful Signature Card inside modal body */
.signature-card {
  margin-top: 32px;
  background: var(--bg-2);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: all 0.3s ease;
}

.signature-card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.signature-card-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin: 0;
  line-height: 1.5;
}

.signature-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  width: 100%;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.signature-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signature-section label,
.signature-card label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.signature-section input,
.signature-card input {
  background: var(--bg-4);
  border: 1px solid var(--border-bright);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

.signature-section input#signatureInput,
.signature-card input#signatureInput {
  font-size: 18px;
  font-style: italic;
}

.signature-section input:focus,
.signature-card input:focus { border-color: var(--red); }

.btn-accept {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
  height: 52px;
}

.btn-accept:hover:not(:disabled) {
  background: #16a34a;
  transform: translateY(-2px);
}

.btn-accept:disabled {
  background: var(--bg-4);
  color: var(--text-3);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}

.modal-success {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  text-align: center;
  animation: fadeIn 0.4s ease;
  padding: 40px;
  overflow-y: auto;
}

/* === SPINNER & KEYFRAMES === */
.spinner {
  animation: rotate 2s linear infinite;
}
@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

/* === CONTRACT LIGHT MODE (PAPER THEME) === */
.modal-container.light-mode {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.15);
}

.modal-container.light-mode .modal-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.modal-container.light-mode .modal-header h2 {
  color: #0f172a;
}

.modal-container.light-mode .modal-close {
  color: #64748b;
}
.modal-container.light-mode .modal-close:hover {
  color: #ef4444;
}

.modal-container.light-mode .modal-body {
  background: #ffffff;
  color: #334155;
}

.modal-container.light-mode .modal-body h3 {
  color: #0f172a;
  border-top-color: #e2e8f0;
}

.modal-container.light-mode .modal-body p,
.modal-container.light-mode .modal-body li {
  color: #475569;
}

.modal-container.light-mode .modal-body strong {
  color: #0f172a;
}

.modal-container.light-mode .tier-card {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.modal-container.light-mode .tier-card:hover {
  border-color: #64748b;
}
.modal-container.light-mode .tier-card .tier-title {
  color: #334155 !important;
}
.modal-container.light-mode .tier-card .tier-title[style*="gold"] {
  color: #b45309 !important; /* Premium gold color adjusted for high contrast light mode */
}
.modal-container.light-mode .tier-card.selected {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.03);
}
.modal-container.light-mode .tier-card.selected .tier-title {
  color: #16a34a !important;
}

.modal-container.light-mode .modal-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.modal-container.light-mode .signature-card {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.modal-container.light-mode .signature-card-title {
  color: #0f172a;
}

.modal-container.light-mode .signature-card-subtitle {
  color: #64748b;
}

.modal-container.light-mode .signature-actions {
  border-top-color: #cbd5e1;
}

.modal-container.light-mode .signature-section label,
.modal-container.light-mode .signature-card label {
  color: #64748b;
}

.modal-container.light-mode .signature-section input,
.modal-container.light-mode .signature-card input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}
.modal-container.light-mode .signature-section input:focus,
.modal-container.light-mode .signature-card input:focus {
  border-color: #16a34a;
}

.modal-container.light-mode .modal-success {
  background: #ffffff;
}
.modal-container.light-mode .modal-success h3 {
  color: #0f172a;
}
.modal-container.light-mode .modal-success p {
  color: #475569;
}
.modal-container.light-mode .modal-success div[style*="background"] {
  border: 1px solid #e2e8f0;
}
.modal-container.light-mode .modal-success div[style*="color: var(--text-2)"] span {
  color: #334155 !important;
}
.modal-container.light-mode .modal-success strong {
  color: #0f172a !important;
}

/* === SECURE INBOX LAYOUT === */
.inbox-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  min-height: calc(100vh - 180px);
  margin-top: 10px;
}

.inbox-list-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  overflow: hidden;
}

.inbox-list-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
}

.inbox-list-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: 0.5px;
}

.inbox-list-count {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 600;
  background: var(--bg-4);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-bright);
}

.inbox-list-items {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.inbox-item {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.inbox-item.selected {
  background: rgba(200, 16, 46, 0.06);
  border-left: 3px solid var(--red);
}

.inbox-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inbox-item-from {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.inbox-item.unread .inbox-item-from {
  color: var(--text);
  font-weight: 700;
}

.inbox-item-dot {
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--red);
  display: inline-block;
}

.inbox-item-date {
  font-size: 11px;
  color: var(--text-3);
}

.inbox-item-subject {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-item.unread .inbox-item-subject {
  color: var(--text);
  font-weight: 700;
}

.inbox-item-snippet {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- DETAIL CARD --- */
.inbox-detail-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  overflow: hidden;
  position: relative;
}

.inbox-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  background: rgba(255, 255, 255, 0.005);
}

.inbox-detail-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.inbox-detail-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.inbox-detail-subj {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.4;
  letter-spacing: 0.3px;
}

.inbox-detail-sender {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sender-info-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sender-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-4);
  border: 1px solid var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--red);
  font-size: 14px;
}

.sender-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sender-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

.sender-email {
  font-size: 11.5px;
  color: var(--text-3);
}

.mail-meta-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mail-date {
  font-size: 11.5px;
  color: var(--text-3);
}

.mail-to {
  font-size: 11px;
  color: var(--text-3);
}

.inbox-detail-body {
  padding: 24px;
  overflow-y: auto;
  line-height: 1.6;
  font-size: 14px;
  color: var(--text-2);
  flex: 1;
}

.inbox-detail-body h3 {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  margin: 20px 0 10px;
}

.inbox-detail-body p {
  margin-bottom: 12px;
}

.inbox-detail-body ul {
  margin: 10px 0 16px 20px;
}

.inbox-detail-body li {
  margin-bottom: 6px;
}

.inbox-detail-body strong {
  color: var(--text);
}

/* --- ATTACHMENT BOX --- */
.attachment-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-4);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 24px;
  max-width: 380px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.attachment-box:hover {
  border-color: var(--red);
  background: rgba(200, 16, 46, 0.05);
}

.attachment-icon {
  font-size: 20px;
}

.attachment-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.attachment-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
}

.attachment-size {
  font-size: 11px;
  color: var(--text-3);
}

.attachment-download-btn {
  color: var(--text-2);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.attachment-box:hover .attachment-download-btn {
  color: var(--red);
  font-weight: 600;
}

/* --- TOAST NOTIFICATION --- */
.inbox-toast {
  position: fixed;
  bottom: 24px;
  right: -400px;
  width: 350px;
  background: rgba(17, 17, 24, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px var(--red-glow);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  z-index: 1000;
  cursor: pointer;
  transition: right 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.inbox-toast.show {
  right: 24px;
}

.toast-icon {
  width: 32px;
  height: 32px;
  background: rgba(200, 16, 46, 0.1);
  border: 1px solid var(--red-soft);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(200, 16, 46, 0.15);
}

.toast-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.toast-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.toast-close:hover {
  color: var(--text);
}

@media (max-width: 768px) {
  .inbox-container {
    grid-template-columns: 1fr;
  }
  .inbox-list-card {
    height: 300px;
  }
  .inbox-detail-card {
    height: 400px;
  }
}

