/* =====================================================================
   Jobready Rekrytering – utseende
   Layout: fast sidomeny + arbetsyta. Under 820px blir menyn en flikrad.
   ===================================================================== */
/* Utseende: ljus vit kristall, röda inslag, mjuka skuggor längs sidorna. Alltid ljust. */
:root, :root[data-theme="dark"] {
  color-scheme: light;
  --bg: #f3f5f8; --bg-top: #ffffff; --panel: #ffffff; --panel-2: #f8f9fb; --ink: #15171c; --muted: #5f6672; --line: #e3e6eb;
  --accent: #c8102e; --accent-2: #e0213f; --accent-ink: #ffffff; --accent-soft: #fdecef; --signal: #d81f3c; --signal-ink: #ffffff;
  --star: #c99a1a; --ok: #1f7a4d; --warn: #a96400; --bad: #b42318; --chip: #eef1f5; --mark: #ffe0e5;
  --sh-1: 0 1px 2px rgba(17, 24, 39, .04), 0 6px 20px rgba(17, 24, 39, .06);
  --sh-2: 0 2px 4px rgba(17, 24, 39, .05), 0 14px 36px rgba(17, 24, 39, .09);
  --sh-side: 8px 0 32px rgba(17, 24, 39, .07);
  --glans: rgba(200, 16, 46, .05);
  --f-ui: "Familjen Grotesk", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --r: 12px;
}

* { box-sizing: border-box }
html, body { height: 100% }
body { margin: 0; background-color: var(--bg); background-image: radial-gradient(900px 480px at 100% -8%, var(--glans), transparent 70%), linear-gradient(180deg, var(--bg-top) 0, var(--bg) 420px); background-attachment: fixed; color: var(--ink); font-family: var(--f-ui); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased }
a { color: var(--accent) }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; text-wrap: balance; line-height: 1.2 }
h2 { font-size: 16px; margin: 0 0 12px; text-wrap: balance }
h3 { font-size: 14px; margin: 0 0 8px }
.muted { color: var(--muted) }
.mono { font-family: var(--f-mono); font-size: 12.5px }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap }
.small { font-size: 13px }
[hidden] { display: none !important }

/* ---------- knappar och fält ---------- */
.btn { font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 8px; box-shadow: 0 1px 2px rgba(17, 24, 39, .05); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; line-height: 1.3 }
.btn:hover { border-color: var(--muted) }
.btn.sm { padding: 4px 10px; font-size: 13px }
.btn.pri { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 1px 2px rgba(200, 16, 46, .25), 0 6px 14px rgba(200, 16, 46, .18) }
.btn.pri:hover { filter: brightness(1.05) }
.btn.sig { background: var(--signal); color: var(--signal-ink); border-color: var(--signal) }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none }
.btn.ghost:hover { background: var(--chip) }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent }
.btn.danger.arm { background: var(--bad); color: var(--accent-ink) }
.btn:disabled { opacity: .45; cursor: not-allowed }
.btn.wide { width: 100%; justify-content: center }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .03em; min-width: 0 }
label.f > span.req::after { content: " *"; color: var(--signal) }
input, select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; min-width: 0 }
input:hover, select:hover, textarea:hover { border-color: var(--muted) }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; flex: none }
textarea { min-height: 72px; resize: vertical; line-height: 1.45 }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center }
.between { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center }
.stack { display: flex; flex-direction: column; gap: 12px }

/* ---------- inloggning ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 32px 16px }
.auth .card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: var(--sh-2) }
.brand { font-weight: 700; font-size: 22px; letter-spacing: -.02em }
.brand span { color: var(--signal) }
.brand small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .1em; text-transform: uppercase }
.msg { font-size: 14px; padding: 10px 12px; border-radius: 6px; background: var(--chip) }
.msg.err { color: var(--bad); background: transparent; border: 1px solid var(--bad) }
.msg.ok { color: var(--ok); background: transparent; border: 1px solid var(--ok) }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline }

/* ---------- ram ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100% }
nav.side { background: var(--panel); border-right: 1px solid var(--line); box-shadow: var(--sh-side); z-index: 5; padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto }
nav.side .brand { padding: 0 10px 18px }
nav.side .sep { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 4px; font-weight: 600 }
nav.side a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500 }
nav.side a:hover { background: var(--chip) }
nav.side a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent) }
nav.side a .n { font-family: var(--f-mono); font-size: 12px; min-width: 22px; text-align: center; border-radius: 99px }
nav.side a .n.hot { background: var(--signal); color: var(--signal-ink); padding: 0 7px }
nav.side .me { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 10px 0; font-size: 13px; display: flex; flex-direction: column; gap: 6px }
.rolechip { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; background: var(--chip); color: var(--muted); vertical-align: middle }
.rolechip.admin { background: var(--accent-soft); color: var(--accent) }
main { padding: 26px 32px 80px; min-width: 0; max-width: 1280px; width: 100% }
.demo-bar { background: var(--accent-soft); color: var(--ink); font-size: 13px; padding: 8px 32px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line) }
.pagehead { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px }
.pagehead p { margin: 4px 0 0; color: var(--muted); max-width: 70ch }

/* ---------- sök och filter ---------- */
.search { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px }
.ai { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start }
.ai textarea { min-height: 46px; height: 46px; resize: vertical; font-size: 15px }
.ai-lbl { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; letter-spacing: .03em }
.ai-lbl > span:first-child { color: var(--ink) }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel) }
.seg button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 7px 11px; cursor: pointer; white-space: nowrap }
.seg button + button { border-left: 1px solid var(--line) }
.seg button.on { background: var(--accent); color: var(--accent-ink) }
.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end }
.filters select { font-size: 14px; padding: 7px 8px }
.resbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin: 4px 0 10px; font-size: 14px }
.kbd { font-family: var(--f-mono); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted) }

/* ---------- lista ---------- */
.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: opacity .15s; box-shadow: var(--sh-1) }
.list.loading { opacity: .55 }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2) }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle }
.tbl tr:last-child td { border-bottom: 0 }
.tbl tr.rad { cursor: pointer }
.tbl tr.rad:hover td { background: var(--panel-2) }
.tbl tr.ut td { padding-top: 0; color: var(--muted); font-size: 13px; cursor: pointer }
.tbl tr.harut td { border-bottom: 0 }
.who { display: flex; gap: 10px; align-items: center; min-width: 0 }
.who b { display: block; font-weight: 600 }
.thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; background: var(--chip); flex: none; display: block }
.thumb.ph { display: grid; place-items: center; font-weight: 700; color: var(--muted); font-size: 13px }
.stars { color: var(--star); letter-spacing: 1px; white-space: nowrap }
.stars b { color: var(--ink); font-family: var(--f-mono); font-weight: 500; letter-spacing: 0; margin-left: 4px; font-size: 13px }
.match { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: 13px; font-weight: 500 }
.match i { display: inline-block; width: 44px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; position: relative }
.match i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p); background: var(--accent) }
.list.loading, #ag-lista.loading { opacity: .55 }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--chip); white-space: nowrap }
.pill.ok { color: var(--ok) } .pill.warn { color: var(--warn) } .pill.bad { color: var(--bad) } .pill.acc { color: var(--accent) } .pill.sig { color: var(--signal) }
.empty { padding: 36px 20px; text-align: center; color: var(--muted) }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 14px; background: var(--panel-2) }
.skel { height: 14px; border-radius: 4px; background: var(--chip); animation: puls 1.2s ease-in-out infinite }
@keyframes puls { 50% { opacity: .5 } }

/* ---------- kandidatsida ---------- */
.khead { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 18px }
.khead .back { margin-right: 4px }
.khead .title { flex: 1; min-width: 200px }
.khead .title .mono { color: var(--muted) }
.save { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center }
.save .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok) }
.save.busy .dot { background: var(--warn) } .save.err { color: var(--bad) } .save.err .dot { background: var(--bad) }
.kgrid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sh-1) }
.panel + .panel { margin-top: 0 }
.panel h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px }
.fgrid .full { grid-column: 1 / -1 }
.fgrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)) }
.rate { display: flex; gap: 4px }
.rate button { font: inherit; font-family: var(--f-mono); width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer }
.rate button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.side-col { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px }
.photo { width: 100%; aspect-ratio: 1; max-width: 100%; border-radius: 8px; object-fit: cover; background: var(--chip); display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center }
img.photo { display: block }
.checks { display: flex; flex-direction: column }
.checks label { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; cursor: pointer }
.checks label:last-child { border-bottom: 0 }
.missing { font-size: 13px; color: var(--warn); margin: 6px 0 0; padding-left: 18px }
.ready-ok { font-size: 13px; color: var(--ok); font-weight: 600 }
.docs { display: flex; flex-direction: column; gap: 8px }
.doc { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px }
.doc .name { font-weight: 600; overflow-wrap: anywhere }
.drop { border: 1.5px dashed var(--line); border-radius: 8px; padding: 14px; text-align: center; font-size: 13.5px; color: var(--muted); cursor: pointer }
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink) }
.logglist { font-size: 13px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto }
.logglist div { border-left: 2px solid var(--line); padding-left: 8px }
details.box { border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--panel-2) }
details.box summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; list-style: none; display: flex; justify-content: space-between; gap: 8px }
details.box summary::-webkit-details-marker { display: none }
details.box summary::after { content: "Visa"; font-weight: 500; color: var(--accent); font-size: 13px }
details.box[open] summary::after { content: "Dölj" }
details.box[open] { padding-bottom: 12px }
.q { font-size: 12.5px; color: var(--muted); font-weight: 500; letter-spacing: 0 }
.confirmbox { border: 1px solid var(--bad); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-weight: 600; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.18) }
.toast.err { background: var(--bad); color: #fff }
.boot { min-height: 100%; display: grid; place-items: center; color: var(--muted) }

/* ---------- konton/logg ---------- */
.cards2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start }

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)) }
  .kgrid, .cards2 { grid-template-columns: 1fr }
  .side-col { position: static }
  .photo { max-width: 220px }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr }
  nav.side { position: sticky; top: 0; height: auto; flex-direction: row; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); z-index: 10; align-items: center }
  nav.side .brand, nav.side .sep { display: none }
  nav.side a { white-space: nowrap; flex: none }
  nav.side .me { margin: 0 0 0 auto; border: 0; padding: 0; flex-direction: row; align-items: center; flex: none }
  nav.side .me .who-me { display: none }
  main { padding: 18px 16px 80px }
  .demo-bar { padding: 8px 16px }
  .filters, .fgrid, .fgrid.three { grid-template-columns: 1fr 1fr }
  .ai { grid-template-columns: 1fr }
  .tbl .hide-m { display: none }
}
@media (max-width: 480px) { .filters, .fgrid, .fgrid.three { grid-template-columns: 1fr } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important } }

/* ---------- kandidatanalys ---------- */
.lead { font-size: 16px; margin: 0; line-height: 1.5 }
.lbl { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px }
.agrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px }
.agrid > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px }
.tl { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px }
.chips { display: flex; flex-wrap: wrap; gap: 6px }
.chip { font-size: 12.5px; padding: 2px 9px; border-radius: 99px; background: var(--chip); border: 1px solid var(--line) }
.chip.red { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600 }
.note-ny { font-size: 14px; background: var(--accent-soft); border-radius: 8px; padding: 8px 10px }
.note-varn { font-size: 14px; border: 1px solid var(--warn); border-radius: 8px; padding: 8px 10px; color: var(--ink) }
.note-varn ul { margin: 4px 0 0; padding-left: 18px }

/* ---------- arbetsgivarens kort ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px }
.cand { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; box-shadow: var(--sh-1); transition: box-shadow .15s }
.cand:hover { box-shadow: var(--sh-2) }
.cand.top { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--sh-2) }
.cand .head { display: grid; grid-template-columns: 68px minmax(0, 1fr) 64px; gap: 12px; align-items: center }
.photo-sm { width: 68px; height: 68px; border-radius: 10px; object-fit: cover; display: block; background: var(--chip) }
.photo-sm.ph { display: grid; place-items: center; font-family: var(--f-mono); font-size: 12px; color: var(--muted) }
.code { font-family: var(--f-mono); font-size: 12px; color: var(--muted) }
.cand .role { font-weight: 700; font-size: 17px; line-height: 1.2; color: var(--ink); text-decoration: none }
.cand .role:hover { color: var(--accent) }
.ring { position: relative; width: 64px; height: 64px }
.ring svg { display: block }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-mono); font-weight: 500; font-size: 14px; padding-bottom: 6px }
.ring small { position: absolute; left: 0; right: 0; bottom: 13px; text-align: center; font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em }
.summary { margin: 0; font-size: 14.5px; padding: 10px 12px; background: var(--panel-2); border-radius: 8px; border: 1px solid var(--line) }
dl.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 14px }
dl.facts dt { color: var(--muted) }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere }
blockquote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; font-size: 15px }
.assess { font-size: 13.5px; display: flex; flex-direction: column; gap: 4px }
.scores { display: flex; gap: 8px; flex-wrap: wrap }
.scores span { font-size: 12.5px; background: var(--chip); padding: 2px 8px; border-radius: 6px }
.scores b { font-family: var(--f-mono) }
.utdrag { margin: 0; color: var(--muted) }
.locked { display: flex; gap: 12px; align-items: center; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2) }
.lock { width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--accent-soft); position: relative }
.lock::before { content: ""; position: absolute; left: 9px; top: 6px; width: 10px; height: 9px; border: 2px solid var(--accent); border-bottom: 0; border-radius: 6px 6px 0 0 }
.lock::after { content: ""; position: absolute; left: 7px; top: 13px; width: 14px; height: 10px; background: var(--accent); border-radius: 3px }
.blurtext { filter: blur(5px); user-select: none; -webkit-user-select: none; font-size: 13.5px; line-height: 1.4; color: var(--ink); pointer-events: none }
.kontakt { border: 1px solid var(--ok); border-radius: 10px; padding: 10px 12px; font-size: 14.5px }
.sprad { display: grid; grid-template-columns: 38px minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none }
.sprad:last-child { border-bottom: 0 }
.sprad:hover { background: var(--panel-2) }
.sp-namn { display: flex; flex-direction: column; min-width: 0 }
@media (max-width: 1100px) { .cards { grid-template-columns: 1fr } }
@media (max-width: 640px) {
  .sprad { grid-template-columns: 38px minmax(0, 1fr) auto }
  .sprad .sp-kontakt { display: none }
  .agrid { grid-template-columns: 1fr }
  .cand .head { grid-template-columns: 56px minmax(0, 1fr) 64px }
  .photo-sm { width: 56px; height: 56px }
}

/* ---------- Dataskydd ---------- */
.dsgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px }
.dsgrid .lbl { margin-bottom: 2px }
@media (max-width: 640px) { .dsgrid { grid-template-columns: 1fr } }
.ai-stod { font-size: 12px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, #fff); border-radius: 8px; padding: 6px 10px }
.ai-godk { border-top: 1px solid var(--line); padding-top: 12px }
.ai-godk textarea { width: 100% }
.ds-form { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fcfcfd }
