:root {
  --bg: #f8f9fc;
  --card: #ffffff;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --primary-dark: #4338ca;
  --text: #1e293b;
  --muted: #64748b;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.14);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== HEADER ===== */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo { display: flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none; }
.logo-img { width: 32px; height: 32px; object-fit: contain; filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(346deg) brightness(95%) contrast(94%); }
.logo-img-white { filter: brightness(0) invert(1); }
.logo-text { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.05rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.logo-accent { color: var(--primary); }
.logo-accent-light { color: #f97316; }
.landing-logo { display: flex; align-items: center; gap: 8px; }
.landing-logo .logo-text { color: white; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.65rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 28px; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }

.header-nav { display: flex; gap: 4px; flex: 1; }

.nav-btn {
  background: none;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--primary-light); color: var(--primary); }
.nav-btn.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.header-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-name { font-size: 0.85rem; color: var(--muted); }

/* ===== BUTTONS ===== */
button { cursor: pointer; border: none; border-radius: 6px; font-size: 0.85rem; font-weight: 500; padding: 8px 16px; transition: all 0.15s; }

.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }

.btn-ghost { background: none; color: var(--muted); padding: 6px 10px; }
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.w-full { width: 100%; }

/* ===== VIEWS ===== */
.view { min-height: calc(100vh - 58px); }

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 { font-size: 1.2rem; }

/* ===== LANDING PAGE ===== */
.landing-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  min-height: 100vh;
  color: white;
}
.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 20px 48px; max-width: 1300px; margin: 0 auto; }
.landing-logo { font-size: 1.1rem; font-weight: 800; color: white; }
.landing-nav-right { display: flex; gap: 10px; align-items: center; }
.landing-nav-btn { background: rgba(255,255,255,0.12); color: white; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 8px 16px; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.landing-nav-btn:hover { background: rgba(255,255,255,0.2); }
.landing-cta-sm { background: #f97316; color: white; border: none; border-radius: 6px; padding: 8px 18px; font-size: 0.85rem; font-weight: 700; cursor: pointer; }
.landing-cta-sm:hover { background: #ea6c00; }

.hero-body { display: grid; grid-template-columns: 1fr 420px; gap: 60px; align-items: center; max-width: 1300px; margin: 0 auto; padding: 48px 48px 64px; }

.hero-eyebrow { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: #f97316; margin-bottom: 16px; }

.hero-headline { font-size: clamp(2.2rem, 4vw, 3.4rem); font-weight: 900; line-height: 1.1; color: white; margin-bottom: 20px; letter-spacing: -0.02em; }

.hero-sub { font-size: 1.05rem; color: #cbd5e1; line-height: 1.65; margin-bottom: 32px; max-width: 480px; }

.hero-actions { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; flex-wrap: wrap; }

.btn-hero-primary { background: #f97316; color: white; border: none; border-radius: 8px; padding: 13px 28px; font-size: 0.95rem; font-weight: 700; cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,0.2); transition: all 0.15s; }
.btn-hero-primary:hover { background: #ea6c00; transform: translateY(-1px); }

.btn-hero-ghost { background: none; color: white; border: none; font-size: 0.95rem; font-weight: 600; cursor: pointer; opacity: 0.85; padding: 13px 8px; transition: opacity 0.15s; }
.btn-hero-ghost:hover { opacity: 1; }

.hero-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-pill { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #cbd5e1; border-radius: 20px; padding: 5px 14px; font-size: 0.78rem; font-weight: 600; }

.hero-right .auth-card { background: white; border: none; box-shadow: 0 24px 80px rgba(0,0,0,0.3); }

.mockup-section { max-width: 1300px; margin: 0 auto; padding: 0 48px 80px; }
.mockup-label { text-align: center; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #f97316; margin-bottom: 20px; }

.browser-chrome { background: #1e293b; border-radius: 12px; overflow: hidden; box-shadow: 0 32px 80px rgba(0,0,0,0.4); }
.browser-bar { background: #334155; padding: 10px 16px; display: flex; align-items: center; gap: 8px; }
.browser-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.browser-url { flex: 1; background: #1e293b; border-radius: 6px; padding: 4px 14px; font-size: 0.75rem; color: #94a3b8; margin-left: 8px; font-family: monospace; }
.browser-body { background: #f8f9fc; padding: 16px; }

.mock-stats { display: flex; gap: 10px; margin-bottom: 12px; }
.mock-stat { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 14px; flex: 1; }
.ms-label { font-size: 0.65rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.ms-val   { font-size: 1.4rem; font-weight: 800; margin-top: 2px; }

.mock-table-wrap { overflow: hidden; border-radius: 8px; border: 1px solid #e2e8f0; }
.mock-table { width: 100%; border-collapse: collapse; background: white; font-size: 0.78rem; }
.mock-table thead th { background: #f1f5f9; padding: 8px 12px; text-align: left; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.mock-table tbody tr { border-bottom: 1px solid #f1f5f9; }
.mock-table tbody tr:last-child { border-bottom: none; }
.mock-table td { padding: 8px 12px; vertical-align: middle; }
.mock-rank { font-weight: 800; color: #4f46e5; text-align: center; width: 28px; }
.mock-loc  { font-size: 0.68rem; color: #94a3b8; }
.mbadge { display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: 0.67rem; font-weight: 700; }
.mb-submitted { background: #dbeafe; color: #1e40af; }
.mb-accepted  { background: #dcfce7; color: #166534; }
.mb-interview { background: #ede9fe; color: #5b21b6; }
.mb-progress  { background: #fef3c7; color: #92400e; }

/* ===== AUTH ===== */
.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #eef2ff 0%, #f8f9fc 100%);
  padding: 20px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

/* auth-logo styles defined in logo section above */

.auth-card h2 { font-size: 1.1rem; margin-bottom: 20px; }

.auth-sub { font-size: 0.875rem; color: var(--muted); margin-bottom: 16px; }

.auth-error {
  background: #fee2e2;
  color: var(--danger);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.82rem;
  margin-bottom: 12px;
  display: none;
}
.auth-error.visible { display: block; }

.auth-success {
  background: #dcfce7;
  color: var(--success);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.auth-links { margin-top: 16px; text-align: center; font-size: 0.82rem; color: var(--muted); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.auth-links a { color: var(--primary); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card);
  transition: border 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-group textarea { resize: vertical; min-height: 70px; }
.hint { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.readonly-input { background: #f8f9fc !important; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.section-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--primary-light); }
.tag-auto   { font-size: 0.65rem; background: #dcfce7; color: #166534; border-radius: 3px; padding: 1px 5px; margin-left: 6px; font-weight: 700; }
.tag-manual { font-size: 0.65rem; background: #f1f5f9; color: var(--muted);  border-radius: 3px; padding: 1px 5px; margin-left: 6px; font-weight: 700; }

/* ===== SEARCH DROPDOWN ===== */
.search-results { border: 1px solid var(--border); border-radius: 6px; max-height: 200px; overflow-y: auto; margin-top: 4px; display: none; box-shadow: var(--shadow-lg); background: var(--card); }
.search-results.open { display: block; }
.search-result-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--primary-light); }
.search-result-item .result-name { font-weight: 600; }
.search-result-item .result-loc  { font-size: 0.75rem; color: var(--muted); }
.fetch-status { font-size: 0.8rem; color: var(--muted); margin-top: 6px; min-height: 18px; }
.fetch-status.ok  { color: var(--success); }
.fetch-status.err { color: var(--danger); }

/* ===== STATS BAR ===== */
.stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }

.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 1.7rem; font-weight: 800; margin-top: 2px; }
.stat-card.c-accepted .value { color: var(--success); }
.stat-card.c-warning  .value { color: var(--warning); }
.stat-card.c-danger   .value { color: var(--danger); }
.stat-card.c-primary  .value { color: var(--primary); }

/* ===== TOOLBAR ===== */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.toolbar select, .toolbar input[type=text] { border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font-size: 0.85rem; background: var(--card); color: var(--text); }
.toolbar input[type=text] { width: 200px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); font-size: 0.84rem; }
thead th { background: #f1f5f9; padding: 10px 14px; text-align: left; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
td { padding: 10px 14px; vertical-align: middle; }

.rank-cell { font-weight: 800; color: var(--primary); text-align: center; width: 40px; }
.school-name { font-weight: 600; }
.school-location { font-size: 0.74rem; color: var(--muted); margin-top: 1px; }
.notes-cell { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 0.8rem; }
.actions-cell { display: flex; gap: 6px; }

/* Status badges */
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.badge-not-started  { background: #f1f5f9; color: var(--muted); }
.badge-in-progress  { background: #fef3c7; color: #92400e; }
.badge-submitted    { background: #dbeafe; color: #1e40af; }
.badge-interview    { background: #ede9fe; color: #5b21b6; }
.badge-accepted     { background: #dcfce7; color: #166534; }
.badge-rejected     { background: #fee2e2; color: #991b1b; }
.badge-waitlisted   { background: #fef9c3; color: #713f12; }
.badge-deferred     { background: #f3e8ff; color: #6b21a8; }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border-radius: 14px; padding: 28px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 1.1rem; margin-bottom: 4px; }

/* ===== FAMILY VIEW ===== */
.family-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.family-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.family-section h3 { font-size: 0.9rem; margin-bottom: 16px; color: var(--text); }
.member-list { display: flex; flex-direction: column; gap: 10px; }
.member-card { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.member-info .member-name { font-weight: 600; font-size: 0.88rem; }
.member-info .member-email { font-size: 0.76rem; color: var(--muted); }
.member-empty { font-size: 0.84rem; color: var(--muted); padding: 12px 0; }

/* ===== TRACKER SWITCHER ===== */
.tracker-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
  border: 1px solid #cbd5e1;
}

/* ===== SPINNER ===== */
.loading-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 6px; }

/* ===== ADMIN ===== */
.admin-badge { background: #fef3c7; color: #92400e; border-radius: 20px; padding: 4px 12px; font-size: 0.75rem; font-weight: 700; border: 1px solid #fcd34d; }

.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.admin-tab { background: none; border: none; border-bottom: 3px solid transparent; border-radius: 0; padding: 8px 18px; font-size: 0.875rem; font-weight: 500; color: var(--muted); cursor: pointer; margin-bottom: -1px; transition: all 0.15s; }
.admin-tab:hover { color: var(--primary); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.admin-tab-content { display: block; }

.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }

.status-chart { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.status-chart h3 { font-size: 0.875rem; margin-bottom: 16px; }
.chart-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 0.83rem; }
.chart-label { width: 110px; flex-shrink: 0; }
.chart-bar-wrap { flex: 1; background: var(--border); border-radius: 4px; height: 8px; }
.chart-bar { height: 8px; border-radius: 4px; background: var(--primary); transition: width 0.4s; }
.chart-count { width: 30px; text-align: right; font-weight: 600; color: var(--muted); font-size: 0.8rem; }

.user-status-active   { color: var(--success); font-weight: 600; font-size: 0.78rem; }
.user-status-disabled { color: var(--danger);  font-weight: 600; font-size: 0.78rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  main { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .family-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 20px; }
  table { font-size: 0.78rem; }
  td, th { padding: 8px 10px; }
  .toolbar input[type=text] { width: 140px; }
}
