/* ============================================================================
   STRUCTURAL COMPONENTS — LOCKED. Do not edit this file (the design audit
   verifies its integrity). It carries structure only — layout, spacing
   discipline, accessibility, responsive behavior — and takes ALL of its look
   from tokens.css. Restyle by setting tokens; extend freely in app.css.

   Why locked: every recurring defect we shipped (footers flush against the
   viewport, uneven padding, invisible buttons, unstyled mobile nav) came from
   rebuilding these primitives per project. The structure is solved once, here.
   ========================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: var(--leading);
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); }

/* --- Navigation -------------------------------------------------------- */
/* Solid background by default (--nav-bg): a header must never be invisible
   over a hero. Overlay navs are an explicit token choice, not an accident. */
.nav {
  position: relative;
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-4) var(--container-pad);
  background: var(--nav-bg);
  color: var(--nav-ink);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--nav-ink); text-decoration: none; }
.navlinks { display: flex; align-items: center; gap: var(--space-4); }
.navlinks a { color: var(--nav-ink); opacity: .78; text-decoration: none; }
.navlinks a:hover { opacity: 1; }

/* Mobile navigation — links collapse into an accessible hamburger below 720px.
   Pure CSS (the #nav-toggle checkbox drives it): no JavaScript, and it keeps
   working after hx-boost swaps the page. Cramped links on a phone are the #1
   "unfinished" tell, so keep a real mobile menu on every site. */
.nav-burger { display: none; }
@media (max-width: 720px) {
  .nav-burger {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 11px; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius);
  }
  .nav-burger span {
    display: block; width: 100%; height: 2px; background: var(--nav-ink);
    transition: transform .2s ease, opacity .2s ease;
  }
  .navlinks {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--nav-bg); border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .10);
  }
  .navlinks a, .navlinks form, .navlinks .linklike {
    display: block; width: 100%; text-align: left;
    padding: var(--space-3) var(--container-pad); border-top: 1px solid var(--border);
  }
  .nav-toggle:checked ~ .navlinks { display: flex; }
  /* Hamburger morphs into an X while the menu is open. */
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* --- Layout rhythm ------------------------------------------------------ */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6) var(--container-pad) var(--space-8);
}
.narrow { max-width: 26rem; margin-left: auto; margin-right: auto; }

/* Full-bleed section band: background spans the viewport, content stays inside
   a container. Stack these on the landing page; the shared vertical rhythm and
   horizontal inset come from tokens, so spacing stays consistent by
   construction. Restyle per project with your own band classes in app.css
   (e.g. .band-dark { background: ...; color: ... }). */
.section { padding: var(--section-pad-y) 0; }
.section > .container { padding-top: 0; padding-bottom: 0; }
.section-tint { background: var(--bg-2); }

.hero { padding: var(--space-7) 0 var(--space-6); }
.hero h1 { font-size: 2.2rem; margin: 0 0 var(--space-2); }
.lead { color: var(--muted); font-size: 1.1rem; }

.panel {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-5); margin-top: var(--space-5);
}
.page-head { padding: var(--space-4) 0 0; }

/* --- Footer -------------------------------------------------------------- */
/* Symmetric vertical padding + the same horizontal inset as every section —
   footer content never sits flush against the viewport edge. Alignment is
   yours: add .center for a simple one-line footer, or build richer footers by
   putting a .container (with your own grid) inside — but pick ONE alignment
   per footer; mixing centered and left-aligned blocks reads as broken. */
.foot, .footer {
  padding: var(--space-7) var(--container-pad);
  color: var(--muted); font-size: .85rem;
}
.footer > .container { padding: 0; }
.center { text-align: center; }

/* --- Forms ---------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
label { display: flex; flex-direction: column; gap: var(--space-1); font-weight: 500; }
input, textarea, select {
  font: inherit; padding: var(--space-2) var(--space-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --- Buttons --------------------------------------------------------------
   Color/background are protected with !important so a generic link rule
   (e.g. `.my-dark-band a { color: ... }`) can NEVER make button text invisible
   — the exact bug that shipped an unreadable "Boka en tid". You still control
   the look completely, via custom properties (they pass through !important):
     .btn-secondary { --btn-bg: var(--bg-2); --btn-ink: var(--text); }        */
.btn, a.btn {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-block;
  background: var(--btn-bg, var(--accent)) !important;
  color: var(--btn-ink, var(--accent-ink)) !important;
  border: 0; text-decoration: none;
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
  align-self: flex-start;
}
.btn:hover { filter: brightness(1.08); }
.linklike {
  font: inherit; background: none; border: 0; padding: 0;
  color: var(--muted); cursor: pointer; text-decoration: underline;
}
.inline { display: inline; }

/* --- Feedback + utilities -------------------------------------------------- */
.flash {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.messages { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.messages li { border-bottom: 1px solid var(--border); padding-bottom: var(--space-3); }
.messages p { margin: var(--space-1) 0 0; white-space: pre-wrap; }
.msg-head { display: flex; gap: var(--space-3); align-items: baseline; flex-wrap: wrap; }

/* --- Public data tables (member-facing lists; /admin has its own CSS) ------ */
.table-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.table-list li { display: flex; align-items: baseline; gap: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th, .data-table td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { font-weight: 600; white-space: nowrap; }
.data-table td { max-width: 28rem; overflow-wrap: anywhere; }
.row-actions { white-space: nowrap; }
.pager { display: flex; gap: var(--space-5); margin-top: var(--space-4); }
.row-detail dt { margin-top: var(--space-3); }
.row-detail dd { margin: var(--space-1) 0 0; overflow-wrap: anywhere; }

/* --- Notification hooks ----------------------------------------------------- */
.hook-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.hook-list li { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.hook-target { font-weight: 500; }
.hook-actions { margin-left: auto; display: flex; gap: var(--space-3); }
.badge { font-size: .72rem; padding: .1rem var(--space-2); border-radius: 999px; }
.badge-on { background: #dff5e1; color: #1c6b2e; }
.badge-off { background: #eee; color: #666; }
.hook-add { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.hook-add input[type=email] { flex: 1; min-width: 14rem; }
