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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a1a;
  color: #f0f0f0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Screens ── */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ── Splash ── */
#screen-splash { align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #1a1a3e 0%, #0a0a1a 70%); }
.splash-center { text-align: center; }
.app-name { font-size: 2.4rem; font-weight: 700; margin-top: 1rem; letter-spacing: 2px; }
.tagline { color: #8888bb; margin-top: 0.4rem; font-size: 1rem; }

/* ── Halo Logo ── */
.halo-logo { position: relative; width: 90px; height: 90px; margin: 0 auto; }
.halo-logo.sm { width: 60px; height: 60px; }
.halo-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; border-top-color: #f59e0b; border-right-color: #f59e0b; animation: spin 2s linear infinite; box-shadow: 0 0 20px #f59e0b55; }
.halo-inner { position: absolute; inset: 10px; background: #1a1a3e; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.halo-logo.sm .halo-inner { inset: 6px; font-size: 1.2rem; }
.logo-icon { font-size: inherit; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Setup ── */
#screen-setup { overflow-y: auto; }
.setup-scroll { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; max-width: 500px; width: 100%; margin: 0 auto; }
.setup-header { text-align: center; padding: 1rem 0; }
.setup-header h2 { font-size: 1.6rem; font-weight: 700; margin-top: 0.8rem; }
.setup-header p { color: #8888bb; margin-top: 0.4rem; }
.setup-body { display: flex; flex-direction: column; gap: 1rem; }
.setup-footer { padding-bottom: 2rem; }

/* ── Inputs ── */
.input-group { display: flex; flex-direction: column; gap: 0.4rem; }
.input-group label { font-size: 0.82rem; font-weight: 600; color: #aaaacc; text-transform: uppercase; letter-spacing: 0.5px; }
.input-group input, .input-group textarea, .input-group select {
  background: #16163a; border: 2px solid #2a2a4a; color: #f0f0f0;
  border-radius: 10px; padding: 0.8rem 1rem; font-size: 0.95rem; width: 100%;
}
.input-group input:focus, .input-group textarea:focus { outline: none; border-color: #f59e0b; }
.input-group small { color: #666699; font-size: 0.8rem; }
.optional { color: #666699; font-weight: 400; text-transform: none; font-size: 0.78rem; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.check-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: #c0c0e0; cursor: pointer; }
.check-label input { width: auto; }

/* ── Buttons ── */
.btn-primary { background: linear-gradient(135deg, #f59e0b, #d97706); color: #0a0a1a; border: none; border-radius: 12px; padding: 0.9rem 2rem; font-size: 1rem; font-weight: 700; cursor: pointer; transition: opacity 0.2s; }
.btn-primary:active { opacity: 0.8; }
.btn-primary.full-width { width: 100%; }
.btn-ghost { background: none; border: 2px solid #2a2a4a; color: #aaaacc; border-radius: 12px; padding: 0.8rem 1.5rem; font-size: 0.95rem; cursor: pointer; }
.btn-ghost.full-width { width: 100%; margin-top: 0.5rem; }
.btn-danger { background: #7f1d1d; border: none; color: #fca5a5; border-radius: 12px; padding: 0.8rem 1.5rem; font-size: 0.95rem; cursor: pointer; }
.btn-danger.full-width { width: 100%; margin-top: 0.5rem; }

/* ── Top bar ── */
.top-bar { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 1rem; background: #12122a; border-bottom: 1px solid #2a2a4a; position: sticky; top: 0; z-index: 100; }
.app-title-sm { font-size: 1rem; font-weight: 700; color: #f59e0b; }
.status-text { font-size: 0.78rem; color: #8888bb; margin-top: 0.1rem; }
.icon-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 0.3rem; }

/* ── Tab Bar ── */
.tab-bar { display: flex; border-bottom: 1px solid #2a2a4a; background: #0a0a1a; position: sticky; top: 58px; z-index: 50; }
.tab { flex: 1; background: none; border: none; color: #8888bb; padding: 0.7rem 0.3rem; font-size: 0.78rem; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; }
.tab.active { color: #f59e0b; border-bottom-color: #f59e0b; }
.tab-content { display: none; flex: 1; flex-direction: column; overflow-y: auto; padding-bottom: 2rem; }
.tab-content.active { display: flex; }

/* ── Search bar ── */
.search-bar-row { display: flex; gap: 0.5rem; padding: 0.8rem 1rem 0.4rem; }
.search-input { flex: 1; background: #16163a; border: 2px solid #2a2a4a; color: #f0f0f0; border-radius: 10px; padding: 0.7rem 1rem; font-size: 0.95rem; }
.search-input:focus { outline: none; border-color: #f59e0b; }
.btn-search { background: #f59e0b; color: #0a0a1a; border: none; border-radius: 10px; padding: 0.7rem 1rem; font-weight: 700; cursor: pointer; white-space: nowrap; }

/* ── Filters ── */
.filter-row { display: flex; gap: 0.4rem; padding: 0 1rem 0.6rem; overflow-x: auto; }
.filter-chip { background: #16163a; border: 1px solid #2a2a4a; color: #aaaacc; border-radius: 20px; padding: 0.3rem 0.9rem; font-size: 0.8rem; cursor: pointer; white-space: nowrap; }
.filter-chip.active { background: #2a1f00; border-color: #f59e0b; color: #f59e0b; }

/* ── Job Cards ── */
.jobs-list { display: flex; flex-direction: column; gap: 0.7rem; padding: 0.4rem 1rem; }
.job-card { background: #16163a; border: 1px solid #2a2a4a; border-radius: 14px; padding: 1rem; cursor: pointer; transition: border-color 0.2s; }
.job-card:active { border-color: #f59e0b; }
.job-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.4rem; }
.job-title { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.job-company { font-size: 0.85rem; color: #8888bb; margin-top: 0.1rem; }
.source-badge { font-size: 0.7rem; background: #2a2a4a; color: #aaaacc; border-radius: 6px; padding: 0.2rem 0.5rem; white-space: nowrap; flex-shrink: 0; }
.job-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }
.meta-chip { font-size: 0.75rem; background: #1e1e3e; border-radius: 6px; padding: 0.2rem 0.5rem; color: #aaaacc; }
.meta-chip.salary { color: #86efac; background: #0f2a1a; }
.job-snippet { font-size: 0.82rem; color: #8888bb; line-height: 1.5; margin-bottom: 0.7rem; }
.job-card-footer { display: flex; gap: 0.5rem; justify-content: flex-end; }
.btn-analyze-sm { background: #1e1a4e; border: 1px solid #6c63ff; color: #a78bfa; border-radius: 8px; padding: 0.4rem 0.8rem; font-size: 0.8rem; cursor: pointer; }
.btn-apply-sm { background: #f59e0b; color: #0a0a1a; border: none; border-radius: 8px; padding: 0.4rem 0.8rem; font-size: 0.8rem; font-weight: 700; cursor: pointer; }

/* ── Analyze Tab ── */
.analyze-content { display: flex; flex-direction: column; gap: 0.8rem; padding: 1rem; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.detail-title { font-size: 1.1rem; font-weight: 700; }
.detail-company { color: #8888bb; font-size: 0.9rem; margin-top: 0.2rem; }
.detail-salary { color: #86efac; font-weight: 700; white-space: nowrap; }
.apply-link { display: inline-block; color: #f59e0b; font-size: 0.85rem; text-decoration: none; margin-top: 0.5rem; }
.job-detail-card { background: #16163a; border: 1px solid #2a2a4a; border-radius: 14px; padding: 1rem; }
.overlay-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }

/* ── Score card ── */
.match-score-card { background: #16163a; border: 1px solid #2a2a4a; border-radius: 14px; padding: 1rem; }
.score-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.8rem; }
.score-circle { width: 64px; height: 64px; border-radius: 50%; border: 3px solid; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 700; flex-shrink: 0; }
.score-verdict { font-size: 0.95rem; line-height: 1.4; }
.score-label { font-size: 0.75rem; color: #8888bb; margin-top: 0.2rem; }
.reasons-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.8rem; }
.reason-item { font-size: 0.85rem; padding: 0.4rem 0.6rem; border-radius: 8px; line-height: 1.4; }
.reason-item.good { background: #0f2a1a; color: #86efac; }
.reason-item.warn { background: #2a1a00; color: #fbbf24; }
.keywords-row { margin-top: 0.4rem; }
.keywords-label { font-size: 0.78rem; color: #8888bb; margin-bottom: 0.4rem; }
.keywords-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.kw-chip { background: #1e1a4e; border: 1px solid #6c63ff; color: #a78bfa; border-radius: 6px; padding: 0.2rem 0.6rem; font-size: 0.78rem; }

/* ── Cover Letter ── */
.cover-letter-card { background: #16163a; border: 1px solid #2a2a4a; border-radius: 14px; padding: 1rem; }
.cl-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.cl-header h3 { font-size: 1rem; }
.btn-copy-sm { background: #f59e0b; color: #0a0a1a; border: none; border-radius: 8px; padding: 0.4rem 0.8rem; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.cl-body { font-size: 0.88rem; line-height: 1.7; color: #c0c0e0; }

/* ── Apply Actions ── */
.apply-actions { display: flex; flex-direction: column; gap: 0.5rem; }

/* ── Tracker ── */
.tracker-panel { padding: 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
.tracker-header-row { display: flex; justify-content: space-between; align-items: center; }
.tracker-stats { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.stat-chip { font-size: 0.75rem; border-radius: 8px; padding: 0.2rem 0.6rem; }
.stat-chip.applied  { background: #1e1a4e; color: #a78bfa; }
.stat-chip.interview { background: #1a2e0f; color: #86efac; }
.stat-chip.offer    { background: #2a1f00; color: #fbbf24; }
.tracker-card { background: #16163a; border: 1px solid #2a2a4a; border-radius: 12px; padding: 0.9rem; }
.tracker-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.4rem; }
.tracker-title { font-size: 0.95rem; font-weight: 700; }
.tracker-company { font-size: 0.82rem; color: #8888bb; }
.tracker-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.tracker-score { font-size: 0.75rem; background: #2a1f00; color: #fbbf24; border-radius: 6px; padding: 0.2rem 0.5rem; }
.status-select { background: #0a0a1a; border: 1px solid #2a2a4a; color: #f0f0f0; border-radius: 8px; padding: 0.3rem 0.5rem; font-size: 0.78rem; cursor: pointer; }
.tracker-meta { display: flex; justify-content: space-between; font-size: 0.78rem; color: #8888bb; }
.tracker-link { color: #f59e0b; text-decoration: none; }

/* ── Overlay ── */
.overlay { position: fixed; inset: 0; background: #000000cc; display: flex; align-items: flex-end; z-index: 999; }
.overlay.hidden { display: none; }
.overlay-box { background: #16163a; border-radius: 20px 20px 0 0; padding: 1.2rem; width: 100%; max-height: 80vh; display: flex; flex-direction: column; gap: 0.8rem; }
.overlay-top { display: flex; justify-content: space-between; align-items: flex-start; }
.overlay-top h3 { font-size: 1rem; font-weight: 700; flex: 1; margin-right: 0.5rem; }
.close-btn { background: #2a2a4a; border: none; color: #f0f0f0; border-radius: 8px; padding: 0.3rem 0.6rem; cursor: pointer; font-size: 0.9rem; }
.overlay-body { overflow-y: auto; flex: 1; }
.overlay-desc { font-size: 0.85rem; color: #c0c0e0; line-height: 1.6; margin-top: 0.5rem; }
.overlay-actions { display: flex; flex-direction: column; gap: 0.5rem; }

/* ── Settings Panel ── */
.settings-panel { position: fixed; inset: 0; background: #0a0a1a; z-index: 200; flex-direction: column; overflow-y: auto; }
.settings-top { display: flex; align-items: center; gap: 1rem; padding: 1rem; border-bottom: 1px solid #2a2a4a; position: sticky; top: 0; background: #0a0a1a; }
.settings-top h3 { font-size: 1.1rem; }
.settings-body { padding: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.divider { border: none; border-top: 1px solid #2a2a4a; margin: 0.3rem 0; }

/* ── States ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1.5rem; text-align: center; gap: 0.8rem; flex: 1; }
.empty-icon { font-size: 3rem; }
.empty-state h3 { font-size: 1.1rem; }
.empty-state p { color: #8888bb; font-size: 0.9rem; line-height: 1.6; }
.loading-state { display: flex; flex-direction: column; align-items: center; padding: 3rem; gap: 1rem; color: #8888bb; }
.analyzing-msg { display: flex; align-items: center; gap: 0.6rem; color: #8888bb; padding: 1rem; }
.error-msg { color: #fca5a5; padding: 1rem; font-size: 0.9rem; }
.hidden { display: none !important; }

/* ── Spinner ── */
.spinner { width: 36px; height: 36px; border: 3px solid #2a2a4a; border-top-color: #f59e0b; border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner-sm { width: 18px; height: 18px; border: 2px solid #2a2a4a; border-top-color: #f59e0b; border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }

/* ── Advanced Filters ── */
.adv-filters-wrap { display: flex; flex-direction: column; gap: 0.3rem; padding: 0 1rem 0.7rem; border-bottom: 1px solid #1a1a3a; }
.adv-filter-group { display: flex; align-items: center; gap: 0.4rem; overflow-x: auto; }
.adv-filter-label { font-size: 0.7rem; color: #555588; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; min-width: 38px; }

/* ── Interview Prep Card ── */
.interview-prep-card { background: #12122e; border: 1px solid #2a2a5a; border-radius: 14px; padding: 1rem; display: flex; flex-direction: column; gap: 0.7rem; }
.prep-section-title { font-size: 0.75rem; font-weight: 700; color: #4fc3f7; text-transform: uppercase; letter-spacing: 0.6px; margin-top: 0.3rem; }
.prep-culture { font-size: 0.85rem; color: #b3c8e8; line-height: 1.6; }
.prep-salary { font-size: 0.85rem; color: #86efac; line-height: 1.5; background: #0a2018; border-radius: 8px; padding: 0.6rem 0.8rem; }
.prep-flags-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.prep-flags-col { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; min-width: 140px; }
.prep-item { font-size: 0.82rem; padding: 0.35rem 0.6rem; border-radius: 8px; line-height: 1.4; }
.prep-item.green { background: #0a2018; color: #86efac; }
.prep-item.red   { background: #2a0a0a; color: #fca5a5; }
.prep-questions { display: flex; flex-direction: column; gap: 0.5rem; }
.prep-question { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.85rem; color: #c0d0f0; line-height: 1.5; background: #0e0e28; border-radius: 8px; padding: 0.6rem 0.8rem; }
.q-num { background: #f59e0b; color: #0a0a1a; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; flex-shrink: 0; margin-top: 0.1rem; }

/* ── Toast ── */
.toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px); background: #22c55e; color: white; padding: 0.7rem 1.5rem; border-radius: 30px; font-weight: 600; font-size: 0.9rem; opacity: 0; transition: all 0.3s; z-index: 9999; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
