/* DM Sans (SIL Open Font License), samma typsnitt som newrepublic.se. Ligger lokalt på servern, ingen extern tjänst. */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url(/static/vendor/dm-sans/dm-sans-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url(/static/vendor/dm-sans/dm-sans-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ground: #FFFFFF;
  --surface: #FFFFFF;
  --ink: #1B2430;
  --muted: #5B6573;
  --line: #E2E5E2;
  --field-line: #BFC7C1;
  --accent: #30493A;
  --accent-dark: #213428;
  --accent-soft: #E9EFEA;
  --yes-bg: #E2F1E7; --yes-fg: #1B6B3A;
  --no-bg: #F6E3E3; --no-fg: #8A2E2E;
  --pending-bg: #ECEFEC; --pending-fg: #3C4655;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { margin: 0 0 4px; font-size: 30px; line-height: 1.2; font-family: Georgia, "Times New Roman", serif; font-weight: 400; color: #052416; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
code { font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.strong { font-weight: 600; color: var(--ink); text-decoration: none; }
.prewrap { white-space: pre-line; }

/* Admin-layout */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 220px; max-width: 260px; background: #30483E; color: #FFFFFF; padding: 28px 20px; display: flex; flex-direction: column; gap: 6px; }
.brand { display: block; padding: 0 12px 20px; }
.brand img { display: block; width: 100%; max-width: 180px; height: auto; }
.navlink { padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,.08); color: #FFFFFF; font-weight: 600; text-decoration: none; }
.navlink:hover { background: rgba(255,255,255,.18); color: #FFFFFF; }
.navlink.current { background: #FFFFFF; color: #30483E; }
.navlink.current:hover { background: #FFFFFF; color: #30483E; }
.side a:focus-visible, .side button:focus-visible { outline-color: #FFFFFF; }
.side .muted { color: rgba(255,255,255,.75); }
.side .btn-secondary { background: #30493A; color: #FFFFFF; border-color: rgba(255,255,255,.35); border-radius: 999px; padding-left: 18px; padding-right: 18px; }
.side .btn-secondary:hover { background: #3B5A48; }
.side-user { margin-top: auto; padding: 16px 12px 0; display: flex; flex-direction: column; gap: 8px; }
.main { flex: 999 1 560px; min-width: 0; padding: 40px 48px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.page-head p { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.empty { text-align: center; }
.stats { display: flex; flex-wrap: wrap; gap: 16px; }
.stat { flex: 1 1 140px; padding: 16px 20px; }
.stat .num { font-size: 30px; font-weight: 700; }

.table-wrap { padding: 0; overflow-x: auto; }
table.data { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; color: var(--muted); font-size: 13px; font-weight: 600; padding: 14px 12px; }
table.data td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 20px; }

.pill { display: inline-block; white-space: nowrap; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill-yes { background: var(--yes-bg); color: var(--yes-fg); }
.pill-no { background: var(--no-bg); color: var(--no-fg); }
.pill-pending { background: var(--pending-bg); color: var(--pending-fg); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--pending-fg); text-decoration: none; font-size: 14px; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* Formulär */
.form { display: flex; flex-direction: column; gap: 20px; max-width: 640px; }
.import { max-width: none; }
.form > .btn { align-self: flex-start; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row .field { flex: 1 1 200px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-size: 14px; font-weight: 600; padding: 0; }
input[type=text], input[type=email], input[type=number], input[type=datetime-local], input[type=file], textarea {
  font: inherit; font-size: 16px; padding: 12px; border: 1px solid var(--field-line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
input[readonly] { background: var(--ground); }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #8FA597; outline-offset: 2px; }
.field .check { font-weight: 400; }
.check { display: flex; gap: 10px; align-items: center; font-size: 16px; font-weight: 400; min-height: 32px; }
.check input { width: 18px; height: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.btn { display: inline-block; font: inherit; font-size: 15px; font-weight: 600; padding: 12px 22px; min-height: 44px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none; text-align: center; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary { background: #fff; border-color: var(--accent); color: var(--accent-dark); }
.btn-danger { background: #fff; border-color: #B54747; color: #8A2E2E; }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: 14px; }

.flash, .success, .error { padding: 14px 16px; border-radius: 8px; font-size: 15px; }
.flash { background: var(--accent-soft); color: var(--accent-dark); }
.success { background: var(--yes-bg); color: var(--yes-fg); margin: 16px 0; }
.error { background: var(--no-bg); color: var(--no-fg); margin: 16px 0; }

/* Publika sidor */
.public .public-wrap { max-width: 560px; margin: 0 auto; padding: 32px 16px 64px; }
.public-brand { font-weight: 700; font-size: 15px; color: var(--muted); margin-bottom: 24px; }
.public h1 { margin-bottom: 8px; }
.public .form { max-width: none; margin: 16px 0; }

@media (max-width: 720px) {
  .main { padding: 24px 16px; }
  .side { max-width: none; }
}

/* E-postsidan */
.mail-grid { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.mail-grid > .col-form { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.mail-grid > .col-preview { flex: 1.3 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.preview-frame { width: 100%; height: 860px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.notice { padding: 14px 16px; border-radius: 8px; background: #FFF4DC; color: #6B4A00; font-size: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form .field { flex: 1 1 200px; }
select { font: inherit; font-size: 16px; padding: 12px; border: 1px solid var(--field-line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }

ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
ul.plain li { padding: 4px 0; }

.add-guest { margin-bottom: 16px; max-width: none; }
.add-guest summary { cursor: pointer; font-weight: 600; }
.add-guest[open] summary { margin-bottom: 16px; }
.fields-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* Textredigerare (Trix) */
trix-toolbar { margin-bottom: 8px; }

trix-toolbar .trix-button--icon-quote,
trix-toolbar .trix-button--icon-code { display: none !important; }
trix-toolbar .trix-button-group { border-color: var(--line, #d6d3c9); background: #fff; }
trix-editor.editor { min-height: 220px; background: #fff; border: 1px solid var(--line, #d6d3c9); border-radius: 8px; padding: 12px 14px; font: inherit; line-height: 1.5; }
trix-editor.editor:focus { outline: 2px solid var(--brand, #1f6f6b); outline-offset: 1px; }
trix-editor.editor h1 { font-size: 1.35em; margin: 0 0 .4em; }
trix-editor.editor ul, trix-editor.editor ol { margin: 0 0 .6em 1.4em; }

/* Bilder */
.image-picker { margin: 12px 0 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; width: 84px; height: 64px; overflow: hidden; }
.thumb:hover, .thumb:focus-visible { outline: 2px solid var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 24px; }
.library-item { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.library-item img { width: 100%; height: 130px; object-fit: contain; background: #F1F4F2; border-radius: 6px; }
trix-editor.editor img { max-width: 100%; height: auto; }
trix-editor.editor figcaption { display: none; }

/* Storlek, typsnitt och bildstorlek i redigeraren */
.trix-extra-tools { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin-top: 8px; }
.trix-extra-tools .trix-button-group { margin: 0; }
.trix-extra-tools .trix-button--text { width: auto; padding: 0 10px; font-size: 13px; }
.trix-extra-tools .trix-button-group[hidden] { display: none; }
.trix-button.f-georgia { font-family: Georgia, serif; }
.trix-button.f-verdana { font-family: Verdana, sans-serif; }
.trix-button.f-courier { font-family: "Courier New", monospace; }
trix-editor.editor small { font-size: 13px; }
trix-editor.editor big { font-size: 22px; }
trix-editor.editor cite { font-family: Georgia, serif; font-style: normal; }
trix-editor.editor var { font-family: Verdana, sans-serif; font-style: normal; }
trix-editor.editor samp { font-family: "Courier New", monospace; }
.trix-size-select { min-height: 30px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 13px; padding: 0 8px; }
.trix-select-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #5B6573; }
.trix-select-field select { min-width: 150px; }
.trix-extra-tools { align-items: flex-end; }
.trix-extra-tools .trix-select-field select { min-height: 30px; height: 30px; width: 170px; font-size: 13px; font-weight: 400; padding: 0 8px; }
trix-editor.editor dfn { font-family: "DM Sans", sans-serif; font-style: normal; }
tr.unsub td { opacity: .6; } tr.unsub td:last-child, tr.unsub td:nth-child(5) { opacity: 1; }

/* Menyn står kvar i bild när sidan är lång, så att Logga ut alltid syns */
@media (min-width: 721px) {
  .side { position: sticky; top: 0; height: 100vh; align-self: flex-start; overflow-y: auto; }
}

/* Innehållet får en maxbredd på stora skärmar och hela raden i eventlistan är klickbar */
.main > * { width: 100%; max-width: 1120px; margin-right: auto; }
tr.clickable { position: relative; }
tr.clickable:hover td { background: #F6F8F6; }
a.row-link::after { content: ""; position: absolute; inset: 0; }

.trix-width-slider { width: 160px; vertical-align: middle; accent-color: #30493A; }
.trix-width-out { font-size: 12px; color: #5B6573; margin-left: 6px; }
.trix-extra-tools .trix-button-group--image { display: inline-flex; align-items: center; gap: 8px; }
trix-editor center { display: block; text-align: center; }
trix-editor address { display: block; text-align: right; font-style: normal; }
trix-editor figure.attachment { max-width: 100%; }

.thumb-choice { position: relative; display: block; }
.thumb-choice input { position: absolute; top: 6px; left: 6px; z-index: 1; width: 18px; height: 18px; min-height: 0; accent-color: #30493A; }
.thumb-choice:has(input:checked) { outline: 3px solid var(--accent); }

/* Inloggningssidan: bara logga och en knapp, ingen meny */
body.login { margin: 0; min-height: 100vh; background: #30483E; display: flex; align-items: center; justify-content: center; }
.login-box { display: flex; flex-direction: column; align-items: center; gap: 32px; padding: 24px; }
.btn-light { background: #FFFFFF; color: #30483E; border-color: #FFFFFF; text-decoration: none; }
.btn-light:hover { background: #E9EFEA; }
.login-error { color: #FFFFFF; background: rgba(255,255,255,.14); border-radius: 8px; padding: 10px 16px; max-width: 340px; text-align: center; }
.login-form { display: flex; flex-direction: column; gap: 10px; width: 260px; }
.login-form input { padding: 10px 14px; border-radius: 8px; border: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.mailbody { overflow-wrap: anywhere; }
.mailbody .pre { white-space: pre-wrap; }
.mailbody blockquote { margin: 8px 0 8px 12px; padding-left: 12px; border-left: 3px solid var(--line); color: #5B6573; }

.perm-card { margin-bottom: 16px; }
.perm-user { font-size: 1.05rem; margin: 0 0 12px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 24px; margin-bottom: 16px; }
.perm-grid .check { align-items: flex-start; }

pre.cmd { background: #f3f3f0; border: 1px solid #ddd; border-radius: 8px; padding: 12px 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; font-size: .85rem; user-select: all; margin: 0 0 12px; }

.csv-example { border: 1px dashed #c9c9c2; border-radius: 10px; padding: 12px 14px; margin: 12px 0; background: #fafaf7; }
.csv-example .table-wrap { overflow-x: auto; }
.csv-example p { margin: 0 0 8px; }
