@font-face { font-family: 'Libre Franklin'; font-weight: 400; src: url(assets/fonts/libre-franklin-400.woff) format('woff'); }
@font-face { font-family: 'Libre Franklin'; font-weight: 500; src: url(assets/fonts/libre-franklin-500.woff) format('woff'); }
@font-face { font-family: 'Libre Franklin'; font-weight: 700; src: url(assets/fonts/libre-franklin-700.woff) format('woff'); }

/* Layout: smal enkolumn med kort per steg under en orange SFS-list */
:root {
  --orange: #DC7100;
  --accent: #B35C00;        /* rubriker, knappar – mörkare orange för kontrast */
  --accent-hover: #9a4f00;
  --on-accent: #ffffff;
  --bg: #FFF3E7;
  --surface: #ffffff;
  --surface-alt: #FFF3E7;
  --card-border: #f1e3d4;
  --text: #1d1d1d;
  --muted: #5c5c5c;
  --border: #d9cfc4;
  --bar: #DC7100;
  --sig-ink: #1a1a5e;
  --err-bg: #fff6f5; --err-border: #e3b4b0; --err-text: #8c1d18;
  --ok-bg: #eef7ee;  --ok-border: #b5d6b5;  --ok-text: #1f5a24;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #F2B272; --accent-hover: #F8CFA3; --on-accent: #2a1700;
    --bg: #1c1712; --surface: #26201a; --surface-alt: #33291f; --card-border: #3a3028;
    --text: #f3ece5; --muted: #b9aea3; --border: #574a3e; --bar: #A85600;
    --err-bg: #3a1d1b; --err-border: #7a3a35; --err-text: #ffc9c3;
    --ok-bg: #1d3320; --ok-border: #3d6b42; --ok-text: #c6ebc9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #F2B272; --accent-hover: #F8CFA3; --on-accent: #2a1700;
  --bg: #1c1712; --surface: #26201a; --surface-alt: #33291f; --card-border: #3a3028;
  --text: #f3ece5; --muted: #b9aea3; --border: #574a3e; --bar: #A85600;
  --err-bg: #3a1d1b; --err-border: #7a3a35; --err-text: #ffc9c3;
  --ok-bg: #1d3320; --ok-border: #3d6b42; --ok-text: #c6ebc9;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'Libre Franklin', 'Franklin Gothic', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  font-size: 16px;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.topbar { background: var(--bar); color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding-top: 28px; padding-bottom: 18px; }
.topbar h1 { margin: 0; font-size: clamp(28px, 6vw, 44px); font-weight: 700; letter-spacing: -0.01em; }
.logo { height: 54px; width: auto; }

.intro { margin: 28px 0 6px; font-size: 17px; }
.note { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

.card {
  background: var(--surface);
  border-radius: 10px;
  padding: 22px 22px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--card-border);
}
.card h2 { margin: 0 0 14px; font-size: 20px; font-weight: 700; color: var(--accent); }
.optional { font-weight: 400; color: var(--muted); font-size: 15px; }
.req { color: var(--accent); }
.hint { color: var(--muted); font-size: 14px; margin: -6px 0 14px; }
.card .grid + .hint { margin: 12px 0 0; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.span-2 { grid-column: span 2; }

label { display: block; font-size: 14px; font-weight: 500; }
label > input:not([type=checkbox]):not([type=radio]), label > textarea, label > select { display: block; margin-top: 5px; }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--orange); outline-offset: 1px; border-color: var(--orange); }
input.invalid, select.invalid { border-color: var(--err-text); background: var(--err-bg); }
textarea { resize: vertical; }

label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 15px; cursor: pointer; }
label.check.small { margin-top: 16px; font-size: 14px; color: var(--muted); }
input[type=checkbox], input[type=radio] { accent-color: var(--orange); width: 18px; height: 18px; margin: 0; }

.reasons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reason {
  flex-direction: row; align-items: center; gap: 10px;
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-weight: 400; font-size: 15px; cursor: pointer; background: var(--surface);
}
.reason:has(input:checked) { border-color: var(--orange); background: var(--surface-alt); font-weight: 500; }
.reasons.invalid .reason, .choice.invalid .reason { border-color: var(--err-text); }

.sub { margin-top: 16px; padding: 16px; background: var(--surface-alt); border-radius: 8px; }
.sub-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.inline { display: flex; flex-wrap: wrap; gap: 10px 22px; }

#sigwrap { margin-top: 14px; }
.sigpad {
  display: block; width: 100%; height: 160px;
  border: 1px dashed var(--orange); border-radius: 8px; background: #ffffff;
  touch-action: none; cursor: crosshair;
}
.date-label { margin-top: 18px; max-width: 220px; }

.errors, .status { background: var(--err-bg); border: 1px solid var(--err-border); color: var(--err-text); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-size: 15px; }
.errors ul { margin: 6px 0 0; padding-left: 20px; }

.actions { display: flex; align-items: center; gap: 20px; margin: 8px 0 40px; flex-wrap: wrap; }
button { font: inherit; cursor: pointer; }
button.primary {
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 8px;
  padding: 14px 28px; font-size: 18px; font-weight: 700;
}
button.primary:hover { background: var(--accent-hover); }
button.primary:disabled { opacity: .6; cursor: progress; }
button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 6px 0; font-size: 15px; }

.footer { color: var(--muted); font-size: 13px; padding-bottom: 32px; }

@media (max-width: 640px) {
  .grid, .grid-4, .grid-3, .choice { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .reasons { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
  .logo { height: 40px; }
}

.status.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }

/* Flikar */
.tabs { display: flex; gap: 4px; }
.tab {
  color: #fff; text-decoration: none; font-weight: 500; font-size: 15px;
  padding: 10px 16px; border-radius: 8px 8px 0 0; background: rgba(255,255,255,.16);
}
.tab:hover { background: rgba(255,255,255,.28); }
.tab[aria-current=page] { background: var(--bg); color: var(--text); font-weight: 700; }
.tab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Beslut */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sign-meta { margin-top: 18px; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 26px 16px; border: 2px dashed var(--border); border-radius: 10px; cursor: pointer;
  background: var(--surface-alt);
}
.drop.over, .drop:hover { border-color: var(--orange); }
.drop:focus-within { outline: 2px solid var(--orange); outline-offset: 2px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-title { font-weight: 700; font-size: 16px; color: var(--accent); overflow-wrap: anywhere; }
.drop-hint { color: var(--muted); font-size: 14px; font-weight: 400; }
.summary { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 18px 0 0; font-size: 15px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.summary dd.warn { color: var(--err-text); }
@media (max-width: 640px) {
  .summary { grid-template-columns: 1fr; gap: 2px; }
  .summary dd { margin-bottom: 8px; }
  .tab { padding: 9px 12px; font-size: 14px; }
}

.sub .hint { margin: 0; }
