@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Always reserve scrollbar gutter — prevents content-width jump when switching
   between tall (scrollable) and short (non-scrollable) tabs/pages */
html { scrollbar-gutter: stable; }

:root {
  --bg:            #1a1b26;
  --surface:       #24283b;
  --surface2:      #292e42;
  --border:        rgba(255,255,255,0.08);
  --gold:          #7aa2f7;
  --gold-hover:    #9ab8f9;
  --text:          #f0f0f0;
  --muted:         #999;
  --danger:        #e05252;
  --success:       #31a24c;
  --warning:       #e0a030;
  --sidebar-w:     220px;
  --topbar-h:      54px;
  --green:         #5dd87a;
  --blue:          #6ba3e0;
  --success-text:  #6ddd8a;
  --danger-text:   #f08080;
  /* Vars that differ between dark and light themes */
  --nav-link:      #ccc;
  --nav-link-hover: #fff;
  --hover-bg:      rgba(255,255,255,0.05);
  --label-color:   #ddd;
  --input-border:  rgba(255,255,255,0.12);
}

/* ── Themes ─────────────────────────────────────────────────────────────────── */
/* Use html[data-theme] (specificity 0,1,1) to beat :root (0,1,0) */

/* Ember (default) — warm dark, gold accent */
html[data-theme="ember"] {
  --bg: #0c0c10; --surface: #14141a; --surface2: #1c1c24;
  --gold: #f4c542; --gold-hover: #ffd967;
}

/* Monokai — warm dark, orange accent */
html[data-theme="monokai"] {
  --bg: #272822; --surface: #3e3d32; --surface2: #49483e;
  --gold: #fd971f; --gold-hover: #ffb055;
}

/* Dracula — dark purple, pink accent */
html[data-theme="dracula"] {
  --bg: #282a36; --surface: #343746; --surface2: #44475a;
  --gold: #ff79c6; --gold-hover: #ff93d3;
}

/* Gruvbox — earthy dark, orange accent */
html[data-theme="gruvbox"] {
  --bg: #282828; --surface: #3c3836; --surface2: #504945;
  --gold: #fe8019; --gold-hover: #ffab40;
}

/* Nord — arctic blue, light blue accent */
html[data-theme="nord"] {
  --bg: #2e3440; --surface: #3b4252; --surface2: #434c5e;
  --gold: #88c0d0; --gold-hover: #a3d4e0;
}

/* Solarized — deep teal bg, cyan accent */
html[data-theme="solarized"] {
  --bg: #002b36; --surface: #073642; --surface2: #0d4250;
  --gold: #2aa198; --gold-hover: #35cfc4;
}

/* One Dark — Atom dark, blue accent */
html[data-theme="onedark"] {
  --bg: #21252b; --surface: #282c34; --surface2: #2c313c;
  --gold: #61afef; --gold-hover: #82c4f7;
}

/* Tokyo Night — deep navy, soft blue accent */
html[data-theme="tokyonight"] {
  --bg: #1a1b26; --surface: #24283b; --surface2: #292e42;
  --gold: #7aa2f7; --gold-hover: #9ab8f9;
}

/* Catppuccin Mocha — soft dark, mauve accent */
html[data-theme="catppuccin"] {
  --bg: #1e1e2e; --surface: #313244; --surface2: #45475a;
  --gold: #cba6f7; --gold-hover: #d6b9f9;
}

/* Light — clean light mode */
html[data-theme="light"] {
  --bg:            #f0f2f5;
  --surface:       #ffffff;
  --surface2:      #e8eaed;
  --border:        rgba(0,0,0,0.1);
  --gold:          #8a6200;
  --gold-hover:    #a37400;
  --text:          #1a1a1a;
  --muted:         #777;
  --success-text:  #1a7a35;
  --danger-text:   #c0392b;
  --nav-link:      #555;
  --nav-link-hover: #111;
  --hover-bg:      rgba(0,0,0,0.04);
  --label-color:   #333;
  --input-border:  rgba(0,0,0,0.15);
}

/* Windows 95 — classic gray, navy accent */
html[data-theme="win95"] {
  --bg:            #c0c0c0;
  --surface:       #d4d0c8;
  --surface2:      #c0c0c0;
  --border:        rgba(0,0,0,0.3);
  --gold:          #000080;
  --gold-hover:    #1084d0;
  --text:          #000000;
  --muted:         #555555;
  --success-text:  #006400;
  --danger-text:   #8b0000;
  --nav-link:      #000000;
  --nav-link-hover: #ffffff;
  --hover-bg:      rgba(0,0,128,0.08);
  --label-color:   #000000;
  --input-border:  rgba(0,0,0,0.4);
}
/* Windows 95 nav hover — classic navy highlight with white text */
html[data-theme="win95"] .sidebar-nav a:hover {
  background: #000080;
}

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

/* ── Utility classes ────────────────────────────────────────────────────────── */
.text-muted    { color: var(--muted); }
.text-danger   { color: var(--danger); }
.text-gold     { color: var(--gold); }
.text-warning  { color: var(--warning); }
.text-green    { color: var(--green); }
.text-sm       { font-size: 12px; }
.text-xs       { font-size: 11px; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.text-nowrap   { white-space: nowrap; }
.font-bold     { font-weight: bold; }
.font-normal   { font-weight: normal; }
.d-inline      { display: inline; }
.mb-0          { margin-bottom: 0 !important; }
.mt-0          { margin-top: 0 !important; }
.hint          { font-size: 12px; color: var(--muted); }
.hint-sm       { font-size: 11px; color: var(--muted); }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
  display: flex;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hover); }

/* ── Layout ── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ── Topbar theme picker ─────────────────────────────────────────────────────── */
.theme-picker {
  position: relative;
}
.theme-picker-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  transition: border-color .15s, color .15s;
}
.theme-picker-btn:hover { border-color: var(--gold); color: var(--gold); }
.theme-picker-btn svg { width: 15px; height: 15px; display: block; }
.theme-picker-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  min-width: 140px;
  max-width: calc(100vw - 12px); /* P3: prevent off-left overflow on narrow screens */
  z-index: 9999;
  padding: 4px;
  flex-direction: column;
  gap: 1px;
}
.theme-picker-dropdown.open { display: flex; }
.theme-picker-option {
  background: none;
  border: none;
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 7px 12px;
  text-align: left;
  transition: background .1s;
  white-space: nowrap;
}
.theme-picker-option:hover { background: var(--surface); }
.theme-picker-option.active { color: var(--gold); font-weight: 600; }

#content {
  padding: 28px 28px 60px;
  flex: 1;
}

/* ── Sidebar ── */
.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
}

.sidebar-brand span {
  font-size: 13px;
  font-weight: bold;
  color: var(--gold);
  line-height: 1.2;
}

.sidebar-nav {
  padding: 10px 0;
  flex: 1;
}

.nav-section {
  padding: 14px 16px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.nav-section:hover { color: var(--text); }
.nav-chevron {
  width: 11px;
  height: 11px;
  opacity: 0.5;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.nav-section.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-section-items {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height .25s ease;
}
.nav-section-items.collapsed { max-height: 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: var(--nav-link);
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}

.sidebar-nav a:hover {
  background: var(--hover-bg);
  color: var(--nav-link-hover);
}

.sidebar-nav a.active {
  background: color-mix(in srgb, var(--gold) 12%, transparent);
  border-left-color: var(--gold);
  color: var(--gold);
}

/* ── Topbar ── */
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.year-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.year-switcher select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
}

.topbar-user {
  font-size: 13px;
  color: var(--muted);
}

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

.btn-logout {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  transition: background .15s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  color: var(--text);
}

/* ── YoY snapshot grid ── */
.yoy-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

/* ── Stat cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.stat-card .stat-num {
  font-size: 32px;
  font-weight: bold;
  color: var(--gold);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 22px;
}

.card h2 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

table th a { color: var(--muted); }
table th a:hover { color: var(--text); }

table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s;
}

.btn-primary { background: var(--gold); color: #000; }
.btn-primary:hover { background: var(--gold-hover); color: #000; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--hover-bg); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c44; color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--hover-bg); color: var(--text); }

/* ── Forms ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols-1 { grid-template-columns: 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.span-2 { grid-column: span 2; }

label {
  font-size: 13px;
  font-weight: bold;
  color: var(--label-color);
}

label .opt {
  font-weight: normal;
  color: var(--muted);
  font-size: 12px;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
  background: var(--surface2);
  border: 1px solid var(--input-border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent);
}

textarea { min-height: 120px; resize: vertical; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--gold);
}

.checkbox-row label {
  cursor: pointer;
  font-weight: normal;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: bold;
}

.badge-yes  { background: rgba(49,162,76,.2);  color: #5dd87a; }
.badge-no   { background: rgba(255,255,255,.06); color: var(--muted); }
.badge-gold { background: rgba(244,197,66,.15); color: var(--gold); }
.badge-red  { background: rgba(224,82,82,.2);   color: #f07070; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 14px;
}

.alert-success {
  background: rgba(49,162,76,.15);
  border: 1px solid rgba(49,162,76,.3);
  color: #6ddd8a;
}

.alert-error {
  background: rgba(224,82,82,.15);
  border: 1px solid rgba(224,82,82,.3);
  color: #f08080;
}

.alert-info {
  background: rgba(244,197,66,.1);
  border: 1px solid rgba(244,197,66,.25);
  color: var(--gold);
}

.alert-warning {
  background: rgba(224,160,48,.12);
  border: 1px solid rgba(224,160,48,.3);
  color: #e0a030;
}

/* ── Search / filter bar ── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-bar input,
.filter-bar select {
  width: auto;
  padding: 8px 12px;
  font-size: 16px;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 18px;
  font-size: 13px;
}

.pagination a, .pagination span {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
}

pre {
  word-break: break-all;
  overflow-wrap: break-word;
}

.pagination a:hover { background: rgba(255,255,255,0.06); }
.pagination .current { background: var(--gold); color: #000; border-color: var(--gold); }

/* ── Login page ── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}

.login-card .login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-card .login-logo img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: contain;
}

.login-card h1 {
  font-size: 18px;
  text-align: center;
  margin-bottom: 6px;
}

.login-card p.sub {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 22px;
}

a.stat-card:hover {
  border-color: var(--gold);
  background: var(--surface2);
  cursor: pointer;
}

/* ── Modal ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}

.modal h2 {
  font-size: 17px;
  margin-bottom: 12px;
  color: var(--gold);
}

.modal p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 22px;
}

.modal .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ── Tooltip ── */
.tooltip-wrap {
  display: inline-flex;
  align-items: center;
  cursor: default;
}
#mk-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: normal;
  white-space: pre-wrap;
  max-width: 260px;
  min-width: 100px;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  pointer-events: none;
  display: none;
}

/* ── Sticky form actions ── */
.form-actions-sticky {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  margin-top: 0;
  z-index: 50;
}

/* Prevent fixed bar from covering page bottom */
body:has(.form-actions-sticky) #content {
  padding-bottom: 80px;
}

/* ── Nav icons (Lucide) ── */
.sidebar-nav a {
  -webkit-tap-highlight-color: transparent;
}
.sidebar-nav a svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ── Contact cards (mobile) ── */
.contact-cards { display: none; }
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.cc-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.cc-name-wrap { flex: 1; min-width: 0; }
.cc-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  display: block;
}
.cc-location { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cc-position { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.cc-detail { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.cc-detail a { color: var(--text); text-decoration: none; }
.cc-phone-label { font-size: 11px; color: var(--muted); margin-left: 4px; }
.cc-sponsors {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.cc-sponsor-link { font-size: 12px; color: var(--muted); text-decoration: none; }
.cc-muted { font-size: 12px; color: var(--muted); }

/* ── Toast notifications ── */
#toast-container {
  position: fixed;
  top: 66px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.45);
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 400px;
  animation: toast-in .2s ease;
  transition: opacity .3s, transform .3s;
}
.toast-success {
  background: rgba(49,162,76,.2);
  border: 1px solid rgba(49,162,76,.4);
  color: var(--success-text);
}
.toast-error {
  background: rgba(224,82,82,.2);
  border: 1px solid rgba(224,82,82,.4);
  color: var(--danger-text);
}
.toast span { flex: 1; }
.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: .6;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.toast-close:hover { opacity: 1; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Stat card sub-label ── */
.stat-card .stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  opacity: .8;
}

/* ── Hamburger (hidden on desktop) ── */
#hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Sidebar overlay (hidden on desktop) ── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99;
}

/* ── Sponsor card list (mobile) ─────────────────────────────────────────────── */
.sponsor-cards { display: none; }

.sc-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.sc-messaged  { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.sc-pledged   { background: rgba(93,216,122,.15); color: #5dd87a; border: 1px solid rgba(93,216,122,.3); }
.sc-received  { background: rgba(212,175,55,.15); color: var(--gold); border: 1px solid rgba(212,175,55,.3); }
.sc-denied    { background: rgba(220,53,69,.12); color: var(--danger); border: 1px solid rgba(220,53,69,.25); }
.sc-date      { background: transparent; color: var(--muted); border: 1px solid transparent; font-weight: normal; }

@media (max-width: 768px) {
  .sponsors-table-card { display: none; }
  .sponsor-cards {
    display: flex;
    flex-direction: column;
  }
  .sponsor-card {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .sponsor-card:last-child { border-bottom: none; }
  .sc-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }
  .sc-title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.3;
    flex: 1;
  }
  .sc-title a { color: var(--text); text-decoration: none; }
  .sc-title a:hover { color: var(--gold); }
  .sc-level { flex-shrink: 0; }
  .sc-contact { font-size: 13px; color: var(--muted); }
  .sc-email { font-size: 13px; }
  .sc-email a { color: var(--muted); }
  .sc-status {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 3px;
  }
  .sc-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
  }
}

/* ── Responsive — Tablet & Mobile (≤768px) ── */
/* ── Mobile step-wizard ──────────────────────────────────────────────────────── */
.wizard-nav {
  display: none;
}
@media (max-width: 768px) {
  .wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  .wizard-indicator {
    font-size: 13px;
    font-weight: 600;
    color: var(--gold);
    text-align: center;
    flex: 1;
  }
}

@media (max-width: 768px) {
  /* Sidebar — slide in from left */
  #sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    will-change: transform;
    overflow-y: auto;
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay.open { display: block; }
  #main { margin-left: 0; }
  #hamburger { display: flex; }

  /* Topbar — tighter on mobile */
  #topbar { padding: 0 12px; gap: 8px; }
  .topbar-right { gap: 8px; }

  /* Hide goal tracker on mobile — it's too wide */
  .goal-tracker { display: none !important; }

  /* Hide "Year:" label text, keep the select + button */
  .year-switcher label { display: none; }

  /* Hide username — too much clutter */
  .topbar-user { display: none; }

  /* Content — reduce padding */
  #content { padding: 16px 14px 60px; }

  /* Page header — stack title and actions */
  .page-header { flex-wrap: wrap; gap: 10px; }
  .page-header h1 { font-size: 18px; }

  /* Cards — reduce padding */
  .card { padding: 16px 14px; }

  /* Stat grid — 2 columns on mobile */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: span 1; }

  /* Filter bar — stack vertically, full width */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input,
  .filter-bar select { width: 100%; }
  .filter-bar .btn { width: 100%; text-align: center; justify-content: center; }

  /* Tables — touch scroll */
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* Touch-friendly button heights */
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .btn-sm { min-height: 44px; }
  .btn-logout { min-height: 44px; display: inline-flex; align-items: center; }
  .year-switcher-go { display: none; }

  /* Modals — slide up from bottom */
  .modal-backdrop { align-items: flex-end; }
  .modal {
    max-width: 100%;
    width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px 20px 32px;
  }

  /* Pagination — wrap */
  .pagination { flex-wrap: wrap; }

  /* Sponsor edit — collapse 2-col add-sponsor layout and inner field rows */
  #sponsor-grid { grid-template-columns: 1fr !important; }
  .form-row { grid-template-columns: 1fr !important; }

  /* Email compose — single column */
  .email-compose-grid { grid-template-columns: 1fr !important; }

  /* Dashboard YoY snapshot — 2 columns on tablet */
  .yoy-grid { grid-template-columns: 1fr 1fr; }

  /* Reports YoY summary — single column */
  .yoy-summary-grid { grid-template-columns: 1fr !important; }

  /* Kanban — horizontal scroll */
  .kanban-board { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Toast — full width at bottom on mobile, clear iPhone home indicator */
  #toast-container {
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    right: 12px;
    left: 12px;
  }
  .toast { min-width: 0; max-width: 100%; width: 100%; }

  /* Sticky form bar — sidebar is hidden, so span full width */
  .form-actions-sticky { left: 0; }

  /* Contact edit — collapse two-column layout to single column */
  .contact-edit-layout { grid-template-columns: 1fr !important; }

  /* Status tabs (sponsors.php) — taller touch targets */
  .status-tab { padding: 12px 18px !important; }

  /* Expand button — larger tap target on mobile */
  .expand-btn { padding: 12px 8px; }

  /* Alpha bar — larger tap targets on mobile */
  .alpha-btn { min-width: 36px; min-height: 40px; padding: 8px 4px; font-size: 14px; }

  /* Dashboard grids — collapse to single column on mobile */
  .dashboard-trend-grid { grid-template-columns: 1fr !important; }
  .dashboard-cols { grid-template-columns: 1fr !important; }

  /* Email log — hide non-essential columns on mobile */
  .email-log-hide { display: none; }

  /* Social field rows — label spans full width, input + open-btn share a row */
  .social-field-row { grid-template-columns: 1fr auto !important; grid-template-rows: auto auto; }
  .social-field-row > label { grid-column: 1 / -1; }
  .social-field-row > input { grid-column: 1; }
  .social-field-row > .url-open-btn { grid-column: 2; }

  /* Map — reduce height on mobile */
  #map { height: 300px !important; }

  /* Nav section headers — bump up from 10px, illegible on mobile */
  .nav-section { font-size: 12px; }

  /* Pagination — 44px tap targets */
  .pagination a, .pagination span {
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  /* Sponsor-edit tab buttons — 44px tap targets (override inline padding) */
  .tab-btn { min-height: 44px !important; padding-top: 10px !important; padding-bottom: 10px !important; }

  /* Reports / any table-wrap — horizontal scroll on mobile */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Advanced filter checkboxes — larger tap targets */
  .filter-bar label { min-height: 44px; }
  .filter-bar input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; }

  /* Contacts — hide table, show cards on mobile */
  .contacts-table-card { display: none; }
  .contact-cards { display: block; }

  /* Safe area insets — iPhone notch / Dynamic Island in landscape */
  #topbar {
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  #sidebar { padding-left: env(safe-area-inset-left); }

  /* Notes textarea — needs more room when virtual keyboard is open */
  #newNoteText { min-height: 80px; }
}

/* ── Responsive — Phone only (≤480px) ── */
@media (max-width: 480px) {
  /* Stat grid — single column on very small screens */
  .stat-grid { grid-template-columns: 1fr; }

  /* YoY grid — stay 2 columns on small phones, boxes are compact */
  .yoy-grid { grid-template-columns: 1fr 1fr; }

  /* Smaller table text */
  table { font-size: 12px; }
  table th, table td { padding: 8px 10px; }

  /* Login card — edge to edge with padding */
  .login-card { padding: 28px 20px; border-radius: 10px; }

  /* Reduce card padding further */
  .card { padding: 14px 12px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HELP SYSTEM
   ═══════════════════════════════════════════════════════════════════════════ */

/* Panel overlay */
#helpPanelOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 300;
}
#helpPanelOverlay.open { display: block; }

/* Slide-out panel */
#helpPanel {
  position: fixed;
  top: 0; right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,.3);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s ease;
}
#helpPanel.open { transform: translateX(0); }

#helpPanelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#helpPanelHeader h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}
#helpPanelBody {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 24px;
}

/* Panel section toggles */
.help-section { margin-bottom: 4px; }
.help-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  color: var(--text);
  font-weight: 600;
  font-size: 11px;
  padding: 10px 0 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .7;
}
.help-section-toggle svg { width: 14px; height: 14px; transition: transform .2s; }
.help-section-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.help-section-body { padding-bottom: 8px; }
.help-section-body.hidden { display: none; }

/* Individual articles */
.help-article {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.help-article:last-child { border-bottom: none; }
.help-article h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text);
}
.help-article-body {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.help-article-body p { margin: 0 0 8px; }
.help-article-body p:last-child { margin-bottom: 0; }
.help-article-body ul { margin: 0 0 8px; padding-left: 18px; }
.help-article-body li { margin-bottom: 4px; }
.help-article-body strong { color: var(--text); }

/* Panel loading / error / empty states */
.help-loading, .help-error, .help-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 32px 0;
}

/* ── Card section label (replaces repetitive inline uppercase styles) ── */
.card-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: 0 0 14px;
}

/* ── Contextual ? button ──────────────────────────────────────────────── */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: none;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 5px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  position: relative;
  transition: border-color .15s, color .15s;
}
/* Expand tap area to 44px without changing visual size */
.help-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
}
.help-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* N5: Attachment row hover — only on pointer devices; avoids stuck highlight on touch */
@media (hover: hover) {
  .attach-label:hover { background: var(--bg) !important; }
  /* Alpha-bar — hover style only on pointer devices; prevents sticky highlight on touch */
  .alpha-btn:hover { background: var(--gold); color: #000; border-color: var(--gold); }
  .alpha-btn.clear-letter:hover { color: var(--danger); border-color: var(--danger); background: transparent; }
}
