/* Admincentret, sidgrupp 1: bara det sidorna behöver utöver kitet (admin-ui.css). Laddas av base.html.
   Översikt (ov-), Användare (uw-), Företag (co-), Registrering (bp-), Filmer (fl-) och Besöksstatistik (tf-).
   Andra passet (docs/product/admincenter-ui.md «Smarta delar»): statuspillrens popovers, pillrader i panelerna,
   «Läge»-kolumnen, raden som spelar filmen och diagrammets dagar. */

/* ── Gemensamt ───────────────────────────────────────────────────────────────────────────────────────────── */
/* Filter-popovern: fält och brytare under varandra. */
.uw-filter > * + *, .co-filter > * + * { margin-top: 12px; }
.uw-filter > h3 + *, .co-filter > h3 + * { margin-top: 0; }
.uw-filter .adm-toggle, .co-filter .adm-toggle { display: flex; font-size: 13px; }
.uw-filter .adm-toggle small { margin-left: 2px; }

/* Statuspillrens popovers (Registrering, Underhåll): följden för det valda läget, beroende fält bara när de gäller. */
.bp-reg, .ov-maint { display: grid; gap: 12px; margin: 0; }
.bp-reg .adm-pop__meta, .ov-maint .adm-pop__meta { margin-top: 2px; }
.bp-reg .adm-field > span, .ov-maint .adm-field > span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bp-reg__lead, .ov-maint__lead { display: none; }
.bp-reg:has(input[value="open"]:checked) [data-reg-lead="open"],
.bp-reg:has(input[value="invite_only"]:checked) [data-reg-lead="invite_only"],
.bp-reg:has(input[value="closed"]:checked) [data-reg-lead="closed"],
.ov-maint:not(:has(.adm-switch__input:checked)) [data-maint-lead="off"],
.ov-maint:has(.adm-switch__input:checked) [data-maint-lead="on"] { display: block; }
.bp-reg:has(input[value="open"]:checked) .bp-reg__msg,
.ov-maint:not(:has(.adm-switch__input:checked)) .ov-maint__msg { display: none; }
.ov-maint:has(.adm-switch__input:checked) .adm-switch__input:checked + .adm-switch { background: #c27b1a; }

/* ── Översikt ────────────────────────────────────────────────────────────────────────────────────────────── */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 18px; align-items: start; }
.ov-todo .adm-todo { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.ov-todo .adm-todo > li { border-top: 1px solid var(--adm-soft); }
.ov-todo .adm-todo > li:first-child { border-top: 0; }
@container adm-page (min-width: 760px) {
  .ov-todo .adm-todo > li { border-top: 0; border-left: 1px solid var(--adm-soft); }
  .ov-todo .adm-todo > li:first-child { border-left: 0; }
}

/* ── Användare (panelen) ─────────────────────────────────────────────────────────────────────────────────── */
.adm-drawer__sub .uw-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.uw-seen { color: var(--adm-mut); }
a.uw-pill-link { padding-right: 4px; text-decoration: none; transition: background-color 140ms; }
a.uw-pill-link:hover { background: color-mix(in srgb, #b3412c 20%, transparent); color: var(--adm-bad); }
.uw-pill-link .material-symbols-outlined { font-size: 15px; }
.adm-drawer .adm-drawer__body > .adm-tabs:first-child { margin-top: -8px; }
.uw-facts { padding: 16px 18px; }
.adm-drawer .uw-activity { --cols: 92px 80px minmax(0, 1fr) 46px 132px; }


/* ── Företag ─────────────────────────────────────────────────────────────────────────────────────────────── */
.co-table { --cols: minmax(0, 2.3fr) minmax(0, 1.3fr) 84px minmax(0, 1.7fr) 72px; }
/* «Läge»: bara det som avviker – pillren får brytas, aldrig klippas. */
.co-flags { display: flex; flex-wrap: wrap; gap: 4px 6px; overflow: visible; white-space: normal; }
.co-flags:empty { display: none; }
.co-who { display: flex; align-items: center; gap: 10px; }
.co-who__copy { display: grid; min-width: 0; }
.co-who__copy b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-mark { display: inline-grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #e8ece7; color: #35443b; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.co-ai small { display: inline; color: var(--adm-mut); }
.co-ai.is-over { color: var(--adm-bad); }
.co-ai.is-over small { color: var(--adm-bad); }
.co-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
/* Pillren i panelens statusrad som går till sin flik, och AI-takets pill i samma höjd som de andra. */
.co-pill-go { border: 0; font-family: inherit; cursor: pointer; padding-right: 4px; transition: filter 140ms; }
.co-pill-go:hover { filter: brightness(.96) saturate(1.2); }
.co-pill-go:focus-visible { outline: 2px solid var(--adm-green); outline-offset: 2px; }
.co-pill-go .material-symbols-outlined { margin-left: -1px; font-size: 15px; }
.co-status .adm-status { height: 24px; gap: 5px; padding: 0 6px 0 9px; font-size: 11.5px; }
.co-status .adm-status__dot { width: 6px; height: 6px; }
.co-status .adm-status__caret { font-size: 16px !important; }
@media (pointer: coarse) { .co-status .adm-status { height: 32px; } }
.co-people { --cols: minmax(0, 1fr) auto; }
.co-people .adm-td--status { color: var(--adm-mut); font-size: 12.5px; text-align: right; }
.co-pane > * + * { margin-top: 12px; }
/* AI-takets fält i popovern: ett riktigt fält (inte kitets text-med-penna), Enter/lämna sparar, Esc ångrar. */
.co-cap.adm-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.co-cap.adm-inline::after { content: none; }
.co-cap__field { display: inline-flex; align-items: center; gap: 8px; color: var(--adm-mut); font-size: 13px; }
.co-cap__field > span[aria-hidden] { color: var(--adm-ink); font-size: 15px; }
.co-cap.adm-inline input { field-sizing: fixed; width: 8ch; height: 38px; margin: 0; padding: 0 12px; border-color: var(--adm-field-line); border-radius: 12px; background: #fff; color: var(--adm-ink); font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.co-saved { margin: 0; color: var(--adm-green); font-size: 12.5px; }
.co-rating { color: var(--adm-warn); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.co-place { display: grid; gap: 10px; padding: 14px 18px 16px; }
.co-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.co-actions form, .co-review, .co-approve form { margin: 0; }
.co-review__text { margin: 4px 0; color: #35443b; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.co-reviews small a, .co-place a { color: var(--adm-green); text-decoration: underline; text-underline-offset: 2px; }
.co-reqs > li { flex-wrap: nowrap; padding-top: 11px; padding-bottom: 11px; }
.co-reqs__icon { flex: none; color: #7f9a8a; font-size: 20px; }
.co-reqs > li.is-approved .co-reqs__icon { color: var(--adm-green); }
.co-approve form { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.co-docs > li { align-items: flex-start; }
.co-docs .adm-rows__main > b { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.co-docs .adm-rows__main > small + small { margin-top: 1px; }
.co-valid.is-expired { color: var(--adm-bad); }
.co-reason { color: var(--adm-bad) !important; }
.co-review { display: flex; flex: 1 1 100%; flex-wrap: wrap; align-items: center; gap: 8px; }
.co-review__note { flex: 1 1 220px; }
.co-review__note input { min-height: 32px; height: 32px; border-radius: 999px; font-size: 12.5px; }
@media (min-width: 641px) and (max-width: 1180px) {
  .co-table { --cols: minmax(0, 2fr) minmax(0, 1.2fr) 84px minmax(0, 1.5fr); }
  .co-table .adm-table__head > :nth-child(5), .co-table .adm-table__row > :nth-child(5) { display: none; }
}
@media (max-width: 640px) {
  .co-table .adm-table__row { position: relative; padding-left: 54px; }
  .co-table .co-who .co-mark { position: absolute; top: 12px; left: 13px; }
  .co-table .adm-td--meta > small { display: inline; }
  .co-table .adm-td--meta > span + small::before { content: ' · '; }
  .co-table .adm-td--meta.co-ai > span + small::before { content: none; }
  .co-table .co-flags { justify-content: flex-end; max-width: 60%; }
  .co-cap.adm-inline input { height: 44px; font-size: 16px; }
  .co-review__note input { height: 44px; font-size: 16px; }
}

/* ── Registrering ────────────────────────────────────────────────────────────────────────────────────────── */
.bp-table--vantar { --cols: minmax(0, 1fr) 128px 230px; }
.bp-table--behandlade { --cols: minmax(0, 1fr) 120px 128px 128px; }
.bp-table--inbjudningar { --cols: minmax(0, 1fr) 104px 128px 128px 128px; }
.bp-actions { display: flex; justify-content: flex-end; gap: 6px; }
.bp-actions form { margin: 0; }
@media (max-width: 640px) {
  .bp-table .bp-actions { flex-basis: 100%; order: 4; justify-content: flex-start; max-width: none; margin-left: 0; }
  .bp-table--inbjudningar .bp-actions { order: 4; }
}

/* ── Filmer ──────────────────────────────────────────────────────────────────────────────────────────────── */
.fl-table { --cols: minmax(0, 2fr) minmax(0, 1.5fr) 150px 40px; }
/* Hela raden spelar filmen (en knapp): samma utseende som listans länkrader. */
.fl-row { width: 100%; min-height: 64px; margin: 0; border: 0; border-bottom: 1px solid var(--adm-soft); background: none; color: inherit; font: inherit; text-align: left; }
.fl-play { display: flex; justify-content: flex-end; color: var(--adm-green); }
.fl-play .material-symbols-outlined { font-size: 26px; transition: color 140ms; }
.fl-row:hover .fl-play, .fl-row:focus-visible .fl-play, .fl-row.is-cursor .fl-play { color: var(--adm-deep); }
.fl-off { display: inline-flex !important; margin-top: 5px; }
@media (max-width: 640px) {
  .fl-table .adm-td--meta > small { display: inline; }
  .fl-table .adm-td--meta > span + small::before { content: ' · '; }
}

/* ── Besöksstatistik ─────────────────────────────────────────────────────────────────────────────────────── */
.tf-workspace { display: grid; gap: 14px; }
.tf-tile-name { overflow: hidden; font-size: 24px !important; text-overflow: ellipsis; white-space: nowrap; }
.tf-table { --cols: minmax(0, 1fr) 96px 110px 80px; }
.tf-table--rank { --cols: minmax(0, 1fr) auto; }
.tf-rank { display: flex; align-items: center; gap: 10px; }
.tf-rank > i { display: inline-grid; flex: none; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 8px; background: var(--adm-green-soft); color: var(--adm-green); font-size: 11px; font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.tf-rank > span { display: grid; min-width: 0; }
.tf-rank b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-table--rank .adm-num b { display: block; font-variant-numeric: tabular-nums; }
.tf-table--rank .adm-num small { color: var(--adm-mut); }
.tf-rankings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
/* Diagrammet: staplar i skogens grön på ett ljust spår; värdet i en liten skylt vid pekare eller fokus. */
.tf-chart { display: flex; align-items: stretch; gap: 3px; height: 200px; padding: 30px 18px 14px; }
.tf-chart__point { position: relative; display: grid; flex: 1 1 0; grid-template-rows: 1fr 16px; gap: 5px; min-width: 0; padding: 0; border: 0; background: none; color: var(--adm-mut); font: inherit; text-decoration: none; cursor: default; }
a.tf-chart__point { cursor: pointer; }
.tf-chart__point:focus-visible { outline: 2px solid var(--adm-green); outline-offset: 2px; border-radius: 6px; }
.tf-chart__track { display: flex; align-items: flex-end; min-height: 0; overflow: hidden; border-radius: 6px 6px 3px 3px; transition: background-color 140ms; }
a.tf-chart__point:hover .tf-chart__track { background: rgb(18 56 43 / 4%); }
/* En tom dag är en tunn linje, inte en stapel. */
.tf-chart__point.is-empty .tf-chart__track i { height: 2px; border-radius: 1px; background: rgb(18 56 43 / 20%); }
/* En vald dag: de andra tonas, dagens etikett i skog. */
.tf-chart.has-selection .tf-chart__point:not(.is-selected) .tf-chart__track i { opacity: .32; }
.tf-chart__point.is-selected small { color: var(--adm-deep); font-weight: 600; }
.tf-period .adm-select { min-width: 124px; }
.tf-chart__track i { display: block; width: 100%; height: max(3px, var(--tf-h)); border-radius: inherit; background: linear-gradient(180deg, #1f6b4f, #12382b); transition: filter 140ms; }
.tf-chart__point:hover .tf-chart__track i, .tf-chart__point:focus-visible .tf-chart__track i { filter: brightness(1.25); }
.tf-chart__point small { font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; }
.tf-chart__tip { position: absolute; z-index: 3; top: -26px; left: 50%; width: max-content; max-width: 220px; padding: 4px 8px; border-radius: 8px; background: var(--adm-deep); color: #fff; font-size: 11.5px; line-height: 1.3; opacity: 0; pointer-events: none; transform: translateX(-50%); transition: opacity 140ms; }
.tf-chart__point:first-child .tf-chart__tip { left: 0; transform: none; }
.tf-chart__point:last-child .tf-chart__tip { right: 0; left: auto; transform: none; }
.tf-chart__point:hover .tf-chart__tip, .tf-chart__point:focus-visible .tf-chart__tip { opacity: 1; }
@media (max-width: 900px) { .tf-rankings { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .tf-chart { gap: 2px; height: 170px; padding: 28px 12px 12px; }
  .tf-chart__point small { font-size: 10.5px; }
  .tf-table--rank .adm-table__row { flex-wrap: nowrap; min-height: 52px; }
  .tf-table--rank .adm-table__row::after { content: none; }
  .tf-table .adm-td--status { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) { .tf-chart__track i, .tf-chart__tip { transition: none; } }
.fl-table .adm-td--wrap small { white-space: normal; }
