/* PM Job Finder – shared styles */
:root {
  --bg: #f6f7f9; --surface: #fff; --text: #0f172a; --muted: #64748b; --line: #e5e7eb; --soft: #f8fafc;
  --accent: #4f46e5; --accent-soft: #eef2ff; --accent-text: #4338ca;
  --green: #15803d; --green-soft: #ecfdf3; --amber: #b45309; --amber-soft: #fffbeb; --red: #b42318; --red-soft: #fef3f2;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* elements with display: grid/flex would otherwise ignore `hidden` */
body { margin: 0; background: var(--bg); color: var(--text);
       font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* App bar */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 28px; height: 56px;
          padding: 0 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #7c3aed);
              display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; }
nav { display: flex; gap: 4px; }
nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
nav a:hover { background: var(--soft); color: var(--text); text-decoration: none; }
nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.userbox { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* Page */
main { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
main.narrow { max-width: 860px; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 16px; font-weight: 650; margin: 36px 0 12px; }
h3 { font-size: 14px; font-weight: 650; margin: 20px 0 8px; }
.sub { color: var(--muted); margin: 4px 0 24px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* Controls */
input, select { font: inherit; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
                background: var(--surface); color: var(--text); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { height: auto; accent-color: var(--accent); }
label { color: var(--muted); display: flex; gap: 6px; align-items: center; }
button { font: inherit; font-weight: 600; height: 36px; padding: 0 14px; border-radius: 8px; cursor: pointer;
         border: 1px solid var(--accent); background: var(--accent); color: #fff; box-shadow: var(--shadow); }
button:hover:not(:disabled) { filter: brightness(1.06); }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
button:disabled { opacity: .5; cursor: default; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters input[type=search] { flex: 1; min-width: 240px; }

/* KPI cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px;
        box-shadow: var(--shadow); }
.stat b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13px; }
.stat h3 { margin: 0 0 8px; }
.stat dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.stat dt { color: var(--muted); }
.stat dd { margin: 0; font-weight: 600; text-align: right; }
button.stat { height: auto; text-align: left; color: var(--text); font-weight: 400; transition: transform .1s, border-color .1s; }
button.stat:hover { border-color: var(--accent); transform: translateY(-1px); filter: none; }
button.stat.active { border-color: var(--accent); background: var(--accent-soft); }

/* Segmented tabs */
.tabs { display: inline-flex; gap: 2px; padding: 4px; margin-bottom: 16px; background: var(--surface);
        border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
button.tab { height: 32px; background: none; border: none; box-shadow: none; color: var(--muted); padding: 0 14px; }
button.tab:hover { color: var(--text); filter: none; }
button.tab.active { background: var(--accent-soft); color: var(--accent-text); }
button.tab .muted { font-weight: 500; margin-left: 4px; }
button.tab.flash { background: var(--amber-soft); transition: background .3s; }

/* Tables */
.count { color: var(--muted); margin-bottom: 8px; font-size: 13px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
     padding: 10px 14px; background: var(--soft); border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; }
th.sorted { color: var(--accent); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--soft); }
tr.is-applied td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

a.ext { color: var(--muted); font-size: 12px; margin-left: 4px; }
a.ext:hover { color: var(--accent); text-decoration: none; }

/* Badges, grades, flags */
.badge { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 999px; margin-left: 6px;
         background: var(--soft); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.new, .badge.active { background: var(--accent-soft); color: var(--accent-text); border-color: #c7d2fe; }
.badge.closed { color: var(--red); }
.grade { display: inline-block; min-width: 40px; height: 26px; padding: 0 9px; border-radius: 999px; font-weight: 700;
         font-size: 13px; line-height: 24px; text-align: center; border: 1px solid var(--line); background: var(--soft);
         color: var(--text); box-shadow: none; }
.grade.apply, .badge.apply { background: var(--green-soft); color: var(--green); border-color: #abefc6; }
.grade.maybe, .badge.maybe { background: var(--amber-soft); color: var(--amber); border-color: #fedf89; }
.grade.skip, .badge.skip { background: var(--red-soft); color: var(--red); border-color: #fecdca; }
.flag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-left: 8px;
        background: var(--accent); color: #fff; white-space: nowrap; }
.flag.declined { background: var(--red-soft); color: var(--red); }
select.status { height: 30px; padding: 0 8px; font-size: 13px; }
input.applied { width: 16px; height: 16px; vertical-align: middle; }
button.archive { height: 28px; padding: 0 10px; font-size: 12px; font-weight: 500; background: var(--surface);
                 color: var(--muted); border-color: var(--line); box-shadow: none; }
button.archive:hover:not(:disabled) { color: var(--red); border-color: #fecdca; }

/* Reasoning row */
tr.detail td, tr.detail:hover td { background: var(--soft); }
.why { display: grid; grid-template-columns: 1.4fr 1.2fr 1fr; gap: 24px; }
.why h4 { margin: 4px 0 6px; font-size: 13px; }
.why ul { margin: 0; padding-left: 18px; }
.why p { margin: 0 0 6px; }
.sev { font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.sev.blocker { color: var(--red); }
.sev.major { color: var(--amber); }

/* Stage board (Applied tab) */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; overflow-x: auto;
         padding-bottom: 8px; align-items: start; }
.column { background: #eef0f4; border-radius: var(--radius); padding: 10px; min-height: 140px; border: 2px solid transparent; }
.column.drop { border-color: var(--accent); background: var(--accent-soft); }
.column.declined-zone { background: var(--red-soft); color: var(--red); display: grid; place-items: center; text-align: center;
                        font-size: 13px; font-weight: 500; }
.column.declined-zone.drop { border-color: var(--red); }
.column-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px;
               font-weight: 650; font-size: 13px; }
.column-head .pill { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 0 8px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px;
         box-shadow: var(--shadow); cursor: grab; }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; }
.kcard.is-declined { background: #fbfbfc; border-style: dashed; }
.kcard.is-declined .kcard-title { color: var(--muted); }
.kcard-company .flag { margin-left: 6px; text-transform: none; letter-spacing: 0; }
.kcard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.kcard-company { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kcard-title { display: block; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.kcard-cv { display: inline-block; font-size: 12px; font-weight: 500; margin-bottom: 10px; }
.kcard-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.kcard .grade { min-width: 34px; height: 22px; line-height: 20px; font-size: 12px; }
.empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 4px; }

/* CV sheet (cv.html, opp.html) – A4 proportions, prints as-is */
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow);
         padding: 44px 52px; max-width: 820px; color: #111827; font-size: 13px; line-height: 1.45; }
.sheet h1 { font-size: 26px; letter-spacing: .06em; text-transform: uppercase; margin: 0; }
.sheet .contact { color: #4b5563; margin: 4px 0 16px; }
.sheet .summary { font-size: 13.5px; margin: 0 0 18px; }
.sheet h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent);
            border-bottom: 1px solid #e5e7eb; padding-bottom: 4px; margin: 18px 0 10px; }
.cv-head { display: flex; align-items: center; gap: 12px; }
.li-logo { display: inline-flex; line-height: 0; }
.role { margin-bottom: 12px; }
.role-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.role-head span { font-weight: 400; color: #4b5563; white-space: nowrap; }
.role ul { margin: 4px 0 0; padding-left: 18px; }
.role li { margin-bottom: 3px; }
.skills p { margin: 0 0 4px; }
/* Match highlighting (opp.html): relevance colour scale and changed text */
.sheet.highlight li { border-radius: 4px; padding: 1px 4px; margin-left: -4px; }
.sheet.highlight li.rel-3 { background: #dcfce7; }
.sheet.highlight li.rel-2 { background: #f0fdf4; }
.sheet.highlight li.rel-1 { background: #fefce8; }
.sheet.highlight .changed { box-shadow: inset 3px 0 0 var(--accent); }
.sheet.highlight li.flash { outline: 2px solid var(--accent); }

/* Edit stages dialog */
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; width: 540px; max-width: 94vw;
         box-shadow: 0 24px 60px rgba(15, 23, 42, .3); color: var(--text); }
dialog::backdrop { background: rgba(15, 23, 42, .4); }
.stage-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.stage-row input.stage-label { flex: 1; }
.stage-row .count { min-width: 52px; text-align: right; }
.stage-row button { height: 32px; padding: 0 10px; }
.stage-row.removed { color: var(--muted); }
.stage-row.removed s { flex: 1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.add-form { display: grid; gap: 8px; }
.add-form textarea { font: inherit; resize: vertical; }
.fetch-one { height: 28px; padding: 0 10px; font-size: 12px; }

/* Cards, notices, toast (Settings / Analysis) */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 24px 16px;
        margin-bottom: 20px; box-shadow: var(--shadow); }
.notice { border: 1px solid #fedf89; background: var(--amber-soft); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 440px; padding: 14px 18px; border-radius: var(--radius);
         background: var(--text); color: #fff; box-shadow: 0 12px 32px rgba(15, 23, 42, .25); z-index: 10; font-weight: 500; }
#insights ol { padding-left: 20px; }
#insights li { margin-bottom: 12px; }
.proposal { margin-top: 6px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; }
