/* Job Application OS — minimal slate + indigo theme */
:root {
  --bg: #f1f5f9;
  --bg-soft: #f8fafc;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --good: #15803d;
  --good-soft: #f0fdf4;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #b91c1c;
  --bad-soft: #fef2f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .06);
}
* { 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);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); }

.view { display: block; }

/* ---------- login ---------- */
#login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow); text-align: center;
}
.login-logo { margin-bottom: 14px; }
.login-card h1 { margin: 0 0 6px; font-size: 21px; letter-spacing: -0.01em; }
.login-card .muted { font-size: 14px; margin: 0 0 4px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; text-align: left; }
#login-error { margin: 10px 0 0; font-size: 13px; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.profile-switcher { display: flex; gap: 8px; align-items: center; }

/* ---------- metrics ---------- */
.metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; padding: 16px 20px 4px; max-width: 1100px; margin: 0 auto;
}
.metric {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.metric .v { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; }
.metric .k { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 20px;
  border-bottom: 1px solid var(--line); background: var(--card);
  scrollbar-width: thin;
}
.tab {
  white-space: nowrap; border: 1px solid var(--line); background: var(--bg-soft);
  color: var(--ink-soft); border-radius: 999px; padding: 7px 16px; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: background .15s, color .15s, border-color .15s;
}
.tab:hover { border-color: #c7d2fe; color: var(--ink); background: var(--accent-soft); }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab.active:hover { background: var(--ink); color: #fff; }

/* ---------- job list ---------- */
#jobs { padding: 16px 20px 48px; max-width: 960px; margin: 0 auto; }
.job {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: box-shadow .15s, transform .15s;
}
.job:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.job-head { padding: 14px 16px; cursor: pointer; }
.job-head .co { font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; }
.job-head .ti { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.job-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge {
  font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; color: var(--muted); background: var(--bg-soft); line-height: 1.4;
}
.badge.sponsor-yes { color: var(--good); border-color: #bbf7d0; background: var(--good-soft); }
.badge.sponsor-no { color: var(--bad); border-color: #fecaca; background: var(--bad-soft); }
.badge.status-applied, .badge.status-sent { color: var(--accent); border-color: #c7d2fe; background: var(--accent-soft); }
.badge.status-submitted { color: var(--good); border-color: #bbf7d0; background: var(--good-soft); }
.badge.status-draft { color: var(--warn); border-color: #fde68a; background: var(--warn-soft); }
.badge.stage-found { color: var(--muted); }
.badge.stage-filtered_in { color: var(--good); border-color: #bbf7d0; background: var(--good-soft); }
.badge.stage-filtered_out { color: var(--bad); border-color: #fecaca; background: var(--bad-soft); }
.badge.reason { color: var(--warn); border-color: #fde68a; background: var(--warn-soft); }

/* ---------- pipeline filters ---------- */
.filters { display: flex; gap: 8px; margin: 0 auto 6px; flex-wrap: wrap; }
.filters select { flex: 1; min-width: 160px; }
.stage-head {
  font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
  margin: 20px 0 10px; font-weight: 700;
}

/* ---------- packet viewer ---------- */
.packet-pdf { width: 100%; height: 62vh; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); }
.section-title { font-weight: 700; margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.job-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 7px 0 7px 20px; border-left: 2px solid var(--line); position: relative; font-size: 13.5px; }
.timeline li::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  position: absolute; left: -5.5px; top: 12px;
}
.timeline .t { font-weight: 600; }
.timeline .d { color: var(--muted); font-size: 12.5px; }

/* ---------- job detail modal ---------- */
.detail-head { padding-right: 36px; }
.detail-company { margin: 0; font-size: 21px; letter-spacing: -0.02em; }
.detail-title { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px;
  margin: 18px 0; padding: 16px 18px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
}
.dg-k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.dg-v { font-size: 14px; font-weight: 500; color: var(--ink); margin-top: 2px; word-break: break-word; }
.detail-section { margin-top: 22px; }
.detail-section > h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.detail-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--card);
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 12px; text-transform: capitalize;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--ink-soft);
}
.pill-draft { color: var(--warn); border-color: #fde68a; background: var(--warn-soft); }
.pill-approved { color: var(--accent); border-color: #c7d2fe; background: var(--accent-soft); }
.pill-submitted, .pill-sent { color: var(--good); border-color: #bbf7d0; background: var(--good-soft); }
.outreach-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; background: var(--card);
}
.outreach-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.outreach-name { font-weight: 600; font-size: 14px; }
.outreach-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
pre.json {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 12px; overflow-x: auto; max-height: 240px; overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap;
}

/* ---------- buttons & inputs ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: none; border-radius: 9px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: background .15s, transform .05s, border-color .15s;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--accent-hover); color: #fff; }
button:active, .btn:active { transform: translateY(1px); }
button.ghost, .btn.ghost { background: var(--card); color: var(--ink-soft); border: 1px solid var(--line); }
button.ghost:hover, .btn.ghost:hover { background: var(--bg-soft); border-color: #cbd5e1; color: var(--ink); }
button.small, .btn.small { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font-size: 14px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d2fe; border-color: var(--accent); }
.profile-switcher select { width: auto; }
#add-profile { white-space: nowrap; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 28px 14px; z-index: 50; overflow-y: auto; backdrop-filter: blur(2px);
}
.modal-card {
  background: var(--card); border-radius: 16px; padding: 26px;
  width: 100%; max-width: 680px; position: relative; box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
.modal-close {
  position: absolute; top: 12px; right: 12px; background: var(--bg-soft); color: var(--muted);
  font-size: 20px; line-height: 1; padding: 0; width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line);
}
.modal-close:hover { background: var(--line); color: var(--ink); }
.modal-card h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .metrics { grid-template-columns: repeat(3, 1fr); padding: 12px 14px 2px; }
  .metric { padding: 10px; }
  .metric .v { font-size: 19px; }
  .tabs { padding: 10px 14px; }
  #jobs { padding: 12px 14px 40px; }
  .topbar { padding: 10px 14px; }
  .brand span { font-size: 14.5px; }
  .modal { padding: 12px 8px; }
  .modal-card { padding: 20px 16px; border-radius: 14px; }
  .detail-grid { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .detail-row { align-items: flex-start; flex-direction: column; }
}
