:root {
  --red: #c8102e;
  --red-dark: #a00d25;
  --ink: #1f2328;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --ok-bg: #ecfdf3; --ok-ink: #05603a;
  --err-bg: #fef3f2; --err-ink: #b42318;
  --info-bg: #eff8ff; --info-ink: #175cd3;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--red); }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 0 0 .4rem; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 40px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* Top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-mark { background: var(--red); color: #fff; padding: 2px 8px; border-radius: 6px; font-weight: 800; letter-spacing: .5px; }
.mainnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a { color: var(--ink); text-decoration: none; padding: 6px 12px; border-radius: 8px; }
.mainnav a:hover { background: var(--bg); }
.mainnav a.active { background: #fde8eb; color: var(--red-dark); font-weight: 600; }
.usermenu { display: flex; align-items: center; gap: 12px; }
.usermenu form { margin: 0; }
.linklike { background: none; border: 0; color: var(--red); cursor: pointer; font: inherit; padding: 0; }

/* Footer */
.footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .85rem; padding: 14px 0; text-align: center; }
.footer a, .sponsor a { color: var(--muted); }

/* Guest pages */
body.guest { justify-content: center; align-items: center; padding: 24px 16px; }
.guest-box { width: 100%; max-width: 400px; }
.guest-brand { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 16px; display: flex; justify-content: center; gap: 8px; align-items: center; }
.sponsor { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card h1 { font-size: 1.35rem; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.form-wide { max-width: 720px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; flex: 1; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form .row { display: flex; gap: 14px; flex-wrap: wrap; }
.form .row > label { min-width: 220px; }
input, select, textarea {
  font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #f4a3b0; border-color: var(--red); }
.hint { color: var(--muted); font-size: .9rem; margin: 0; }
.actions { display: flex; gap: 10px; }
.inline-form { margin-top: 18px; }

/* Buttons */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid #d0d5dd; background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-block { width: 100%; }

/* Flash */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash-success { background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); color: var(--err-ink); }
.flash-info { background: var(--info-bg); color: var(--info-ink); }

/* Dashboard tiles */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); text-decoration: none; position: relative; }
a.tile:hover { border-color: var(--red); }
.tile p { margin: 0; color: var(--muted); font-size: .93rem; }
.tile-soon { opacity: .75; }
.badge { display: inline-block; font-size: .75rem; background: #f2f4f7; color: var(--muted); border-radius: 999px; padding: 2px 9px; margin-top: 10px; margin-left: 4px; }

/* Tables */
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--red); font-weight: 600; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #f9fafb; font-weight: 600; color: var(--muted); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.status { font-size: .8rem; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.status-active { background: var(--ok-bg); color: var(--ok-ink); }
.status-pending { background: #fffaeb; color: #b54708; }
.status-disabled { background: #f2f4f7; color: var(--muted); }

@media (max-width: 640px) {
  .topbar-inner { gap: 10px; padding-top: 8px; padding-bottom: 8px; }
  .mainnav { order: 3; flex-basis: 100%; }
  .usermenu { margin-left: auto; }
}

/* ── Sections ─────────────────────────────────────────────── */
main > h2 { margin-top: 28px; }
textarea { resize: vertical; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; }
code { background: #f2f4f7; padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.btn-small { padding: 5px 10px; font-size: .88rem; }
.btn-danger { color: var(--err-ink); border-color: #fecdca; }
.btn-danger:hover { background: var(--err-bg); }
.badge-red { background: #fde8eb; color: var(--red-dark); }
.actions form { margin: 0; }
.actions { flex-wrap: wrap; align-items: center; }
.actions select { width: auto; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 16px 0; }
.panel-highlight { border-color: var(--red); box-shadow: 0 0 0 3px #fde8eb; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.cards .card { padding: 18px; }
.cards .card h2 { font-size: 1.05rem; margin-bottom: 4px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.contact { margin: 8px 0; font-size: .93rem; }

.filelist { list-style: none; margin: 0; padding: 0; }
.filelist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.filelist li:first-child { border-top: 0; }
.filelist-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filelist-actions form { margin: 0; }
.linklist { margin: 0; padding-left: 18px; }
.linklist li { margin: 4px 0; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0 16px; }
.filters input[type=search] { flex: 1; min-width: 220px; width: auto; }
.filters select { width: auto; }
.check input, .radios input { width: auto; }
.filters .check, .radios .check { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.radios { display: flex; gap: 18px; flex-wrap: wrap; }
.row-closed { opacity: .55; }
.table td.notes { max-width: 340px; }

.weeks { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; }
.weeks legend { font-weight: 600; font-size: .92rem; padding: 0 4px; }
.weeks .hint { grid-column: 1 / -1; }
.form .weeks label.check { font-weight: 400; }
.weekgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.weekcell { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.weekcell-label { font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.chip { display: inline-block; background: #fde8eb; color: var(--red-dark); border-radius: 999px; padding: 2px 10px; font-size: .85rem; margin: 2px 2px 0 0; text-decoration: none; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 8px 0 12px; font-size: .93rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.feedback-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kind { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 2px 8px; border-radius: 6px; }
.kind-ros { background: var(--ok-bg); color: var(--ok-ink); }
.kind-ris { background: var(--err-bg); color: var(--err-ink); }
.kind-forslag { background: var(--info-bg); color: var(--info-ink); }
.status-fb-new { background: #fffaeb; color: #b54708; }
.status-fb-in_progress { background: var(--info-bg); color: var(--info-ink); }
.status-fb-done { background: var(--ok-bg); color: var(--ok-ink); }
.status-fb-rejected { background: #f2f4f7; color: var(--muted); }
.feedback-head .status { margin-left: auto; }
.response { background: #f9fafb; border-left: 3px solid var(--red); padding: 10px 12px; border-radius: 4px; font-size: .93rem; }

.prose { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; max-width: 760px; }
.prose h2 { font-size: 1.2rem; margin: 22px 0 6px; }
.prose h3, .prose h4 { font-size: 1.05rem; margin: 18px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 12px; }

/* ── Calendar ─────────────────────────────────────────────── */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
.cal-nav h2 { margin: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal-head { background: #f9fafb; font-size: .8rem; font-weight: 600; color: var(--muted); padding: 6px 8px; }
.cal-day { background: var(--card); min-height: 96px; padding: 4px 6px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-out { background: #fafafa; }
.cal-out .cal-date { color: #b0b6c0; }
.cal-today .cal-date { color: var(--red); font-weight: 700; }
.cal-date { font-size: .85rem; display: flex; justify-content: space-between; }
.cal-add { color: var(--muted); text-decoration: none; visibility: hidden; padding: 0 4px; }
.cal-day:hover .cal-add { visibility: visible; }
.cal-item { display: block; font-size: .78rem; line-height: 1.3; padding: 2px 6px; border-radius: 5px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-meeting { background: var(--red); color: #fff; }
.cal-event { background: var(--info-bg); color: var(--info-ink); }
.cal-event.vis-leadership, .cal-event.vis-selected { background: #f4ebff; color: #6941c6; }
.cal-event.vis-members { background: #ecfdf3; color: var(--ok-ink); }
.cal-cancelled, .cal-meeting.cal-cancelled { background: #f2f4f7; color: var(--muted); text-decoration: line-through; }
.cal-absent { background: rgba(255,255,255,.25); border-radius: 4px; padding: 0 4px; margin-left: 2px; }
.agenda { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.agenda li { display: flex; gap: 14px; align-items: baseline; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.agenda li:first-child { border-top: 0; }
.agenda li.cal-cancelled { background: none; text-decoration: none; opacity: .6; }
.agenda-date { min-width: 210px; color: var(--muted); font-size: .9rem; }
.next-meeting { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.next-meeting h2 { margin: 2px 0; }
.holder { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.panel h3 { font-size: 1rem; margin: 14px 0 4px; }
@media (max-width: 760px) { .cal-desktop { display: none; } .agenda-date { min-width: 0; flex-basis: 100%; } }

/* ── View-as bar (admins) + member cards ──────────────────── */
.viewas { background: #1f2328; color: #d0d5dd; font-size: .85rem; }
.viewas-on { background: #b54708; color: #fff; }
.viewas-inner { display: flex; gap: 16px; align-items: center; min-height: 38px; flex-wrap: wrap; }
.viewas form { display: flex; gap: 8px; align-items: center; margin: 0; }
.viewas select { width: auto; padding: 3px 8px; font-size: .85rem; }
.card-link { color: var(--ink); text-decoration: none; display: block; }
.card-link:hover { border-color: var(--red); }
.cards .card h2 a { color: var(--ink); text-decoration: none; }
.cards .card h2 a:hover { color: var(--red); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.guest-box:has(.weeks) { max-width: 560px; }
@media (max-width: 640px) { .prose { padding: 18px; } }
