/* Färger, kort och banner följer verktygsmallen (mall.php) på huvudsajten.
   Obs: definiera inte --secondary/--light/--dark här, de används av huvudsajtens header och footer. */
:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --text: #333333;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --v-dark: #0f172a;
  --accent: #c2410c;
  --ok: #166534;
  --ok-soft: #e4f4e9;
  --err: #991b1b;
  --err-soft: #fbe9e9;
  --warn-soft: #fff4de;
  --radius: 12px;
  --shadow: 0 4px 15px rgba(0, 0, 0, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden; /* breda tabeller (t.ex. Användare) ska bara scrolla inom .table-wrap, inte hela sidan */
}
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .9rem; }
small, .muted { color: var(--muted); }
code { background: #eef1f4; padding: .1em .35em; border-radius: 4px; font-size: .92em; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px; }

/* Header */
.community-bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--primary); text-decoration: none; }
.main-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.main-nav a { text-decoration: none; color: var(--text); font-weight: 500; }
.main-nav a:hover { color: var(--primary); }
.nav-user { color: var(--muted); font-size: .92rem; }
.bar-search { display: flex; gap: .4rem; align-items: center; flex: 1 1 220px; max-width: 360px; margin: 0; }
.bar-search input { width: 100%; font: inherit; font-size: .92rem; padding: .35rem .6rem; border: 1px solid #ccc; border-radius: 6px; }
.foot-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: var(--text); cursor: pointer; }
.link-button:hover { color: var(--primary); }

/* Banner överst (som .hero-tools i mall.php) */
.hero-tools { background: linear-gradient(135deg, var(--v-dark), var(--primary)); color: #fff; padding: 2.5rem 5%; text-align: center; margin-bottom: 0; }
.hero-tools h1 { font-size: 2.2rem; margin: 0 0 .6rem; }
.hero-tools p { font-size: 1.05rem; opacity: .95; max-width: 700px; margin: 0 auto; line-height: 1.4; }

/* Långa ord och webbadresser ska aldrig spränga layouten */
.vac { overflow-wrap: break-word; }
.vac pre, .vac textarea { max-width: 100%; }

/* Inbäddade YouTube-filmer */
.video { position: relative; aspect-ratio: 16 / 9; max-width: 720px; margin: 0 0 1rem; background: #000; border-radius: var(--radius); overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Länkruta och länklistor */
.link-box { border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; margin: 0 0 1rem; }
.link-box legend { font-weight: 600; padding: 0 .4rem; }
.link-row { display: grid; grid-template-columns: 2fr 1fr; gap: .5rem; margin-bottom: .4rem; }
.link-row input { margin-top: 0 !important; }
.post-links { margin: 0 0 1rem; padding-left: 1.2rem; }
.post-links li { margin-bottom: .3rem; }
.avatar { border-radius: 50%; object-fit: cover; vertical-align: middle; background: #e2e8f0; }
.avatar-ph { display: inline-block; text-align: center; color: #fff; font-weight: 700; }
.avatar-c0 { background: #2563eb; } .avatar-c1 { background: #0f766e; } .avatar-c2 { background: #b45309; } .avatar-c3 { background: #7c3aed; }
.avatar-c4 { background: #be123c; } .avatar-c5 { background: #0369a1; } .avatar-c6 { background: #4d7c0f; } .avatar-c7 { background: #475569; }
@media (max-width: 800px) { .link-row { grid-template-columns: 1fr; } }

/* Uppladdade bilder */
.images { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0 0 1rem; }
.image { margin: 0; }
.image img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.image form { margin-top: .3rem; }
input[type="file"] { display: block; width: 100%; margin-top: .3rem; font: inherit; }

main.wrap { padding-top: 0; padding-bottom: 3rem; min-height: 60vh; }

/* Footer */
.community-foot { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .9rem; padding: 1rem 0; }
.community-foot .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Cards */
.vcard { background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--primary); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.vcard.legal { max-width: 860px; margin-left: auto; margin-right: auto; }
.legal h2 { margin-top: 1.4rem; }
.legal li { margin-bottom: .35rem; }
.vcard.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.vcard h2 { margin-bottom: .75rem; }

/* Flash */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: #b7e0c4; }
.flash-error { background: var(--err-soft); color: var(--err); border-color: #f0c2c2; }
.flash-info { background: var(--primary-soft); color: var(--primary-dark); border-color: #bfdde4; }

/* Forms */
.form label { display: block; font-weight: 600; margin-bottom: .9rem; }
.form label small { display: block; font-weight: 400; margin-top: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%;
  font: inherit;
  padding: .6rem .75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  margin-top: .3rem;
}
textarea { resize: vertical; min-height: 6rem; }
input:focus, select:focus, textarea:focus, .vbtn:focus-visible, .link-button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .35);
  outline-offset: 1px;
}
.check { display: flex; gap: .55rem; align-items: flex-start; font-weight: 400 !important; }
.check input { width: auto; margin-top: .3rem; }
.hp { position: absolute; left: -9999px; height: 0; width: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
/* Långa kryssrutelistor (t.ex. Etiketter i Verktygslista) i flera spalter i stället för en lång kolumn */
.check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .15rem 1rem; }

.vbtn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--primary); color: #fff; border: 1px solid var(--primary);
  padding: .6rem 1.1rem; border-radius: 6px; text-decoration: none;
}
.vbtn:hover { background: var(--primary-dark); color: #fff; }
.vbtn-secondary { background: #fff; color: var(--primary); }
.vbtn-secondary:hover { background: var(--primary-soft); color: var(--primary-dark); }
.vbtn-danger { background: #fff; color: var(--err); border-color: #e0a9a9; }
.vbtn-danger:hover { background: var(--err-soft); color: var(--err); }
.vbtn-small { padding: .3rem .65rem; font-size: .88rem; }
.vbtn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
summary.vbtn { list-style: none; }
summary.vbtn::-webkit-details-marker { display: none; }

/* Startsida: fråga överst, kategorier till höger */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "ask side" "latest side";
  gap: 1.25rem 1.5rem;
  align-items: start;
}
.area-ask { grid-area: ask; }
.area-side { grid-area: side; }
.area-latest { grid-area: latest; }
.ask-box h2 { font-size: 1.4rem; }
.ask-box textarea { min-height: 7.5rem; font-size: 1.05rem; margin: 0 0 1rem; }

.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li a { display: flex; justify-content: space-between; gap: .5rem; padding: .55rem .6rem; border-radius: 8px; text-decoration: none; color: var(--text); }
.cat-list li a:hover { background: var(--primary-soft); color: var(--primary-dark); }
.cat-list .count { color: var(--muted); font-size: .88rem; }
.cat-list .community a { background: var(--warn-soft); }
.cat-list .divider { border-top: 1px solid var(--line); margin: .5rem 0; }

/* Frågelistor */
.q-list { list-style: none; margin: 0; padding: 0; }
.q-item { padding: .9rem 0; border-top: 1px solid var(--line); }
.q-item:first-child { border-top: 0; padding-top: 0; }
.q-item h3 { margin-bottom: .2rem; }
.q-item h3 a { text-decoration: none; color: var(--text); }
.read-more { font-weight: 600; white-space: nowrap; }
.cat-chip { display: inline-block; background: var(--primary-soft); color: var(--primary-dark); text-decoration: none; padding: .05rem .55rem; border-radius: 999px; font-weight: 600; }
.cat-chip:hover { background: var(--primary); color: #fff; }
.q-item h3 a:hover { color: var(--primary); text-decoration: underline; }
.meta { color: var(--muted); font-size: .88rem; display: flex; gap: .5rem 1rem; flex-wrap: wrap; align-items: center; }
.vbadge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; background: #eceff3; color: #3d4b5b; }
.vbadge-staff { background: var(--primary-soft); color: var(--primary-dark); }
.vbadge-best { background: var(--ok-soft); color: var(--ok); }
.vbadge-new { background: #fde9d9; color: var(--accent); }
.vbadge-in_progress { background: #fff0c9; color: #7a5b00; }
.vbadge-answered { background: var(--ok-soft); color: var(--ok); }
.vbadge-rejected { background: var(--err-soft); color: var(--err); }
.vbadge-open, .vbadge-review, .vbadge-needs_info { background: var(--warn-soft); color: #7a5b00; }
.answer-report { font-size: .82rem; margin-top: .3rem; }
.answer-report a { color: var(--muted); }

/* Frågesida */
.question-body { font-size: 1.08rem; }
.answer { border-left: 4px solid var(--line); padding: .25rem 0 .25rem 1rem; margin: 1.1rem 0; }
.answer.staff { border-color: var(--primary); }
.answer.best { border-color: var(--ok); background: linear-gradient(90deg, var(--ok-soft), transparent 60%); }
.answer.hidden { opacity: .55; }
.answer-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .35rem; font-size: .92rem; }
.answer-tools { display: flex; gap: .4rem; margin-top: .4rem; }

/* Enhetligt bred kolumn i stället för en flex-rad som viker sig olika brett per fält */
.premium-form { display: flex; flex-direction: column; gap: .4rem; max-width: 200px; margin-top: .3rem; }
.premium-form label { font-size: .82rem; font-weight: 400; color: var(--muted); margin: 0; }
.premium-form input, .premium-form select { display: block; width: 100%; margin-top: .15rem; }
.premium-form button { width: 100%; }
.sort-bar { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin: .3rem 0 .9rem; }
.sort-bar a { padding: .25rem .8rem; border-radius: 999px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: .92rem; }
.sort-bar a.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.pager { display: flex; gap: .5rem; margin-top: 1rem; }

/* Personal */
.subnav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.subnav a { padding: .45rem .9rem; border-radius: 999px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); font-weight: 500; }
.subnav a.active, .subnav a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters a { padding: .3rem .8rem; border-radius: 999px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: .92rem; }
.filters a.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { text-align: left; padding: .65rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.data th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.data tr:hover td { background: #fafbfc; }
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }

/* Små statistikrutor, t.ex. i "Statistik"-kortet överst på Användare */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; text-align: center; }
.stat-tile strong { display: block; font-size: 1.6rem; line-height: 1.2; color: var(--primary); }
.stat-tile span { font-size: .85rem; color: var(--muted); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.orig { background: #f7f8fa; border: 1px dashed #c6ced7; border-radius: 8px; padding: .8rem 1rem; }
.empty { color: var(--muted); padding: 1rem 0; }

/* Adminpanel (personal/webbplats.php): vänster meny med huvudgrupper, höger innehåll */
.admin-panel { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.admin-panel-nav h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.1rem 0 .4rem; }
.admin-panel-nav h2:first-child { margin-top: 0; }
.admin-panel-nav ul { display: block; list-style: none; margin: 0; padding: 0; }
.admin-panel-nav a { display: block; padding: .45rem .7rem; border-radius: 8px; text-decoration: none; color: var(--text); font-size: .95rem; }
.admin-panel-nav a:hover { background: var(--surface); }
.admin-panel-nav a.active { background: var(--primary); color: #fff; font-weight: 600; }
.admin-panel-content { min-width: 0; }
/* Undermeny i vänstermenyn (t.ex. Mailutskick), utfälld när man är på någon av dess sidor, och samma undermeny som flikar på sidan. */
.admin-panel-nav a.active-parent { background: var(--surface); font-weight: 600; color: var(--primary-dark); }
.admin-panel-nav ul.admin-panel-sub { margin: .2rem 0 .4rem .75rem; padding-left: .5rem; border-left: 2px solid var(--line); }
.admin-panel-sub a { font-size: .9rem; padding: .35rem .6rem; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: .2rem; margin: 0 0 1.25rem; border-bottom: 2px solid var(--line); }
.admin-tabs a { margin-bottom: -2px; padding: .55rem 1rem; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0; color: var(--text); font-weight: 500; text-decoration: none; }
.admin-tabs a:hover, .admin-tabs a:focus-visible { background: var(--surface); color: var(--primary); }
.admin-tabs a.active { border-bottom-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.uts-historik { margin-top: .4rem; font-size: .9rem; }
.uts-historik summary { cursor: pointer; color: var(--primary); }
.uts-historik .grp-logg { margin-top: .4rem; }
.uts-statusval { margin-bottom: .9rem; }

/* ---------- Användare och Grupper (personal/anvandare.php, personal/grupper.php), 2026-10-23 ----------
   Egna klassnamn (au-, grp-), eftersom huvudsajtens header.php läser in Bootstrap (t.ex. .badge, .card, .collapse, .offcanvas). */
.au-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.au-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.au-head h1 { margin: 0; }

/* Hjälpruta överst på sidan, med "Visa mer hjälp" */
.au-help { background: var(--primary-soft); border: 1px solid #c7dbfb; border-left: 5px solid var(--primary); border-radius: var(--radius); padding: .9rem 1.15rem; margin-bottom: 1.25rem; color: #1e3a6b; }
.au-help p { margin: 0 0 .45rem; }
.au-help p:last-of-type { margin-bottom: 0; }
.au-help details { margin-top: .5rem; }
.au-help summary { cursor: pointer; font-weight: 600; color: var(--primary-dark); }
.au-help ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.au-help li { margin-bottom: .35rem; }

/* Frågetecken (?) med en kort förklaring: en <details>, så det fungerar utan JS och med tangentbordet */
.au-tip { display: inline-block; position: relative; vertical-align: middle; text-transform: none; letter-spacing: 0; }
.au-tip > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #e2e8f0; color: #334155; font-size: .75rem; font-weight: 700; line-height: 1; cursor: pointer; user-select: none; }
.au-tip > summary::-webkit-details-marker { display: none; }
.au-tip[open] > summary, .au-tip > summary:hover { background: var(--primary); color: #fff; }
.au-tip > span { position: absolute; z-index: 40; left: -.5rem; top: calc(100% + .4rem); width: max-content; max-width: min(19rem, 80vw); background: var(--v-dark); color: #fff; font-size: .85rem; font-weight: 400; line-height: 1.45; padding: .6rem .75rem; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); white-space: normal; text-align: left; }
.au-tip-up > span { top: auto; bottom: calc(100% + .4rem); left: auto; right: -.5rem; }

/* Popup-formulär under en knapp (Ny användare, Ny grupp, Redigera …): en <details> med knappen som rubrik */
.au-pop { position: relative; }
.au-pop > summary { list-style: none; }
.au-pop > summary::-webkit-details-marker { display: none; }
.au-pop-body { position: absolute; z-index: 30; right: 0; top: calc(100% + .45rem); width: min(640px, calc(100vw - 2rem)); background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--primary); border-radius: var(--radius); box-shadow: 0 14px 44px rgba(0,0,0,.2); padding: 1.25rem 1.35rem; text-align: left; }
.au-pop-left .au-pop-body { right: auto; left: 0; }
.au-pop-body h2 { margin-top: 0; }
.au-pop-body.grp-danger { border-top-color: var(--err); }

/* Statistikrutor som är länkar (filtrerar listan) */
.au-stats { margin-bottom: 1.25rem; }
a.stat-tile { display: block; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.stat-tile:hover, a.stat-tile:focus-visible { border-color: var(--primary); box-shadow: var(--shadow); color: inherit; }

/* Sök och filter i en rad ovanför tabellen */
.au-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.au-f { display: flex; flex-direction: column; gap: .3rem; min-width: 9.5rem; flex: 0 1 auto; }
.au-f-q { flex: 1 1 15rem; }
.au-f > label, .au-f-label { display: flex; align-items: center; gap: .35rem; margin: 0; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.au-f-label label { margin: 0; }
.au-f input, .au-f select { margin: 0; padding: .45rem .6rem; }
.au-f select { max-width: 16rem; }
.au-f-check { flex-direction: row; align-items: center; gap: .4rem; min-width: 0; padding-bottom: .5rem; }
.au-f-check label { display: flex; align-items: center; gap: .4rem; margin: 0; font-size: .95rem; font-weight: 400; color: var(--text); text-transform: none; letter-spacing: 0; }
.au-f-check input { width: auto; }
.au-f-btns { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; padding-bottom: .25rem; }

.au-count { display: flex; justify-content: space-between; align-items: center; gap: .4rem 1rem; flex-wrap: wrap; margin: 0 0 .6rem; color: var(--muted); font-size: .92rem; }

/* Listan: luftig, sorterbara rubriker, namnet öppnar panelen */
table.au-list td { vertical-align: middle; padding-top: .85rem; padding-bottom: .85rem; }
table.au-list th a { color: inherit; text-decoration: none; white-space: nowrap; }
table.au-list th a:hover, table.au-list th a:focus-visible { color: var(--primary); }
.au-sort { margin-left: .3rem; font-size: .75em; opacity: .55; }
th[aria-sort] .au-sort { opacity: 1; color: var(--primary); }
.au-c-check { width: 2.5rem; }
.au-c-check input { width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer; vertical-align: middle; }
a.au-open { display: inline-flex; align-items: center; gap: .75rem; color: var(--text); text-decoration: none; }
a.au-open .avatar { flex: 0 0 auto; }
.au-open-txt { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; }
a.au-open:hover strong, a.au-open:focus-visible strong { color: var(--primary); text-decoration: underline; }
.au-name-meta { display: flex; flex-wrap: wrap; gap: .3rem; }
.au-name-meta:empty { display: none; }
.au-prem { margin-top: .3rem; font-size: .82rem; color: var(--muted); }
.au-prem-on { color: var(--ok); }
.au-prem-on::before { content: "💎 "; }
table.data tr.au-row-sel td { background: #f3f8ff; }
table.data tr.au-row-open td { background: var(--primary-soft); }

/* Gruppmärken */
.au-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.au-chip { display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; padding: .15rem .6rem; border-radius: 999px; background: #e8f0fe; border: 1px solid #c7d7fb; color: #1e40af; font-size: .82rem; font-weight: 600; line-height: 1.4; text-decoration: none; }
.au-chip a { color: inherit; text-decoration: none; }
a.au-chip:hover, a.au-chip:focus-visible, .au-chip a:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.au-chip a:hover { background: none; text-decoration: underline; color: inherit; }
.au-chip-typ { font-weight: 400; opacity: .8; }
.au-chip-ark { background: #f1f5f9; border-color: var(--line); color: var(--muted); }
.au-chip form { display: inline; margin: 0; }
.au-chip-x { border: 0; background: none; padding: 0 .1rem; margin: 0 0 0 .1rem; color: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer; }
.au-chip-x:hover, .au-chip-x:focus-visible { color: var(--err); }

/* Åtgärder för markerade rader: syns när något är markerat (alltid utan JS) */
.au-bulk { position: sticky; bottom: 1rem; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 1rem 0; padding: .75rem 1.1rem; border-radius: var(--radius); background: var(--v-dark); color: #fff; box-shadow: 0 10px 30px rgba(15,23,42,.35); }
.au-js .au-bulk:not(.au-bulk-on) { display: none; }
.au-bulk select { width: auto; max-width: 100%; margin: 0; padding: .4rem .6rem; }
.au-bulk .link-button { color: #cbd5e1; }
.au-bulk .link-button:hover, .au-bulk .link-button:focus-visible { color: #fff; }
.au-bulk .au-tip > summary { background: #334155; color: #fff; }

/* Sidopanelen: en <dialog> till höger. Utan JS står den öppen (open) bredvid listan, med JS blir den en ruta med bakgrund. */
dialog.au-panel { position: fixed; inset: 0 0 0 auto; z-index: 1100; width: min(600px, 100vw); max-width: 100vw; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--bg); color: var(--text); box-shadow: -12px 0 40px rgba(0,0,0,.25); overflow-y: auto; }
dialog.au-panel::backdrop { background: rgba(15,23,42,.45); }
.au-panel-in { min-height: 100%; padding: 1.25rem 1.4rem 2.5rem; }
.au-panel-head { position: relative; margin-bottom: 1rem; padding: 1.2rem 1.25rem; background: var(--surface); border-top: 5px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow); }
.au-panel-head .au-user { margin-bottom: .5rem; font-size: 1.15rem; }
.au-panel-close { position: absolute; top: .55rem; right: .6rem; display: flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; color: var(--muted); font-size: 1.6rem; line-height: 1; text-decoration: none; }
.au-panel-close:hover, .au-panel-close:focus-visible { background: var(--primary-soft); color: var(--primary-dark); }
.au-sec { margin-bottom: .9rem; padding: 1rem 1.15rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.au-sec h3 { margin: 0 0 .65rem; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.au-sec .form label:last-of-type { margin-bottom: .8rem; }
.au-sec-danger { border-color: #f0c2c2; }
.au-sec-danger h3 { color: var(--err); }
.au-sec-danger summary { cursor: pointer; color: var(--err); font-weight: 600; }
.au-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .4rem 1rem; margin: 0; }
.au-kv dt { color: var(--muted); font-weight: 400; }
.au-kv dd { margin: 0; }
.au-premium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; align-items: end; }
.au-premium label { margin: 0; font-size: .82rem; color: var(--muted); }
.au-premium input, .au-premium select { margin-top: .2rem; padding: .45rem .55rem; }
.au-premium .vbtn-row { grid-column: 1 / -1; }

/* Grupper */
.grp-crumbs { margin: 0 0 .5rem; font-size: .9rem; color: var(--muted); }
.grp-crumbs a { color: var(--muted); }
.grp-head { padding-bottom: 1.2rem; }
.grp-head-ark { border-top-color: #94a3b8; }
.grp-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: .6rem; }
.grp-title h1 { margin: 0; }
.grp-desc { max-width: 70ch; }
.grp-head .au-kv { margin: .4rem 0 1rem; }
.grp-note { max-width: 70ch; margin: 0 0 1rem; padding: .7rem .9rem; background: var(--warn-soft); border-radius: 8px; font-size: .95rem; }
.grp-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; padding-top: .9rem; border-top: 1px solid var(--line); }
.grp-cardhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .6rem; }
.grp-cardhead h2 { margin: 0; }
.grp-cardhead .grp-filter { width: 16rem; max-width: 100%; margin: 0; padding: .4rem .6rem; }
.grp-name { display: flex; align-items: flex-start; gap: .4rem; padding-left: calc(var(--niva, 0) * 1.6rem); }
.grp-name a { font-weight: 600; text-decoration: none; }
.grp-name a:hover { text-decoration: underline; }
.grp-tree { color: #94a3b8; }
.grp-path { font-size: .85rem; color: var(--muted); }
tr.grp-row-ark td { color: var(--muted); }
.grp-role { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 0; }
.grp-role input { width: 11rem; max-width: 100%; margin: 0; padding: .35rem .5rem; }
.grp-sok { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.grp-sok input[type=search] { width: 20rem; max-width: 100%; margin: 0; }
.grp-cands { max-height: 24rem; overflow-y: auto; margin: .7rem 0 .9rem; padding: .3rem; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.grp-cand { display: flex !important; align-items: center; gap: .65rem; margin: 0 !important; padding: .45rem .55rem; border-radius: 6px; font-weight: 400 !important; cursor: pointer; }
.grp-cand:hover { background: var(--primary-soft); }
.grp-cand input { width: auto; margin: 0; }
.grp-cand small { display: block; color: var(--muted); }
.grp-logg { margin: 0; padding: 0; list-style: none; }
.grp-logg li { padding: .55rem 0; border-top: 1px solid var(--line); }
.grp-logg li:first-child { border-top: 0; padding-top: 0; }
.grp-logg time { margin-right: .4rem; color: var(--muted); font-size: .88rem; white-space: nowrap; }
.au-f input[type=search], .grp-sok input[type=search], input.grp-filter { font: inherit; padding: .45rem .6rem; border: 1px solid #ccc; border-radius: 6px; background: #fff; color: var(--text); }
.au-f input[type=search] { width: 100%; }
.ms-grupper { margin: 0 0 .8rem; padding-left: 1.2rem; }
.ms-grupper li { margin-bottom: .55rem; }

@media (max-width: 800px) {
  .home-grid { grid-template-columns: 1fr; grid-template-areas: "ask" "side" "latest"; }
  .two-col { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  .admin-panel { grid-template-columns: 1fr; }
  h1 { font-size: 1.45rem; }
  .hero-tools { padding: 1.75rem 5%; }
  .hero-tools h1 { font-size: 1.7rem; }

  /* Breda admin-tabeller (Användare, Premiumkoder, Verktygslista): en bred <table> med
     redigeringsformulär inbäddade i celler kan inte krympa under sin innehållsbredd, vilket
     annars tvingar hela sidan bredare än mobilskärmen (även med .table-wrap overflow-x:auto,
     som bara isolerar scroll – inte alltid layoutbredden). Bygg i stället om varje rad till ett
     staplat kort utan tabellramverk på smala skärmar. */
  .table-wrap { overflow-x: visible; border: 0; box-shadow: none; border-radius: 0; }
  table.data, table.data tbody, table.data tr { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data td { display: block; border-bottom: 0; padding: .3rem 0; }
  table.data tr { border-bottom: 1px solid var(--line); padding: .8rem 0; }
  table.data tr:first-child { padding-top: 0; }

  /* Användare och Grupper på smala skärmar: varje rad blir ett kort, med kryssrutan till vänster och etiketter framför fälten. */
  .au-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
  .au-stats .stat-tile { padding: .6rem .4rem; }
  .au-stats .stat-tile strong { font-size: 1.3rem; }
  .au-pop[open] { flex-basis: 100%; }
  .au-pop-body { position: static; width: auto; margin-top: .6rem; }
  .au-f, .au-f-q { flex: 1 1 100%; min-width: 0; }
  .au-f-check, .au-f-btns { flex: 0 0 auto; }
  table.au-list td { padding: .25rem 0; }
  table.au-list-check tr { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); }
  table.au-list-check td { grid-column: 2; }
  table.au-list-check td.au-c-check { grid-column: 1; grid-row: 1 / span 6; padding-top: .6rem; }
  table.au-list td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .82rem; }
  .au-bulk { bottom: .5rem; }
  .au-panel-in { padding: 1rem .9rem 2.5rem; }
  .au-premium { grid-template-columns: 1fr; }
  .grp-name { padding-left: calc(var(--niva, 0) * .9rem); }
}

/* Reglaget (på/av) på sidorna Spel annonser och Spelinställningar: en kryssruta som ser ut som en strömbrytare. */
.form label.spe-reglage { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; position: relative; margin-bottom: 1rem; }
.spe-reglage input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.spe-reglage .spe-slid { flex: none; width: 46px; height: 26px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .2s; }
.spe-reglage .spe-slid::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.spe-reglage input:checked + .spe-slid { background: var(--primary); }
.spe-reglage input:checked + .spe-slid::after { transform: translateX(20px); }
.spe-reglage input:focus-visible + .spe-slid { outline: 2px solid var(--primary); outline-offset: 2px; }
textarea.spe-kod { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .9rem; }
