/* Job Finder — light, laptop-first UI */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --green: #047857;
  --green-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .06);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --topbar: 56px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); margin: 0 0 12px; }
kbd {
  font: 11px var(--font); border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 4px; background: var(--surface); margin: 0 1px;
}

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  color: var(--text-2); font-weight: 500; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow); transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: #9ca3af; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.ghost:hover { background: #f3f4f6; }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; justify-content: center; height: 40px; }
.btn:disabled { opacity: .55; cursor: default; }
input[type="url"], input[type="search"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  padding: 7px 10px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); outline: none;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: grid; grid-template-columns: 260px 1fr auto; align-items: center; gap: 16px;
  padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.views { display: flex; gap: 4px; }
.view-btn {
  border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.view-btn:hover { background: #f3f4f6; color: var(--text); }
.view-btn.active { background: var(--accent-soft); color: var(--accent); }
.count {
  display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px;
  background: #f3f4f6; color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: center;
}
.view-btn.active .count { background: #e0e7ff; color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.scan-status { color: var(--muted); font-size: 13px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-status.running::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%;
  background: var(--accent); animation: pulse 1s infinite ease-in-out;
}
@keyframes pulse { 50% { opacity: .25; } }
.split { display: flex; }
.split .btn:first-child { border-radius: 8px 0 0 8px; }
.split .split-more { border-radius: 0 8px 8px 0; border-left: 1px solid rgba(255,255,255,.35); background: #6366f1; }
.split .split-more:hover { background: var(--accent-hover); }
.menu-wrap { position: relative; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: #e0e7ff; color: var(--accent);
  font-weight: 700;
}
.menu {
  position: absolute; right: 0; top: 42px; width: 260px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 30;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-email { font-weight: 600; }
.menu-sub { color: var(--muted); font-size: 12.5px; }
.menu button {
  display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px;
}
.menu button:hover { background: #f3f4f6; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------- discover layout ---------- */
.discover {
  display: grid; grid-template-columns: 260px minmax(340px, 440px) 1fr;
  height: calc(100vh - var(--topbar));
}
.sidebar {
  border-right: 1px solid var(--line); background: var(--surface); padding: 18px 16px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
}
.side-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: block; }
.input-row { display: flex; gap: 6px; }
.input-row .btn { height: auto; }
.lists { display: flex; flex-direction: column; gap: 2px; }
.lists button {
  display: flex; justify-content: space-between; align-items: center; border: 0; background: none;
  padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; text-align: left;
}
.lists button:hover { background: #f3f4f6; }
.lists button.active { background: var(--accent-soft); color: var(--accent); }
.lists button.active .count { background: #e0e7ff; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 11px;
  font-size: 13px; color: var(--text-2);
}
.chip:hover { border-color: #9ca3af; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.segmented { display: inline-flex; background: #f3f4f6; border-radius: 9px; padding: 3px; }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; font-size: 13px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.shortcuts { margin-top: auto; color: var(--muted); font-size: 12px; line-height: 1.9; }

.list-pane { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; background: var(--surface-2); }
.search-row { padding: 14px 14px 8px; }
.list-meta { padding: 0 16px 8px; color: var(--muted); font-size: 12.5px; }
.job-list { list-style: none; margin: 0; padding: 0 8px 16px; overflow-y: auto; flex: 1; }
.job-item {
  display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 11px 10px; border-radius: 10px;
  cursor: pointer; border: 1px solid transparent; margin-bottom: 2px;
}
.job-item:hover { background: var(--surface); border-color: var(--line); }
.job-item.selected { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.08); }
.job-item .title { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.job-item .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-item .tags { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* score pill */
.score {
  display: inline-grid; place-items: center; height: 26px; min-width: 40px; padding: 0 8px; border-radius: 999px;
  font-weight: 700; font-size: 13px; background: #f3f4f6; color: var(--muted); font-variant-numeric: tabular-nums;
}
.score.high { background: var(--green-soft); color: var(--green); }
.score.mid { background: var(--amber-soft); color: var(--amber); }
.score.lg { height: 34px; min-width: 56px; font-size: 16px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 1px 8px;
  border-radius: 999px; background: #f3f4f6; color: var(--text-2); white-space: nowrap;
}
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- detail ---------- */
.detail-pane { overflow-y: auto; background: var(--surface); }
.detail { max-width: 860px; padding: 28px 36px 60px; }
.detail-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 40px; }
.detail-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.detail h1 { font-size: 22px; line-height: 1.3; margin: 0 0 4px; letter-spacing: -.01em; }
.detail .company { color: var(--text-2); font-size: 15px; }
.detail .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.detail .tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 18px 0 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.actions select { width: auto; height: 34px; padding: 0 30px 0 10px; }
.spacer { flex: 1; }
.card {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; background: var(--surface);
}
.card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; justify-content: space-between; }
.why { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-card { border-color: #c7d2fe; background: linear-gradient(180deg, #f5f7ff, #fff 70%); }
.ai-verdict { font-weight: 600; font-size: 15px; margin: 0 0 12px; }
.ai-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ai-cols ul { margin: 4px 0 0; padding-left: 18px; }
.ai-cols li { margin-bottom: 3px; }
.ai-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.ai-pitch { margin: 14px 0 0; padding: 10px 12px; background: var(--surface); border: 1px dashed #c7d2fe; border-radius: 8px; color: var(--text-2); }
.ai-actions { display: flex; gap: 8px; margin-top: 14px; }
.notes textarea { min-height: 84px; resize: vertical; }
.notes .saved { font-size: 12px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.ad-text { color: var(--text-2); white-space: pre-wrap; line-height: 1.65; font-size: 14px; }
.ad-text.clamped { max-height: 320px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }

/* ---------- pipeline ---------- */
.pipeline { height: calc(100vh - var(--topbar)); position: relative; }
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 16px; padding: 20px; height: 100%; overflow-x: auto; }
.column { background: #eef0f3; border-radius: 12px; display: flex; flex-direction: column; min-height: 0; }
.column.drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.column-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 8px; font-weight: 600; }
.column-head .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.column-body { padding: 4px 10px 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  box-shadow: var(--shadow); cursor: grab;
}
.kcard:hover { border-color: var(--line-strong); }
.kcard.dragging { opacity: .5; }
.kcard .title { font-weight: 600; line-height: 1.35; }
.kcard .sub { color: var(--muted); font-size: 12.5px; }
.kcard .row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 6px; }
.column-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 8px; border: 1px dashed var(--line-strong); border-radius: 10px; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(760px, 62vw); background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow-y: auto; z-index: 10;
}
.drawer-close {
  position: absolute; top: 14px; right: 16px; width: 32px; height: 32px; border-radius: 8px; border: 0;
  background: #f3f4f6; font-size: 20px; line-height: 1; color: var(--muted);
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111827; color: #fff;
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 50; max-width: 560px;
}
.toast.error { background: var(--red); }

/* ---------- dialogs ---------- */
dialog {
  border: 0; border-radius: 16px; padding: 24px 26px; width: min(720px, 92vw); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(17, 24, 39, .35); }
dialog h2 { margin: 0 0 4px; font-size: 18px; }
dialog p.muted { margin: 0 0 14px; }
dialog label { display: block; margin-bottom: 14px; font-weight: 500; }
dialog label input { margin-top: 6px; }
dialog textarea { font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
#password-dialog { width: min(440px, 92vw); }

/* ---------- login ---------- */
body.login {
  display: grid; place-items: center; min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% -10%, #e0e7ff 0, transparent 60%), var(--bg);
}
.login-card {
  width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 32px; box-shadow: var(--shadow-lg);
}
.login-card .brand { margin-bottom: 28px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
.login-card p.muted { margin: 0 0 22px; }
.login-card label { display: block; margin-bottom: 14px; font-weight: 500; }
.login-card input { margin-top: 6px; height: 40px; }
.drawer .detail { padding-right: 64px; }
