:root {
  --bg: #f6f7f9;
  --card-bg: #ffffff;
  --ink: #1c2128;
  --muted: #6b7280;
  --border: #e2e5e9;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --stated: #15803d;
  --stated-bg: #dcfce7;
  --lean: #b45309;
  --lean-bg: #fef3c7;
  --open: #6b7280;
  --open-bg: #e5e7eb;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.app-header {
  padding: 28px 20px 14px;
  text-align: center;
}

.brand { font-size: 1.4rem; font-weight: 700; margin-top: 4px; }

.subtitle {
  color: var(--muted);
  margin: 6px auto 0;
  max-width: 560px;
}

/* Simple cross-page nav — one page name, one link to the other. No
   persistent tab bar, just a clear way to move between the two pages. */
.page-nav {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  font-size: 0.9rem;
}
.page-nav-current { font-weight: 700; color: var(--accent); }
.page-nav-link { color: var(--muted); text-decoration: none; }
.page-nav-link:hover { color: var(--accent); text-decoration: underline; }

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 30px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

.card h2 { margin-top: 0; }
.card h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.card h3 .section-note { font-weight: 400; font-size: 0.82rem; color: var(--muted); }

.muted { color: var(--muted); font-size: 0.9rem; }

textarea, input[type="text"], input[type="number"], input[type="date"], select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
textarea { resize: vertical; }

.row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 15px;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #1d4ed8; }
.btn.secondary { background: #eef0f3; color: var(--ink); }
.btn.secondary:hover { background: #e2e5e9; }
.btn.ghost { background: transparent; color: var(--muted); text-decoration: underline; padding: 9px 4px; }
.btn.danger { background: var(--danger-bg); color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 0.82rem; }

/* Field chrome: label row, control, badge + lean toggle */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
  gap: 8px;
}
.field label.main-label { font-weight: 600; font-size: 0.92rem; }
.field .hint { color: var(--muted); font-size: 0.82rem; margin-bottom: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.stated { background: var(--stated-bg); color: var(--stated); }
.badge.lean   { background: var(--lean-bg);   color: var(--lean); }
.badge.open   { background: var(--open-bg);   color: var(--open); }

.field-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-size: 0.85rem;
}
.lean-toggle { display: flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; }
.lean-toggle input { margin: 0; }
.lean-reason {
  flex: 1 1 220px;
  border: 1px solid var(--lean-bg);
  background: #fffdf6;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.84rem;
}
.lean-reason[hidden] { display: none; }
.hidden { display: none; }

/* Chips / tags */
.chip-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px;
  background: #fff;
}
.chip {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chip.custom { background: #fff7ed; color: #9a3412; border: 1px dashed #fb923c; }
button.chip { border: none; cursor: pointer; font: inherit; }
button.chip:hover { background: #e0e7ff; }
.chip button {
  border: none; background: transparent; cursor: pointer;
  color: inherit; font-weight: 700; line-height: 1; padding: 0;
}
.chip-input input {
  border: none; outline: none; flex: 1; min-width: 120px;
  font: inherit; padding: 4px;
}

/* Checkbox chip groups (standardized picks) */
.check-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.88rem;
  cursor: pointer;
  background: #fff;
}
.check-chip input { margin: 0; }
.check-chip.checked { background: #eef2ff; border-color: #a5b4fc; color: #3730a3; }

.suggestions { margin-top: 14px; }
.suggestion-group { margin-bottom: 10px; }
.suggestion-group h4 { margin: 0 0 6px; font-size: 0.86rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

/* Repeatable entry cards (education / experience / extracurriculars) */
.entry-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  background: #fbfbfc;
}
.entry-card .entry-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.entry-card .entry-head span { font-weight: 600; font-size: 0.88rem; color: var(--muted); }
.entry-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 8px; }
.entry-grid input, .entry-card textarea { font-size: 0.9rem; }

.empty-state { color: var(--muted); font-style: italic; font-size: 0.88rem; }

/* Headline / story summary */
.summary-card .headline-text {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.3;
  border: none;
  background: transparent;
  width: 100%;
  padding: 4px 0;
  resize: none;
  overflow: hidden;
}
.summary-card .story-text {
  border: none; background: transparent; width: 100%; padding: 4px 0;
  min-height: 64px; font-size: 0.96rem;
}
.summary-note {
  font-size: 0.8rem;
  color: var(--muted);
  background: #f4f5f7;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
}

/* Completeness banner */
.completeness-card { padding: 16px 22px; }
.completeness-pct {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
}
.completeness-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 6px;
}
.completeness-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.25s ease;
}

/* Understated data-portability row — deliberately not a persistent
   bar; export/import stay reachable without being presented as a
   primary action. No "start over" here on purpose: destructive and
   rarely needed, not worth a standing invitation to click it. */
.tiny-actions {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 18px 16px 30px;
}
.tiny-actions a { color: var(--muted); text-decoration: underline; cursor: pointer; }
.tiny-actions a:hover { color: var(--accent); }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}
.toast.show { opacity: 1; }

@media (max-width: 480px) {
  .field-label-row { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* Job board */
.job-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.job-title { margin: 0; font-size: 1.05rem; }
.job-sub { margin: 2px 0 0; font-size: 0.85rem; }
.job-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.job-desc { margin: 0 0 6px; font-size: 0.92rem; }
.job-source { font-size: 0.78rem; margin: 6px 0 0; }
.job-dealbreaker-warning {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.85rem;
  margin: 6px 0;
}
.match-score {
  flex-shrink: 0;
  background: var(--stated-bg);
  color: var(--stated);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.match-score-none { background: var(--open-bg); color: var(--open); }
.profile-status-found { color: var(--accent); font-weight: 600; }

/* Job board — table ("spreadsheet") view */
.jobs-table-scroll { overflow-x: auto; }
.jobs-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; white-space: nowrap; }
.jobs-table th, .jobs-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.jobs-table th { cursor: pointer; user-select: none; background: #f8fafc; position: sticky; top: 0; }
.jobs-table th:hover { background: #eef2ff; }
.jobs-table th.sorted::after { content: " " attr(data-dir); font-size: 0.75em; }
.jobs-table tbody tr:hover { background: #f8fafc; }
.jobs-table td.job-title-cell { white-space: normal; min-width: 220px; }
.jobs-table a { color: var(--accent); }
.jobs-table tbody tr { cursor: pointer; }
.jobs-table td.verified-cell { color: var(--verified); font-weight: 600; }

/* A bit more color than the neutral gray/blue palette elsewhere: a
   distinct hue for "verified company" (teal) and one for the
   Finance & Consulting quick filter (amber) so they read as
   deliberate accents, not just more gray chips. */
:root {
  --verified: #0f766e;
  --verified-bg: #ccfbf1;
  --focus: #b45309;
  --focus-bg: #fef3c7;
}
.app-header { background: linear-gradient(135deg, #eef2ff 0%, var(--bg) 70%); border-bottom: 1px solid var(--border); }
.chip.verified { background: var(--verified-bg); color: var(--verified); }
.quick-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
#filter-verified-wrap.checked { background: var(--verified-bg); border-color: var(--verified); color: var(--verified); }
#filter-fincon-wrap.checked { background: var(--focus-bg); border-color: var(--focus); color: var(--focus); }

/* Collapsible filters — closed by default so they don't occupy
   permanent space; the quick filters above stay outside this and are
   always visible since they're the fast path. */
#filters-panel { margin-top: 10px; }
#filters-panel summary {
  cursor: pointer;
  font-weight: 600;
  padding: 8px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
#filters-panel summary::-webkit-details-marker { display: none; }
#filters-panel summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; }
#filters-panel[open] summary::before { transform: rotate(90deg); }
#filters-panel[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.filters-count {
  background: var(--accent); color: var(--accent-ink); border-radius: 999px;
  font-size: 0.75rem; padding: 1px 7px; font-weight: 700;
}

/* Job detail overlay */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17, 24, 39, 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 50;
}
/* .hidden and .modal-overlay have equal specificity — without this,
   source order alone decides which display value wins, which is too
   fragile to rely on. */
.modal-overlay.hidden { display: none; }
.modal-panel {
  background: var(--card-bg); border-radius: var(--radius); max-width: 640px;
  width: 100%; padding: 20px; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal-close { position: absolute; top: 14px; right: 14px; }

/* ---------------------------------------------------------------------
 * Profile dashboard — the "crystallized" read-only view a profile
 * becomes once built, replacing the always-editing form as the
 * default. Deliberately looks read, not editable: no input borders,
 * no form chrome, closer to a resume/LinkedIn profile page.
 * ------------------------------------------------------------------- */
#dashboard-view { max-width: 760px; margin: 0 auto; padding: 0 16px 30px; }

.dashboard-hero {
  background: linear-gradient(135deg, #eef2ff 0%, var(--card-bg) 70%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 16px;
}
.dashboard-headline { margin: 0 0 4px; font-size: 1.3rem; }
.dashboard-subline { margin: 0 0 10px; color: var(--muted); }
.dashboard-story { margin: 0 0 14px; }
.dashboard-hero-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 8px;
}
.dashboard-progress { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.dashboard-progress-bar { width: 100px; height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.dashboard-progress-fill { height: 100%; background: var(--accent); }

.dashboard-section { margin-bottom: 16px; }
.dashboard-section h3 { margin: 0 0 8px; font-size: 1rem; }
.dashboard-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.dashboard-entry { padding: 10px 0; border-bottom: 1px solid var(--border); }
.dashboard-entry:last-child { border-bottom: none; }
.dashboard-entry-title { font-weight: 600; }
.dashboard-entry-sub { color: var(--muted); font-size: 0.88rem; margin: 1px 0 4px; }
.dashboard-entry-desc { font-size: 0.9rem; margin: 0; }

.dashboard-empty { color: var(--muted); font-size: 0.9rem; }
