/* Matrosens enkäter – färger och typsnitt från matrosen.nu (jaboka/matrosen-web, assets/site.css).
   Typsnitten ligger i appen (static/fonts, SIL Open Font License) så att inga externa resurser laddas. */

@font-face { font-family: "Bitter"; font-weight: 600; font-display: swap; src: url("fonts/bitter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Bitter"; font-weight: 700; font-display: swap; src: url("fonts/bitter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-display: swap; src: url("fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-display: swap; src: url("fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 700; font-display: swap; src: url("fonts/source-sans-3-latin-700-normal.woff2") format("woff2"); }

:root {
  --font-display: "Bitter", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --indigo: #34348f;
  --indigo-deep: #222462;
  --accent: #c4461d;
  --ink: #1b1c3b;
  --muted: #565b85;
  --bg: #f3f5fa;
  --paper: #ffffff;
  --ice: #edf1f8;
  --line: #d5dbea;
  --selected: #e6e7fb;
  --error-bg: #fbe1dd;
  --error-line: #a3291d;
  --ok: #1f6f4a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --indigo: #aeb2f2;
    --indigo-deep: #c9ccf7;
    --accent: #ff9a74;
    --ink: #e4e6f3;
    --muted: #a7abd0;
    --bg: #13142b;
    --paper: #1b1d3a;
    --ice: #171a36;
    --line: #34365e;
    --selected: #2a2c5c;
    --error-bg: #4a1f24;
    --error-line: #ffb7ab;
    --ok: #7fd3a8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.6 var(--font-body); }
a { color: var(--indigo); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Sidhuvud och sidfot */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 880px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--indigo-deep); text-decoration: none; font: 700 1.15rem/1.15 var(--font-display); }
.brand img { width: 44px; height: 44px; }
.brand small { display: block; font: 600 .78rem/1.3 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.admin-nav a { font-weight: 600; text-decoration: none; }
.site-footer { text-align: center; padding: 32px 24px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }

/* Innehåll */
main { max-width: 880px; margin: 40px auto 64px; padding: 0 24px; }
body:not(.admin) main { max-width: 760px; }
h1, h2, h3 { font-family: var(--font-display); color: var(--indigo-deep); line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 700; margin: 8px 0 20px; }
h2 { font-size: 1.35rem; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 1.1rem; font-weight: 600; margin: 28px 0 8px; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0; }
.lead { font-size: 1.15rem; color: var(--muted); }
.muted { color: var(--muted); }
.fine { font-size: .85rem; color: var(--muted); }
.intro { background: var(--ice); border-radius: 12px; padding: 16px 24px; margin: 24px 0; }
.deadline { font-weight: 700; color: var(--indigo-deep); }
.notice { border-left: 4px solid var(--accent); background: var(--paper); padding: 10px 16px; font-size: .95rem; border-radius: 0 8px 8px 0; }
.error { background: var(--error-bg); border: 1px solid var(--error-line); color: var(--ink); padding: 14px 16px; border-radius: 8px; }
.preview-bar { background: var(--indigo-deep); color: var(--paper); padding: 12px 16px; border-radius: 8px; }
.preview-bar a { color: var(--paper); font-weight: 700; }
.receipt strong { font-size: 1.4rem; letter-spacing: .05em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.nowrap { white-space: nowrap; }

/* Formulär */
fieldset { border: 0; border-top: 1px solid var(--line); padding: 24px 0; margin: 24px 0 0; min-width: 0; }
legend { font: 700 1.1rem/1.45 var(--font-display); color: var(--indigo-deep); padding-right: 12px; }
.number { color: var(--accent); padding-right: 6px; }
.required { color: var(--accent); }
.help { color: var(--muted); margin: 4px 0 10px; }
.option { display: flex; align-items: flex-start; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 10px 0; cursor: pointer; }
.option:has(input:checked) { border-color: var(--indigo); background: var(--selected); box-shadow: 0 0 0 1px var(--indigo); }
input[type=radio], input[type=checkbox] { margin: 4px 0; width: 20px; height: 20px; accent-color: var(--indigo); flex-shrink: 0; }
.field-label { display: block; font-weight: 600; margin: 14px 0 4px; }
input:not([type=radio]):not([type=checkbox]):not([type=hidden]), textarea, select {
  display: block; width: 100%; background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; font: inherit; padding: 11px 12px; }
input[type=number] { max-width: 260px; }
textarea { resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; margin: 16px 0; font-weight: 600; }
fieldset.sub { border: 1px dashed var(--line); border-radius: 10px; padding: 8px 16px 16px; margin: 16px 0; }
fieldset.sub legend { font: 600 .9rem var(--font-body); color: var(--muted); padding: 0 6px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row input { flex: 1; }
.row.three > span { flex: 1; }

button, .button {
  display: inline-block; background: var(--indigo); color: #fff; padding: 13px 24px; border: 0; border-radius: 8px;
  font: 700 1rem var(--font-body); text-decoration: none; cursor: pointer; margin-top: 12px; }
button:hover, .button:hover { background: var(--indigo-deep); color: #fff; }
@media (prefers-color-scheme: dark) { button, .button { color: #13142b; } button:hover, .button:hover { color: #13142b; } }
button.secondary, .button.secondary { background: transparent; color: var(--indigo); box-shadow: inset 0 0 0 2px var(--indigo); }
button.secondary:hover, .button.secondary:hover { background: var(--selected); color: var(--indigo-deep); }
button.danger { background: transparent; color: var(--error-line); box-shadow: inset 0 0 0 2px var(--error-line); }
button.small { padding: 5px 12px; font-size: .85rem; margin: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.actions form { margin: 0; }
.actions .button, .actions button { margin-top: 0; }

/* Styrelsens sidor */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; margin: 20px 0; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: none; }
.status-open { background: #dff3e8; color: #1f6f4a; }
.status-draft { background: var(--ice); color: var(--muted); }
.status-closed { background: #ececf1; color: #4b4e66; }
@media (prefers-color-scheme: dark) {
  .status-open { background: #1d3a2d; color: #7fd3a8; }
  .status-closed { background: #2a2b3f; color: #c3c5da; }
}
.link-box code { display: block; background: var(--ice); padding: 12px 14px; border-radius: 8px; font-size: 1rem; overflow-wrap: anywhere; user-select: all; }
.qr { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.qr img { background: #fff; border-radius: 8px; padding: 6px; }
.questions { padding-left: 1.4em; }
.questions > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.q-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.kind { font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--ice); padding: 1px 8px; border-radius: 999px; }
.opts { margin: 6px 0; color: var(--muted); }
.q-actions { display: flex; gap: 6px; margin-top: 8px; }
.new-survey .row button { margin-top: 0; }

.stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 20px 0; }
.stats section { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; flex: 1; min-width: 160px; }
.stats strong { display: block; font: 700 1.8rem/1.2 var(--font-display); color: var(--indigo-deep); }
.stats span { font-size: .85rem; color: var(--muted); }
.stats.small strong { font-size: 1.4rem; }
.bars { list-style: none; padding: 0; margin: 12px 0; }
.bars li { display: grid; grid-template-columns: minmax(0, 2fr) minmax(80px, 3fr) auto; gap: 12px; align-items: center; padding: 6px 0; }
meter.bar { width: 100%; height: 14px; }
meter.bar::-webkit-meter-bar { background: var(--ice); border: 0; border-radius: 999px; }
meter.bar::-webkit-meter-optimum-value { background: var(--indigo); border-radius: 999px; }
meter.bar::-moz-meter-bar { background: var(--indigo); border-radius: 999px; }
.bar-value { font-weight: 600; white-space: nowrap; }
.texts { padding-left: 1.2em; }
.texts li { white-space: pre-wrap; overflow-wrap: anywhere; padding: 6px 0; border-bottom: 1px solid var(--line); }

.table-wrap { overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--ice); color: var(--indigo-deep); font-weight: 700; }
.comment { white-space: pre-wrap; min-width: 160px; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  main { margin-top: 24px; padding: 0 16px; }
  .header-inner { padding: 12px 16px; }
  .card { padding: 16px; }
  .row, .row.three { flex-direction: column; align-items: stretch; }
  .bars li { grid-template-columns: 1fr auto; }
  .bars li meter { grid-column: 1 / -1; }
  body:not(.admin) button[type=submit] { width: 100%; }
}
