/* Elvins Rutt – mörkt tema som standard, ljust läge med data-theme="light" på <html>.
   Accentfärgen styrs av --accent (och --accent-ink för text ovanpå accenten). */

:root {
  --bg: #0a0a0c;
  --surface: #141417;
  --surface-2: #1c1c21;
  --line: #2a2a31;
  --ink: #f6f6f8;
  --ink-soft: #a6a6b0;
  --ink-faint: #6e6e78;
  --accent: #5b8cff;
  --accent-ink: #0a0a0c;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --warn: #ffb23e;
  --warn-soft: color-mix(in srgb, var(--warn) 16%, transparent);
  --bad: #ff5d5d;
  --bad-soft: color-mix(in srgb, var(--bad) 15%, transparent);
  --focus: var(--accent);
  --radius: 20px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --display: "Archivo", "Arial Black", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 72px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f3f0;
  --surface: #ffffff;
  --surface-2: #e9e9e4;
  --line: #dcdcd6;
  --ink: #111114;
  --ink-soft: #55555e;
  --ink-faint: #85858e;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --warn: #a35f00;
  --bad: #c62828;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.03), 0 14px 30px -20px rgba(20, 20, 30, 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  transition: background-color 0.25s ease, color 0.25s ease;
}

button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Topbar & navigering ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  /* Ingen backdrop-filter här på mobil: den skulle låsa den fasta menyn (.tabs) inne i topplisten. */
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.brand-mark svg { width: 22px; height: 22px; stroke-width: 3; }
.brand-name { font-family: var(--display); font-weight: 900; font-size: 1.25rem; letter-spacing: -0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  position: relative; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; cursor: pointer;
  padding: 6px 4px; border-radius: 16px;
  color: var(--ink-faint); font-size: 0.74rem; font-weight: 600;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.tab:active { transform: scale(0.94); }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] svg { color: var(--accent); stroke-width: 2.5; }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 2px; width: 44px; height: 30px; border-radius: 999px;
  background: var(--accent-soft); z-index: -1;
}
.tab-count {
  position: absolute; top: 2px; left: calc(50% + 8px);
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 0.7rem; font-weight: 800; display: grid; place-items: center;
}
.tab-dot { position: absolute; top: 6px; left: calc(50% + 10px); width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 3px var(--surface); }

@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .topbar { padding: 14px 32px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .tabs { position: static; display: flex; gap: 6px; background: none; border: 0; padding: 0; backdrop-filter: none; }
  .tab { flex-direction: row; gap: 8px; min-height: 44px; font-size: 0.95rem; padding: 8px 16px; border-radius: 999px; }
  .tab svg { width: 18px; height: 18px; }
  .tab:hover { color: var(--ink); background: var(--surface-2); }
  .tab[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
  .tab[aria-current="page"] svg { color: currentColor; }
  .tab[aria-current="page"]::before { display: none; }
  .tab-count, .tab-dot { position: static; box-shadow: none; }
  .tab[aria-current="page"] .tab-count { background: var(--accent-ink); color: var(--accent); }
}

main { max-width: 1120px; margin: 0 auto; padding: 8px 16px 140px; outline: none; }
@media (min-width: 760px) { main { padding-left: 32px; padding-right: 32px; } }

/* ---------- Sidhuvud ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin: 20px 0 22px; }
.page-head h1 { font-size: clamp(2.2rem, 7vw, 3.4rem); line-height: 0.98; font-weight: 900; letter-spacing: -0.035em; }
.page-head h1 .accent { color: var(--accent); }
.page-head p { margin: 10px 0 0; color: var(--ink-soft); max-width: 60ch; }
.head-links { margin-top: 14px !important; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
@media (min-width: 760px) { .stats { width: auto; } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; min-width: 104px; }
.stat b { display: block; font-family: var(--display); font-weight: 900; font-size: 1.9rem; line-height: 1; }
.stat:first-child b { color: var(--accent); }
.stat span { font-size: 0.78rem; color: var(--ink-soft); line-height: 1.25; display: block; margin-top: 4px; }

/* ---------- Verktygsrad ---------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; min-height: 52px;
  transition: border-color 0.15s ease;
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 20px; height: 20px; color: var(--ink-faint); flex: none; }
.search input { border: 0; background: none; padding: 12px 0; width: 100%; outline: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  min-height: 44px; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 0.92rem; font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
select.sort { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 0 14px; min-height: 48px; font-weight: 600; }

/* ---------- Jobbkort ---------- */

.job-list { display: grid; gap: 14px; }
@media (min-width: 900px) { .job-list { grid-template-columns: 1fr 1fr; } }

.job {
  position: relative;
  display: flow-root;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); cursor: pointer; text-align: left; width: 100%;
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
  animation: card-in 0.35s ease both;
}
.job:nth-child(2) { animation-delay: 0.03s; } .job:nth-child(3) { animation-delay: 0.06s; }
.job:nth-child(4) { animation-delay: 0.09s; } .job:nth-child(5) { animation-delay: 0.12s; }
.job:nth-child(n + 6) { animation-delay: 0.15s; }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } }
.job:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
.job.is-picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }

/* Siffran flyter till höger, så att texten under får hela kortets bredd. */
.job-main { min-width: 0; }
.job .ring { float: right; margin: 0 0 8px 14px; }
.job h3 { font-family: var(--display); font-weight: 800; font-size: 1.22rem; line-height: 1.18; letter-spacing: -0.015em; }
.job .employer { color: var(--ink); opacity: 0.8; font-size: 0.95rem; margin-top: 4px; font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 0.86rem; color: var(--ink-soft); }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta svg { width: 15px; height: 15px; }
.excerpt { margin: 10px 0 0; font-size: 0.9rem; color: var(--ink-soft); line-height: 1.5; overflow-wrap: anywhere; }
.reasons { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.reason { font-size: 0.78rem; font-weight: 600; background: var(--surface-2); color: var(--ink-soft); padding: 4px 10px; border-radius: 999px; }
.reason.hit { background: var(--accent-soft); color: var(--accent); }

/* Matchningssiffran: stor och tydlig */
.ring {
  --p: 0; --c: var(--accent);
  width: 72px; height: 72px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center;
}
.ring::before { content: ""; grid-area: 1/1; width: 60px; height: 60px; border-radius: 50%; background: var(--surface); }
.ring span { grid-area: 1/1; position: relative; font-family: var(--display); font-weight: 900; font-size: 1.55rem; line-height: 1; letter-spacing: -0.03em; }
.ring span::after { content: "%"; font-size: 0.55em; font-weight: 800; margin-left: 1px; opacity: 0.6; }
.ring[data-tone="high"] span { color: var(--accent); }
.ring[data-tone="mid"] { --c: var(--warn); }
.ring[data-tone="low"] { --c: var(--ink-faint); }
.ring[data-tone="low"] span { color: var(--ink-soft); }

.job-foot {
  clear: both; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px;
}
.foot-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; margin-left: auto; }
.new-badge { font-size: 0.78rem; font-weight: 800; color: var(--accent-ink); background: var(--accent); padding: 4px 10px; border-radius: 999px; letter-spacing: 0.02em; }
.status-badge { font-size: 0.78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.deadline-text { font-size: 0.82rem; color: var(--ink-soft); }
.source { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.removed-badge { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--bad-soft); color: var(--bad); margin-top: 4px; }
.apply-hint { font-size: 0.8rem; color: var(--ink-soft); align-self: center; }

.icon-btn {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px;
  min-height: 44px; min-width: 44px; padding: 8px 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  font-size: 0.86rem; font-weight: 600; color: var(--ink-soft);
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }
.icon-btn[aria-pressed="true"] svg { fill: currentColor; animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pop { 0% { transform: scale(0.6); } 100% { transform: scale(1); } }

.pick {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font-size: 0.88rem; font-weight: 700; color: var(--ink);
  border: 1.5px solid var(--accent); border-radius: 999px; padding: 8px 14px; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.pick:active { transform: scale(0.96); }
.pick svg { width: 17px; height: 17px; }
.pick input { accent-color: var(--accent); margin: 0; width: 18px; height: 18px; }
.pick:has(input:checked) { background: var(--accent); color: var(--accent-ink); }

.empty {
  text-align: center; padding: 48px 20px; color: var(--ink-soft);
  border: 1.5px dashed var(--line); border-radius: var(--radius);
}
.empty h3 { color: var(--ink); margin-bottom: 8px; font-size: 1.4rem; }

.skeleton { height: 190px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Knappar ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; border: 1.5px solid transparent; border-radius: 999px; padding: 10px 22px;
  font-weight: 700; cursor: pointer; text-decoration: none; letter-spacing: -0.005em;
  transition: transform 0.1s ease, filter 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 19px; height: 19px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px -12px var(--accent); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-faint); }
.btn-danger { background: none; color: var(--bad); border-color: var(--bad-soft); }
.btn-sm { min-height: 40px; padding: 6px 16px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; box-shadow: none; transform: none; }
.btn.is-busy { position: relative; pointer-events: none; }
.btn.is-busy::after { content: ""; width: 16px; height: 16px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Ansökningstavla ---------- */

.board { display: grid; gap: 14px; }
@media (min-width: 760px) { .board { grid-template-columns: repeat(4, 1fr); align-items: start; } }
.column { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.column h2 { font-family: var(--display); font-size: 1rem; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.column h2 .dot { width: 10px; height: 10px; border-radius: 50%; }
.column h2 .n { margin-left: auto; color: var(--ink-soft); font-weight: 700; font-family: var(--sans); font-size: 0.85rem; background: var(--surface-2); padding: 1px 9px; border-radius: 999px; }
.column-empty { font-size: 0.88rem; color: var(--ink-faint); padding: 10px 2px; }
.mini {
  background: var(--surface-2); border: 1px solid transparent; border-radius: 14px; padding: 14px;
  margin-bottom: 8px; cursor: pointer; width: 100%; text-align: left;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.mini:hover { border-color: var(--ink-faint); }
.mini:active { transform: scale(0.98); }
.mini b { display: block; font-weight: 700; font-size: 0.98rem; line-height: 1.3; }
.mini small { color: var(--ink-soft); }
.mini .deadline { display: block; margin-top: 6px; font-size: 0.8rem; color: var(--ink-faint); }
.mini .deadline.soon { color: var(--bad); font-weight: 700; }

/* ---------- Formulär ---------- */

.form { display: grid; gap: 18px; max-width: 680px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.field { display: grid; gap: 8px; }
.field label, .field legend { font-weight: 700; font-size: 0.98rem; }
.field .hint { font-size: 0.86rem; color: var(--ink-soft); margin: 0; }
.field input[type="text"], .field input[type="email"], .field input[type="date"], .field select, .field textarea {
  border: 1.5px solid var(--line); background: var(--bg); border-radius: 14px; padding: 12px 14px; width: 100%; min-height: 50px;
  transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field textarea { min-height: 100px; resize: vertical; }
fieldset.field { border: 0; padding: 0; margin: 0; }
.checks { display: flex; gap: 8px; flex-wrap: wrap; }
.checks label {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.checks label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.checks input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; border: 1.5px solid var(--line); background: var(--bg); border-radius: 14px; padding: 8px; }
.tag-input input { flex: 1 1 120px; border: 0; background: none; padding: 6px; outline: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 4px 4px 4px 12px; font-size: 0.9rem; font-weight: 600; }
.tag button { border: 0; background: none; color: inherit; cursor: pointer; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.tag button svg { width: 13px; height: 13px; stroke-width: 3; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Ljust/mörkt läge */
.theme-switch { display: inline-flex; background: var(--bg); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; }
.theme-switch button { border: 0; background: none; min-height: 40px; padding: 6px 16px; border-radius: 999px; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---------- Detaljvy ---------- */

dialog#detail {
  border: 0; padding: 0; width: min(720px, 100%); max-height: 94dvh;
  background: var(--surface); color: var(--ink);
  border-radius: 26px 26px 0 0; margin: auto auto 0;
}
@media (min-width: 760px) { dialog#detail { border-radius: 26px; margin: auto; max-height: 90dvh; border: 1px solid var(--line); } }
dialog#detail::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
dialog[open] { animation: rise 0.28s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.d-head { position: sticky; top: 0; z-index: 1; background: var(--surface); padding: 20px 20px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: start; }
.d-head h2 { font-size: 1.55rem; line-height: 1.12; }
.d-head .employer { color: var(--ink-soft); margin-top: 6px; }
.d-close { margin-left: auto; flex: none; }
.d-body { padding: 18px 20px 28px; display: grid; gap: 22px; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; }
.facts div { background: var(--surface-2); border-radius: 14px; padding: 10px 14px; }
.facts dt { font-size: 0.72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.facts dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.section-title { font-family: var(--sans); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin-bottom: 8px; }
.job-desc { margin: 0; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.6; }
.status-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.letter { width: 100%; min-height: 280px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--bg); padding: 14px; line-height: 1.6; resize: vertical; }
.letter:focus { border-color: var(--accent); outline: none; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Toast ---------- */

#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 24px) scale(0.96);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px;
  font-size: 0.92rem; font-weight: 700; opacity: 0; pointer-events: none; z-index: 50;
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
@media (min-width: 760px) { #toast { bottom: 32px; } }

/* ---------- Notiser ---------- */

.notice {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: 18px; padding: 14px 16px; margin: 12px 0 16px; font-size: 0.94rem;
}
.notice b { color: var(--warn); }
.notice.warn { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.notice.warn b { color: var(--bad); }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Vald-lista och granskning ---------- */

.select-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 10px; justify-content: center;
  width: max-content; max-width: calc(100% - 24px);
  background: var(--ink); color: var(--bg); border-radius: 999px; padding: 8px 8px 8px 20px;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.7);
  animation: bar-in 0.3s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes bar-in { from { transform: translate(-50%, 30px); opacity: 0; } }
.select-bar b { font-family: var(--display); font-size: 1.15rem; }
.select-bar .btn-ghost { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.select-bar .btn-primary { box-shadow: none; }
@media (min-width: 760px) { .select-bar { bottom: 24px; } }
@media (max-width: 759px) { .select-bar #clear-picks { display: none; } }
body:has(.select-bar) #toast { bottom: calc(var(--nav-h) + 90px + env(safe-area-inset-bottom)); }
@media (min-width: 760px) { body:has(.select-bar) #toast { bottom: 100px; } }

.review-checks { display: grid; gap: 14px; margin-bottom: 16px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.checklist .check-text { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.checklist li { flex-wrap: nowrap !important; align-items: flex-start !important; }
.checklist .check-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; flex: none; }
.checklist .ok > .check-icon { background: var(--accent); color: var(--accent-ink); }
.checklist .todo > .check-icon { background: var(--warn-soft); color: var(--warn); }
.test-mode { display: flex; gap: 10px; align-items: flex-start; font-size: 0.94rem; }
.test-mode input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; }
.review-item { display: grid; gap: 14px; margin-bottom: 14px; transition: border-color 0.3s ease, opacity 0.3s ease; }
.review-item.is-sent { border-color: var(--accent); animation: sent 0.6s ease; }
.review-item.is-failed { border-color: var(--bad); }
@keyframes sent { 30% { transform: scale(1.012); } }
.review-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.review-head h3 { font-size: 1.2rem; }
.review-item .employer, .review-item .hint { color: var(--ink-soft); font-size: 0.9rem; margin: 0; }
.review-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 12px; justify-content: flex-start; }
@media (min-width: 760px) { .review-actions { bottom: 0; } }
.result { margin: 0; font-weight: 700; font-size: 0.94rem; padding: 10px 14px; border-radius: 14px; }
.result.ok { background: var(--accent-soft); color: var(--accent); }
.result.fail { background: var(--bad-soft); color: var(--bad); }
.repeat-warn { color: var(--warn); font-size: 0.86rem; font-weight: 700; margin: 4px 0 0; }

/* ---------- Aktivitetsrapport ---------- */

.field-inline { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.report-summary { display: grid; gap: 18px; margin-bottom: 16px; }
@media (min-width: 760px) { .report-summary { grid-template-columns: auto 1fr; align-items: start; } }
.big-number { display: grid; justify-items: start; }
.big-number b { font-family: var(--display); font-weight: 900; font-size: 4.6rem; line-height: 0.9; color: var(--accent); letter-spacing: -0.04em; }
.big-number span { color: var(--ink-soft); font-size: 0.98rem; margin-top: 6px; }
.report-status { display: grid; gap: 10px; justify-items: start; }
.report-status p { margin: 0; }
.table-card { padding: 0; overflow: hidden; margin-bottom: 16px; }
.report-section { padding: 0; }
.report-h { font-family: var(--display); font-size: 1.05rem; padding: 16px 16px 8px; display: flex; gap: 8px; align-items: center; }
.report-h .n { font-family: var(--sans); font-size: 0.8rem; background: var(--surface-2); border-radius: 999px; padding: 1px 9px; color: var(--ink-soft); }
.report-section .column-empty { padding: 4px 16px 16px; margin: 0; }
table.report { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.report th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.report td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.report tr:last-child td { border-bottom: 0; }
table.report tr.is-done td { color: var(--ink-faint); }
table.report .cell-check input { width: 22px; height: 22px; accent-color: var(--accent); }
.cell-date { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 6px 8px; font-size: 0.86rem; max-width: 9.5em; }
.cell-extra { font-size: 0.82rem; color: var(--ink-soft); }
.sent-letter { white-space: pre-wrap; font-family: inherit; font-size: 0.85rem; background: var(--bg); padding: 10px; border-radius: 10px; max-height: 16em; overflow: auto; }
.report-foot { color: var(--ink-soft); font-size: 0.86rem; margin: 12px 0; }
.manual-form { display: grid; gap: 16px; }
@media (max-width: 700px) {
  table.report thead { display: none; }
  table.report tr { display: grid; grid-template-columns: auto 1fr 1fr; gap: 2px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
  table.report td { padding: 2px 0; border: 0; }
  table.report td[data-label]::before { content: attr(data-label); display: block; font-size: 0.7rem; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
  table.report td.cell-check { grid-row: span 3; }
  table.report td.cell-extra, table.report td[colspan] { grid-column: 2 / -1; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Mobil: filterknapparna på en rad som går att svepa, så att jobben syns snabbare. */
@media (max-width: 759px) {
  .toolbar { gap: 8px; }
  .toolbar .search { flex-basis: 100%; }
  .toolbar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: 1 1 0; min-width: 0; margin: 0 -2px; padding: 0 2px; }
  .toolbar .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  select.sort { flex: none; }
  .page-head { margin: 14px 0 16px; }
}

/* ---------- Inloggning och första start ---------- */

body.is-gate { padding-bottom: 0; }
body.is-gate .topbar, body.is-gate .tabs { display: none; }
body.is-gate main { padding-bottom: 32px; }
.gate {
  min-height: calc(100dvh - 40px); max-width: 440px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  text-align: center; padding: 32px 4px calc(24px + env(safe-area-inset-bottom));
  animation: card-in 0.4s ease both;
}
.gate h1 { font-size: clamp(2.6rem, 11vw, 3.6rem); font-weight: 900; letter-spacing: -0.04em; line-height: 0.95; }
.gate-logo { width: 104px; height: 104px; border-radius: 28px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 24px 60px -20px var(--accent); }
.gate-logo svg { width: 64px; height: 64px; stroke-width: 3; }
.gate-lead { margin: 0; color: var(--ink-soft); font-size: 1.08rem; max-width: 34ch; }
.gate-note { margin: 4px 0 0; color: var(--ink-faint); font-size: 0.86rem; max-width: 34ch; }
.gate .btn { width: 100%; }
.gate-steps { display: flex; gap: 6px; }
.gate-steps i { width: 28px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.gate-steps i.on { background: var(--accent); }
.gate-check { width: 84px; height: 84px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 2.6rem; font-weight: 900; animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
.gate .install { text-align: left; width: 100%; }
.btn-big { min-height: 60px; font-size: 1.1rem; }
.btn-google { min-height: 60px; font-size: 1.08rem; background: #fff; color: #1f1f1f; border-color: #dadce0; box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.6); }
.btn-google:hover { filter: brightness(0.97); }
.btn-google.btn-sm { min-height: 44px; font-size: 0.95rem; }
.g-logo { width: 22px; height: 22px; stroke: none; }

.install { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border-radius: 18px; padding: 16px; }
.install > div { display: grid; gap: 4px; flex: 1 1 220px; }
.install span { color: var(--ink-soft); font-size: 0.92rem; }
.card .install { background: none; padding: 0; }
.ios-share { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); }
.ios-share svg { width: 17px; height: 17px; color: var(--accent); }

/* ---------- Konto ---------- */

.account { display: grid; gap: 14px; max-width: 680px; }
.card-title { font-size: 1.25rem; margin-bottom: 14px; }
.account-card { display: flex; align-items: center; gap: 16px; }
.account-card h2 { font-size: 1.35rem; }
.account-card p { margin: 4px 0 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.account-card .btn { margin-top: 10px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; flex: none; object-fit: cover; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 1.6rem; }
.cv-file { display: flex; align-items: center; gap: 14px; background: var(--surface-2); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.cv-file > div { display: grid; min-width: 0; }
.cv-file b { overflow-wrap: anywhere; }
.cv-file div span { color: var(--ink-soft); font-size: 0.88rem; }
.cv-icon { width: 48px; height: 56px; border-radius: 10px; flex: none; background: var(--bad); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 0.8rem; letter-spacing: 0.04em; }
.cv-card .hint { color: var(--ink-soft); font-size: 0.88rem; margin: 12px 0 0; }
.cv-card label.btn { cursor: pointer; }
.search-card { display: grid; gap: 18px; }
.search-card .card-title { margin-bottom: 0; }
.field-title { font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.chips.wrap { flex-wrap: wrap; }
.chips.wrap .chip[aria-pressed="true"]::before { content: "✓ "; }
.settings-card { display: grid; gap: 16px; justify-items: start; }
.settings-card .card-title { margin-bottom: 0; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; font-weight: 700; }

/* ---------- Färska jobb ---------- */

.head-links { display: flex; flex-wrap: wrap; gap: 8px; }
.updated { margin: 10px 0 0 !important; font-size: 0.85rem; color: var(--ink-faint) !important; font-weight: 600; }
.refresh-btn.is-busy svg { display: none; }
.job .new-badge { animation: pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); }

/* Dra nedåt för att uppdatera */
.ptr {
  --pull: 0px;
  position: fixed; top: 0; left: 50%; z-index: 40; pointer-events: none;
  width: 40px; height: 40px; margin-left: -20px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; place-items: center;
  transform: translateY(calc(var(--pull) - 50px)); opacity: min(1, calc(var(--pull) / 60px));
}
.ptr span { width: 18px; height: 18px; border: 2.5px solid var(--ink-faint); border-right-color: transparent; border-radius: 50%; transform: rotate(calc(var(--pull) * 3deg)); }
.ptr.ready span { border-color: var(--accent); border-right-color: transparent; }
.ptr.spin { --pull: 80px; opacity: 1; transition: transform 0.2s ease; }
.ptr.spin span { border-color: var(--accent); border-right-color: transparent; animation: spin 0.7s linear infinite; }

/* ---------- Utskick ---------- */

@media (max-width: 759px) { .tab { font-size: 0.68rem; } .tab svg { width: 23px; height: 23px; } }
.send-note { color: var(--ink-soft); font-size: 0.9rem; margin: 6px 0 0; }
.to-line { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; overflow-wrap: anywhere; }
.to-line svg, .review-item .hint svg { width: 17px; height: 17px; vertical-align: -3px; color: var(--accent); }
.to-line .hint { font-weight: 500; }
.outbox-head { font-family: var(--display); font-weight: 800; font-size: 1.25rem; color: var(--ink) !important; }
.progress { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin: 0 0 16px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width 0.5s ease; }
.outbox { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.outbox-item { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; transition: border-color 0.3s ease; }
.outbox-item > div { display: grid; gap: 2px; min-width: 0; }
.outbox-item small { color: var(--ink-soft); overflow-wrap: anywhere; }
.outbox-status { font-size: 0.9rem; font-weight: 700; color: var(--ink-soft); margin-top: 4px; }
.outbox-item .d-actions { margin-top: 8px; }
.outbox-item .dot { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 900; background: var(--surface-2); color: var(--ink-faint); }
.outbox-item.is-ok { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); animation: sent 0.6s ease; }
.outbox-item.is-ok .dot { background: var(--accent); color: var(--accent-ink); }
.outbox-item.is-ok .outbox-status { color: var(--accent); }
.outbox-item.is-fail { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.outbox-item.is-fail .dot { background: var(--bad); color: #fff; }
.outbox-item.is-fail .outbox-status { color: var(--bad); }
.outbox-item.is-warn .dot { background: var(--warn); color: #000; }
.outbox-item.is-warn .outbox-status { color: var(--warn); }
.outbox-item.is-busy .dot { border: 3px solid var(--accent); border-right-color: transparent; background: none; animation: spin 0.8s linear infinite; }

/* ---------- Skickade ---------- */

.sent-list { display: grid; gap: 14px; }
@media (min-width: 900px) { .sent-list { grid-template-columns: 1fr 1fr; } }
.sent-item { display: grid; gap: 10px; align-content: start; }
.sent-item h3 { font-size: 1.2rem; }
.sent-item .employer { color: var(--ink-soft); margin-top: -6px; }
.sent-item.is-failed { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.sent-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 0.88rem; font-weight: 600; }
.badge-ok, .badge-fail { font-size: 0.78rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.badge-ok { background: var(--accent-soft); color: var(--accent); }
.badge-fail { background: var(--bad-soft); color: var(--bad); }
.facts .wide { grid-column: 1 / -1; }
.sync-status { font-size: 0.82rem; color: var(--ink-faint) !important; margin-top: 8px !important; }
.review-head .btn { flex: none; white-space: nowrap; }

/* Rapporten på mobil: bocken till vänster, uppgifterna under varandra i en bred kolumn. */
@media (max-width: 700px) {
  table.report tr { grid-template-columns: 40px 1fr; gap: 6px 12px; padding: 14px 16px; }
  table.report td { grid-column: 2; }
  table.report td.cell-check { grid-column: 1; grid-row: 1 / span 9; padding-top: 2px; }
  table.report td[data-label="Datum"]::before { display: none; }
  table.report td:last-child { padding-top: 4px; }
}
