/* ==========================================================================
   Horizon Roleplay — stylesheet
   Ersätter style.css, theme.css, multi_roles.css, profile-extra.css och
   horizon-redesign.css. Ladda ENDAST denna fil.
   Platta ytor, tunna linjer, en accentfärg. Inga glöd, gradienter eller
   glas-effekter.
   ========================================================================== */


:root {
  color-scheme: dark;

  /* Ytor */
  --bg: #111214;
  --bg-2: #0d0e10;
  --surface: #17181b;
  --surface-2: #1d1f22;
  --surface-3: #25272b;
  --hover: #1f2124;

  /* Linjer */
  --line: #24262a;
  --line-2: #2f3236;
  --line-3: #3d4045;

  /* Text */
  --text: #ecebe8;
  --text-2: #b4b2ad;
  --text-3: #97958f;
  --text-4: #86847e;

  /* Accent: skymningsorange, används sparsamt */
  --accent: #ee8a52;
  --accent-hover: #f39b68;
  --accent-ink: #1b0f07;
  --accent-tint: rgba(238, 138, 82, .12);
  --accent-line: rgba(238, 138, 82, .38);

  /* Status */
  --ok: #74c493;
  --ok-tint: rgba(116, 196, 147, .12);
  --warn: #dfb35f;
  --warn-tint: rgba(223, 179, 95, .12);
  --bad: #e8776e;
  --bad-tint: rgba(232, 119, 110, .12);
  --info: #82aee0;
  --info-tint: rgba(130, 174, 224, .12);

  --r-xs: 5px;
  --r-sm: 7px;
  --r: 10px;
  --r-lg: 14px;

  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --t: 160ms;
}

/* ==========================================================================
   Bas
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  min-height: 100%;
  overflow-x: clip;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 28px; letter-spacing: -.025em; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
small { font-size: 12.5px; }
b, strong { font-weight: 600; }
ul { margin: 0; padding-left: 18px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Sidovy-wrapper */
.wrap,
.container {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
}
.wrap { padding: 0 0 48px; }

/* ==========================================================================
   Topbar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
  margin-bottom: 36px;
}
/* Fullbredd-bakgrund bakom topbaren utan att ändra markup */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background: rgba(17, 18, 20, .9);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: max-content;
}
.logo {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line-2);
  border-radius: 8px;
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-copy { display: flex; align-items: baseline; gap: 8px; }
.brand-copy b { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.brand-copy small { color: var(--text-3); font-size: 13px; }

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}
.nav .btn {
  height: 34px;
  min-height: 0;
  padding: 0 12px;
  color: var(--text-2);
  background: transparent;
  border-color: transparent;
  font-weight: 500;
}
.nav .btn:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.nav .btn.active { color: var(--text); background: var(--surface-2); }
.nav .btn.primary,
.nav .btn.primary.active {
  margin-left: 6px;
  color: var(--accent-ink);
  background: var(--accent);
}
.nav .btn.primary:hover { background: var(--accent-hover); }
.nav a[href="logout.php"] { margin-left: 6px; border-color: var(--line-2); }

/* ==========================================================================
   Knappar
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-hover); }

.btn.danger { color: var(--bad); background: transparent; border-color: rgba(232, 119, 110, .35); }
.btn.danger:hover { background: var(--bad-tint); border-color: var(--bad); }

.btn.warn { color: var(--warn); background: transparent; border-color: rgba(223, 179, 95, .35); }
.btn.warn:hover { background: var(--warn-tint); border-color: var(--warn); }

.btn.small { min-height: 30px; padding: 0 11px; font-size: 12.5px; }

/* ==========================================================================
   Formulär
   ========================================================================== */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  line-height: 1.5;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
textarea { min-height: 140px; resize: vertical; }
select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8883' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
input::placeholder, textarea::placeholder { color: var(--text-4); }
input:hover:not(:focus), textarea:hover:not(:focus), select:hover:not(:focus) { border-color: var(--line-3); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
input[readonly] { color: var(--text-3); background: var(--surface); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

label { display: block; color: var(--text); font-size: 13.5px; font-weight: 500; }
.required-mark { color: var(--accent); margin-left: 2px; }

/* ==========================================================================
   Paneler
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card > .hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}
.card > .body { padding: 18px; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

/* Taggar, räknare */
.badge,
.small-pill,
.home-section-count,
.my-notification-type {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.card > .hd .badge,
.home-section-count { font-size: 12px; font-variant-numeric: tabular-nums; }
.home-section-count { background: transparent; border: 0; padding: 0; }

/* Ansökningsstatus */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-2);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.godkand { color: var(--ok); background: var(--ok-tint); }
.status.nekad { color: var(--bad); background: var(--bad-tint); }
.status.intervju { color: var(--warn); background: var(--warn-tint); }

/* ==========================================================================
   Roller
   ========================================================================== */
.admin-mini-role,
.admin-role-badge,
.home-role-badge,
.profile-role-badge {
  --rc: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px 0 6px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.admin-mini-role,
.home-role-badge { height: 20px; font-size: 11.5px; padding: 0 7px 0 5px; }

.role-icon { display: inline-grid; place-items: center; color: var(--rc); }
.role-icon svg,
.multi-role-option-icon svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.role-label { color: inherit; }

.role-agare { --rc: #e6b85c; }
.role-delagare { --rc: #d9a35a; }
.role-head-admin, .role-admin { --rc: #e8776e; }
.role-ledning { --rc: #ee8a52; }
.role-staff-manager { --rc: #c79ee0; }
.role-head-mod { --rc: #6fa8e0; }
.role-mod { --rc: #82b5ea; }
.role-helper { --rc: #74c493; }
.role-medlemskapsansvarig, .role-verksamhetsledare-medlemskap { --rc: #7fc7b6; }
.role-forum-utvecklare { --rc: #a99ae8; }
.role-event-ansvarig, .role-verksamhetsledare-event { --rc: #e6a0c4; }
.role-kriminell-ansvarig, .role-verksamhetsledare-kriminell { --rc: #cf8f8a; }
.role-servervakt-ansvarig, .role-verksamhetsledare-servervakt { --rc: #9fb8cc; }
.role-jobb-ansvarig, .role-verksamhetsledare-jobb { --rc: #cbb487; }
.role-donation-ansvarig { --rc: #d7bd6c; }
.role-user { --rc: var(--text-4); }

.admin-role-badge.role-agare,
.profile-role-badge.role-agare { color: #f0d79f; border-color: rgba(230, 184, 92, .3); }

/* Ägarnamn: guldton, ingen glöd */
.owner-name-glow { color: #e9c77e !important; }

/* ==========================================================================
   Avatarer (gemensamt)
   ========================================================================== */
.home-person-avatar,
.home-member-avatar,
.board-thread-avatar,
.board-author-avatar,
.thread-author-avatar,
.thread-post-avatar,
.profile-comment-avatar,
.admin-dashboard-avatar,
.admin-member-avatar,
.members-modern-avatar {
  position: relative;
  flex: 0 0 auto;
  display: block;
  border-radius: 50%;
  background: var(--surface-3);
}
.home-person-avatar img,
.home-member-avatar img,
.board-thread-avatar img,
.board-author-avatar img,
.thread-author-avatar img,
.thread-post-avatar img,
.profile-comment-avatar img,
.admin-dashboard-avatar img,
.admin-member-avatar img,
.members-modern-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.home-avatar-fallback,
.board-avatar-fallback,
.admin-dashboard-avatar-fallback,
.admin-avatar-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: var(--surface-3);
  border-radius: inherit;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.home-online-dot,
.admin-online-dot,
.members-status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  background: var(--ok);
  border: 2px solid var(--surface);
  border-radius: 50%;
}

/* ==========================================================================
   Sidhuvud-mönster (hero-sektioner = rubrikrad, inte kort)
   ========================================================================== */
.home-hero,
.board-hero,
.thread-hero-card,
.create-thread-hero,
.members-hero-card,
.admin-hero.card {
  background: transparent;
  border: 0;
  border-radius: 0;
}

.board-breadcrumbs,
.thread-breadcrumbs,
.create-thread-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--text-3);
  font-size: 13px;
}
.board-breadcrumbs a,
.thread-breadcrumbs a,
.create-thread-breadcrumbs a { color: var(--text-2); transition: color var(--t); }
.board-breadcrumbs a:hover,
.thread-breadcrumbs a:hover,
.create-thread-breadcrumbs a:hover { color: var(--accent); }
.board-breadcrumbs span,
.thread-breadcrumbs span,
.create-thread-breadcrumbs span { color: var(--text-4); }

/* Små statistikrader (siffra + etikett) */
.home-hero-stats,
.board-stats-row,
.thread-hero-stats,
.members-hero-stats,
.my-hero-summary,
.admin-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}
.home-hero-stats > div,
.board-stat-box,
.thread-hero-stats > div,
.members-hero-stats > div,
.my-hero-summary > div,
.admin-summary > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  background: none;
  border: 0;
}
.home-hero-stats b,
.board-stat-box b,
.thread-hero-stats b,
.members-hero-stats b,
.my-hero-summary b,
.admin-summary b {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.home-hero-stats span,
.board-stat-box span,
.thread-hero-stats span,
.members-hero-stats span,
.my-hero-summary span,
.admin-summary span {
  color: var(--text-3);
  font-size: 13px;
}
.board-stat-box { flex-direction: column-reverse; }
.my-hero-summary .has-unread b { color: var(--accent); }

/* ==========================================================================
   Startsidan
   ========================================================================== */
.grid.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}
.home-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.home-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  padding: 4px 0 8px;
}
.home-hero-content { max-width: 560px; }
.home-hero h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.03em; }
.home-hero h1 span { color: inherit; }
.home-hero p { margin-top: 10px; color: var(--text-2); font-size: 15.5px; }
.home-hero .cta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

.home-forum-section { overflow: hidden; }
.board-grid { display: flex; flex-direction: column; }

/* Forumrad */
.board.home-board {
  display: block;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  transition: background var(--t) var(--ease);
}
.board.home-board:first-child { border-top: 0; }
.board.home-board:hover { background: var(--hover); }
.board.home-board:hover h3 { color: var(--accent); }
.home-board-icon { display: none; }

.home-board-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  grid-template-areas: "top latest" "meta latest";
  column-gap: 28px;
  row-gap: 6px;
  align-items: start;
}
.board-top { grid-area: top; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.home-board-heading h3 { font-size: 15px; font-weight: 600; transition: color var(--t); }
.home-board-heading p { margin-top: 2px; color: var(--text-3); font-size: 13.5px; }
.board-top .small-pill { display: none; }

.board-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  color: var(--text-3);
  font-size: 12.5px;
}
.board-meta b { color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.board-meta .status { height: 20px; font-size: 11.5px; }

.home-board-latest {
  grid-area: latest;
  align-self: center;
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.home-latest-label { display: block; color: var(--text-4); font-size: 11.5px; margin-bottom: 2px; }
.home-board-latest b {
  display: block;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.home-board-latest small { display: block; color: var(--text-3); font-size: 12px; }
.home-no-thread { color: var(--text-4); font-size: 12.5px; }

/* Sidokolumn */
.home-sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.home-side-card > .body { padding: 6px; }

.home-staff-list,
.home-latest-threads { display: flex; flex-direction: column; }

.home-staff-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  transition: background var(--t);
}
.home-staff-item:hover { background: var(--hover); }
.home-person-avatar { width: 34px; height: 34px; }
.home-person-info { min-width: 0; flex: 1; }
.home-person-info > b { display: block; font-size: 13.5px; font-weight: 600; }
.home-role-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.home-row-arrow { display: none; }

.home-online-members {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
}
.home-online-member {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px 0 4px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  transition: border-color var(--t), color var(--t);
}
.home-online-member:hover { color: var(--text); border-color: var(--line-3); }
.home-member-avatar { width: 22px; height: 22px; }
.home-member-avatar .home-avatar-fallback { font-size: 10px; }
.home-member-avatar .home-online-dot { display: none; }

.home-thread-item {
  display: block;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  transition: background var(--t);
}
.home-thread-item:hover { background: var(--hover); }
.home-thread-marker { display: none; }
.home-thread-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.home-thread-title-row b {
  min-width: 0;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.home-thread-title-row .status { flex: 0 0 auto; height: 18px; font-size: 11px; padding: 0 6px; }
.home-thread-content > span {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.body.home-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  padding: 0;
  background: var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  overflow: hidden;
}
.home-stat-box {
  display: flex;
  flex-direction: column-reverse;
  gap: 1px;
  padding: 14px 16px;
  background: var(--surface);
}
.home-stat-box b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.home-stat-box span { color: var(--text-3); font-size: 12.5px; }
.home-latest-member {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  font-size: 13px;
  transition: background var(--t);
}
.home-latest-member:hover { background: var(--hover); }
.home-latest-member > span:first-child { color: var(--text-3); }
.home-latest-member b { margin-left: auto; font-weight: 500; }

/* ==========================================================================
   Kategorisida (board.php)
   ========================================================================== */
.board-page-grid,
.create-thread-layout,
.my-page-layout,
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
}
.board-main,
.create-thread-main,
.my-page-main,
.profile-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.board-sidebar,
.create-thread-sidebar,
.my-page-sidebar,
.profile-sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.board-hero-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.board-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.board-hero-copy p { margin-top: 6px; max-width: 620px; color: var(--text-2); }
.board-hero-actions { display: flex; align-items: center; gap: 8px; }
.board-access-note { color: var(--text-3); font-size: 13px; }
.board-stats-row { margin-top: 18px; gap: 24px; }
.board-stat-box { flex-direction: row-reverse; align-items: baseline; gap: 6px; }
.board-stat-box b { font-size: 15px; }
.board-stat-box span { font-size: 13px; }

.body.board-thread-body { padding: 0; }
.board-thread-list { display: flex; flex-direction: column; }
.board-thread-item {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  transition: background var(--t);
}
.board-thread-item:first-child { border-top: 0; }
.board-thread-item:hover { background: var(--hover); }
.board-thread-avatar { width: 36px; height: 36px; }
.board-thread-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.board-thread-title { font-size: 15px; font-weight: 600; transition: color var(--t); }
.board-thread-title::after { content: ""; position: absolute; inset: 0; } /* hela raden klickbar */
.board-thread-item:hover .board-thread-title { color: var(--accent); }
.board-thread-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12.5px;
}
.board-thread-meta a { position: relative; z-index: 1; color: var(--text-2); }
.board-thread-meta a:hover { color: var(--accent); }

.board-thread-side { display: flex; align-items: center; gap: 24px; }
.board-thread-replies { display: flex; align-items: baseline; gap: 5px; min-width: 56px; justify-content: flex-end; }
.board-thread-replies b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.board-thread-replies span { color: var(--text-3); font-size: 12.5px; }
.board-thread-last { display: flex; flex-direction: column; min-width: 150px; text-align: right; }
.board-thread-last span { color: var(--text-4); font-size: 11.5px; }
.board-thread-last b { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.board-thread-open { display: none; }

.board-empty,
.members-empty,
.my-empty-state {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 32px 20px;
  color: var(--text-3);
}
.board-empty b,
.members-empty b,
.my-empty-state b { display: block; color: var(--text); font-size: 14.5px; }
.board-empty p,
.members-empty p,
.my-empty-state p { margin-top: 2px; font-size: 13.5px; }
.board-empty-icon,
.members-empty-icon,
.my-empty-icon,
.admin-empty-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 15px;
}

/* Info-listor i sidokolumner */
.board-info-list,
.create-thread-info-list { display: flex; flex-direction: column; }
.board-info-row,
.create-thread-info-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.board-info-row:first-child,
.create-thread-info-list > div:first-child { border-top: 0; padding-top: 0; }
.board-info-row:last-child,
.create-thread-info-list > div:last-child { padding-bottom: 0; }
.board-info-row span,
.create-thread-info-list span { color: var(--text-3); }
.board-info-row b,
.create-thread-info-list b { font-weight: 500; text-align: right; }

.board-sidebar .card > .body:has(.board-author-list) { padding: 6px; }
.board-author-list { display: flex; flex-direction: column; }
.board-author-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  transition: background var(--t);
}
.board-author-item:hover { background: var(--hover); }
.board-author-avatar { width: 30px; height: 30px; }
.board-author-content { min-width: 0; }
.board-author-content b { display: block; font-size: 13.5px; font-weight: 500; }
.board-author-content span { display: block; color: var(--text-3); font-size: 12px; }
.board-list-arrow { display: none; }

/* ==========================================================================
   Tråd (thread.php)
   ========================================================================== */
.thread-page { display: flex; flex-direction: column; gap: 16px; max-width: 1000px; margin: 0 auto; }

.thread-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
}
.thread-hero-copy { min-width: 0; flex: 1 1 520px; }
.thread-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.thread-title-line h1 { flex: 1 1 100%; overflow-wrap: anywhere; }

.thread-lock-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.thread-lock-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.thread-lock-state.open { color: var(--text-3); }
.thread-lock-state.locked { color: var(--bad); background: var(--bad-tint); }

.thread-author-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font-size: 13.5px;
}
.thread-author-avatar { width: 32px; height: 32px; }
.thread-author-line > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.thread-author-line > div span { color: var(--text-3); }
.thread-author-line > div a { font-weight: 600; transition: color var(--t); }
.thread-author-line > div a:hover { color: var(--accent); }
.thread-author-line > div small { flex-basis: 100%; color: var(--text-3); }

.thread-hero-stats { gap: 24px; }
.thread-hero-stats b { font-size: 18px; }

.thread-admin-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 20px;
  padding: 10px 12px 10px 16px;
  background: var(--surface);
  border: 1px dashed var(--line-3);
  border-radius: var(--r);
}
.thread-admin-heading { color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.thread-admin-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.thread-admin-form .btn { min-height: 32px; font-size: 13px; }
.thread-admin-form select { width: auto; min-width: 150px; min-height: 32px; padding-top: 5px; padding-bottom: 5px; font-size: 13px; }

.thread-post-list { display: flex; flex-direction: column; gap: 12px; }

.thread-post {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  overflow: hidden;
  scroll-margin-top: 84px;
}
.thread-post-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 14px;
  text-align: center;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}
.thread-post-avatar { width: 64px; height: 64px; border-radius: 14px; }
.thread-post-username { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; transition: color var(--t); }
.thread-post-username:hover { color: var(--accent); }
.thread-post-roles { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.thread-post-user-stats {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  width: 100%;
  justify-content: center;
}
.thread-post-user-stats > div { display: flex; flex-direction: column-reverse; }
.thread-post-user-stats b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.thread-post-user-stats span { color: var(--text-4); font-size: 11.5px; }

.thread-post-main { display: flex; flex-direction: column; min-width: 0; }
.thread-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.thread-post-header > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.thread-post-date { color: var(--text-2); font-size: 13px; font-weight: 500; }
.thread-post-header small { color: var(--text-4); font-family: var(--mono); font-size: 11.5px; }
.thread-post-header-actions { display: flex; align-items: center; gap: 8px; }
.thread-post-header-actions form { margin: 0; }
.thread-post-number { color: var(--text-4); font-family: var(--mono); font-size: 12px; }
.thread-post-number:hover { color: var(--accent); }

.thread-delete-post {
  height: 26px;
  padding: 0 9px;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  font-size: 12px;
  white-space: nowrap;
  transition: color var(--t), border-color var(--t), background var(--t);
}
.thread-delete-post:hover { color: var(--bad); border-color: rgba(232, 119, 110, .45); background: var(--bad-tint); }

.thread-post-body {
  padding: 18px 20px 22px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  max-width: 76ch;
}

.thread-reply-card > .body { padding: 18px; }
.thread-reply-form { display: flex; flex-direction: column; gap: 8px; }
.thread-reply-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.thread-reply-actions > span { color: var(--text-3); font-size: 12.5px; }

.thread-reply-state,
.profile-login-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.thread-reply-state b,
.profile-login-note b { display: block; font-size: 14.5px; }
.thread-reply-state p,
.profile-login-note span { display: block; color: var(--text-3); font-size: 13.5px; }
.thread-reply-state.locked b { color: var(--bad); }

.thread-footer-actions { display: flex; gap: 8px; }

/* ==========================================================================
   Skapa tråd / ansökan
   ========================================================================== */
.create-thread-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.create-thread-title-row > div:first-child { max-width: 620px; }
.create-thread-title-row .badge { margin-bottom: 10px; }
.create-thread-title-row p { margin-top: 6px; color: var(--text-2); }
.create-thread-category { display: flex; flex-direction: column; align-items: flex-end; font-size: 13.5px; }
.create-thread-category span { color: var(--text-3); font-size: 12.5px; }
.create-thread-category b { font-weight: 500; }

.create-thread-form { display: flex; flex-direction: column; gap: 20px; }
.create-thread-field { display: flex; flex-direction: column; gap: 8px; }
.create-thread-field-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.create-thread-field-head span { display: block; margin-top: 2px; color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.create-thread-field-head .small-pill { margin-top: 0; }
.create-thread-field textarea { min-height: 220px; }

.create-thread-question-list { display: flex; flex-direction: column; }
.create-thread-question {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.create-thread-question:first-child { border-top: 0; padding-top: 4px; }
.create-thread-question-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 12px;
}
.create-thread-question-content { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding-top: 3px; }
.create-thread-question-content textarea { min-height: 110px; }

.create-thread-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.create-thread-closed { padding: 16px; background: var(--surface-2); border-radius: var(--r); }
.create-thread-closed b { display: block; }
.create-thread-closed p { margin-top: 2px; color: var(--text-3); font-size: 13.5px; }

/* ==========================================================================
   Notiser, fel, tomma lägen
   ========================================================================== */
.error,
.success-note,
.my-errors,
.create-thread-errors {
  padding: 12px 14px;
  border: 1px solid;
  border-radius: var(--r);
  font-size: 14px;
}
.error,
.my-errors,
.create-thread-errors { color: #f3c3be; background: var(--bad-tint); border-color: rgba(232, 119, 110, .35); }
.success-note { color: #bfe6cd; background: var(--ok-tint); border-color: rgba(116, 196, 147, .35); }
.create-thread-errors { display: flex; gap: 12px; }
.create-thread-errors b { color: var(--text); }
.create-thread-errors ul { margin-top: 4px; }
.create-thread-error-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--bg);
  background: var(--bad);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}
.my-errors { display: flex; flex-direction: column; gap: 4px; }

.empty-note,
.admin-dashboard-empty {
  padding: 14px 12px;
  color: var(--text-3);
  font-size: 13.5px;
}

/* ==========================================================================
   Profil + Min sida (delad hero)
   ========================================================================== */
.profile-hero-card,
.my-hero-card { position: relative; overflow: hidden; }
.profile-cover,
.my-hero-cover {
  height: 72px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.profile-hero-body,
.my-hero-content {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 20px;
  padding: 0 24px 22px;
}
.profile-avatar-wrap,
.my-avatar-wrap {
  width: 104px;
  height: 104px;
  margin-top: -44px;
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--surface-3);
  border: 4px solid var(--surface);
  border-radius: 20px;
}
.profile-avatar-wrap img,
.my-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }

.profile-identity,
.my-identity { flex: 1 1 280px; min-width: 0; padding-top: 14px; }
.profile-eyebrow { display: block; color: var(--text-3); font-size: 12.5px; margin-bottom: 2px; }
.profile-identity h1,
.my-identity h1 { font-size: 26px; overflow-wrap: anywhere; }
.my-identity .badge { margin-bottom: 8px; }
.profile-role-list,
.my-role-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.profile-meta-row { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 12px; font-size: 13px; }
.profile-meta-row span { display: flex; flex-direction: column; color: var(--text-3); }
.profile-meta-row b { color: var(--text-2); font-weight: 500; }
.my-identity > p { margin-top: 10px; color: var(--text-3); font-size: 13px; }
.my-hero-summary { align-self: flex-end; padding-bottom: 4px; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}
.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 14px 24px;
  border-left: 1px solid var(--line);
}
.profile-stat:first-child { border-left: 0; }
.profile-stat b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.profile-stat span { color: var(--text-3); font-size: 12.5px; }

.profile-bio-text { color: var(--text-2); line-height: 1.7; }

.profile-comment-form { display: flex; flex-direction: column; gap: 8px; }
.profile-comment-form textarea { min-height: 96px; }
.profile-comment-submit { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-comment-submit > span { color: var(--text-3); font-size: 12.5px; }

.profile-comment-list { display: flex; flex-direction: column; margin-top: 18px; border-top: 1px solid var(--line); }
.profile-comment-form + .profile-comment-list,
.profile-login-note + .profile-comment-list { margin-top: 18px; }
.profile-comment-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.profile-comment-item:last-child { border-bottom: 0; padding-bottom: 0; }
.profile-comment-avatar { width: 34px; height: 34px; }
.profile-comment-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.profile-comment-head > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.profile-comment-author { font-size: 14px; font-weight: 600; transition: color var(--t); }
.profile-comment-author:hover { color: var(--accent); }
.profile-comment-head time { color: var(--text-3); font-size: 12.5px; }
.profile-comment-body { margin-top: 4px; color: var(--text); font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.profile-comment-delete-form { margin: 0; }
.icon-delete {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--text-4);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  transition: color var(--t), background var(--t), border-color var(--t);
}
.icon-delete svg { width: 14px; height: 14px; }
.icon-delete:empty::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.icon-delete:hover { color: var(--bad); background: var(--bad-tint); border-color: rgba(232, 119, 110, .35); }

.profile-sidebar .card > .body,
.my-page-sidebar .card > .body { padding: 6px; }
.profile-side-list,
.profile-activity-list { display: flex; flex-direction: column; }
.profile-side-item,
.profile-activity-item {
  display: block;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  transition: background var(--t);
}
.profile-side-item:hover,
.profile-activity-item:hover { background: var(--hover); }
.profile-side-item b { display: block; font-size: 13.5px; font-weight: 500; line-height: 1.4; }
.profile-side-item span { display: block; margin-top: 2px; color: var(--text-3); font-size: 12px; }
.profile-activity-item { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; }
.profile-activity-icon { color: var(--text-4); font-size: 13px; line-height: 1.5; }
.profile-activity-item b { display: block; font-size: 13px; font-weight: 500; line-height: 1.45; }
.profile-activity-item p {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.5;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.profile-activity-item time,
.profile-activity-item small { display: block; margin-top: 3px; color: var(--text-4); font-size: 11.5px; }

/* ==========================================================================
   Min sida — notiser, formulär, länkar
   ========================================================================== */
.my-notification-head-actions { display: flex; align-items: center; gap: 8px; }
.my-notification-head-actions form { margin: 0; }
.my-notifications-card > .body { padding: 0; }
.my-notification-list { display: flex; flex-direction: column; }

.my-notification-item {
  --nc: var(--text-3);
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  transition: background var(--t);
}
.my-notification-item:first-child { border-top: 0; }
.my-notification-item:hover { background: var(--hover); }
.my-notification-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--nc);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1;
}
.my-notification-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.my-notification-title-row b { font-size: 14px; font-weight: 600; }
.my-notification-type { height: 19px; padding: 0 7px; font-size: 11px; }
.my-notification-content p { margin-top: 3px; color: var(--text-2); font-size: 13.5px; }
.my-notification-meta { display: flex; gap: 6px; margin-top: 4px; color: var(--text-4); font-size: 12px; }
.my-unread-dot {
  align-self: center;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}
.my-notification-arrow { display: none; }

.my-notification-item.is-read .my-notification-title-row b { color: var(--text-2); font-weight: 500; }
.my-notification-item.is-read .my-notification-content p { color: var(--text-3); }

.type-thread_reply { --nc: var(--info); }
.type-application_godkand { --nc: var(--ok); }
.type-application_nekad { --nc: var(--bad); }
.type-application_intervju { --nc: var(--warn); }
.type-roles_updated { --nc: #b9a3ea; }

.my-profile-form { display: flex; flex-direction: column; gap: 16px; }
.my-form-field { display: flex; flex-direction: column; gap: 4px; }
.my-form-field > span { color: var(--text-3); font-size: 12.5px; margin-bottom: 4px; }
.my-form-actions { display: flex; justify-content: flex-end; }

.my-thread-list { display: flex; flex-direction: column; margin: -6px; }
.my-thread-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  transition: background var(--t);
}
.my-thread-item:hover { background: var(--hover); }
.my-thread-item b { display: block; font-size: 14px; font-weight: 500; }
.my-thread-item span { color: var(--text-3); font-size: 12.5px; }
.my-thread-item .status { color: var(--text-2); }
.my-thread-item .status.godkand { color: var(--ok); }
.my-thread-item .status.nekad { color: var(--bad); }
.my-thread-item .status.intervju { color: var(--warn); }
.my-thread-arrow { display: none; }

.my-quick-links { display: flex; flex-direction: column; }
.my-quick-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  color: var(--text-2);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  transition: background var(--t), color var(--t);
}
.my-quick-links a:hover { color: var(--text); background: var(--hover); }
.my-quick-links b { color: var(--text-4); font-weight: 400; }

.body.my-notification-legend { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; }
.my-notification-legend > div { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 13px; }
.my-notification-legend span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: var(--r-xs);
  font-size: 11px;
}
.my-notification-legend > div:nth-child(1) span { color: var(--info); }
.my-notification-legend > div:nth-child(2) span { color: var(--ok); }
.my-notification-legend > div:nth-child(3) span { color: var(--warn); }
.my-notification-legend > div:nth-child(4) span { color: var(--bad); }
.my-notification-legend > div:nth-child(5) span { color: #b9a3ea; }
.my-notification-legend b { color: var(--text-2); font-weight: 400; }

/* ==========================================================================
   Medlemmar
   ========================================================================== */
.members-page { display: flex; flex-direction: column; gap: 20px; }
.members-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.members-hero-copy .badge { display: none; }
.members-hero-copy p { margin-top: 6px; color: var(--text-2); }

.members-search-card { background: transparent; border: 0; }
.members-search-card > .body { padding: 0; }
.members-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.members-toolbar h2 { font-size: 16px; }
.members-toolbar p { color: var(--text-3); font-size: 13px; }
.members-search-form { display: flex; gap: 8px; width: min(380px, 100%); }
.members-search-form input { min-height: 36px; }

.members-list-card > .hd { display: none; }
.members-list-card > .body { padding: 0; }
.members-modern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1px;
  background: var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow: hidden;
}
.members-modern-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  transition: background var(--t);
}
.members-modern-card:hover { background: var(--hover); }
.members-modern-avatar { width: 40px; height: 40px; }
.members-modern-content { min-width: 0; flex: 1; }
.members-modern-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.members-modern-heading h3 { overflow: hidden; font-size: 14.5px; white-space: nowrap; text-overflow: ellipsis; transition: color var(--t); }
.members-modern-card:hover h3 { color: var(--accent); }
.members-card-arrow { display: none; }
.members-role-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.members-modern-meta { display: flex; gap: 6px; margin-top: 8px; color: var(--text-4); font-size: 12px; }
.members-modern-meta b { color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.members-status-dot { border-color: var(--surface); }

.members-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 14px;
  border-top: 1px solid var(--line);
}
.members-page-link {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  color: var(--text-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transition: background var(--t), color var(--t);
}
.members-page-link:hover { color: var(--text); background: var(--surface-2); }
.members-page-link.active { color: var(--text); background: var(--surface-2); border-color: var(--line-2); }
.members-page-link.disabled { color: var(--text-4); pointer-events: none; }
.members-page-dots { display: grid; place-items: center; min-width: 24px; color: var(--text-4); }

/* ==========================================================================
   Admin
   ========================================================================== */
.admin-hero.card { margin-bottom: 24px; }
.admin-hero.card > .body { padding: 0; }
.admin-hero-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
}
.admin-hero-row .admin-current-roles { margin: 0 0 10px; }
.page-title { font-size: 28px; }
.page-sub { margin-top: 6px; max-width: 620px; color: var(--text-2); }

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.admin-dashboard-card > .body { padding: 6px; }
.admin-activity-list,
.admin-new-member-list { display: flex; flex-direction: column; }
.admin-activity-item,
.admin-new-member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  transition: background var(--t);
}
.admin-activity-item:hover,
.admin-new-member:hover { background: var(--hover); }
.admin-dashboard-avatar { width: 34px; height: 34px; }
.admin-dashboard-avatar.large { width: 38px; height: 38px; }
.admin-activity-content,
.admin-new-member-content { flex: 1; min-width: 0; }
.admin-activity-heading b,
.admin-new-member-heading b { font-size: 13.5px; font-weight: 600; }
.admin-activity-text,
.admin-new-member-date { display: block; margin-top: 4px; color: var(--text-3); font-size: 12px; }
.admin-list-arrow { display: none; }

.admin-current-roles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.admin-search { display: flex; gap: 8px; margin-bottom: 16px; }
.admin-search input { min-height: 36px; }
.admin-user-list { display: flex; flex-direction: column; gap: 12px; }

.admin-empty-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 4px;
  color: var(--text-3);
  font-size: 13.5px;
}
.admin-empty-search b { display: block; color: var(--text); }

.admin-member-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 20px;
  padding: 18px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.admin-member-profile { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.admin-member-avatar { width: 44px; height: 44px; }
.admin-member-info { min-width: 0; }
.admin-member-heading { display: flex; align-items: center; gap: 8px; }
.admin-member-name { font-size: 15px; font-weight: 600; transition: color var(--t); }
.admin-member-name:hover { color: var(--accent); }
.admin-you-badge {
  height: 19px;
  padding: 0 7px;
  color: var(--accent);
  background: var(--accent-tint);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 19px;
}
.admin-member-details { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; color: var(--text-3); font-size: 12.5px; }
.admin-member-details small { margin-right: 4px; color: var(--text-4); }

.admin-member-actions { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.admin-role-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.admin-role-form .admin-role-label { flex-basis: 100%; color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.admin-role-form select { width: auto; flex: 1 1 160px; min-height: 36px; }
.admin-role-form.multi { display: block; }

.multi-role-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.multi-role-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  padding: 7px 10px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), color var(--t);
}
.multi-role-option:hover { border-color: var(--line-3); color: var(--text); }
.multi-role-option:has(input:checked) { color: var(--text); border-color: var(--accent-line); background: var(--accent-tint); }
.multi-role-option input { width: 15px; height: 15px; margin: 0; flex: 0 0 auto; }
.multi-role-option-icon { display: inline-grid; place-items: center; color: var(--text-3); }
.multi-role-option-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.admin-role-save-row { display: flex; justify-content: flex-end; margin-top: 10px; }

.admin-protected-role {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px dashed var(--line-3);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.admin-lock-icon { color: var(--text-4); font-size: 9px; line-height: 20px; }
.admin-protected-role b { display: block; color: var(--text-2); font-weight: 500; }
.admin-protected-role small { display: block; }

.body.admin-role-history { display: flex; flex-direction: column; padding: 6px 18px; }
.admin-history-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.admin-history-item:first-child { border-top: 0; }
.admin-history-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: var(--r-xs);
  font-size: 12px;
}
.admin-history-title { display: flex; flex-wrap: wrap; gap: 4px; font-size: 13.5px; }
.admin-history-title span { color: var(--text-3); }
.admin-history-roles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.admin-history-arrow { color: var(--text-4); }
.admin-history-date { color: var(--text-4); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }

/* ==========================================================================
   Inloggning
   ========================================================================== */
.login-center {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 260px);
  padding: 24px 0;
}
.login-card {
  width: min(400px, 100%);
  padding: 32px 28px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.login-logo { display: grid; place-items: center; margin-bottom: 18px; }
.discord-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
}
.discord-icon img { width: 26px; height: 26px; }
.login-card h1 { font-size: 22px; }
.login-card p { margin: 8px 0 22px; color: var(--text-2); font-size: 14px; }
.discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  color: #fff;
  background: #5865f2;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  font-weight: 600;
  transition: background var(--t);
}
.discord-btn:hover { background: #4752c4; }
.discord-btn-icon { display: inline-flex; align-items: center; gap: 10px; }
.discord-btn-icon img,
.discord-btn img { width: 20px; height: 20px; }

/* ==========================================================================
   Integritetspolicy och övriga textsidor
   ========================================================================== */
.container > .card { padding: 32px !important; gap: 14px !important; }
.container > .card h1 { font-size: 28px; }
.container > .card h1 + p { color: var(--text-3); font-size: 13.5px; }
.container > .card h2 { margin-top: 14px; font-size: 17px; }
.container > .card p,
.container > .card li { color: var(--text-2); line-height: 1.7; }
.container > .card ul { display: flex; flex-direction: column; gap: 4px; }
.container > .card a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Äldre sidor (edit-profile, create_post, register) */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.list-item { padding: 10px 0; border-top: 1px solid var(--line); }
.meta, .muted { color: var(--text-3); }
.hero { position: relative; }

/* ==========================================================================
   Sidfot + cookie-banner
   ========================================================================== */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 56px;
  padding-top: 20px;
  color: var(--text-3);
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.site-footer-brand { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 500; }
.site-footer-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.site-footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
.site-footer-links a { transition: color var(--t); }
.site-footer-links a:hover { color: var(--text); }

.cookie-banner {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 200;
  width: min(440px, calc(100% - 40px));
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.cookie-banner[hidden] { display: none; }
.cookie-inner { display: flex; flex-direction: column; gap: 14px; }
.cookie-text b { display: block; font-size: 14px; }
.cookie-sub { margin-top: 2px; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.cookie-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.cookie-actions .btn { min-height: 32px; font-size: 13px; }
.cookie-actions a.btn { margin-right: auto; padding: 0; color: var(--text-2); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.cookie-actions a.btn:hover { color: var(--text); }

/* ==========================================================================
   Rörelse
   footer.php lägger .is-leaving på body vid intern navigering och väntar på
   transitionend (max 420 ms). En kort övergång här gör att klicket går
   vidare efter ~120 ms i stället för att vänta ut timeouten.
   ========================================================================== */
body { transition: opacity 120ms ease; }
body.is-leaving { opacity: .55; }

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

/* ==========================================================================
   Responsivt
   ========================================================================== */
@media (max-width: 1080px) {
  .grid.home-layout,
  .board-page-grid,
  .create-thread-layout,
  .my-page-layout,
  .profile-layout { grid-template-columns: minmax(0, 1fr); }

  .home-sidebar,
  .board-sidebar,
  .profile-sidebar,
  .create-thread-sidebar,
  .my-page-sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    align-items: start;
  }
  .admin-dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-member-card { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .wrap, .container { width: calc(100% - 32px); }
  body { font-size: 14.5px; }
  h1, .page-title { font-size: 24px; }
  .home-hero h1 { font-size: 28px; }

  /* Topbar: varumärke på första raden, navigering som scrollbar rad under */
  .topbar { flex-wrap: wrap; gap: 6px; height: auto; padding-top: 10px; margin-bottom: 24px; }
  .brand-copy small { display: none; }
  .brand-copy b { font-size: 14px; white-space: nowrap; }
  .logo { width: 30px; height: 30px; }
  .nav {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 0;
    padding: 0 1px 8px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav .btn { flex: 0 0 auto; height: 32px; padding: 0 8px; font-size: 13px; }
  .nav a[href="logout.php"], .nav .btn.primary { margin-left: auto; }

  .home-board-content {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "meta" "latest";
  }
  .home-board-latest { margin-top: 6px; padding: 8px 0 0; border-left: 0; border-top: 1px dashed var(--line); }

  .board-thread-item { grid-template-columns: 32px minmax(0, 1fr); padding: 14px 16px; }
  .board-thread-avatar { width: 32px; height: 32px; }
  .board-thread-side { grid-column: 2; justify-content: flex-start; gap: 16px; }
  .board-thread-replies { min-width: 0; justify-content: flex-start; }
  .board-thread-last { min-width: 0; text-align: left; }
  .board-thread-last span { display: none; }
  .board-thread-last b { font-weight: 400; color: var(--text-3); }

  .thread-post { grid-template-columns: minmax(0, 1fr); }
  .thread-post-user {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 12px 16px;
    text-align: left;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .thread-post-avatar { width: 36px; height: 36px; border-radius: 50%; }
  .thread-post-roles { justify-content: flex-start; }
  .thread-post-user-stats { display: none; }
  .thread-post-header { padding: 10px 16px; }
  .thread-post-header small { display: none; }
  .thread-post-body { padding: 14px 16px 18px; }
  .thread-admin-form { margin-left: 0; }

  .profile-hero-body, .my-hero-content { padding: 0 16px 18px; }
  .profile-avatar-wrap, .my-avatar-wrap { width: 84px; height: 84px; margin-top: -36px; border-radius: 16px; }
  .profile-identity, .my-identity { padding-top: 0; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-stat { padding: 12px 16px; }
  .profile-stat:nth-child(3) { border-left: 0; }
  .profile-stat:nth-child(n+3) { border-top: 1px solid var(--line); }

  .my-notification-item { padding: 12px 14px; gap: 10px; }

  .card > .hd { padding: 12px 14px; }
  .card > .body { padding: 14px; }
  .container > .card { padding: 22px 18px !important; }

  .create-thread-category { align-items: flex-start; }
  .create-thread-actions .btn { flex: 1; }

  .members-search-form { width: 100%; }
  .admin-history-item { grid-template-columns: 26px minmax(0, 1fr); }
  .admin-history-date { grid-column: 2; }

  .site-footer { flex-direction: column; align-items: flex-start; }
  .cookie-banner { left: 12px; bottom: 12px; width: calc(100% - 24px); padding: 14px; }
  .cookie-inner { gap: 10px; }
}

/* Moderatorverktyg: håll accentfärgen för sidans huvudhandling */
.thread-admin-form .btn.primary {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line-2);
  font-weight: 500;
}
.thread-admin-form .btn.primary:hover { background: var(--surface-3); border-color: var(--line-3); }

/* Ansökningar: fråga/svar-lista (thread_render_body i thread.php) */
.application-qa { display: flex; flex-direction: column; margin: 0; }
.application-item { padding: 14px 0; border-top: 1px solid var(--line); }
.application-item:first-child { padding-top: 0; border-top: 0; }
.application-item:last-child { padding-bottom: 0; }
.application-item dt { color: var(--text-3); font-size: 13px; font-weight: 500; line-height: 1.45; }
.application-item dd { margin: 4px 0 0; color: var(--text); font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.application-item dd.is-empty { color: var(--text-4); font-style: italic; }
