/* =====================================================================
   BeerEvent UI 2.0 — designsystem
   ---------------------------------------------------------------------
   Ett lager ovanpå Bootstrap 5.3 som ger hela appen det nya utseendet.
   Filen är indelad i:
     1.  Design tokens (mörkt + ljust tema)
     2.  Bas, bakgrund och typografi
     3.  App-shell: toppnav, sidomeny, innehåll, sidfot
     4.  Knappar
     5.  Kort, paneler och sektioner
     6.  Hero / sidhuvud
     7.  Statistikkort
     8.  Chips och badges
     9.  Tabeller och listor
     10. Formulär
     11. Overlays: modal, offcanvas, dropdown, toast
     12. Hjälpklasser
     13. Responsivt
   ===================================================================== */

/* ------------------------------------------------------------------
   1. DESIGN TOKENS
   ------------------------------------------------------------------ */

:root {
  --ui-font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ui-font-display: "Segoe UI Semibold", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ui-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --ui-radius-xs: 8px;
  --ui-radius-sm: 10px;
  --ui-radius: 14px;
  --ui-radius-lg: 20px;
  --ui-radius-pill: 999px;

  --ui-topbar-h: 64px;
  --ui-sidebar-w: 264px;
  --ui-sidebar-w-collapsed: 74px;

  --ui-ease: cubic-bezier(.32, .72, .28, 1);

  /* Varumärkesfärger — samma i båda teman */
  --ui-gold: #f5b942;
  --ui-gold-strong: #e9a51f;
  --ui-gold-soft: rgba(245, 185, 66, .16);
  --ui-hop: #8cc63f;
  --ui-hop-soft: rgba(140, 198, 63, .16);

  /* --ui-gold är märkesguldet (ytor, kanter, ikoner) - för brödtext på
     ljusa ytor räcker inte kontrasten (se --ui-gold-ink nedan). */
  --ui-gold-ink: var(--ui-gold);
}

/* --- Mörkt tema (standard, motsvarar referensdesignen) --- */
.theme-dark {
  --ui-bg: #071624;
  --ui-bg-2: #0b2033;
  --ui-bg-3: #102a40;
  --ui-canvas: radial-gradient(120% 80% at 78% -10%, #14395a 0%, rgba(20, 57, 90, 0) 60%),
               linear-gradient(178deg, #0a2136 0%, #071624 46%, #061320 100%);

  --ui-surface: #0d2135;
  --ui-surface-2: #102a40;
  --ui-surface-3: #16374f;
  --ui-surface-raised: rgba(255, 255, 255, .045);
  --ui-surface-hover: rgba(255, 255, 255, .07);

  --ui-text: #eaf2fb;
  --ui-text-strong: #ffffff;
  --ui-muted: #92a9c1;
  --ui-faint: #6d849c;

  --ui-border: rgba(255, 255, 255, .09);
  --ui-border-strong: rgba(255, 255, 255, .16);
  --ui-divider: rgba(255, 255, 255, .06);

  --ui-primary: var(--ui-gold);
  --ui-primary-text: #17222e;
  --ui-primary-hover: #ffca5c;

  --ui-accent: #4d92f5;
  --ui-accent-soft: rgba(77, 146, 245, .16);
  --ui-success: #34c77b;
  --ui-success-soft: rgba(52, 199, 123, .16);
  --ui-warning: #f0a33c;
  --ui-warning-soft: rgba(240, 163, 60, .16);
  --ui-danger: #ef5f6b;
  --ui-danger-soft: rgba(239, 95, 107, .16);
  --ui-info: #7c6cf0;
  --ui-info-soft: rgba(124, 108, 240, .16);

  --ui-shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  --ui-shadow: 0 12px 32px rgba(2, 10, 20, .45);
  --ui-shadow-lg: 0 24px 60px rgba(2, 10, 20, .6);

  --ui-topbar-bg: rgba(7, 22, 36, .88);
  --ui-sidebar-bg: #061422;
  --ui-hero-image: url("../img/ui2/hero-dark.d2c7b6146937.jpg");
  --ui-hero-overlay: linear-gradient(100deg, rgba(6, 19, 32, .95) 0%, rgba(6, 19, 32, .8) 34%, rgba(6, 19, 32, .28) 62%, rgba(6, 19, 32, .05) 100%);
  --ui-hero-overlay-mobile: linear-gradient(100deg, rgba(6, 19, 32, .98) 0%, rgba(6, 19, 32, .95) 58%, rgba(6, 19, 32, .88) 100%);

  color-scheme: dark;
}

/* --- Ljust tema --- */
.theme-light {
  --ui-bg: #f4f7fb;
  --ui-bg-2: #ffffff;
  --ui-bg-3: #eaf0f7;
  --ui-canvas: radial-gradient(120% 80% at 78% -10%, #e3edf9 0%, rgba(227, 237, 249, 0) 60%),
               linear-gradient(178deg, #f7fafd 0%, #eef3f9 100%);

  --ui-surface: #ffffff;
  --ui-surface-2: #f7f9fc;
  --ui-surface-3: #eef3f9;
  --ui-surface-raised: #ffffff;
  --ui-surface-hover: #eef3f9;

  --ui-text: #10243a;
  --ui-text-strong: #071624;
  --ui-muted: #526581;
  --ui-faint: #64758c;

  --ui-border: #d8e0ea;
  --ui-border-strong: #b9c6d6;
  --ui-divider: #e6ebf2;

  /* Vit text på #d99312 gav bara 2.6:1 kontrast (WCAG AA kräver 4.5:1).
     Samma lösning som i mörkt tema - guld yta, mörk text - ger 8:1+. */
  --ui-primary: #f0ae2e;
  --ui-primary-text: #17222e;
  --ui-primary-hover: #d99312;
  --ui-primary-border: #a8710a;

  /* Läsbar variant av märkesguldet för brödtext på ljusa ytor (1.76:1
     som ren #f5b942 var för lite - detta ger ~5.8:1). */
  --ui-gold-ink: #8a5d00;

  --ui-accent: #2563eb;
  --ui-accent-soft: rgba(37, 99, 235, .1);
  --ui-success: #12805a;
  --ui-success-soft: rgba(18, 128, 90, .1);
  --ui-warning: #b45309;
  --ui-warning-soft: rgba(180, 83, 9, .1);
  --ui-danger: #c02b3a;
  --ui-danger-soft: rgba(192, 43, 58, .1);
  --ui-info: #5b4bd6;
  --ui-info-soft: rgba(91, 75, 214, .1);

  --ui-shadow-sm: 0 1px 3px rgba(16, 36, 58, .08);
  --ui-shadow: 0 8px 24px rgba(16, 36, 58, .1);
  --ui-shadow-lg: 0 20px 48px rgba(16, 36, 58, .14);

  --ui-topbar-bg: rgba(255, 255, 255, .92);
  --ui-sidebar-bg: #ffffff;
  --ui-hero-image: url("../img/ui2/hero-light.a430e840d5b9.jpg");
  --ui-hero-overlay: linear-gradient(100deg, rgba(255, 255, 255, .96) 0%, rgba(255, 255, 255, .86) 34%, rgba(255, 255, 255, .4) 64%, rgba(255, 255, 255, .08) 100%);
  --ui-hero-overlay-mobile: linear-gradient(100deg, rgba(255, 255, 255, .98) 0%, rgba(255, 255, 255, .95) 58%, rgba(255, 255, 255, .88) 100%);

  color-scheme: light;
}

/* Bryggan till gamla variabelnamn så att äldre CSS-regler inte krockar. */
.theme-dark, .theme-light {
  --card-bg: var(--ui-surface);
  --border-subtle: var(--ui-border);
  --surface: var(--ui-surface);
  --surface-2: var(--ui-surface-2);
  --text: var(--ui-text);
  --muted: var(--ui-muted);
  --primary: var(--ui-accent);
  --success: var(--ui-success);
  --danger: var(--ui-danger);
  --border: var(--ui-border);
  --chip-bg: var(--ui-surface-3);
  --chip-text: var(--ui-muted);

  --bs-body-color: var(--ui-text);
  --bs-body-bg: transparent;
  --bs-emphasis-color: var(--ui-text-strong);
  --bs-secondary-color: var(--ui-muted);
  --bs-border-color: var(--ui-border);
  --bs-link-color: var(--ui-accent);
  --bs-link-hover-color: var(--ui-accent);
  --bs-border-radius: var(--ui-radius-sm);
}

/* ------------------------------------------------------------------
   2. BAS, BAKGRUND OCH TYPOGRAFI
   ------------------------------------------------------------------ */

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: var(--ui-font-sans);
  font-size: .95rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.ui-app {
  position: relative;
  min-height: 100vh;
  background: var(--ui-canvas);
  background-attachment: fixed;
  color: var(--ui-text);
}

/* Dekorativt humlemönster i bakgrunden */
.ui-app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("../img/ui2/hop-pattern.41a141abffd8.svg");
  background-size: 780px auto;
  background-position: -80px -60px;
  opacity: .16;
}
.theme-light .ui-app::before { opacity: .1; }

/* OBS: ingen z-index här – annars bildas en ny stacking-context som
   fångar modaler/offcanvas i .ui-shell och gör att Bootstraps
   .modal-backdrop (som läggs direkt i <body>) hamnar ovanpå dem. */
.ui-app > * { position: relative; }

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--ui-font-display);
  color: var(--ui-text-strong);
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.2;
}

a { color: var(--ui-accent); text-decoration: none; }
a:hover { color: var(--ui-accent); text-decoration: underline; }

hr { border-color: var(--ui-divider); opacity: 1; }

::selection { background: var(--ui-gold-soft); color: var(--ui-text-strong); }

:focus-visible {
  outline: 2px solid var(--ui-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Rubrik med versaler och gyllene streck, som "DIN VÄG IN" i designen */
.ui-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .5rem;
  color: var(--ui-gold-ink);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.ui-eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--ui-gold);
}

.ui-lead { color: var(--ui-muted); font-size: 1.02rem; }
.ui-muted, .text-muted, .text-body-secondary { color: var(--ui-muted) !important; }

/* Handskriven avslutning i sidfoten */
.ui-script {
  font-family: "Segoe Script", "Bradley Hand", "Brush Script MT", cursive;
  font-size: 1.05rem;
  color: var(--ui-muted);
}

/* ------------------------------------------------------------------
   3. APP-SHELL
   ------------------------------------------------------------------ */

.ui-shell {
  display: flex;
  min-height: calc(100vh - var(--ui-topbar-h));
  align-items: stretch;
}

.ui-shell__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ui-page {
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
  max-width: 1520px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 3vw, 2.25rem) 3rem;
}
.ui-page--flush { padding-left: 0; padding-right: 0; max-width: none; }
.ui-page--narrow { max-width: 760px; }
.ui-page--medium { max-width: 1080px; }

/* --- Toppnav --- */
.ui-topbar {
  position: sticky;
  top: 0;
  z-index: 1035;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--ui-topbar-h);
  padding: 0 clamp(.85rem, 2.4vw, 1.5rem);
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.ui-brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  flex: 0 0 auto;
  color: var(--ui-text-strong);
  font-family: var(--ui-font-display);
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -.025em;
}
.ui-brand:hover { color: var(--ui-text-strong); text-decoration: none; }
.ui-brand__mark { width: 2rem; height: 2rem; flex: 0 0 auto; }

/* Huvudnavigation i toppen */
.ui-topnav {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.ui-topnav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .85rem;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-muted);
  font-size: .93rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color .16s var(--ui-ease), background .16s var(--ui-ease);
}
.ui-topnav__link:hover { color: var(--ui-text-strong); background: var(--ui-surface-hover); text-decoration: none; }
.ui-topnav__link.is-active { color: var(--ui-gold-ink); }
.ui-topnav__link.is-active::after {
  content: "";
  position: absolute;
  left: .85rem;
  right: .85rem;
  bottom: -.62rem;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--ui-gold);
}

.ui-topbar__actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 0 0 auto;
  margin-left: auto;
}

/* Rund ikonknapp (sök, notiser, fäll ihop) */
.ui-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  background: var(--ui-surface-raised);
  color: var(--ui-muted);
  font-size: 1.05rem;
  line-height: 1;
  transition: all .16s var(--ui-ease);
}
.ui-icon-btn:hover,
.ui-icon-btn:focus-visible {
  border-color: var(--ui-gold);
  background: var(--ui-gold-soft);
  color: var(--ui-gold-ink);
}
.ui-icon-btn--square { border-radius: var(--ui-radius-sm); }
.ui-icon-btn__dot {
  position: absolute;
  top: .35rem;
  right: .4rem;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--ui-gold);
  box-shadow: 0 0 0 2px var(--ui-topbar-bg);
}
.ui-icon-btn--badged { position: relative; }

/* Kontomeny */
.ui-account > .btn,
.ui-account__toggle {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.5rem;
  padding: .3rem .8rem .3rem .35rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-pill);
  background: var(--ui-surface-raised);
  color: var(--ui-text);
  font-weight: 600;
  transition: all .16s var(--ui-ease);
}
.ui-account__toggle:hover,
.ui-account__toggle:focus-visible {
  border-color: var(--ui-gold);
  background: var(--ui-gold-soft);
  color: var(--ui-text-strong);
}
.ui-account__avatar {
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--ui-accent);
  color: #fff;
  font-size: .95rem;
}
.ui-account__toggle::after { margin-left: .15rem; color: var(--ui-muted); }

/* --- Sidomeny --- */
.ui-sidebar {
  position: sticky;
  top: var(--ui-topbar-h);
  z-index: 1030;
  flex: 0 0 var(--ui-sidebar-w);
  width: var(--ui-sidebar-w);
  height: calc(100vh - var(--ui-topbar-h));
  display: flex;
  flex-direction: column;
  padding: 1rem .75rem;
  border-right: 1px solid var(--ui-border);
  background: var(--ui-sidebar-bg);
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: flex-basis .22s var(--ui-ease), width .22s var(--ui-ease);
}

.ui-sidebar__section + .ui-sidebar__section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ui-divider);
}
.ui-sidebar__heading {
  padding: 0 .75rem .5rem;
  color: var(--ui-faint);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* Eventväljare: expanderbar lista över de event man administrerar,
   samma mönster som undermenyn under Inställningar. */
.ui-sidebar__eventtoggle { font-weight: 650; }
.ui-sidebar__chevron { flex: 0 0 auto; margin-left: auto; color: var(--ui-faint); font-size: .85rem; transition: transform .16s var(--ui-ease); }
.ui-sidebar__external { flex: 0 0 auto; margin-left: auto; color: var(--ui-faint); font-size: .8rem; }
.ui-sidebar__eventtoggle[aria-expanded="true"] .ui-sidebar__chevron { transform: rotate(180deg); }

.ui-sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  padding: .68rem .78rem;
  margin-bottom: .15rem;
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-muted);
  font-size: .93rem;
  font-weight: 600;
  text-align: left;
  transition: all .16s var(--ui-ease);
}
.ui-sidebar__link:hover,
.ui-sidebar__link:focus-visible {
  background: var(--ui-surface-hover);
  color: var(--ui-text-strong);
  text-decoration: none;
}
.ui-sidebar__link.is-active {
  background: var(--ui-gold-soft);
  color: var(--ui-gold-ink);
}
.ui-sidebar__link.is-active::before {
  content: "";
  position: absolute;
  top: .55rem;
  bottom: .55rem;
  left: -.75rem;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--ui-gold);
}
.ui-sidebar__icon {
  flex: 0 0 1.35rem;
  width: 1.35rem;
  font-size: 1.12rem;
  line-height: 1;
  text-align: center;
}
.ui-sidebar__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-sidebar__count {
  flex: 0 0 auto;
  padding: .1rem .5rem;
  border-radius: var(--ui-radius-pill);
  background: var(--ui-surface-3);
  color: var(--ui-muted);
  font-size: .72rem;
  font-weight: 700;
}
.ui-sidebar__link.is-active .ui-sidebar__count { background: var(--ui-gold); color: var(--ui-primary-text); }

/* Undermeny (t.ex. Inställningar → Grunduppgifter) */
.ui-sidebar__sub {
  margin: .15rem 0 .4rem;
  padding: 0 0 0 1.55rem;
  list-style: none;
  border-left: 1px solid var(--ui-divider);
  margin-left: 1.35rem;
}
.ui-sidebar__sub .ui-sidebar__link {
  padding: .5rem .7rem;
  font-size: .88rem;
  font-weight: 500;
  align-items: flex-start;
}
/* Undermenyernas etiketter får radbryta i stället för att kapas med "...".
   Etiketterna är korta på svenska, men översättningar blir ofta längre. */
.ui-sidebar__sub .ui-sidebar__label {
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.3;
}
.ui-sidebar__sub .ui-sidebar__link.is-active { background: transparent; color: var(--ui-gold-ink); }
.ui-sidebar__sub .ui-sidebar__link.is-active::before { display: none; }
.ui-sidebar__sub .ui-sidebar__link.is-active .ui-sidebar__icon::before { color: var(--ui-gold-ink); }

.ui-sidebar__spacer { flex: 1 1 auto; }

/* Aktivt event – kort med bild högst upp i menyn, dubblar som eventväljare */
.ui-sidebar__eventcard {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .6rem .65rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-raised);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s var(--ui-ease), background .16s var(--ui-ease);
}
.ui-sidebar__eventcard:hover,
.ui-sidebar__eventcard:focus-visible { border-color: var(--ui-border-strong); background: var(--ui-surface-hover); }
.ui-sidebar__eventcard-thumb {
  flex: 0 0 3rem;
  width: 3rem;
  height: 3rem;
  border-radius: var(--ui-radius-sm);
  background: var(--event-hero-image, var(--ui-hero-image, var(--ui-surface-3))) var(--event-hero-position, center)/cover no-repeat, var(--ui-surface-3);
}
.ui-sidebar__eventcard-body { min-width: 0; flex: 1 1 auto; font-size: .78rem; color: var(--ui-muted); line-height: 1.35; }
.ui-sidebar__eventcard-body strong {
  display: block;
  color: var(--ui-text-strong);
  font-size: .92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-sidebar__eventcard-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Kontokort längst ner i menyn */
.ui-sidebar__profile {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid transparent;
  border-radius: var(--ui-radius);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s var(--ui-ease), background .16s var(--ui-ease);
}
.ui-sidebar__profile:hover,
.ui-sidebar__profile:focus-visible { border-color: var(--ui-border); background: var(--ui-surface-hover); }
.ui-sidebar__profile-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 2.3rem;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: var(--ui-accent);
  color: #fff;
  font-weight: 800;
  font-size: .8rem;
}
.ui-sidebar__profile-body { min-width: 0; flex: 1 1 auto; font-size: .78rem; color: var(--ui-muted); line-height: 1.3; }
.ui-sidebar__profile-body strong {
  display: block;
  color: var(--ui-text-strong);
  font-size: .88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hopfälld sidomeny → ikonrad */
.ui-shell.is-collapsed .ui-sidebar {
  flex-basis: var(--ui-sidebar-w-collapsed);
  width: var(--ui-sidebar-w-collapsed);
  padding-left: .5rem;
  padding-right: .5rem;
}
.ui-shell.is-collapsed .ui-sidebar__heading,
.ui-shell.is-collapsed .ui-sidebar__chevron,
.ui-shell.is-collapsed .ui-sidebar__external,
.ui-shell.is-collapsed .ui-sidebar__sub,
.ui-shell.is-collapsed .ui-sidebar-toggle__label { display: none; }

/* Fälld meny: döljs visuellt men lämnas kvar för skärmläsare, annars
   blir varje länk (och räknaren bredvid) namnlös när bara ikonen syns. */
.ui-shell.is-collapsed .ui-sidebar__label,
.ui-shell.is-collapsed .ui-sidebar__count,
.ui-shell.is-collapsed .ui-sidebar__eventcard-body,
.ui-shell.is-collapsed .ui-sidebar__profile-body {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.ui-shell.is-collapsed .ui-sidebar__link {
  justify-content: center;
  padding-left: .5rem;
  padding-right: .5rem;
}
.ui-shell.is-collapsed .ui-sidebar__link.is-active::before { left: -.5rem; }
.ui-shell.is-collapsed .ui-sidebar__eventcard,
.ui-shell.is-collapsed .ui-sidebar__profile { justify-content: center; padding: .5rem; }

.ui-sidebar-toggle {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  padding: .6rem .78rem;
  margin-top: .5rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-muted);
  font-size: .88rem;
  font-weight: 600;
}
.ui-sidebar-toggle:hover { background: var(--ui-surface-hover); color: var(--ui-text-strong); }
.ui-shell.is-collapsed .ui-sidebar-toggle { justify-content: center; }
.ui-shell.is-collapsed .ui-sidebar-toggle .bi::before { content: "\f285"; } /* chevron-right */

/* --- Sidfot --- */
.ui-footer {
  margin-top: auto;
  padding: 1.4rem clamp(1rem, 3vw, 2.25rem);
  border-top: 1px solid var(--ui-border);
  color: var(--ui-muted);
  font-size: .85rem;
}
.ui-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 1520px;
  margin: 0 auto;
}
.ui-footer__brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--ui-text);
  font-family: var(--ui-font-display);
  font-weight: 800;
  letter-spacing: -.02em;
}
.ui-footer__tagline { display: inline-flex; align-items: center; gap: .6rem; }
.ui-footer__tagline img { width: 1.5rem; height: 1.5rem; }
.ui-footer__links { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.ui-footer__links a { color: var(--ui-muted); }
.ui-footer__links a:hover { color: var(--ui-gold-ink); }

/* ------------------------------------------------------------------
   4. KNAPPAR
   ------------------------------------------------------------------ */

.btn {
  --bs-btn-border-radius: var(--ui-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.6rem;
  padding: .5rem 1rem;
  border-radius: var(--ui-radius-sm);
  font-weight: 650;
  font-size: .92rem;
  line-height: 1.25;
  transition: all .16s var(--ui-ease);
}
.btn-sm { min-height: 2.15rem; padding: .3rem .7rem; font-size: .84rem; border-radius: var(--ui-radius-xs); }
.btn-lg { min-height: 3rem; padding: .7rem 1.5rem; font-size: 1rem; border-radius: var(--ui-radius); }

.btn:focus, .btn:focus-visible { box-shadow: 0 0 0 3px var(--ui-gold-soft); outline: none; }

.btn-primary,
.theme-light .btn-primary {
  background: var(--ui-primary);
  border-color: var(--ui-primary);
  color: var(--ui-primary-text);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.theme-light .btn-primary:hover {
  background: var(--ui-primary-hover);
  border-color: var(--ui-primary-hover);
  color: var(--ui-primary-text);
}
.btn-check:checked + .btn-primary { background: var(--ui-primary-hover); border-color: var(--ui-primary-hover); color: var(--ui-primary-text); }

/* Extra kant i ljust tema - guld mot vitt annars nästan osynlig kant. */
.theme-light .btn-primary { border-color: var(--ui-primary-border); }
.theme-light .btn-primary:hover, .theme-light .btn-primary:focus { border-color: var(--ui-primary-border); }

/* Sekundär: neutral kontur som passar båda teman */
.btn-outline-light,
.btn-outline-secondary,
.btn-secondary,
.theme-light .btn-outline-light,
.theme-light .btn-outline-secondary {
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-surface-raised);
  color: var(--ui-text);
}
.btn-outline-light:hover, .btn-outline-secondary:hover, .btn-secondary:hover,
.btn-outline-light:focus, .btn-outline-secondary:focus,
.theme-light .btn-outline-light:hover, .theme-light .btn-outline-secondary:hover {
  border-color: var(--ui-gold);
  background: var(--ui-gold-soft);
  color: var(--ui-text-strong);
}

.btn-success { background: var(--ui-success); border-color: var(--ui-success); color: #fff; }
.btn-success:hover, .btn-success:focus { background: var(--ui-success); border-color: var(--ui-success); color: #fff; filter: brightness(1.08); }
.btn-danger { background: var(--ui-danger); border-color: var(--ui-danger); color: #fff; }
.btn-warning { background: var(--ui-warning); border-color: var(--ui-warning); color: #17222e; }
.btn-info { background: var(--ui-accent); border-color: var(--ui-accent); color: #fff; }

.btn-outline-danger { border-color: var(--ui-danger); background: transparent; color: var(--ui-danger); }
.btn-outline-danger:hover, .btn-outline-danger:focus { background: var(--ui-danger); border-color: var(--ui-danger); color: #fff; }
.btn-outline-primary { border-color: var(--ui-primary); background: transparent; color: var(--ui-primary); }
.btn-outline-primary:hover { background: var(--ui-primary); color: var(--ui-primary-text); }
.btn-outline-success { border-color: var(--ui-success); background: transparent; color: var(--ui-success); }
.btn-outline-success:hover { background: var(--ui-success); color: #fff; }

.btn-link { color: var(--ui-accent); text-decoration: none; font-weight: 600; min-height: 0; padding: 0; }
.btn-link:hover { color: var(--ui-accent); text-decoration: underline; }

/* Kvarvarande hjälpklasser från gamla UI:t */
.calendar-btn { min-width: 2.75rem; min-height: 2.75rem; }
.contact-icon {
  width: 2.5rem; height: 2.5rem; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--ui-radius-xs); line-height: 0;
}
.contact-icon i { font-size: 1.1rem; }

/* Knapprad som bryter snyggt */
.ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

/* ------------------------------------------------------------------
   5. KORT, PANELER OCH SEKTIONER
   ------------------------------------------------------------------ */

.card,
.ui-card {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: var(--ui-shadow-sm);
}
.theme-light .card { border-color: var(--ui-border); box-shadow: var(--ui-shadow-sm); }

.card-header, .card-footer {
  border-color: var(--ui-divider);
  background: transparent;
  color: var(--ui-text);
}
.card-body { padding: 1.15rem 1.25rem; }

/* Panel = kort med rubrikrad och ikon, som "Anmälda utställare" i designen */
.ui-panel {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-sm);
  overflow: hidden;
}
.ui-panel__head {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-wrap: wrap;
  padding: 1.05rem 1.25rem;
  border-bottom: 1px solid var(--ui-divider);
}
.ui-panel__icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--ui-radius-xs);
  background: var(--ui-gold-soft);
  color: var(--ui-gold-ink);
  font-size: 1.2rem;
}
.ui-panel__title { margin: 0; font-size: 1.12rem; font-weight: 700; }
.ui-panel__subtitle { margin: .1rem 0 0; color: var(--ui-muted); font-size: .86rem; }
.ui-panel__head-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.ui-panel__body { padding: 1.15rem 1.25rem; }
.ui-panel__body--flush { padding: 0; }
.ui-panel__foot {
  padding: .9rem 1.25rem;
  border-top: 1px solid var(--ui-divider);
  background: var(--ui-surface-2);
}

/* Färgvarianter på panelikonen */
.ui-panel__icon--blue, .ui-tile__icon--blue { background: var(--ui-accent-soft); color: var(--ui-accent); }
.ui-panel__icon--green, .ui-tile__icon--green { background: var(--ui-success-soft); color: var(--ui-success); }
.ui-panel__icon--gold, .ui-tile__icon--gold { background: var(--ui-gold-soft); color: var(--ui-gold-ink); }
.ui-panel__icon--purple, .ui-tile__icon--purple { background: var(--ui-info-soft); color: var(--ui-info); }
.ui-panel__icon--danger, .ui-tile__icon--danger { background: var(--ui-danger-soft); color: var(--ui-danger); }

/* Sidhuvud på enklare sidor */
.ui-pagehead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.35rem;
}
.ui-pagehead__title { margin: 0; font-size: clamp(1.6rem, 3vw, 2.1rem); }
.ui-pagehead__sub { margin: .35rem 0 0; color: var(--ui-muted); }

/* Tillbakalänk */
.ui-back {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .85rem;
  margin-bottom: .9rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface-raised);
  color: var(--ui-muted);
  font-size: .87rem;
  font-weight: 600;
}
.ui-back:hover { border-color: var(--ui-gold); color: var(--ui-gold-ink); text-decoration: none; }

/* Tomt läge */
.ui-empty {
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--ui-border-strong);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-raised);
  color: var(--ui-muted);
  text-align: center;
}
.ui-empty__icon { font-size: 2.2rem; color: var(--ui-faint); display: block; margin-bottom: .6rem; }
.ui-empty__title { color: var(--ui-text); font-weight: 700; margin-bottom: .3rem; }

/* Aviseringar */
.alert {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-raised);
  color: var(--ui-text);
}
.alert-success { border-color: var(--ui-success); background: var(--ui-success-soft); color: var(--ui-text); }
.alert-danger  { border-color: var(--ui-danger);  background: var(--ui-danger-soft);  color: var(--ui-text); }
.alert-warning { border-color: var(--ui-warning); background: var(--ui-warning-soft); color: var(--ui-text); }
.alert-info,
.theme-light .alert-info { border-color: var(--ui-accent); background: var(--ui-accent-soft); color: var(--ui-text); }
.alert-secondary { border-color: var(--ui-border); background: var(--ui-surface-raised); color: var(--ui-muted); }

/* ------------------------------------------------------------------
   6. HERO / SIDHUVUD MED BILD
   ------------------------------------------------------------------ */

.ui-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: 1.5rem;
  padding: clamp(1.5rem, 3.5vw, 2.6rem) clamp(1.25rem, 3vw, 2.4rem);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background:
    var(--ui-hero-overlay),
    var(--event-hero-image, var(--ui-hero-image, url("../img/ui2/hero-fallback.0706c2639cbd.svg"))) var(--event-hero-position, right center)/cover no-repeat,
    var(--ui-surface);
  box-shadow: var(--ui-shadow);
}
.ui-hero__inner { position: relative; z-index: 2; max-width: 64ch; }
.ui-hero__title {
  margin: 0;
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -.03em;
}
.ui-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.15rem;
  margin-top: .8rem;
  color: var(--ui-muted);
  font-size: .95rem;
}
.ui-hero__meta-item { display: inline-flex; align-items: center; gap: .45rem; }
.ui-hero__meta-item .bi { color: var(--ui-gold-ink); }
.ui-hero__badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }

/* Chips ovanpå en hero-bild (sidhuvuden och eventkortets minihero,
   ".ui-panel__hero" i ui2-brewer.css) kan hamna över ljusa/varma partier
   av bilden. Den vanliga chip-stilen tonar bakgrunden i accentfärgen och
   sätter texten i samma färg, vilket kan tappa kontrast mot bilden. Ge
   hero-chips en garanterat mörk, solid bakgrund istället och låt
   accentfärgen synas via ikonen/pricken – då blir de läsbara oavsett
   bildinnehåll, och likadana överallt (ingen blur behövs). */
.ui-hero .ui-chip,
.ui-panel__hero .ui-chip {
  background: rgba(6, 19, 32, .82);
  border-color: rgba(255, 255, 255, .18);
  color: #f5f8fb;
}
.ui-hero .ui-chip--gold,    .ui-panel__hero .ui-chip--gold    { --ui-chip-accent: var(--ui-gold); }
.ui-hero .ui-chip--green,   .ui-panel__hero .ui-chip--green   { --ui-chip-accent: var(--ui-success); }
.ui-hero .ui-chip--blue,    .ui-panel__hero .ui-chip--blue    { --ui-chip-accent: var(--ui-accent); }
.ui-hero .ui-chip--warning, .ui-panel__hero .ui-chip--warning { --ui-chip-accent: var(--ui-warning); }
.ui-hero .ui-chip--danger,  .ui-panel__hero .ui-chip--danger  { --ui-chip-accent: var(--ui-danger); }
.ui-hero .ui-chip--purple,  .ui-panel__hero .ui-chip--purple  { --ui-chip-accent: var(--ui-info); }
.ui-hero .ui-chip .bi,
.ui-panel__hero .ui-chip .bi { color: var(--ui-chip-accent, inherit); }
.ui-hero .ui-chip--dot::before,
.ui-panel__hero .ui-chip--dot::before { background: var(--ui-chip-accent, var(--ui-muted)); }
.ui-hero__actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.1rem;
}
.ui-hero__actions--top { justify-content: flex-end; }
.ui-hero__actions--top .btn-outline-light { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }

/* Verktygsrad under hero:n (Klona / Exportera CSV på eventadministrationens
   sidor) - i vanligt sidflöde i stället för att flyta som en overlay ovanpå
   hero-bilden, där en nedfälld meny annars kunde hamna ovanpå titeln på
   kortare/mobila hero:ar. */
.ui-hero-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
  margin: 0 0 1.5rem;
}

/* Hero på publika startsidan */
.ui-hero--landing {
  padding: clamp(1.8rem, 4vw, 3.4rem);
  --ui-hero-image: url("../img/ui2/hero-golden-hop-waves.509ac823247f.png");
  --event-hero-position: center center;
}

/* Sökfält i hero */
.ui-herosearch {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
  padding: .5rem;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-sm);
}
.ui-herosearch__field { position: relative; flex: 1 1 15rem; min-width: 0; }
.ui-herosearch__field .form-control,
.ui-herosearch__field .form-select {
  height: 3rem;
  border: 0;
  background-color: transparent;
  padding-left: 2.5rem;
}
.ui-herosearch__field .form-control:focus,
.ui-herosearch__field .form-select:focus { box-shadow: none; background-color: transparent; }
.ui-herosearch__icon {
  position: absolute;
  top: 50%;
  left: .85rem;
  transform: translateY(-50%);
  color: var(--ui-muted);
  pointer-events: none;
}
.ui-herosearch .btn { flex: 0 0 auto; min-height: 3rem; padding-inline: 1.5rem; }

/* ------------------------------------------------------------------
   7. STATISTIKKORT
   ------------------------------------------------------------------ */

.ui-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.ui-tile {
  display: flex;
  align-items: center;
  gap: .85rem;
  width: 100%;
  padding: .95rem 1.05rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  color: var(--ui-text);
  text-align: left;
  box-shadow: var(--ui-shadow-sm);
  transition: all .16s var(--ui-ease);
}
a.ui-tile:hover, button.ui-tile:hover,
a.ui-tile:focus-visible, button.ui-tile:focus-visible {
  transform: translateY(-2px);
  border-color: var(--ui-gold);
  color: var(--ui-text);
  text-decoration: none;
  box-shadow: var(--ui-shadow);
}
.ui-tile.is-active { border-color: var(--ui-gold); background: linear-gradient(180deg, var(--ui-gold-soft), transparent); }

.ui-tile__icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 2.6rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: var(--ui-radius-xs);
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
  font-size: 1.25rem;
}
.ui-tile__body { flex: 1 1 auto; min-width: 0; }
.ui-tile__label {
  display: block;
  color: var(--ui-muted);
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.3;
}
.ui-tile__value {
  display: block;
  color: var(--ui-text-strong);
  font-family: var(--ui-font-display);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.15;
}
.ui-tile__value small, .ui-tile__value .text-muted { font-size: .9rem; font-weight: 600; }
.ui-tile__chevron { flex: 0 0 auto; color: var(--ui-faint); font-size: 1.05rem; }

/* Större översiktskort med mätare */
.ui-statcard {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.15rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-sm);
}
.ui-statcard--green { border-color: rgba(52, 199, 123, .35); background: linear-gradient(160deg, var(--ui-success-soft), transparent 70%), var(--ui-surface); }
.ui-statcard--gold  { border-color: rgba(245, 185, 66, .35); background: linear-gradient(160deg, var(--ui-gold-soft), transparent 70%), var(--ui-surface); }
.ui-statcard--blue  { border-color: rgba(77, 146, 245, .35); background: linear-gradient(160deg, var(--ui-accent-soft), transparent 70%), var(--ui-surface); }
.ui-statcard--warm  { border-color: rgba(240, 163, 60, .35); background: linear-gradient(160deg, var(--ui-warning-soft), transparent 70%), var(--ui-surface); }
.ui-statcard__label { color: var(--ui-muted); font-size: .82rem; font-weight: 600; }
.ui-statcard__value { font-family: var(--ui-font-display); font-size: 1.9rem; font-weight: 800; color: var(--ui-text-strong); line-height: 1.15; }
.ui-statcard__hint { color: var(--ui-muted); font-size: .8rem; }
.ui-statcard__link { margin-top: auto; padding-top: .8rem; font-size: .85rem; font-weight: 600; }

/* Cirkulär mätare */
.ui-gauge, .overview-gauge {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 4.1rem;
  width: 4.1rem;
  height: 4.1rem;
  border-radius: 50%;
  background: conic-gradient(var(--gauge-color, var(--ui-success)) var(--gauge-percent, 0%), var(--ui-surface-3) 0);
}
.ui-gauge::after, .overview-gauge::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--ui-surface);
}
.ui-gauge__inner, .overview-gauge__inner {
  position: relative;
  z-index: 1;
  color: var(--ui-text);
  font-size: .8rem;
  font-weight: 700;
}

/* Linjär mätare */
.progress, .ui-progress {
  height: .55rem;
  border-radius: var(--ui-radius-pill);
  background: var(--ui-surface-3);
  overflow: hidden;
}
.progress-bar { background: var(--ui-gold); }
.progress-bar.bg-warning { background: var(--ui-warning) !important; }
.progress-bar.bg-success { background: var(--ui-success) !important; }

/* Bred framstegsrad med procentbricka */
.ui-progressrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
}
.ui-progressrow__body { flex: 1 1 auto; min-width: 0; }
.ui-progressrow__pill {
  flex: 0 0 auto;
  padding: .3rem .8rem;
  border-radius: var(--ui-radius-pill);
  background: var(--ui-gold);
  color: var(--ui-primary-text);
  font-weight: 800;
  font-size: .88rem;
}

/* ------------------------------------------------------------------
   8. CHIPS OCH BADGES
   ------------------------------------------------------------------ */

.badge {
  padding: .3rem .65rem;
  border-radius: var(--ui-radius-pill);
  background: var(--ui-surface-3);
  color: var(--ui-muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .01em;
}

.badge.chip,
.ui-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-pill);
  background: var(--ui-surface-3);
  color: var(--ui-muted);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.3;
}
.ui-chip .bi { font-size: .85rem; }

.ui-chip--gold, .badge.chip-gold { border-color: rgba(245,185,66,.4); background: var(--ui-gold-soft); color: var(--ui-gold-ink); }
.ui-chip--green, .badge.chip-success,
.theme-dark .badge.chip-success, .theme-light .badge.chip-success { border-color: rgba(52,199,123,.4); background: var(--ui-success-soft); color: var(--ui-success); }
.ui-chip--blue, .badge.chip-style,
.theme-dark .badge.chip-style, .theme-light .badge.chip-style { border-color: rgba(77,146,245,.4); background: var(--ui-accent-soft); color: var(--ui-accent); }
.ui-chip--warning { border-color: rgba(240,163,60,.4); background: var(--ui-warning-soft); color: var(--ui-warning); }
.ui-chip--danger { border-color: rgba(239,95,107,.4); background: var(--ui-danger-soft); color: var(--ui-danger); }
.ui-chip--purple { border-color: rgba(124,108,240,.4); background: var(--ui-info-soft); color: var(--ui-info); }
.ui-chip--neutral, .badge.chip-neutral,
.theme-dark .badge.chip-neutral, .theme-light .badge.chip-neutral { background: var(--ui-surface-3); color: var(--ui-muted); }

/* Statusprick, t.ex. "● Öppet" */
.ui-chip--dot::before {
  content: "";
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: currentColor;
}

/* Rad med flera chips, t.ex. anmälningsstatus på ett events infosida */
.ui-chips { display: flex; flex-wrap: wrap; gap: .45rem; }

/* Publik eventinfosida: innehåll + smal sidodel med praktisk info/länkar */
.event-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  align-items: start;
  gap: 1.5rem;
}
.event-detail-aside { display: flex; flex-direction: column; gap: 1.25rem; }
@media (max-width: 860px) {
  .event-detail-layout { grid-template-columns: 1fr; }
}

/* Faktalista, t.ex. datum/tid/plats i sidodelen */
.ui-facts { display: flex; flex-direction: column; }
.ui-facts__item { display: flex; flex-direction: column; gap: .3rem; padding: .75rem 0; border-top: 1px solid var(--ui-divider); }
.ui-facts__item:first-child { padding-top: 0; border-top: 0; }
.ui-facts__label {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--ui-faint);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ui-facts__label .bi { color: var(--ui-gold-ink); font-size: .95rem; }
.ui-facts__value { color: var(--ui-text-strong); font-size: .95rem; font-weight: 600; }

/* Länklista, t.ex. kontakt/Facebook i sidodelen */
.ui-linklist { display: flex; flex-direction: column; gap: .7rem; list-style: none; padding: 0; margin: 0; }
.ui-linklist a { display: inline-flex; align-items: center; gap: .55rem; color: var(--ui-accent); font-weight: 650; overflow-wrap: anywhere; }
.ui-linklist a:hover { text-decoration: underline; }
.ui-linklist .bi { flex: 0 0 auto; color: var(--ui-gold-ink); font-size: 1.05rem; }

/* Formaterad eventbeskrivning (TinyMCE-innehåll) */
.event-description { color: var(--ui-text); line-height: 1.65; }
.event-description > *:first-child { margin-top: 0; }
.event-description > *:last-child { margin-bottom: 0; }
.event-description p, .event-description ul, .event-description ol { margin: 0 0 .85rem; }
.event-description ul, .event-description ol { padding-left: 1.3rem; }
.event-description a { color: var(--ui-accent); text-decoration: underline; }
.event-description strong { color: var(--ui-text-strong); }

/* Bootstrap-färgbadges mappade mot paletten */
.text-bg-success { background: var(--ui-success-soft) !important; color: var(--ui-success) !important; }
.text-bg-warning { background: var(--ui-warning-soft) !important; color: var(--ui-warning) !important; }
.text-bg-danger  { background: var(--ui-danger-soft) !important;  color: var(--ui-danger) !important; }
.text-bg-info    { background: var(--ui-accent-soft) !important;  color: var(--ui-accent) !important; }
.text-bg-secondary { background: var(--ui-surface-3) !important;  color: var(--ui-muted) !important; }
.text-bg-primary { background: var(--ui-gold-soft) !important;    color: var(--ui-gold) !important; }

.badge-style { background: var(--ui-accent-soft); color: var(--ui-accent); }
.badge-metric { background: var(--ui-surface-3); color: var(--ui-text); }
.badge-competition { background: var(--ui-success-soft); color: var(--ui-success); }
.badge .chip-mini { font-family: var(--ui-font-mono); font-size: 11px; }

/* Ja/Nej-brickor i tabeller */
.ui-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  padding: .25rem .6rem;
  border-radius: var(--ui-radius-xs);
  background: var(--ui-surface-3);
  color: var(--ui-muted);
  font-size: .78rem;
  font-weight: 700;
}
.ui-flag--yes { background: var(--ui-success); color: #06231a; }
.ui-flag--no { background: var(--ui-surface-3); color: var(--ui-muted); }

/* ------------------------------------------------------------------
   9. TABELLER OCH LISTOR
   ------------------------------------------------------------------ */

.ui-table-wrap,
.table-dark-card {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-sm);
  overflow: auto;
}
.ui-panel__body--flush .ui-table-wrap,
.ui-panel__body--flush .table-dark-card { border: 0; border-radius: 0; box-shadow: none; }

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ui-text);
  --bs-table-border-color: var(--ui-divider);
  margin-bottom: 0;
  color: var(--ui-text);
}
.table > :not(caption) > * > * { background: transparent; }

.table thead th,
.table-dark-card thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface-2);
  color: var(--ui-muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.theme-light .table thead th,
.theme-light .table-dark-card thead th { background: var(--ui-surface-2); color: var(--ui-muted); }
.table thead th .btn-link,
.table-dark-card thead th .btn-link { color: inherit; font: inherit; text-decoration: none; padding: 0; }
.table thead th .btn-link:hover { color: var(--ui-gold-ink); text-decoration: none; }

.table tbody td, .table tbody th {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--ui-divider);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--ui-surface-hover); }
.theme-dark .table-dark-card tbody tr:nth-child(odd) td,
.theme-light .table-dark-card tbody tr:nth-child(odd) td { background: transparent; }
.theme-dark .table-dark-card tbody tr:hover td,
.theme-light .table-dark-card tbody tr:hover td { background: var(--ui-surface-hover); }
.table tbody tr:focus-within { outline: 2px solid var(--ui-gold); outline-offset: -2px; }

.table-comfort td, .table-comfort th { padding-top: .9rem; padding-bottom: .9rem; }

.list-group-item {
  border-color: var(--ui-divider);
  background: var(--ui-surface);
  color: var(--ui-text);
}
.theme-light .list-group-item { background: var(--ui-surface); border-color: var(--ui-divider); color: var(--ui-text); }

.placeholder-muted { color: var(--ui-muted); }

/* Sökrad ovanför en tabell */
.ui-searchbar {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.ui-searchbar__field { position: relative; flex: 1 1 18rem; min-width: 0; }
.ui-searchbar__field .form-control { padding-left: 2.5rem; height: 2.75rem; }
.ui-searchbar__icon {
  position: absolute; top: 50%; left: .9rem; transform: translateY(-50%);
  color: var(--ui-muted); pointer-events: none;
}

/* Ölspecifika detaljer från gamla UI:t */
.beer-icon { width: 1.1rem; height: 1.1rem; color: var(--ui-gold-ink); display: inline-block; }
.beer-name { font-weight: 650; color: var(--ui-text-strong); }
.style-name { color: var(--ui-accent); opacity: .95; }
.theme-light .style-name { color: var(--ui-muted); }
.beer-desc { color: var(--ui-muted) !important; }

/* Mobilt kortläge för öltabellen (behålls från v1) */
@media (max-width: 640px) {
  table.table-beers thead { display: none; }
  table.table-beers, table.table-beers tbody, table.table-beers tr, table.table-beers td { display: block; width: 100%; }
  table.table-beers tr { border-bottom: 1px solid var(--ui-divider); padding: .5rem .75rem; }
  table.table-beers td { padding: .25rem 0; border: 0; }
  table.table-beers td::before { content: attr(data-label) ": "; color: var(--ui-muted); font-weight: 600; margin-right: .25rem; }
  table.table-beers td.text-end { text-align: left !important; }
}

/* ------------------------------------------------------------------
   10. FORMULÄR
   ------------------------------------------------------------------ */

.form-label {
  margin-bottom: .35rem;
  color: var(--ui-text);
  font-size: .87rem;
  font-weight: 650;
}
.form-text, .field-help { color: var(--ui-muted); font-size: .8rem; }

.form-control, .form-select, textarea,
.theme-light .form-control, .theme-light .form-select, .theme-light textarea {
  min-height: 2.7rem;
  padding: .55rem .85rem;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background-color: var(--ui-surface-2);
  color: var(--ui-text);
  font-size: .93rem;
  transition: border-color .16s var(--ui-ease), box-shadow .16s var(--ui-ease);
}
textarea.form-control { min-height: 6rem; }

.form-control::placeholder, textarea::placeholder, input::placeholder,
.theme-light .form-control::placeholder {
  color: var(--ui-faint);
  opacity: 1;
}

.form-control:focus, .form-select:focus, textarea:focus,
.theme-light .form-control:focus, .theme-light .form-select:focus, .theme-light textarea:focus {
  border-color: var(--ui-gold);
  background-color: var(--ui-surface-2);
  color: var(--ui-text);
  box-shadow: 0 0 0 3px var(--ui-gold-soft);
  outline: none;
}
.form-control:disabled, .form-select:disabled, textarea:disabled,
.theme-light .form-control:disabled {
  background-color: var(--ui-surface-3);
  color: var(--ui-faint);
  opacity: 1;
}
.form-select {
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2392a9c1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right .95rem center;
  background-size: 14px 14px;
}
.theme-light .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23526581' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right .95rem center;
  background-size: 14px 14px;
}
select.form-select[multiple], select.form-select[size]:not([size="1"]) { background-image: none; padding-right: .85rem; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--ui-danger); }
.invalid-feedback { color: var(--ui-danger); }

.form-check-input {
  width: 1.1rem; height: 1.1rem;
  border: 1px solid var(--ui-border-strong);
  background-color: var(--ui-surface-2);
}
.form-check-input:checked { background-color: var(--ui-gold); border-color: var(--ui-gold); }
.form-check-input:focus { border-color: var(--ui-gold); box-shadow: 0 0 0 3px var(--ui-gold-soft); }
.form-switch .form-check-input { width: 2.4rem; height: 1.3rem; }
.form-check-label { color: var(--ui-text); }

/* Inställningsrad: etikett + hjälptext till vänster, kontroll till höger */
.ui-field {
  display: grid;
  gap: .35rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--ui-divider);
}
.ui-field:last-child { border-bottom: 0; }
.ui-field__label { font-weight: 650; color: var(--ui-text); }
.ui-field__help { color: var(--ui-muted); font-size: .82rem; }

.ui-switchrow {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: .95rem 0;
  border-bottom: 1px solid var(--ui-divider);
}
.ui-switchrow:last-child { border-bottom: 0; }
/* Modifier: växeln ligger i samma rad som ett fält i kolumnen bredvid och
   centreras vertikalt mot det i stället för att haka i överkanten. */
.ui-switchrow--center {
  width: 100%;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.ui-switchrow__body { flex: 1 1 auto; min-width: 0; }
.ui-switchrow__title { font-weight: 650; color: var(--ui-text); }
.ui-switchrow__help { color: var(--ui-muted); font-size: .82rem; }

/* Fältgrupp med rubrik, som "Grunduppgifter" i designen */
.ui-fieldset { margin-bottom: 1.25rem; }
.ui-fieldset__head { display: flex; align-items: center; gap: .85rem; margin-bottom: 1rem; }

/* TinyMCE och rik text */
.tox-tinymce { border: 1px solid var(--ui-border-strong) !important; border-radius: var(--ui-radius-sm) !important; }

/* ------------------------------------------------------------------
   11. OVERLAYS
   ------------------------------------------------------------------ */

.modal-content,
.theme-dark .modal-content,
.theme-light .modal-content {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: var(--ui-shadow-lg);
}
.modal-header, .modal-footer,
.theme-dark .modal-header, .theme-dark .modal-footer,
.theme-light .modal-header, .theme-light .modal-footer {
  border-color: var(--ui-divider);
  padding: 1.1rem 1.3rem;
}
.modal-body { padding: 1.3rem; color: var(--ui-text); }
.modal-title { font-size: 1.15rem; }
.modal-backdrop { background: #02090f; }
.modal-backdrop.show { opacity: .82; backdrop-filter: blur(8px) saturate(.7); -webkit-backdrop-filter: blur(8px) saturate(.7); }

/* Dialogen börjar under toppnavet och innehållet scrollar inuti rutan,
   så att rubrik och knapprad alltid syns även på låga fönster. */
.modal-dialog {
  margin-top: calc(var(--ui-topbar-h) + .75rem);
  margin-bottom: 1.75rem;
}
.modal-content { max-height: calc(100vh - var(--ui-topbar-h) - 2.5rem); }
.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ui-surface);
  border-radius: var(--ui-radius-lg) var(--ui-radius-lg) 0 0;
}
.modal-body { overflow-y: auto; }
.modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--ui-surface);
  border-radius: 0 0 var(--ui-radius-lg) var(--ui-radius-lg);
}
.modal-fullscreen .modal-content { max-height: none; }
@media (max-width: 575.98px) {
  .modal-dialog { margin-top: calc(var(--ui-topbar-h) + .4rem); margin-bottom: .5rem; }
  .modal-content { max-height: calc(100vh - var(--ui-topbar-h) - 1rem); }
}
.theme-dark .modal .btn-close, .theme-dark .offcanvas .btn-close { filter: invert(1) grayscale(1); opacity: .65; }
.theme-dark .modal .btn-close:hover { opacity: 1; }

.offcanvas,
.theme-dark .offcanvas, .theme-light .offcanvas {
  background: var(--ui-surface);
  color: var(--ui-text);
  border-left: 1px solid var(--ui-border);
}
.offcanvas-header { border-bottom: 1px solid var(--ui-divider); padding: 1.1rem 1.3rem; }
.offcanvas-body { background: var(--ui-surface); padding: 1.3rem; }
.offcanvas-title { font-size: 1.1rem; }

.dropdown-menu {
  padding: .35rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow);
  min-width: 13rem;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .7rem;
  border-radius: var(--ui-radius-xs);
  color: var(--ui-text);
  font-size: .9rem;
  font-weight: 550;
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--ui-surface-hover); color: var(--ui-text-strong); }
.dropdown-item i, .dropdown-item .bi { width: 1.15rem; color: var(--ui-muted); text-align: center; }
.dropdown-item:hover i { color: var(--ui-gold-ink); }
.dropdown-header { padding: .5rem .7rem; color: var(--ui-muted); font-size: .78rem; }
.dropdown-divider { border-color: var(--ui-divider); }
.dropdown-item--logout, .dropdown-item--logout i { color: var(--ui-danger); }
.dropdown-item--logout:hover { background: var(--ui-danger-soft); color: var(--ui-danger); }

.tooltip-inner { background: var(--ui-surface-3); color: var(--ui-text); border-radius: var(--ui-radius-xs); }
.tooltip .tooltip-arrow::before { border-top-color: var(--ui-surface-3); }

/* Toaster */
#toast-container .alert {
  min-width: 16rem;
  margin-bottom: .6rem;
  box-shadow: var(--ui-shadow);
}

/* Skelett vid HTMX-laddning */
.skeleton { position: relative; opacity: .45; pointer-events: none; }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--ui-surface-hover), transparent);
  animation: ui-shimmer 1.1s infinite;
}
@keyframes ui-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ------------------------------------------------------------------
   12. HJÄLPKLASSER
   ------------------------------------------------------------------ */

.ui-grid { display: grid; gap: 1rem; }
.ui-grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.ui-grid--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.ui-grid--4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.ui-stack { display: flex; flex-direction: column; gap: 1rem; }
.ui-stack--tight { gap: .5rem; }
.ui-stack--loose { gap: 1.5rem; }

.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0); }
.ui-divider { height: 1px; border: 0; margin: 1.25rem 0; background: var(--ui-divider); }

.ui-hidden { display: none !important; }

/* ------------------------------------------------------------------
   13. RESPONSIVT
   ------------------------------------------------------------------ */

@media (max-width: 1199.98px) {
  .ui-topnav { display: none; }
}

@media (max-width: 991.98px) {
  :root { --ui-sidebar-w: 240px; }

  .ui-sidebar {
    position: fixed;
    top: var(--ui-topbar-h);
    left: 0;
    height: calc(100vh - var(--ui-topbar-h));
    transform: translateX(-100%);
    box-shadow: var(--ui-shadow-lg);
    transition: transform .24s var(--ui-ease);
  }
  .ui-shell.is-open .ui-sidebar { transform: translateX(0); }
  .ui-shell.is-collapsed .ui-sidebar { flex-basis: var(--ui-sidebar-w); width: var(--ui-sidebar-w); }
  .ui-shell.is-collapsed .ui-sidebar__label,
  .ui-shell.is-collapsed .ui-sidebar__count,
  .ui-shell.is-collapsed .ui-sidebar__heading,
  .ui-shell.is-collapsed .ui-sidebar__chevron,
  .ui-shell.is-collapsed .ui-sidebar__external,
  .ui-shell.is-collapsed .ui-sidebar__sub,
  .ui-shell.is-collapsed .ui-sidebar__eventcard-body,
  .ui-shell.is-collapsed .ui-sidebar__profile-body { display: revert; }
  .ui-shell.is-collapsed .ui-sidebar__link { justify-content: flex-start; padding-left: .78rem; padding-right: .78rem; }

  .ui-sidebar-scrim {
    position: fixed;
    inset: var(--ui-topbar-h) 0 0;
    z-index: 1029;
    background: rgba(3, 12, 22, .55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s var(--ui-ease);
  }
  .ui-shell.is-open .ui-sidebar-scrim { opacity: 1; pointer-events: auto; }

}

@media (max-width: 767.98px) {
  .ui-page { padding: 1rem .9rem 2.5rem; }
  .ui-hero { padding: 1.35rem 1.15rem; border-radius: var(--ui-radius); --ui-hero-overlay: var(--ui-hero-overlay-mobile); }
  .ui-hero__title { font-size: 1.65rem; }
  .ui-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
  .ui-tile { padding: .75rem .8rem; gap: .6rem; }
  .ui-tile__icon { flex-basis: 2.2rem; width: 2.2rem; height: 2.2rem; font-size: 1.05rem; }
  .ui-tile__value { font-size: 1.3rem; }
  .ui-panel__head { padding: .9rem 1rem; }
  .ui-panel__body { padding: 1rem; }
  .ui-footer__inner { flex-direction: column; text-align: center; }
  .btn { min-height: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .ui-topbar, .ui-sidebar, .ui-footer, .ui-hero__actions, .ui-hero-toolbar { display: none !important; }
  .ui-app::before { display: none; }
  .ui-page { padding: 0; }
}
