/* Colours and font from the Cyncly PowerPoint template
   (CYNCLY Template_Final_20240406.potx, colour slide): accent 1 #6038E8 as
   the main violet, accent 5 #34169B as its dark shade, background tones
   "Dark 2" #F9F6F4 (panels) and "Light 2" #E7DCD5 (lines), accent 4 #3DCBFF
   as a light tint for the badge, Arial as heading and body font. The dark
   theme uses the template's 50 % / 25 % tints of accent 1 (#AF9BF3,
   #D7CDF9) and of accent 4 (#9EE5FF) so text stays readable. */
:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #5f5853;
  --line: #e7dcd5;
  --accent: #6038e8;
  --accent-dark: #34169b;
  --accent-fg: #ffffff;
  --danger: #c22b2b;
  --panel: #f9f6f4;
  --badge-bg: #cef2ff;
  --badge-fg: #34169b;
}
/* Explicit dark theme — set by the theme toggle (data-theme="dark" on
   <html>), independent of the OS setting. */
:root[data-theme="dark"] {
  color-scheme: dark; /* dark scrollbars and native controls */
  --bg: #121018;
  --fg: #f9f6f4;
  --muted: #c4bbb4;
  --line: #342c42;
  --accent: #af9bf3;
  --accent-dark: #d7cdf9;
  --accent-fg: #121018;
  --danger: #ff8c8c;
  --panel: #1e1929;
  --badge-bg: #0e3a4c;
  --badge-fg: #9ee5ff;
}
/* "Auto" (no explicit choice saved, data-theme attribute absent): follow
   the OS setting, unless the toggle explicitly forced light mode. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121018;
    --fg: #f9f6f4;
    --muted: #c4bbb4;
    --line: #342c42;
    --accent: #af9bf3;
    --accent-dark: #d7cdf9;
    --accent-fg: #121018;
    --danger: #ff8c8c;
    --panel: #1e1929;
    --badge-bg: #0e3a4c;
    --badge-fg: #9ee5ff;
  }
}
/* All text/background pairs above meet WCAG AA (4.5:1 for normal text): the
   lowest is danger-on-panel at ~5.3:1 (light) and ~7.2:1 accent-on-panel
   (dark). */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 Arial, "Helvetica Neue", Helvetica, sans-serif;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  text-decoration: none;
  color: var(--fg);
}
.brand-name { font-weight: 700; font-size: 18px; }
/* The Cyncly logo symbol (cropped from the template's logo; the black word
   mark next to it would vanish on the dark theme). */
.logo-mark { display: block; width: 26px; height: 26px; }
.badge {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--badge-fg);
  background: var(--badge-bg);
  border-radius: 999px;
  padding: 3px 10px;
}
nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
nav a { color: var(--fg); text-decoration: none; font-weight: 500; }
nav a:hover { color: var(--accent); }
.topbar nav a.active { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
/* Admin entries (review, administration) sit last, set apart by a divider before the first one */
.topbar nav a.nav-admin { position: relative; margin-left: 18px; }
.topbar nav a.nav-admin::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 50%;
  height: 18px;
  border-left: 1px solid var(--line);
  transform: translateY(-50%);
}

/* Admin area: sub-navigation on the left, page content on the right */
.admin-layout { display: flex; gap: 32px; align-items: flex-start; }
.admin-nav {
  flex: 0 0 200px;
  position: sticky;
  top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.admin-nav-title { margin: 2px 10px 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.admin-nav nav { flex-direction: column; align-items: stretch; gap: 2px; }
.admin-nav nav a { display: block; padding: 8px 12px; border-radius: 8px; }
.admin-nav nav a:hover { background: var(--bg); }
.admin-nav nav a.active { background: var(--accent); color: var(--accent-fg); }
.admin-content { flex: 1 1 auto; min-width: 0; }
.admin-content > h1:first-child { margin-top: 0; }
.table-scroll { overflow-x: auto; }
/* Admin overview lists have a fixed maximum height with their own scrollbar,
   so the "create new" form below always stays in view. */
.list-scroll {
  max-height: min(48vh, 560px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 12px;
}
.list-scroll table.list { margin-top: 0; }
.list-scroll table.list thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  box-shadow: inset 0 -1px 0 var(--line);
}
.list-scroll table.list tbody tr:last-child td { border-bottom: 0; }
.news-list { display: flex; flex-direction: column; gap: 16px; padding: 12px; }
.lang-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.lang-pair fieldset { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.news-list .box { max-width: none; }
/* Email templates side by side on wide screens */
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 20px; }
.template-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; min-width: 0; }
.template-card .hint { margin: 0; font-size: 13px; }
.template-card code { background: var(--panel); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.table-scroll .inline-form { flex-wrap: nowrap; }
table.list .button, table.list button { white-space: nowrap; }
.row-actions { display: flex; gap: 8px; align-items: center; }
a.button { text-decoration: none; }
.button.is-disabled { opacity: 0.45; cursor: not-allowed; }
/* Delete confirmation pages */
.danger-zone { border-color: var(--danger); }
.danger-zone h2 { margin-top: 8px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; }
.consequences { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.replacement-select { max-width: 420px; }
.back-link { margin: 0 0 4px; font-size: 13px; }
.back-link a { color: var(--muted); }
.back-link a:hover { color: var(--accent); }
.button.secondary { text-decoration: none; }
button:disabled, .button:disabled, select:disabled { opacity: 0.45; cursor: not-allowed; }

/* Custom file picker (upload page): the native input covers the whole
   control invisibly, the visible part is ours and translated. */
.file-field { display: flex; flex-direction: column; gap: 4px; }
.file-field-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.box label.file-picker {
  position: relative;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  color: var(--fg);
  font-size: 14px;
}
.box label.file-picker:hover { border-color: var(--accent); }
.box label.file-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.box label.file-picker.has-file { border-style: solid; border-color: var(--accent); }
.box input.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: 0;
}
.file-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}
.file-picker:hover .file-button { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.file-picker.has-file .file-name { color: var(--fg); font-weight: 600; }
button:disabled:hover, .button:disabled:hover { background: var(--accent); }
/* The admin area uses the full browser width (tables, side-by-side form fields). */
main:has(.admin-layout) { max-width: none; }
/* The catalog list has many columns (industry, language, groups for admins): more room */
main:has(.catalog-filter):not(:has(.admin-layout)) { max-width: 1280px; }
main:has(.catalog-filter) table.list td:first-child { min-width: 220px; }
.box.box-wide { max-width: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px; }
.checkbox-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.checkbox-row legend { width: 100%; }
.checkbox-row .hint { margin: 0; }
@media (max-width: 760px) {
  .admin-layout { flex-direction: column; align-items: stretch; gap: 16px; }
  .admin-nav { position: static; flex: none; width: 100%; }
  .admin-nav nav { flex-direction: row; flex-wrap: wrap; }
}
.lang-switch { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; font-size: 13px; }
.lang-switch a { color: var(--muted); }
.lang-switch a.active { color: var(--accent); }
.who { color: var(--muted); }
main { max-width: 960px; margin: 0 auto; padding: 32px 28px 64px; }
.hero { display: flex; align-items: center; gap: 48px; flex-wrap: wrap; }
.hero-col { flex: 1 1 360px; min-width: 0; }
.hero-image { display: flex; justify-content: center; }
.hero-image img { max-width: 100%; height: auto; }
.catalog-collage { position: relative; min-height: 340px; width: 100%; }
.catalog-collage img {
  position: absolute;
  width: 68%;
  height: 230px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(20, 20, 43, 0.18);
  border: 4px solid var(--bg);
}
.collage-back { top: 0; left: 0; transform: rotate(-4deg); }
.collage-front { bottom: 0; right: 0; transform: rotate(3deg); }
.page-head { display: flex; align-items: center; gap: 14px; }
/* Line icons from the Cyncly template (24×24, single stroke colour), used as
   a CSS mask so they take the theme's accent colour in light and dark mode. */
.page-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.page-icon::before {
  content: "";
  width: 32px;
  height: 32px;
  background: var(--accent);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.icon-upload { --icon: url(/assets/icons/upload.svg); }
.icon-news { --icon: url(/assets/icons/news.svg); }
.icon-catalog { --icon: url(/assets/icons/catalog.svg); }
.icon-stats { --icon: url(/assets/icons/stats.svg); }
.icon-approve { --icon: url(/assets/icons/approve.svg); }
.icon-admin { --icon: url(/assets/icons/admin.svg); }
.admin-nav-title.icon-admin { display: flex; align-items: center; gap: 8px; }
.admin-nav-title.icon-admin::before {
  content: "";
  width: 18px;
  height: 18px;
  background: var(--accent);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.page-head h1 { margin: 0; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; display: flex; flex-direction: column; gap: 4px; }
footer a { color: var(--muted); }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 700; margin-top: 28px; }
.hint { color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }

/* Toast notifications — triggered via #toast-trigger, see app.js. Stacked
   bottom-right, slide/fade in, dismiss on click or after a timeout. */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 40px);
}
.toast {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-width: 360px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-error { border-left-color: var(--danger); }
.toast-success { border-left-color: #2f9e52; }
:root[data-theme="dark"] .toast-success,
:root:not([data-theme="light"]) .toast-success { border-left-color: #4ade80; }
@media (max-width: 480px) {
  .toast-container { left: 20px; right: 20px; }
  .toast { max-width: none; }
}
.box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 480px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
.box.inline { max-width: 340px; }
.box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.box input[type=text], .box input[type=search], .box input[type=password], .box input[type=email], .box input[type=file], .box textarea, .box select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
}
.box fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.box legend { padding: 0 6px; font-weight: 600; color: var(--muted); font-size: 13px; }
.box .checkbox { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; font-size: 14px; color: var(--fg); cursor: pointer; }

/* Text areas keep their size (no drag handle), everywhere. */
textarea { resize: none; }

/* Checkboxes in the app's look: rounded box, accent fill + white tick. */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--muted);
  border-radius: 5px;
  background: var(--bg);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--accent-fg);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform 0.12s ease-in-out;
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover { border-color: var(--accent); }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"]:disabled { opacity: 0.45; cursor: not-allowed; }

/* Admin settings page: wider form, fieldsets laid out like the box itself */
.settings-form { max-width: 820px; }
.settings-form fieldset { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.settings-form .hint { margin: 0; font-size: 13px; }
.settings-form p.error { margin: 0; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .grow { flex: 1 1 240px; }
.field-row .narrow { flex: 0 0 110px; }
.box textarea.template-body { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; line-height: 1.45; }
.settings-form code { background: var(--panel); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
button, .button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
button:hover, .button:hover { background: var(--accent-dark); }
button.danger, .button.danger { background: var(--danger); }
.link-button { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; font-weight: 600; padding: 0; border-radius: 0; }
table.list { width: 100%; border-collapse: collapse; margin-top: 16px; }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
table.list th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; }
table.list th.num, table.list td.num { text-align: right; white-space: nowrap; }
table.list .desc { color: var(--muted); font-size: 13px; }
.actions { white-space: nowrap; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form select { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: inherit; }
button.small, .button.small { padding: 6px 12px; font-size: 13px; }

.news-item { border-bottom: 1px solid var(--line); padding: 16px 0; }
.news-item h2 { margin-bottom: 4px; }
.news-body { white-space: pre-wrap; }

.legal h2 { margin-top: 24px; }
.legal p { max-width: 640px; }
.legal code { background: var(--panel); padding: 1px 5px; border-radius: 4px; }

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 720px;
  margin: 0 auto;
  background: var(--fg);
  color: var(--bg);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 100;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; font-size: 13px; flex: 1 1 320px; }
.cookie-banner a { color: inherit; text-decoration: underline; }
.cookie-banner button { flex: 0 0 auto; background: var(--accent); color: var(--accent-fg); }

/* Stats dashboard */
.filter-bar { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin: 16px 0 24px; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.filter-bar select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: inherit; }
.stat-cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 24px; min-width: 150px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }
.chart { width: 100%; max-width: 800px; height: auto; margin: 8px 0 24px; }
.chart-label { font-size: 8px; fill: var(--muted); font-family: inherit; }
.success { color: #15803d; font-weight: 600; }
@media (prefers-color-scheme: dark) { .success { color: #4ade80; } }
:root[data-theme="dark"] .success { color: #4ade80; }

/* Admin Impressum editor + live preview */
.impressum-editor { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.impressum-editor .box { max-width: 480px; flex: 1 1 420px; }
.admin-news-forms { flex: 1 1 560px; max-width: 760px; display: flex; flex-direction: column; gap: 20px; }
.admin-news-forms .box { max-width: none; flex: none; }
.impressum-editor textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.impressum-preview { flex: 1 1 420px; min-width: min(320px, 100%); }
.preview-frame { width: 100%; height: 600px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.button.secondary, button.secondary { background: var(--panel); color: var(--fg); border: 1px solid var(--line); }
.preview-banner {
  background: #fdf0dc;
  color: #7a4a00;
  border: 1px solid #e8c27a;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  display: inline-block;
}
:root[data-theme="dark"] .preview-banner { background: #3a2c10; color: #ffcf7a; border-color: #6b4e14; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .preview-banner { background: #3a2c10; color: #ffcf7a; border-color: #6b4e14; }
}
table.list td.filename { word-break: break-all; font-size: 13px; }
table.list .filename { color: var(--muted); font-size: 12px; word-break: break-all; margin-top: 2px; }

/* Catalog search: one row on wide screens, stacked on phones */
.box.catalog-filter { max-width: none; flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; padding: 18px 20px; }
.catalog-filter .catalog-filter-search { flex: 2 1 280px; }
.catalog-filter label:not(.catalog-filter-search) { flex: 1 1 180px; }
.catalog-filter .hint { flex-basis: 100%; margin: 0; }

/* Catalog list: sortable column headers and paging */
main:has(.upload-form):not(:has(.admin-layout)) { max-width: 1280px; }
table.list th .sort-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
table.list th .sort-link:hover, table.list th .sort-link.active { color: var(--accent); }
table.list th .sort-arrow { font-size: 10px; min-width: 10px; }
table.list th.num .sort-link { justify-content: flex-end; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 16px; }
.pager .hint { margin: 0; }
.pager-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pager-num, .pager-current { min-width: 32px; padding: 5px 8px; border-radius: 8px; text-align: center; font-weight: 600; font-size: 14px; }
.pager-num { color: var(--fg); text-decoration: none; border: 1px solid var(--line); }
.pager-num:hover { border-color: var(--accent); color: var(--accent); }
.pager-current { background: var(--accent); color: var(--accent-fg); }
.pager-gap { color: var(--muted); padding: 0 2px; }
.pager-size a, .pager-size strong { margin-left: 6px; }

/* Upload form: catalog data on the left, customer groups on the right */
.upload-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 32px; align-items: start; }
.upload-fields { display: flex; flex-direction: column; gap: 14px; }
.upload-form > button[type=submit] { justify-self: start; align-self: flex-start; }
.box fieldset.group-picker { display: flex; flex-direction: column; gap: 10px; margin: 0; min-width: 0; padding: 12px 14px 14px; }
.group-picker [hidden] { display: none !important; }
.group-tools { display: flex; flex-direction: column; gap: 10px; }
.group-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.group-actions .checkbox { margin-right: auto; }
.group-count { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.group-list { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.group-list .checkbox { padding: 4px 2px; }
.group-error { margin: 0; }
@media (max-width: 760px) {
  .upload-grid { grid-template-columns: minmax(0, 1fr); }
  .group-list { max-height: 280px; }
}
.form-inline { display: inline; }

/* Statistics dashboard: full width — filters and key figures on top, below
   two columns (left: downloads over time + catalogs, right: share per
   customer + customers), stacked on narrow screens. */
main:has(.dashboard) { max-width: none; }
.box.dashboard-top { max-width: none; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding: 16px 20px; margin: 8px 0 20px; }
.dashboard-top .filter-bar { margin: 0; flex: 1 1 520px; }
.dashboard-top .filter-catalog { flex: 1 1 260px; }
.dashboard-top .filter-catalog select { width: 100%; }
.dashboard-top .stat-cards { margin: 0; }
.dashboard-top .stat-card { background: var(--bg); padding: 10px 18px; min-width: 130px; }
.dashboard-top .stat-value { font-size: 24px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.box.dashboard-panel { max-width: none; display: block; padding: 18px 20px; }
.dashboard-panel h2 { margin: 0 0 8px; font-size: 18px; }
.dashboard-panel h2:not(:first-child) { margin-top: 24px; }
.dashboard-panel .chart { max-width: none; margin-bottom: 0; }
.dashboard-panel table.list { margin-top: 4px; background: var(--bg); }
.ring-wrap { display: flex; justify-content: center; padding: 4px 0 0; }
.ring-chart { width: 100%; max-width: 260px; height: auto; }
.ring-chart .slice { stroke: var(--panel); stroke-width: 1.5; }
.ring-total { font-size: 30px; font-weight: 700; fill: var(--fg); }
.ring-caption { font-size: 12px; fill: var(--muted); }
/* Slice colours: the template's six accents and their 75 % tints, grey-beige for "others". */
.slice-1 { fill: #6038e8; } .slice-2 { fill: #ad36ff; } .slice-3 { fill: #388ee8; } .slice-4 { fill: #3dcbff; }
.slice-5 { fill: #34169b; } .slice-6 { fill: #7000ac; } .slice-7 { fill: #886aee; } .slice-8 { fill: #c168ff; }
.slice-9 { fill: #6aaaee; } .slice-10 { fill: #6dd8ff; } .slice-other { fill: #c8bcb3; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.legend-dot.slice-1 { background: #6038e8; } .legend-dot.slice-2 { background: #ad36ff; } .legend-dot.slice-3 { background: #388ee8; }
.legend-dot.slice-4 { background: #3dcbff; } .legend-dot.slice-5 { background: #34169b; } .legend-dot.slice-6 { background: #7000ac; }
.legend-dot.slice-7 { background: #886aee; } .legend-dot.slice-8 { background: #c168ff; } .legend-dot.slice-9 { background: #6aaaee; }
.legend-dot.slice-10 { background: #6dd8ff; } .legend-dot.slice-other { background: #c8bcb3; }
.others-row td { color: var(--muted); }
@media (max-width: 1000px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}
.dashboard-panel td.nowrap { white-space: nowrap; }
.dashboard-panel table.list td:first-child { min-width: 160px; }
@media (max-width: 600px) {
  .dashboard-top .stat-cards { width: 100%; flex-wrap: nowrap; gap: 8px; }
  .dashboard-top .stat-card { flex: 1 1 0; min-width: 0; padding: 8px 10px; }
  .dashboard-top .stat-value { font-size: 20px; }
  .dashboard-top .stat-label { font-size: 11px; line-height: 1.3; }
}

/* Admin catalog management */
table.list td.nowrap { white-space: nowrap; }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); }
.status-approved { background: var(--badge-bg); color: var(--badge-fg); border-color: transparent; }
.status-pending { background: var(--panel); color: var(--fg); }
.status-rejected { background: transparent; color: var(--danger); border-color: currentColor; }
.catalog-facts { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 4px 0 16px; }
.catalog-facts dt { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.catalog-facts dd { margin: 2px 0 0; }
.button-row .push-right { margin-left: auto; }

/* Very narrow screens: form fields and selects never get wider than their column
   (a select is otherwise as wide as its longest option). */
.box label, .catalog-filter label, .filter-bar label { min-width: 0; }
.box select, .box input, .filter-bar select { max-width: 100%; }
