/* Senzum Nexus AI dashboard. Shared by /login and /app. No inline styles anywhere (CSP style-src 'self').
   Look and palette follow SENZUM NEXUS (the Senzum console): DM Sans, the Nexus colour tokens, dark by default. */

/* ---------- Font ---------- */
/* DM Sans, self-hosted (SIL Open Font License, see fonts/OFL.txt) so the CSP stays at 'self' and nothing is fetched
   from another host. One variable file per subset covers every weight from 400 to 700; latin carries å ä ö. */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
/* Dark is the default, as in Nexus; the theme toggle stores 'light' and sets data-theme="light".
   The trailing comments name the Nexus token a value comes from (bg, panel, card-2, line, fg). */
:root {
  color-scheme: dark;
  --nexus: #FF3B3B;                       /* the red NEXUS AI in the wordmark (a logotype), nothing else */
  --nexus-text: #FF3B3B;                  /* the same red as small text: the product line under the wordmark (4.7:1) */
  --brand: #1E93E6;                      /* Nexus blue: primary buttons, focus, selection, bars */
  --brand-strong: #3DA2EB;
  --brand-text: #4AA8EE;                  /* blue as text on the dark panels (6.4:1) */
  --brand-soft: rgba(30, 147, 230, 0.16);
  --brand-ring: rgba(30, 147, 230, 0.45);
  --on-brand: #08080E;                    /* label on Nexus blue: 6.1:1 (white on it is 3.3:1) */
  --ring: #1E93E6;

  --bg: #08080E;                          /* bg */
  --surface: #1D1D2C;                     /* panel */
  --surface-2: #26263A;                   /* card-2 */
  --surface-3: #2F2F46;
  --nav-on: #26263A;
  --text: #F2F2F7;                        /* fg */
  --muted: #9494AC;
  --faint: #6C6C86;
  --quiet: #6C6C86;                       /* grey that is not text: idle lamps */
  --placeholder: #8E8EA6;
  --border: #33334A;                      /* line */
  --border-strong: #45455F;
  --border-hover: #5C5C7A;

  --danger: #FF5C6A;                      /* crimson, lifted a step for text on cards */
  --danger-solid: #D42637;
  --danger-soft: rgba(255, 71, 87, 0.14);
  --ok: #2BD46A;
  --ok-soft: rgba(43, 212, 106, 0.13);
  --warn: #F5C043;
  --warn-soft: rgba(245, 192, 67, 0.13);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.45), 0 24px 60px rgba(0, 0, 0, 0.5);
  --lift: 0 6px 14px -6px rgba(0, 0, 0, 0.55);   /* Nexus .ni:hover */

  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 230px;
  --gutter: 32px;
}

/* Nexus rule for dark mode: grey text was hard to read on the dark background, so every grey TEXT colour is white.
   Grey that is not text (idle lamps, placeholders, hover borders) has its own tokens above and stays grey. */
:root:not([data-theme="light"]) {
  --muted: #F2F2F7;
  --faint: #F2F2F7;
}

:root[data-theme="light"] {
  color-scheme: light;
  --nexus-text: #E02424;                  /* Nexus red a step deeper for small text on white (4.7:1; #FF3B3B is 3.5:1) */
  --brand-strong: #1A84CF;
  --brand-text: #0F6FB8;                  /* blue as text on white (5.3:1) */
  --brand-soft: #E3F1FC;
  --brand-ring: rgba(30, 147, 230, 0.35);
  --ring: #0F6FB8;

  --bg: #F2F2F6;
  --surface: #FFFFFF;
  --surface-2: #F6F6FA;
  --surface-3: #ECECF3;
  --nav-on: #ECECF3;
  --text: #16161F;
  --muted: #63637A;
  --faint: #65657D;                       /* Nexus dim (#8E8EA6) is 3.2:1 on white; darker so small text passes on surface-3 too */
  --quiet: #8E8EA6;
  --placeholder: #6E6E86;
  --border: #E3E3EC;
  --border-strong: #CBCBD8;
  --border-hover: #A9A9BC;

  --danger: #C8233A;
  --danger-solid: #C8233A;
  --danger-soft: #FDECEE;
  --ok: #157A3E;
  --ok-soft: #E5F6EC;
  --warn: #8A5A00;
  --warn-soft: #FDF4DF;

  --shadow-sm: 0 1px 2px rgba(22, 22, 31, 0.06);
  --shadow: 0 1px 2px rgba(22, 22, 31, 0.05), 0 6px 20px rgba(22, 22, 31, 0.06);
  --shadow-lg: 0 2px 6px rgba(22, 22, 31, 0.08), 0 24px 56px rgba(22, 22, 31, 0.18);
  --lift: 0 6px 14px -6px rgba(22, 22, 31, 0.3);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Nexus background: plain bg behind the header, then a straight fade to a muted navy in the content. Fixed to the
   viewport so the fade stays put while the content scrolls. */
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: linear-gradient(180deg, transparent 0, transparent 64px, color-mix(in srgb, var(--surface) 34%, var(--bg)) 260px);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
a { color: var(--brand-text); text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--on-brand);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; color: var(--on-brand); }

/* ---------- Wordmark ---------- */
/* The wordmark: CDON MERCHANT in the text colour (white in the dark theme). Written "CDON Merchant" in the markup so a
   screen reader says the name, set in capitals here. Same size, weight and spacing as the .brand in Nexus. */
.wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  border-radius: var(--radius-sm);
}
.wordmark:hover { color: var(--text); }
.wordmark-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity 0.13s ease;
}
.wordmark-name span { color: var(--nexus); }
/* The product under the wordmark (the sidebar only): CDON Merchant - AI Center, in the wordmark's red, as written (in
   the light theme a step deeper, so the 12px line reads on white). The two lines stack, centred in the rail and
   left-aligned in the phone's top bar. */
a.wordmark { flex-direction: column; align-items: center; gap: 3px; }
.wordmark-product {
  color: var(--nexus-text);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  transition: opacity 0.13s ease;
}
a.wordmark:hover .wordmark-name, a.wordmark:hover .wordmark-product { opacity: 0.68; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-hover); color: var(--text); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }

.btn-danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #FFFFFF; }
.btn-danger:hover { background: var(--danger-solid); border-color: var(--danger-solid); color: #FFFFFF; filter: brightness(0.94); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }

.btn-quiet-danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn-quiet-danger:hover { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* Theme toggle: both icons are in the markup, CSS shows the one for the theme you can switch to (dark is the default). */
.theme-toggle .i-moon { display: none; }
:root[data-theme="light"] .theme-toggle .i-moon { display: block; }
:root[data-theme="light"] .theme-toggle .i-sun { display: none; }

.btn.is-busy { position: relative; color: transparent; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--on-brand);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn:not(.btn-primary):not(.btn-danger).is-busy::after { border-color: var(--muted); border-right-color: transparent; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-weight: 600; font-size: 14px; }
.field-hint { font-size: 13px; color: var(--muted); }
.field-hint.is-ok { color: var(--ok); }

.input, .select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--placeholder); }
.input:hover, .select:hover { border-color: var(--border-hover); }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.select-sm { width: auto; min-width: 150px; min-height: 32px; padding: 4px 30px 4px 10px; font-size: 13px; background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; }

.input-wrap { position: relative; display: flex; }
.input-wrap .input { padding-right: 64px; }
.input-wrap .reveal {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 32px;
  padding: 4px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--brand-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.input-wrap .reveal:hover { background: var(--brand-soft); }

.form-error {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}
.form-error .icon { margin-top: 1px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Role picker: radio cards */
.choice-group { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.choice-group legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.choice {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.choice:hover { border-color: var(--border-hover); }
.choice input { grid-row: span 2; margin: 3px 0 0; accent-color: var(--brand); width: 16px; height: 16px; }
.choice-title { font-weight: 600; font-size: 14px; }
.choice-text { grid-column: 2; font-size: 13px; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--brand-ring); }

/* ---------- Login page ---------- */
/* The Nexus login backdrop: an indigo glow from the top right and a rose glow from the bottom left on the page colour. */
.login-body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  background:
    radial-gradient(120% 120% at 80% -10%, rgba(91, 63, 217, 0.28), transparent 55%),
    radial-gradient(120% 120% at -10% 110%, rgba(240, 51, 140, 0.24), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}
.login-top { display: flex; justify-content: flex-end; padding: 16px; }
.login-main { display: grid; place-items: start center; padding: 4vh 16px 32px; }
/* Headings centred in the card as in Nexus; the fields below stay left-aligned under their labels. */
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 30px 28px 26px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 22px; }
.login-brand .wordmark-product { font-size: 13px; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; text-align: center; }
.login-lead { color: var(--muted); margin-bottom: 24px; font-size: 14px; text-align: center; }
.login-notice {
  margin-bottom: 18px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--text);
  font-size: 14px;
}
.login-help { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.login-foot { padding: 16px; text-align: center; font-size: 12px; color: var(--faint); }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

/* The Nexus rail: the panel colour fading into the page colour over its last 16px, so there is no hard seam. */
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 16px 16px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface) calc(100% - 16px), var(--bg) 100%);
  z-index: 20;
}
.sidebar-head { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0 8px 22px; }
.menu-toggle { display: none; }

.sidebar-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.panel-user { display: none; }
.nav { flex: 1; overflow-y: auto; margin: -2px -6px 0; padding: 2px 6px 8px; scrollbar-width: thin; }
.nav-group + .nav-group { padding-top: 16px; }
/* Section labels and items as Nexus .sec and .ni. */
.nav-group-title { padding: 0 8px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--faint); }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  transition: color 0.13s ease, background-color 0.13s ease, transform 0.13s ease, box-shadow 0.13s ease;
}
/* Hover lifts the item a little instead of filling it; the current page keeps the card background. The lift only
   where there is a real pointer (a tap must not leave an item raised) and not with reduced motion. */
.nav-link:hover { color: var(--text); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .nav-link:hover { transform: translateY(-2px); box-shadow: var(--lift); }
}
.nav-link[aria-current="page"] { background: var(--nav-on); color: var(--text); font-weight: 700; }
.nav-link[aria-current="page"]:hover { transform: none; box-shadow: none; }
.nav-link .icon { width: 17px; height: 17px; }
/* The menu of the bot being administered: its name at the head (the blue edge of the switcher; the switcher beside the
   page title also says what the bot answers), its pages, then Gemensamt below a line, so it is always clear which
   pages belong to the bot. Measured against the menu before bots (scratch check, 2026-10-15): the whole Ärendebot menu
   stays in sight from 700px high, as the old one did, through the short-window steps below. */
.nav-bot { display: grid; }
.nav-bot-head { margin: 0 0 12px 4px; padding: 1px 0 1px 10px; border-left: 3px solid var(--brand); }
.nav-bot-name { font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; color: var(--text); }
.nav-empty { padding: 2px 12px 0; font-size: 13px; color: var(--muted); }
.nav-bot + .nav-shared { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
/* A short window (a 768px-high laptop, 125% scaling on a 1080p screen): with the full Nexus spacing the menu needs
   about 900px and the Administration items would sit below the fold. The rail tightens in two steps so the whole menu
   stays in sight; on a tall window it keeps the Nexus spacing. Below about 700px the menu scrolls. Each step gives
   back the 17px the product line under the wordmark takes (half a pixel per item, a pixel per group), so the line
   never pushes the menu into scrolling at a height where it fitted without it; the first of them (up to 1000px, a
   maximised browser on a 1080p screen) does only that. */
@media (min-width: 768px) and (max-height: 1000px) {
  .nav-group + .nav-group { padding-top: 15px; }
  .nav-link { padding-top: 11.5px; padding-bottom: 11.5px; }
  .nav-bot-head { margin-bottom: 10px; }
  .nav-bot + .nav-shared { margin-top: 12px; padding-top: 11px; }
}
@media (min-width: 768px) and (max-height: 900px) {
  .sidebar { padding-top: 18px; }
  .sidebar-head { padding-bottom: 16px; }
  .nav-group + .nav-group { padding-top: 11px; }
  .nav-group-title { padding-bottom: 6px; }
  .nav-link { padding-top: 8.5px; padding-bottom: 8.5px; }
  .nav-bot-head { margin-bottom: 4px; }
  .nav-bot + .nav-shared { margin-top: 7px; padding-top: 6px; }
}
@media (min-width: 768px) and (max-height: 780px) {
  .nav-group + .nav-group { padding-top: 7px; }
  .nav-group-title { padding-bottom: 4px; }
  .nav-link { padding-top: 5.5px; padding-bottom: 5.5px; }
  .nav-bot-head { margin-bottom: 3px; }
  .nav-bot + .nav-shared { margin-top: 4px; padding-top: 4px; }
}

/* Signature: the safety strip. Says at a glance which environment this is and whether anything can reach a
   customer. Lives at the foot of the sidebar on every page. */
.safety {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 12px;
}
.safety-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.safety-row + .safety-row { margin-top: 6px; }
.safety-label { color: var(--muted); }
.safety-value { margin-left: auto; font-weight: 600; white-space: nowrap; }
.lamp { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--quiet); box-shadow: 0 0 0 3px var(--surface-3); }
.lamp-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.lamp-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.lamp-danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.main { display: flex; flex-direction: column; min-width: 0; }

/* As in Nexus the header has no bar of its own: it sits on the plain page colour above the background fade. */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 12px var(--gutter);
}
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-title:focus { outline: none; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar-lead { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* The bot switcher: which bot this is (name and what it answers), a menu button with a listbox beside the page title.
   The side menu below the wordmark follows it (.nav-bot). Colours come from the theme tokens only. */
.bot-switch { position: relative; flex: none; min-width: 0; }
.bot-switch[hidden] + .topbar-sep { display: none; }
.bot-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-height: 44px;
  padding: 5px 10px 5px 12px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.bot-switch-btn:hover { background: var(--surface-2); border-color: var(--border-hover); border-left-color: var(--brand); }
.bot-switch-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.bot-switch-btn[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.bot-switch-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.bot-switch-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-switch-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-switch-chev { width: 16px; height: 16px; color: var(--muted); transition: transform 0.15s ease; }
.bot-switch-btn[aria-expanded="true"] .bot-switch-chev { transform: rotate(180deg); }
.topbar-sep { flex: none; width: 1px; height: 28px; background: var(--border-strong); }

.bot-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  display: grid;
  gap: 2px;
  min-width: 300px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.bot-list:focus { outline: none; }
.bot-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
}
.bot-option-text { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.25; }
.bot-option-name { font-size: 14px; font-weight: 600; }
.bot-option-sub { font-size: 12.5px; color: var(--muted); }
.bot-option-check { width: 16px; height: 16px; color: var(--brand-text); visibility: hidden; }
/* The keyboard's (and the pointer's) position: a ring that shows in both themes. */
.bot-option.is-active { background: var(--surface-3); box-shadow: inset 0 0 0 2px var(--ring); }
/* The bot being administered: a tint, a tick and the name in the brand colour, not only a colour. */
.bot-option[aria-selected="true"] { background: var(--brand-soft); }
.bot-option[aria-selected="true"] .bot-option-check { visibility: visible; }
.bot-option[aria-selected="true"] .bot-option-name { color: var(--brand-text); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; min-width: 0; border-radius: 999px; color: var(--text); text-decoration: none; transition: background-color 0.15s ease; }
.user-chip:hover { background: var(--surface-3); color: var(--text); }
.user-chip[aria-current="page"] { background: var(--brand-soft); }
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-name { font-weight: 600; font-size: 14px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 12px; color: var(--muted); }
.topbar-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }

.view { flex: 1; width: 100%; max-width: 1180px; padding: 28px var(--gutter) 64px; }
.view:focus { outline: none; }

/* Forced password change: everything but the password form and logout is out of reach. */
.is-forced .nav, .is-forced .menu-toggle, .is-forced .bot-switch, .is-forced .topbar-sep { display: none; }
.is-forced .safety { margin-top: auto; }

/* ---------- Page building blocks ---------- */
.page { display: grid; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.page-lead { color: var(--muted); max-width: 64ch; }
.greeting { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 650; }
.card-sub { font-size: 13px; color: var(--muted); }
.narrow { max-width: 520px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.stat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 24px; padding: 18px 20px 22px; }
.stat { display: grid; align-content: start; gap: 4px; min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 550; }
.stat-value { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; }
.stat-note { font-size: 12px; color: var(--muted); }

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li + li { border-top: 1px solid var(--border); }
.link-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; color: var(--text); text-decoration: none; }
.link-row:hover { background: var(--surface-2); color: var(--text); }
.link-row .icon { color: var(--brand-text); }
.link-row-text { display: grid; gap: 2px; min-width: 0; }
.link-row-title { font-weight: 600; font-size: 14px; }
.link-row-sub { font-size: 13px; color: var(--muted); }
.link-row .chev { margin-left: auto; color: var(--faint); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.env-badge { font-size: 11px; padding: 1px 8px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}
.data td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: 0; }
.data-top td { vertical-align: top; }
.data tbody tr:hover td { background: var(--surface-2); }
.data .num { text-align: right; }
.data .actions { text-align: right; white-space: nowrap; }
.data .actions .btn + .btn { margin-left: 4px; }
.data tr.is-muted td { color: var(--muted); }
.cell-primary { font-weight: 600; }
.cell-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.cell-time { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.cell-detail { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; max-width: 460px; }
.detail-line + .detail-line { margin-top: 2px; }
.you { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }

.table-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pager { display: flex; gap: 6px; }

/* Empty, loading and error states */
.state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
}
.state-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-text);
  margin-bottom: 4px;
}
.state-icon .icon { width: 22px; height: 22px; }
.state-title { font-size: 16px; font-weight: 650; }
.state-text { max-width: 52ch; color: var(--muted); font-size: 14px; }
.state-error .state-icon { background: var(--danger-soft); color: var(--danger); }
.state .btn { margin-top: 6px; }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 24px; color: var(--muted); font-size: 14px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-right-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--brand-soft); font-size: 14px; }
.notice .icon { color: var(--brand-text); margin-top: 1px; }
.notice-warn { background: var(--warn-soft); }
.notice-warn .icon { color: var(--warn); }
.notice-title { font-weight: 650; }

/* ---------- Dialogs ---------- */
.modal {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
/* Literal color: older engines do not pass custom properties to ::backdrop. */
.modal::backdrop { background: rgba(8, 8, 14, 0.6); }
.modal[open] { animation: modal-in 0.16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal-form { display: grid; margin: 0; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 0 24px; }
.modal-title { font-size: 18px; font-weight: 700; padding-top: 4px; }
.modal-body { display: grid; gap: 16px; padding: 14px 24px 8px; }
.modal-text { color: var(--muted); font-size: 14px; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; }

.secret-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border: 1px dashed var(--brand);
  border-radius: var(--radius);
  background: var(--brand-soft);
}
.secret-value { flex: 1; min-width: 0; font-family: var(--mono); font-size: 17px; font-weight: 600; letter-spacing: 0.04em; overflow-wrap: anywhere; user-select: all; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
}
.toast .icon { margin-top: 1px; color: var(--ok); }
.toast-error .icon { color: var(--danger); }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  :root { --gutter: 24px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* Between the phone and a wide window the switcher, the title and the actions do not fit on one row beside the side
   menu: at 768px "Merchant Center-assistent" lay over the theme button and the user chip, and the page title shrank to
   nothing up to about 900px (measured in Chrome, 2026-10-15). The switcher gets a row of its own above the title and
   the actions, which keep the room they had before the switcher. */
@media (min-width: 768px) and (max-width: 1099px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "switch switch" "title actions"; align-items: center; row-gap: 10px; }
  .topbar:has(.bot-switch[hidden]), .is-forced .topbar { grid-template-areas: "title actions"; }
  .topbar-lead { display: contents; }
  .bot-switch { grid-area: switch; justify-self: start; max-width: 100%; }
  .topbar-sep { display: none; }
  .page-title { grid-area: title; }
  .topbar-actions { grid-area: actions; }
}

@media (max-width: 767px) {
  :root { --gutter: 16px; }
  .shell { display: block; }

  .sidebar {
    height: auto;
    padding: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    z-index: 30;
  }
  .sidebar-head { flex-direction: row; justify-content: space-between; gap: 8px; padding: 10px 8px 10px 16px; min-height: 56px; }
  .sidebar-head .env-badge { margin-right: auto; }
  .sidebar-head a.wordmark { align-items: flex-start; gap: 2px; }
  .sidebar-head .wordmark-product { font-size: 11px; }
  .menu-toggle { display: inline-grid; }
  .menu-toggle .i-close { display: none; }
  .nav-open .menu-toggle .i-close { display: block; }
  .nav-open .menu-toggle .i-menu { display: none; }

  .sidebar-panel { display: none; }
  .nav-open .sidebar-panel {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
  }
  .nav { flex: none; overflow: visible; margin: 0; padding: 4px 12px 12px; }
  .safety { margin: 0 12px 14px; }
  .panel-user { display: flex; align-items: center; gap: 10px; margin: 8px 12px 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); color: var(--text); text-decoration: none; }
  .panel-user:hover { color: var(--text); background: var(--surface-3); }
  .panel-user-action { margin-left: auto; font-size: 13px; color: var(--brand-text); white-space: nowrap; }
  .panel-user .chev { margin-left: -4px; color: var(--faint); }
  .panel-user .user-meta { display: flex; }
  .panel-user .user-name { max-width: none; }
  .user-chip .user-meta { display: none; }
  .nav-link { padding: 11px 12px; font-size: 15px; }

  /* The phone's top bar: the bot switcher across the full width (every bot's name fits at 320px), then the page title
     with the actions beside it, as before the switcher. Without the switcher (forced password change, or before the
     bots have loaded) the title and the actions share the one row. */
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "switch switch" "title actions"; align-items: center; min-height: 56px; padding: 8px var(--gutter); gap: 8px; }
  .topbar:has(.bot-switch[hidden]), .is-forced .topbar { grid-template-areas: "title actions"; }
  .topbar-lead { display: contents; }
  .bot-switch { grid-area: switch; min-width: 0; }
  .bot-switch-btn { width: 100%; }
  .bot-switch-chev { margin-left: auto; }
  .topbar-actions { grid-area: actions; }
  .topbar-sep { display: none; }
  .page-title { grid-area: title; font-size: 19px; }
  .bot-list { right: 0; min-width: 0; }
  .user-chip { padding: 0; }
  .topbar-divider { display: none; }
  .logout-text { display: none; }
  .view { padding: 20px var(--gutter) 48px; }

  .card-pad { padding: 18px; }
  .card-head { padding: 14px 16px; }
  .stat-list { padding: 14px 16px 18px; gap: 16px; }

  /* Tables become stacked cards. */
  .data thead { display: none; }
  .data, .data tbody, .data tr, .data td { display: block; width: 100%; }
  .data tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .data tbody tr:last-child { border-bottom: 0; }
  .data tbody tr:hover td { background: transparent; }
  .data td { padding: 3px 0; border: 0; text-align: left; max-width: none; }
  .data td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--faint);
    margin-top: 6px;
  }
  .data td.cell-lead::before { display: none; }
  .data td.cell-event { padding-top: 6px; }
  .data .actions { text-align: left; white-space: normal; padding-top: 10px; }
  .data .actions .btn { margin: 0 6px 6px 0; }
  .data .actions .btn + .btn { margin-left: 0; }

  .modal-head { padding: 18px 16px 0 18px; }
  .modal-body { padding: 12px 18px 8px; }
  .modal-foot { padding: 14px 18px 18px; }
  .modal-foot .btn { flex: 1; }

  .toasts { right: 16px; bottom: 16px; }
  .login-card { padding: 24px 20px; }
}

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

/* =====================================================================================================
   Kunskap and Agenter (page modules under /assets/pages)
   ===================================================================================================== */

/* ---------- Shared building blocks ---------- */
.muted-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.muted-line .icon { color: var(--ok); }
.pad { padding: 18px 20px; }
.stack, .kb-body, .agents { display: grid; gap: 20px; min-width: 0; }
.card-stack { display: grid; gap: 14px; padding: 16px 20px 20px; }
.card-intro { display: grid; gap: 2px; margin-bottom: 16px; }
.card-head-wrap { flex-wrap: wrap; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.card-foot-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cell-primary .badge { margin-left: 8px; vertical-align: 1px; }
.data tr.is-current td { background: var(--surface-2); }
.data-compact td, .data-compact th { padding: 8px 12px; }
.grid-2.tight, .grid-3.tight { gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
.input-num { max-width: 180px; }
.field-hint.is-error { color: var(--danger); }
.narrow-wide { max-width: 680px; }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.back-btn { justify-self: start; margin-left: -8px; }
.choice.is-disabled { opacity: 0.55; cursor: not-allowed; }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand-text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.link-btn:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 2px; }
.link-btn.cell-primary { font-size: 14px; color: var(--text); }
.link-btn.cell-primary:hover { color: var(--brand-text); }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.check-group { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.check-group legend { padding: 0; margin-bottom: 6px; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 20px; }

.notice-danger { background: var(--danger-soft); }
.notice-danger .icon { color: var(--danger); }
.notice-danger .notice-title { color: var(--danger); }
.notice-body { display: grid; gap: 4px; min-width: 0; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.notice-list { margin: 4px 0 0; padding-left: 18px; }
.notice-list li + li { margin-top: 2px; }
/* "Ta bort kund" (pages/kunder.js): what the deletion takes, in two columns where there is room (one on a phone), so
   the dialog fits a 768px-high window with its button in sight. */
.delete-list { columns: 150px 2; column-gap: 24px; }
.delete-list li { break-inside: avoid; }
.delete-list li + li { margin-top: 0; }
.delete-list li { padding-bottom: 2px; }

.problem-box > div { display: grid; gap: 4px; min-width: 0; }
.problem-title { font-weight: 650; }
.problem-list { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-weight: 500; }
.problem-link { color: var(--danger); font-size: 14px; font-weight: 500; }
.problem-link:hover { color: var(--danger); }

/* Tabs: one row, scrolls sideways on a phone. */
.tabs-wrap { position: relative; margin-bottom: -6px; }
.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 10px 14px 12px;
  border: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab[aria-selected="true"] { color: var(--brand-text); font-weight: 650; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px; background: var(--brand); }
.tab:focus-visible { outline-offset: -2px; }
.tab-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.tab-panel { display: grid; gap: 20px; min-width: 0; }
.tab-panel:focus { outline: none; }

/* Segmented choice on native radios. */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.seg-opt { position: relative; display: inline-flex; cursor: pointer; }
.seg-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.seg-text { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 4px; color: var(--muted); font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap; transition: background-color 0.12s ease, color 0.12s ease; }
.seg-opt:hover .seg-text { color: var(--text); }
.seg-input:checked + .seg-text { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.seg-input:focus-visible + .seg-text { outline: 2px solid var(--ring); outline-offset: 1px; }
.seg-opt.is-disabled { cursor: not-allowed; }
.seg-opt.is-disabled .seg-text { color: var(--faint); }
.seg-input:disabled:checked + .seg-text { opacity: 0.7; }
.seg-sm .seg-text { padding: 3px 10px; font-size: 12.5px; }
.seg-opt.is-missing .seg-text::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.seg-audience .seg-input[value="internal"]:checked + .seg-text { color: var(--warn); }
.seg-auto .seg-input[value="off"]:checked + .seg-text { color: var(--text); }

/* Switch. */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch-track { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background-color 0.15s ease; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s ease; }
.switch-input:checked + .switch-track { background: var(--brand); }
.switch-input:checked + .switch-track::after { transform: translateX(14px); }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--ring); outline-offset: 2px; }
.switch-input:disabled + .switch-track { opacity: 0.5; }
.switch:has(.switch-input:disabled) { cursor: not-allowed; }
.switch-label { font-weight: 550; }

/* Heading paths. */
.trail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; min-width: 0; font-size: 13px; color: var(--muted); }
.trail-sep { color: var(--faint); }
.trail-last { color: var(--text); font-size: 14px; font-weight: 650; }
.trail-empty { font-style: italic; }

/* Clamped text. */
.clamp-wrap { display: grid; justify-items: start; gap: 6px; min-width: 0; }
.clamp-wrap > :first-child { justify-self: stretch; }
.is-clamped { max-height: 13.5em; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }

/* Sticky action bar at the foot of a long view. */
.action-bar {
  position: sticky;
  bottom: 12px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 14px 12px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.action-bar-text, .action-bar-note { font-size: 14px; color: var(--muted); }
.action-bar-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.quote { margin: 0; padding: 10px 14px; border-left: 3px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Kunskap: upload ---------- */
.upload-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; padding: 20px; }
.dropzone {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  min-height: 190px;
  padding: 24px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); }
.dropzone-icon .icon { width: 22px; height: 22px; }
.dropzone-title { font-size: 15px; font-weight: 650; }
.dropzone-text { max-width: 40ch; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.upload-options { display: grid; align-content: start; gap: 14px; }
.upload-list-wrap { padding: 0 20px; }
.upload-list-wrap:has(.upload-item) { padding-bottom: 16px; }
.upload-list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 8px; border-top: 1px solid var(--border); }
.upload-list-title { color: var(--faint); font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.upload-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.upload-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.upload-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 8px; background: var(--surface-3); color: var(--muted); }
.upload-icon .icon { width: 16px; height: 16px; }
.upload-item.is-done .upload-icon { background: var(--ok-soft); color: var(--ok); }
.upload-item.is-error .upload-icon { background: var(--danger-soft); color: var(--danger); }
.upload-item.is-warn .upload-icon { background: var(--warn-soft); color: var(--warn); }
.upload-item.is-error .upload-status { color: var(--danger); }
.upload-item.is-warn .upload-status { color: var(--warn); }
.upload-main { display: grid; flex: 1; gap: 4px; min-width: 0; }
.upload-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.upload-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 13px; }
.upload-actions { flex: none; align-self: center; }
.upload-warnings { margin: 2px 0 0; padding-left: 18px; color: var(--warn); font-size: 13px; }
.progress { width: 100%; height: 6px; margin-top: 4px; border: 0; border-radius: 999px; background: var(--surface-3); overflow: hidden; appearance: none; accent-color: var(--brand); }
.progress::-webkit-progress-bar { border-radius: 999px; background: var(--surface-3); }
.progress::-webkit-progress-value { border-radius: 999px; background: var(--brand); transition: width 0.2s ease; }
.progress::-moz-progress-bar { border-radius: 999px; background: var(--brand); }

/* ---------- Kunskap: drafts and review ---------- */
.draft-list { list-style: none; margin: 0; padding: 0; }
.draft-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; }
.draft-row + .draft-row { border-top: 1px solid var(--border); }
.draft-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); }
.draft-main { display: grid; flex: 1; gap: 3px; min-width: 0; }
.draft-title { font-weight: 650; overflow-wrap: anywhere; }
.draft-meta, .draft-counts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--muted); font-size: 13px; }
.draft-counts { color: var(--text); }
.draft-actions { flex: none; }

.review { display: grid; gap: 16px; min-width: 0; }
.review-head { display: grid; gap: 14px; padding: 16px 20px 20px; }
.review-head-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-title-row { display: grid; gap: 4px; }
.review-title { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.review-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; }
.review-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-stat { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.mini-stat-value { color: var(--text); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.review-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.review-tip { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); font-size: 13px; }
.review-tip .icon { width: 16px; height: 16px; color: var(--brand-text); }
.diff-details { margin-top: 6px; }
.diff-details summary { color: var(--brand-text); font-size: 13px; font-weight: 600; cursor: pointer; }
.diff-group { margin-top: 8px; }
.diff-group-title { font-size: 13px; font-weight: 650; }
.diff-items { max-height: 180px; margin: 2px 0 0; padding-left: 18px; overflow-y: auto; color: var(--muted); font-size: 13px; }

.chunk-list { display: grid; gap: 12px; min-width: 0; }
.chunk-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.chunk-card.is-internal { border-left-color: var(--warn); }
.chunk-card.is-skipped { border-left-color: var(--border-strong); background: var(--surface-2); }
.chunk-card.is-skipped .chunk-text { color: var(--muted); }
.chunk-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.chunk-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); font-size: 13px; }
.chunk-notice .icon { width: 16px; height: 16px; color: var(--warn); }
.chunk-notice p { flex: 1; min-width: 180px; }
.chunk-text, .chunk-plain { font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.chunk-text { cursor: text; }
mark.pii { padding: 0 3px; border-radius: 4px; background: var(--brand-soft); color: var(--brand-text); font-weight: 650; box-shadow: inset 0 -1px 0 var(--brand-ring); }
mark.pii.is-undone { background: var(--warn-soft); color: var(--warn); font-weight: 600; box-shadow: inset 0 -1.5px 0 var(--warn); }
.red-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.red-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 3px 4px 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 12.5px; }
.red-chip.is-undone { border-style: dashed; border-color: var(--warn); background: var(--warn-soft); }
.red-kind { color: var(--brand-text); font-weight: 700; }
.red-chip.is-undone .red-kind { color: var(--warn); }
.red-original { max-width: 260px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.red-src { color: var(--faint); }
.red-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 0; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: inset 0 0 0 1px var(--border); }
.red-btn:hover { background: var(--surface-3); }
.red-btn .icon { width: 13px; height: 13px; }
.chunk-reason { color: var(--muted); font-size: 12.5px; }
.chunk-foot { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.chunk-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; min-width: 0; margin: 0; padding: 0; border: 0; }
.chunk-controls:disabled { opacity: 0.6; }
.chunk-controls-main, .chunk-controls-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.chunk-controls-actions { gap: 4px; }
.chunk-hint { color: var(--warn); font-size: 13px; font-weight: 550; }
.chunk-editor { display: grid; gap: 8px; }
.chunk-edit { min-height: 160px; font-size: 14px; }

/* ---------- Kunskap: facts ---------- */
.fact-list { display: grid; gap: 10px; }
.fact-row { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.fact-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 0.9fr) auto; align-items: end; gap: 10px; }
.fact-field { display: grid; gap: 4px; min-width: 0; }
.fact-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.fact-tools { display: flex; align-items: center; gap: 6px; min-height: 42px; }
.fact-status:empty { display: none; }
.dirty-note { color: var(--warn); font-size: 13px; font-weight: 600; }

/* ---------- Kunskap: search ---------- */
.search-form { display: grid; gap: 14px; }
.search-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.search-options .field { flex: 1 1 180px; }
.search-options .check { min-height: 42px; }
.search-submit { margin-left: auto; }
.search-results { display: grid; gap: 10px; }
.results-head { color: var(--muted); font-size: 13px; font-weight: 650; }
.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.result { display: grid; gap: 10px; padding: 14px 18px; }
.result-head { display: flex; align-items: flex-start; gap: 12px; }
.result-rank { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); font-size: 12px; font-weight: 700; }
.result-title { display: grid; flex: 1; gap: 2px; min-width: 0; }
.result-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: 12.5px; }
.result-score { font-variant-numeric: tabular-nums; }

/* ---------- Agenter ---------- */
.agent-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.agent-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.agent-avatar { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--brand); color: var(--on-brand); }
.agent-avatar .icon { width: 22px; height: 22px; }
.agent-head-text { display: grid; gap: 4px; min-width: 0; }
.agent-name { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.agent-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 13px; }
.agent-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-attention { flex-basis: 100%; }

.editor { display: grid; grid-template-columns: 196px minmax(0, 1fr); align-items: start; gap: 20px; }
.editor-nav { position: sticky; top: 16px; }
.editor-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.editor-nav-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--muted); font-size: 13.5px; font-weight: 550; text-decoration: none; }
.editor-nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-problems { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.editor-main, .editor-sections { display: grid; gap: 16px; min-width: 0; }
.editor-section { scroll-margin-top: 16px; }
.editor-section .card-title { font-size: 16px; }
.editor-section .card-title:focus { outline: none; }
.editor-section-body { display: grid; gap: 16px; padding: 18px 20px 20px; }
.is-readonly .edit-only { display: none !important; }
.section-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.section-actions > :only-child { margin-left: auto; }
.sub-list { display: grid; gap: 12px; }
.sub-card { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.sub-card-head { display: flex; align-items: center; gap: 10px; }
.sub-card-head .btn { margin-left: auto; }
.sub-title { margin: 0; font-size: 15px; font-weight: 700; }
.key-chip { padding: 1px 8px; border-radius: var(--radius-sm); background: var(--surface-3); color: var(--muted); font-size: 12px; }
.lang-block { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sub-block { display: grid; gap: 8px; }
.row-list { display: grid; gap: 8px; }
.pair-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.intent-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.intent-row { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.intent-row[open] { background: var(--surface-2); }
.intent-summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; list-style: none; cursor: pointer; }
.intent-summary::-webkit-details-marker { display: none; }
.intent-summary::before { content: ""; width: 7px; height: 7px; flex: none; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); transition: transform 0.15s ease; }
.intent-row[open] > .intent-summary::before { transform: rotate(45deg); }
.intent-label { font-size: 14px; font-weight: 600; }
.intent-key { margin-left: auto; overflow: hidden; color: var(--faint); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.intent-body { display: grid; gap: 14px; padding: 4px 14px 14px; }
.auto-table td { vertical-align: middle; }
.auto-col-head { display: grid; gap: 2px; }
.auto-bulk { display: flex; gap: 10px; }
.auto-bulk .link-btn { font-size: 12px; }
.inline-add { display: flex; gap: 8px; max-width: 460px; }
.inline-add .input { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.model-list { display: grid; }
.model-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 12px 0; }
.model-row:first-child { padding-top: 0; }
.model-row + .model-row { border-top: 1px solid var(--border); }
.model-text { display: grid; flex: 1; gap: 2px; min-width: 200px; }
.model-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.mini-field { display: grid; gap: 4px; }
.mini-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.mini-field .select { min-width: 170px; }
.save-bar.is-dirty { border-color: var(--warn); }
.save-state { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 550; }
.diff-pickers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.diff-pickers .select-sm { min-width: 120px; }
.diff-val { max-height: 9em; padding: 4px 8px; overflow: auto; border-radius: var(--radius-sm); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-from { background: var(--danger-soft); }
.diff-to { background: var(--ok-soft); }
.diff-table td:first-child { max-width: 260px; }

/* ---------- Kunskap and Agenter: narrow screens ---------- */
@media (max-width: 1024px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor-nav { display: none; }
  .upload-body { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
  .tabs-wrap { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
  .tabs { padding: 0 var(--gutter); }
  .card-stack, .editor-section-body { padding: 14px 16px 16px; }
  .upload-body { padding: 16px; }
  .upload-list-wrap { padding: 0 16px; }
  .dropzone { min-height: 0; padding: 20px 16px; }
  .draft-row { flex-wrap: wrap; padding: 14px 16px; }
  .draft-actions { width: 100%; }
  .draft-actions .btn { width: 100%; }
  .review-head { padding: 14px 16px 16px; }
  .review-title { font-size: 18px; }
  .review-tip { margin-left: 0; }
  .chunk-card { padding: 14px; }
  .chunk-controls-main { width: 100%; }
  .chunk-controls-main .select { flex: 1 1 160px; }
  .red-original { max-width: 150px; }
  .action-bar { bottom: 8px; padding: 10px 12px; }
  .action-bar-buttons { width: 100%; margin-left: 0; }
  .action-bar-buttons .btn { flex: 1; }
  .fact-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fact-grid .fact-field:first-child { grid-column: 1 / -1; }
  .fact-tools { grid-column: 1 / -1; justify-content: flex-end; min-height: 0; }
  .search-submit { width: 100%; margin-left: 0; }
  .search-submit .btn { width: 100%; }
  .agent-head { padding: 16px; }
  .agent-head-actions { width: 100%; }
  .agent-head-actions .btn { flex: 1; }
  .pair-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pair-row .select { grid-column: 1; grid-row: 2; }
  .model-controls, .mini-field { width: 100%; }
  .mini-field .select { width: 100%; min-width: 0; }
  .card-foot { padding: 12px 16px; }
  .card-foot-right { width: 100%; justify-content: space-between; }
  .diff-pickers { width: 100%; }
  .diff-table td:first-child { max-width: none; }
  .seg-auto { display: flex; width: 100%; }
  .seg-auto .seg-opt { flex: 1; }
  .seg-auto .seg-text { justify-content: center; width: 100%; }
  .input-num { max-width: none; }
}
.save-bar .btn-ghost:disabled { display: none; }
@media (max-width: 767px) {
  .save-bar { flex-wrap: nowrap; }
  .save-bar .action-bar-buttons { width: auto; margin-left: auto; flex-wrap: nowrap; }
  .save-bar.is-dirty { flex-wrap: wrap; }
  .save-bar.is-dirty .action-bar-buttons { width: 100%; }
  .save-state { font-size: 13px; }
}

/* =====================================================================================================
   Runs: Testkonsol, Körningar, Testkörningar, Inställningar and Översikt (page modules under /assets/pages)
   ===================================================================================================== */

/* ---------- Shared building blocks ---------- */
.kv { display: grid; align-content: start; gap: 2px; min-width: 0; }
.kv-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.kv-value { font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.kv-note { color: var(--muted); font-size: 12px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 24px; padding: 16px 20px 20px; }
.kv-grid-flat { padding: 0; }
.pad-x { padding: 12px 20px; }
.eyebrow { color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.section-title { font-size: 17px; font-weight: 700; }
.static-value { display: flex; align-items: center; min-height: 42px; font-weight: 600; }
.spacer { flex: 1; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ext-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.ext-link .icon { width: 14px; height: 14px; }
.btn.ext-link .icon { width: 16px; height: 16px; }
.row-link { color: var(--text); text-decoration: none; }
.row-link:hover .cell-time, .row-link:focus-visible .cell-time { color: var(--brand-text); text-decoration: underline; text-underline-offset: 2px; }
.data .cell-check { width: 1%; padding-right: 0; }
.data .cell-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.data tr.row-total td { font-weight: 650; background: var(--surface-2); }
.input-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; width: 150px; }
.score-note { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.notice-inset { margin: 0 20px 16px; }
.card-head + .notice-inset { margin-top: 16px; }
.check.is-disabled { opacity: 0.55; cursor: not-allowed; }
.check-title { font-weight: 600; }
.check-note { color: var(--muted); font-size: 13px; }
.card-alert { border-color: var(--danger); }

/* A single-series bar list: label, bar from one baseline in the brand hue, value at the tip. */
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 3.5em; align-items: center; gap: 12px; font-size: 14px; }
.bar-label { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.bar-track { position: relative; height: 12px; border-left: 1px solid var(--border-strong); }
.bar-fill { display: block; height: 100%; max-width: 100%; border-radius: 0 4px 4px 0; background: var(--brand); }
.bar-value { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }

/* Meter: one ratio against the whole, the track a lighter step of the same hue. */
.meter { height: 10px; border-radius: 999px; background: var(--brand-soft); overflow: hidden; }
.meter-fill { display: block; height: 100%; max-width: 100%; border-radius: 999px; background: var(--brand); }
.meter-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.meter-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
/* The weekly cost budget: past the budget the fill turns amber, at the hard cap red. */
.meter-warn { background: var(--warn-soft); }
.meter-warn .meter-fill { background: var(--warn); }
.meter-danger { background: var(--danger-soft); }
.meter-danger .meter-fill { background: var(--danger); }

.count-list { list-style: none; margin: 0; padding: 0; display: grid; }
.count-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.count-list li:last-child { border-bottom: 0; }
.count-text { min-width: 0; overflow-wrap: anywhere; }
.count-num { flex: none; font-weight: 650; font-variant-numeric: tabular-nums; }
.reason-block { display: grid; gap: 6px; min-width: 0; }

/* ---------- One run ---------- */
.run-view, .run-tabs { display: grid; gap: 20px; min-width: 0; }
/* A sideways-scrolling tab row must not widen its grid: one column that may shrink below its content. */
.page, .stack, .kb-body, .agents, .run-view, .run-tabs, .console-result { grid-template-columns: minmax(0, 1fr); }
.run-pair { align-items: start; }

.run-decision { --tone: var(--muted); --tone-soft: var(--surface-3); position: relative; overflow: hidden; }
.run-decision::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone); }
.run-decision.tone-ok { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.run-decision.tone-brand { --tone: var(--brand); --tone-soft: var(--brand-soft); }
.run-decision.tone-warn { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.run-decision.tone-danger { --tone: var(--danger); --tone-soft: var(--danger-soft); }
.run-decision-head { display: flex; align-items: flex-start; gap: 16px; padding: 20px 20px 16px 24px; }
.run-decision-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--tone-soft); color: var(--tone); }
.run-decision-icon .icon { width: 22px; height: 22px; }
.run-decision-text { display: grid; flex: 1; gap: 4px; min-width: 0; }
.run-decision-title { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.run-decision-sub { max-width: 72ch; color: var(--muted); font-size: 14px; }
.run-verdict { display: grid; flex: none; justify-items: end; gap: 6px; text-align: right; }
.run-verdict-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.run-verdict .badge { font-size: 13px; padding: 3px 12px; }
.run-reasons { display: grid; gap: 4px; padding: 0 20px 16px 84px; }
.run-reasons-title { font-size: 13px; font-weight: 650; }
.reason-list { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 14px; }
.run-facts { display: flex; flex-wrap: wrap; gap: 10px 32px; padding: 14px 20px 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }
.run-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.run-decision .run-tags { padding: 0 20px 14px 24px; background: var(--surface-2); }
.run-tags-label { margin-right: 4px; color: var(--muted); font-size: 12px; font-weight: 650; }
.tag-chip { padding: 1px 8px; border-radius: var(--radius-sm); background: var(--surface-3); color: var(--muted); font-size: 12px; }

.run-empty { display: flex; align-items: center; gap: 10px; padding: 22px 20px; color: var(--muted); font-size: 14px; }
.run-empty .icon { color: var(--faint); }
.run-inline-notice { margin: 14px 20px 0; }
.mail { display: grid; gap: 12px; padding: 14px 20px 20px; }
.mail-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-bottom: 10px; border-bottom: 1px dashed var(--border-strong); color: var(--text); font-size: 12.5px; }
.mail-meta-label { color: var(--faint); }
.rich { min-width: 0; font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.rich p { margin: 0 0 10px; }
.rich > :last-child, .rich div > :last-child { margin-bottom: 0; }
.rich ul, .rich ol { margin: 0 0 10px; padding-left: 20px; }
.rich hr { margin: 12px 0; border: 0; border-top: 1px solid var(--border); }
.rich h1, .rich h2, .rich h3, .rich h4 { margin: 0 0 8px; font-size: 15px; }
.rich em { color: var(--muted); }
.rich-dead-link { text-decoration: underline dotted; }
.note-body { margin: 16px 20px 20px; padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--radius); background: var(--warn-soft); font-size: 14px; }

.query-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.query-label { margin-right: 4px; color: var(--muted); font-size: 12px; font-weight: 650; }
.query-chip { padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 12.5px; overflow-wrap: anywhere; }
.source-list { list-style: none; margin: 0; padding: 0; }
.source { display: grid; gap: 8px; min-width: 0; padding: 14px 20px 16px 17px; border-left: 3px solid transparent; }
.source + .source { border-top: 1px solid var(--border); }
.source.is-cited { border-left-color: var(--ok); }
.source.is-internal { border-left-color: var(--warn); }
.source-head { display: flex; align-items: flex-start; gap: 12px; }
.source-rank { display: inline-grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); font-size: 12px; font-weight: 700; }
.source-title { display: grid; flex: 1; gap: 2px; min-width: 0; }
.source-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: 12.5px; }
.source-id { color: var(--faint); font-size: 11.5px; }
.source-badges { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; max-width: 46%; }
.source-text { font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.source .clamp-wrap, .source-link { padding-left: 38px; }
.source-link { font-size: 13px; }

.check-summary { display: flex; flex-wrap: wrap; gap: 12px 36px; padding: 16px 20px; }
.check-stat { display: grid; justify-items: start; gap: 4px; }
.check-stat-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.check-list { list-style: none; margin: 0; padding: 0 20px 16px; display: grid; gap: 8px; }
.check-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); }
.check-item .icon { margin-top: 2px; color: var(--warn); }
.check-item.is-critical { background: var(--danger-soft); }
.check-item.is-critical .icon { color: var(--danger); }
.check-item-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; font-weight: 650; }
.check-item-text { margin-top: 2px; font-size: 13px; overflow-wrap: anywhere; }
.flag-list { list-style: none; margin: 0; padding: 4px 20px 18px; display: grid; gap: 6px; }
.flag-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.flag-item .icon { width: 16px; height: 16px; color: var(--ok); }
.flag-item.is-bad .icon { color: var(--danger); }
.block-text { max-width: 62ch; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

.triage-flags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; padding: 0 20px 20px; }
.triage-flag-group { display: grid; align-content: start; gap: 6px; }
.question-list { margin: 0; padding: 14px 20px 18px 40px; display: grid; gap: 4px; font-size: 14px; }
.ticket-text { max-width: 90ch; }

/* ---------- Testkonsol ---------- */
.console-text { min-height: 150px; }
.console-result { display: grid; gap: 16px; min-width: 0; scroll-margin-top: 16px; }
.console-result-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; }
.console-running { display: flex; align-items: center; gap: 14px; padding: 20px; }
.console-running .spinner { flex: none; }

/* ---------- Körningar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filter-search { display: flex; gap: 4px; margin-left: auto; }
.runs-table .cell-intent { max-width: 220px; }
.runs-table td { vertical-align: top; }
.run-head .agent-meta time { font-variant-numeric: tabular-nums; }

/* ---------- Testkörningar ---------- */
.eval-progress { display: flex; align-items: center; gap: 14px; padding: 16px 20px; }
.eval-progress .spinner { flex: none; }
.eval-progress-main { display: grid; flex: 1; gap: 6px; min-width: 0; }
.import-status { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.import-done { border-bottom: 1px solid var(--border); }
.label-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; gap: 20px; }
.label-card { position: sticky; top: 16px; }
.thread { list-style: none; margin: 0; padding: 16px 20px 20px; display: grid; gap: 10px; }
.thread-msg { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.thread-msg.author-requester { background: var(--surface-2); }
.thread-msg.is-private { border-color: transparent; background: var(--warn-soft); }
.thread-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 6px; }
.thread-author { font-size: 13.5px; font-weight: 650; }
.thread-body { font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.gates-card { position: relative; overflow: hidden; }
.gates-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--danger); }
.gates-card.is-pass::before { background: var(--ok); }
.gate-list { list-style: none; margin: 0; padding: 4px 20px 12px 24px; display: grid; }
.gate { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.gate:last-child { border-bottom: 0; }
.gate-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.gate-icon .icon { width: 14px; height: 14px; stroke-width: 2.25; }
.gate-pass .gate-icon { background: var(--ok-soft); color: var(--ok); }
.gate-fail .gate-icon { background: var(--danger-soft); color: var(--danger); }
.gate-label { font-size: 14px; }
.gate-value { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gate-report { border-top: 1px solid var(--border); }
.gate-report-title { margin: 12px 20px 0 24px; font-size: 13px; color: var(--muted); }
.gate.is-report.gate-fail .gate-icon { background: var(--warn-soft); color: var(--warn); }

/* ---------- Inställningar ---------- */
.mode-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.seg-mode .seg-text { padding: 8px 20px; font-size: 14px; }
.mode-status { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 240px; font-size: 14px; }
.mode-explain { display: grid; gap: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mode-explain-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 4px 16px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13.5px; }
.mode-explain-row:first-child { border-top: 0; }
.mode-explain-row.is-current { background: var(--brand-soft); }
.mode-explain dt { margin: 0; font-weight: 600; }
.mode-explain dd { margin: 0; color: var(--muted); }
.mode-explain-row.is-current dd { color: var(--text); }
@media (max-width: 640px) {
  .mode-explain-row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Översikt ---------- */
.all-clear { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--muted); font-size: 14px; }
.alerts { display: grid; gap: 10px; }
.alert-row { align-items: center; }
.alert-row .notice-body { flex: 1; }
.alert-row .btn { flex: none; }
/* Dividers are each tile's outer right and bottom edge; the row clips the ones on its own border, so an empty last cell stays plain. */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); overflow: hidden; }
.kpi { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 18px 20px; box-shadow: 1px 0 0 0 var(--border), 0 1px 0 0 var(--border); }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.kpi-note { color: var(--muted); font-size: 12.5px; }
.kpi-danger .kpi-label { color: var(--danger); }

@media (max-width: 1024px) {
  .label-layout { grid-template-columns: minmax(0, 1fr); }
  .label-card { position: static; }
}

@media (max-width: 767px) {
  .run-decision-head { flex-wrap: wrap; padding: 16px 16px 12px 20px; }
  .run-verdict { grid-auto-flow: column; align-items: center; justify-content: start; justify-items: start; width: 100%; text-align: left; }
  .run-reasons { padding: 0 16px 14px 20px; }
  .run-facts, .run-decision .run-tags { padding-left: 20px; padding-right: 16px; }
  .source { padding: 14px 16px 16px 13px; }
  .source-head { flex-wrap: wrap; }
  .source-badges { justify-content: flex-start; width: 100%; max-width: none; padding-left: 38px; }
  .triage-flags { grid-template-columns: minmax(0, 1fr); padding: 0 16px 16px; }
  .kv-grid { padding: 14px 16px 16px; }
  .filter-bar .select-sm { flex: 1 1 140px; min-width: 0; }
  .filter-search { width: 100%; margin-left: 0; }
  .filter-search .input-sm { flex: 1; width: auto; }
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .mode-row .seg-mode { display: flex; width: 100%; }
  .seg-mode .seg-opt { flex: 1; }
  .seg-mode .seg-text { justify-content: center; width: 100%; padding: 8px 10px; }
  .note-body { margin: 14px 16px 16px; }
  .mail { padding: 12px 16px 16px; }
  .check-summary, .pad-x { padding-left: 16px; padding-right: 16px; }
  .check-list, .flag-list { padding-left: 16px; padding-right: 16px; }
  .alert-row { flex-wrap: wrap; }
  /* The text keeps the row beside the icon; the button wraps below it, under the text (it used to squeeze the text). */
  .alert-row .notice-body { flex: 1 1 calc(100% - 30px); min-width: 0; }
  .alert-row .btn { margin-left: 30px; }
  .gate-list { padding: 4px 16px 10px 20px; }
  .gate { grid-template-columns: auto minmax(0, 1fr); }
  .gate-value { grid-column: 2; white-space: normal; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 24px; }
}

/* ---------- Inlärning ---------- */
.topics-table td { vertical-align: top; }
.topics-table .cell-lead .badge { margin-left: 8px; vertical-align: 1px; }
.trend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.trend-arrow { font-weight: 700; }
.trend-up .trend-arrow { color: var(--warn); }
.trend-down .trend-arrow { color: var(--ok); }
.trend-new .trend-arrow { color: var(--brand-text); }
.trend-flat .trend-arrow { color: var(--faint); }
.link-row-btn { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.link-row-btn:focus-visible { outline-offset: -2px; }
.card-head-sub { border-top: 1px solid var(--border); }

.style-group { padding: 4px 0 8px; }
.style-group + .style-group { border-top: 1px solid var(--border); }
.style-group-title { padding: 14px 20px 0; font-size: 15px; font-weight: 650; }
.style-lang-title { padding: 10px 20px 0; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; }
.style-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 16px; padding: 12px 20px; }
.style-item + .style-item { border-top: 1px dashed var(--border); }
.style-main { display: grid; gap: 8px; min-width: 0; }
.style-text { max-width: 80ch; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.style-item.is-off .style-text { color: var(--muted); }

.backfill-start { display: grid; gap: 8px; }
.backfill-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.backfill-form .field { min-width: 200px; }
.backfill-progress { display: grid; gap: 12px; padding-top: 4px; border-top: 1px solid var(--border); }
.backfill-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 14px; }
.backfill-head .spinner { flex: none; }

.drawer {
  width: min(680px, 100vw);
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
.drawer::backdrop { background: rgba(8, 8, 14, 0.6); }
.drawer[open] { animation: drawer-in 0.18s ease-out; }
@keyframes drawer-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 16px 14px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.drawer-head-text { display: grid; gap: 2px; min-width: 0; }
.drawer-title { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.drawer-body { display: grid; gap: 22px; padding: 18px 24px 32px; }
.drawer-lead { max-width: 70ch; font-size: 14px; }
.drawer-section { display: grid; gap: 10px; min-width: 0; }
.drawer-section-title { font-size: 15px; font-weight: 650; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.article-box { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: var(--radius); background: var(--surface-2); }
.article-box.is-pending { border-left-color: var(--warn); }
.article-box.is-approved { border-left-color: var(--ok); }
.article-title { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.article-q { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.article-a { font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.conflict-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.related-list { margin: 2px 0 0; padding-left: 18px; display: grid; gap: 2px; }

.case-list { margin: 0; padding: 0 0 0 22px; display: grid; gap: 10px; }
.case-item { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.case-item::marker { color: var(--faint); font-size: 13px; }
.case-q { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.case-a { color: var(--muted); font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--muted); font-size: 12.5px; }
.case-link { display: inline-flex; align-items: center; gap: 4px; }
.case-link .icon { width: 14px; height: 14px; }
/* Inlärning, Tidigare svar: a precedent's decisions under its text. */
.precedent-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }

@media (max-width: 767px) {
  .drawer { width: 100vw; border-left: 0; }
  .drawer-head { padding: 14px 12px 12px 16px; }
  .drawer-body { padding: 14px 16px 28px; }
  .drawer-actions .btn { flex: 1 1 auto; }
  .style-item { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; }
  .style-group-title, .style-lang-title { padding-left: 16px; padding-right: 16px; }
  .backfill-form .field { min-width: 0; width: 100%; }
  .drawer-body .kv-grid-flat, .backfill-progress .kv-grid-flat { padding: 0; }
}

/* ---------- Granska ---------- */
.gr-filters { border-bottom: 0; }
.gr-progress .gr-meter-row { display: flex; align-items: center; gap: 10px; }
.gr-meter { flex: none; width: 96px; height: 8px; }
.gr-progress .cell-sub { white-space: nowrap; }
.gr-head-main { display: grid; gap: 6px; min-width: 0; }
.gr-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 14px; }
.gr-compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gr-pane { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 16px 20px 18px; }
.gr-pane + .gr-pane { border-left: 1px solid var(--border); }
.gr-pane.is-draft { background: var(--surface-2); }
.gr-text { font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.gr-details { border-top: 1px solid var(--border); }
.gr-details > summary { padding: 12px 20px; color: var(--brand-text); font-size: 14px; font-weight: 600; cursor: pointer; }
.gr-details > summary:hover { background: var(--surface-2); }
.gr-summary-hint { margin-left: 10px; color: var(--muted); font-size: 13px; font-weight: 500; }
.gr-item .card-title:focus { outline: none; }
.gr-details-body { display: grid; gap: 10px; padding: 0 20px 16px; }
.gr-label { color: var(--muted); font-size: 13px; font-weight: 650; }
.gr-sources { list-style: none; margin: 0; padding: 0 20px 16px; display: grid; gap: 10px; }
.gr-source { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: var(--radius-sm); }
.gr-source.is-internal { border-left-color: var(--warn); }
.gr-form { display: grid; gap: 14px; padding: 16px 20px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.gr-severe { display: grid; gap: 4px; }
.gr-severe .field-hint { max-width: 80ch; }
.gr-comment { min-height: 56px; }
.gr-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gr-btn { gap: 10px; min-width: 120px; justify-content: space-between; background: var(--surface); }
.gr-btn-ok:hover:not(:disabled) { border-color: var(--ok); color: var(--ok); }
.gr-btn-minor_edit:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-text); }
.gr-btn-major_edit:hover:not(:disabled) { border-color: var(--warn); color: var(--warn); }
.gr-btn-wrong:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-2); color: var(--muted); font-family: var(--mono); font-size: 11.5px; font-weight: 600; line-height: 1; }
.gr-keys { color: var(--faint); font-size: 12.5px; }
.gr-list td { vertical-align: top; }

/* ---------- Autonomi ---------- */
.au-matrix tbody th { padding: 12px 16px; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font-size: 14px; font-weight: 600; white-space: normal; vertical-align: top; }
.au-matrix tbody tr:last-child th { border-bottom: 0; }
.au-intent { min-width: 160px; }
.au-intent .cell-primary { display: block; }
.au-intent-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.au-brand { min-width: 220px; }
.au-cell { display: grid; gap: 8px; min-width: 200px; }
.au-figs { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 13px; }
.au-prec { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.au-prec-value { font-size: 17px; font-weight: 700; }
.au-prec-low { color: var(--muted); font-size: 12.5px; }
/* Meter: the track is a lighter step of the brand hue; dark = Wilson lower bound, light = measured precision, line = the bar. */
.au-bar { position: relative; max-width: 220px; height: 10px; border-radius: 999px; background: var(--brand-soft); }
.au-bar-range, .au-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; max-width: 100%; border-radius: 999px; }
.au-bar-range { background: var(--brand-ring); }
.au-bar-fill { background: var(--brand); }
.au-bar-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); }
.au-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.au-chip { padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; cursor: default; }
.au-chip.is-ready { background: var(--ok-soft); color: var(--ok); }
.au-blockers > summary { color: var(--brand-text); font-size: 13px; font-weight: 600; cursor: pointer; }
.au-blockers .reason-list { margin-top: 6px; font-size: 13px; }
.au-baseline { display: grid; gap: 6px; margin: 0; min-width: 150px; }
.au-baseline-row { display: grid; gap: 1px; }
.au-baseline dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.au-baseline dd { margin: 0; font-size: 14px; font-weight: 600; }

@media (max-width: 1024px) {
  .gr-compare { grid-template-columns: minmax(0, 1fr); }
  .gr-pane + .gr-pane { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 767px) {
  .gr-pane, .gr-form { padding-left: 16px; padding-right: 16px; }
  .gr-details > summary, .gr-details-body, .gr-sources { padding-left: 16px; padding-right: 16px; }
  .gr-summary-hint { display: block; margin: 2px 0 0; }
  .gr-btn { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .gr-buttons .spacer { display: none; }
  .gr-buttons .btn-ghost { flex: 1 1 100%; }
  .gr-keys { display: none; }
  /* One intent in two lines: name, then meter and count, agreement and state side by side. */
  .gr-progress tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 16px; }
  .gr-progress td.cell-lead { grid-column: 1 / -1; }
  .gr-progress td { padding: 0; }
  .gr-progress td[data-label]::before { display: none; }
  .gr-progress td.num { grid-column: 2; grid-row: 2; text-align: right; }
  .gr-progress td.num::before { display: inline; margin: 0 6px 0 0; content: attr(data-label); }
  .gr-progress td:last-child { grid-column: 1 / -1; }
  .gr-progress tr.is-current { background: var(--surface-2); }
  .gr-progress tr.is-current td { background: transparent; }
  /* The matrix as one card per intent: each brand and the baseline under the intent, labelled. */
  .au-matrix thead { display: none; }
  .au-matrix, .au-matrix tbody, .au-matrix tr, .au-matrix tbody th, .au-matrix td { display: block; width: 100%; }
  .au-matrix tr { padding: 4px 0 8px; border-bottom: 1px solid var(--border); }
  .au-matrix tbody tr:last-child { border-bottom: 0; }
  .au-matrix tbody th, .au-matrix td { padding: 8px 16px; border-bottom: 0; }
  .au-matrix td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
  .au-cell, .au-intent, .au-baseline { min-width: 0; }
  .au-bar { max-width: none; }
}

/* Testpass (Inställningar, Översikt, #/testpass) and the time window chip in Körningar. */
.notice-ok { background: var(--ok-soft); }
.notice-ok .icon { color: var(--ok); }
.testpass-banner .notice-body { flex: 1; }
.testpass-live { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--brand-soft); }
.testpass-live .meter-row { align-items: center; }
.testpass-live .meter-value { font-variant-numeric: tabular-nums; }
.pad-x { padding: 16px 20px 0; margin: 0; }
.input-date { max-width: 260px; }
.agent-meta-line { margin: 4px 0 0; font-size: 14px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--brand-soft); color: var(--brand-text); font-size: 13px; font-weight: 600; }
.chip-x { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.chip-x:hover { background: var(--surface-3); }
.chip-x:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.chip-x .icon { width: 14px; height: 14px; }
.testpass-form .field > .seg { justify-self: start; }
.testpass-form .field-hint { margin: 0; }

/* ---------- Översikt: Resultat ---------- */
/* Period chips: a segmented row of toggle buttons (aria-pressed), each a Tab stop; arrow keys move between them. */
.seg-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 3px 12px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; cursor: pointer; transition: background-color 0.12s ease, color 0.12s ease; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.seg-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.results-card .card-head { align-items: flex-start; }
.results-kpis { border-bottom: 1px solid var(--border); }
.results-tables { display: grid; gap: 14px; min-width: 0; }
.results-quality { padding-top: 14px; border-top: 1px solid var(--border); }
.results-quality-main { font-weight: 600; }
.results-side { display: grid; gap: 2px; color: var(--muted); font-size: 13px; }
.results-foot { color: var(--muted); font-size: 12.5px; }
.results-body > .results-foot { padding: 0 20px 18px; text-align: center; }
/* The per-agent and per-brand tables keep their columns at every width and scroll sideways inside their frame. */
.results-table-wrap { border: 1px solid var(--border); border-radius: var(--radius); }
.results-table-wrap:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.data-keep th, .data-keep td { white-space: nowrap; }
.data-keep tbody th { background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 600; text-align: left; }
.data-keep tbody tr:hover th { background: var(--surface-2); }
.data-keep th:first-child, .data-keep td:first-child { position: sticky; left: 0; z-index: 1; }
.data-keep tbody th:first-child { box-shadow: 1px 0 0 0 var(--border); }
/* Boten i Freshdesk: each measure heads its two columns (I dag, 7 dagar); only the brand column stays put sideways. */
.bot-table th[colspan] { text-align: center; }
.bot-table thead tr + tr th:first-child { position: static; }
/* Svar från boten: one row per reply, newest first. The line above the reply wraps on a narrow pane; the reply is shown as
   the merchant got it, folded to three lines (Visa hela svaret opens it). */
.replies-count { padding: 14px 20px 0; color: var(--muted); font-size: 13px; }
.reply-list { margin: 10px 0 0; padding: 0; list-style: none; }
.reply-item { display: grid; gap: 8px; min-width: 0; padding: 14px 20px; border-top: 1px solid var(--border); }
.reply-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; font-size: 13px; }
.reply-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.reply-brand { font-weight: 600; }
.reply-intent { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.reply-text { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.reply-text.is-collapsed { max-height: calc(4.8em + 20px); overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent); mask-image: linear-gradient(180deg, #000 55%, transparent); }
.reply-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.reply-run { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.reply-run .icon { width: 14px; height: 14px; }
.replies-more { display: flex; justify-content: center; padding: 14px 20px 4px; border-top: 1px solid var(--border); }
.replies-body > .results-foot { padding: 14px 20px 18px; border-top: 1px solid var(--border); }
.replies-body > .state + .results-foot { border-top: 0; padding-top: 0; }

@media (max-width: 767px) {
  .results-card .card-head { flex-direction: column; align-items: stretch; }
  .period-seg { display: flex; width: 100%; }
  .period-seg .seg-btn { flex: 1; padding: 6px 4px; min-height: 36px; }
  .data-keep { display: table; width: 100%; }
  .data-keep thead { display: table-header-group; }
  .data-keep tbody { display: table-row-group; }
  .data-keep tr { display: table-row; width: auto; padding: 0; border: 0; }
  .data-keep th, .data-keep td { display: table-cell; width: auto; padding: 8px 10px; border-bottom: 1px solid var(--border); }
  .data-keep .num { text-align: right; }
  .data-keep tbody tr:last-child th, .data-keep tbody tr:last-child td { border-bottom: 0; }
  .results-body > .results-foot { padding: 0 16px 16px; }
  .replies-count { padding: 12px 16px 0; }
  .reply-item { padding: 12px 16px; }
  .reply-text { padding: 8px 10px; }
  .reply-text.is-collapsed { max-height: calc(4.8em + 16px); }
  .replies-more { padding: 12px 16px 4px; }
  .replies-more .btn { width: 100%; justify-content: center; }
  .replies-body > .results-foot { padding: 12px 16px 16px; }
}

/* =====================================================================================================
   The start page of a bot with nothing to administer yet (pages/bot-intro.js): Webbchatt until its Översikt exists,
   Merchant Center-assistent's Översikt.
   ===================================================================================================== */
.bot-intro { display: grid; gap: 18px; }
.bot-intro-head { display: flex; gap: 14px; align-items: flex-start; }
.bot-intro-head .card-title { margin-bottom: 4px; font-size: 17px; }
.bot-intro-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-text); }
.bot-intro-icon .icon { width: 20px; height: 20px; }
.bot-intro-body { display: grid; gap: 10px; }
.bot-intro-points { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.bot-intro-points li { display: flex; gap: 10px; align-items: flex-start; }
.bot-intro-points .icon { width: 16px; height: 16px; margin-top: 3px; color: var(--ok); }

/* ---- Översikt: Så hanterar boten ärendena (pages/bot-breakdown-shared.js) ---- */
/* Each reason is a disclosure: its label, the number of tickets and their share; open, it lists its tickets. */
.handling-lead { font-weight: 600; }
.handling-group { display: grid; gap: 6px; min-width: 0; }
.handling-head, .handling-reason > summary { display: grid; grid-template-columns: minmax(0, 1fr) 64px 56px; gap: 12px; align-items: baseline; }
.handling-head { padding: 0 12px 0 34px; color: var(--muted); font-size: 12px; font-weight: 650; }
.handling-head > span + span { text-align: right; }
.handling-list { display: grid; margin: 0; padding: 0; overflow: hidden; list-style: none; border: 1px solid var(--border); border-radius: var(--radius); }
.handling-list > li { min-width: 0; }
.handling-list > li + li { border-top: 1px solid var(--border); }
.handling-reason > summary { position: relative; min-height: 44px; padding: 11px 12px 11px 34px; list-style: none; cursor: pointer; }
.handling-reason > summary::-webkit-details-marker { display: none; }
.handling-reason > summary::before { content: ""; position: absolute; left: 14px; top: 18px; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); transition: transform 0.15s ease; }
.handling-reason[open] > summary::before { transform: rotate(45deg); }
.handling-reason > summary:hover { background: var(--surface-2); }
.handling-reason > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.handling-label { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.handling-num { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.handling-share { color: var(--muted); font-weight: 600; }
.handling-tickets { display: grid; gap: 8px; min-width: 0; padding: 0 12px 12px; }
.handling-tickets .table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); }
@media (max-width: 767px) {
  .handling-kpis { grid-template-columns: minmax(0, 1fr); }
  .handling-head, .handling-reason > summary { grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; }
  .handling-tickets { padding: 0 8px 8px; }
}

/* ---- Kunskap > Artiklar (kunskap-articles.js) and Webbchatt > Kunskap (webbchatt-kunskap.js) ---- */
.article-editor { display: grid; gap: 20px; min-width: 0; }
.article-layout { display: grid; gap: 20px; align-items: start; min-width: 0; }
@media (min-width: 1100px) {
  .article-layout { grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); }
}
.article-layout > * { min-width: 0; }
.article-side { display: grid; gap: 20px; min-width: 0; }
.article-form { gap: 18px; }
.article-form > *, .article-form .field { min-width: 0; }
.article-form .field-hint { overflow-wrap: anywhere; }
.article-body { min-height: 260px; font-family: inherit; line-height: 1.5; resize: vertical; }
.article-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.article-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.article-side-title { font-size: 15px; font-weight: 650; margin: 0 0 10px; }
.article-preview, .article-history { display: grid; gap: 10px; min-width: 0; }
.field-count { justify-self: end; font-size: 12px; color: var(--muted); }
.field-error { margin: 0; font-size: 13px; color: var(--danger); font-weight: 550; }
.chunk-preview-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.chunk-preview { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.chunk-preview-head { margin: 0; font-size: 12.5px; font-weight: 650; color: var(--muted); overflow-wrap: anywhere; }
.chunk-preview-text { margin: 0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.history-item:first-child { border-top: 0; }
.chatkb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.chatkb-left { margin: 0; padding: 12px 20px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); }
.chatkb-addresses { list-style: none; margin: 0; padding: 0; }
.chatkb-address { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; padding: 14px 20px; border-top: 1px solid var(--border); }
.chatkb-address:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.chatkb-address-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.chatkb-address-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.chatkb-url { overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .article-actions .btn, .chatkb-actions .btn { flex: 1 1 auto; justify-content: center; }
  .history-item { align-items: flex-start; }
}

/* ---- Webbchatt: the agent editor's sites, Översikt, Testa and Utseende ---- */
/* A long option (a ticket agent named with its version) must never widen the editor past a phone screen. */
.editor-sections, .editor-section-body { grid-template-columns: minmax(0, 1fr); }
.editor-section { min-width: 0; }
.tab-panel { grid-template-columns: minmax(0, 1fr); }
.intent-key { min-width: 0; }
.site-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.check-ok { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ok); font-weight: 550; }
.check-ok .icon { width: 18px; height: 18px; }
.widget-host { display: block; min-width: 0; }
.testa { display: grid; gap: 16px; min-width: 0; }
.testa-controls { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.testa-fields { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.testa-fields .field { min-width: 180px; }
.testa-grid { display: grid; gap: 20px; align-items: start; min-width: 0; }
@media (min-width: 1100px) {
  .testa-grid { grid-template-columns: auto minmax(0, 1fr); }
  .testa-chat { position: sticky; top: 16px; }
}
.testa-chat { min-width: 0; }
.testa-panel { width: var(--testa-panel-width, 380px); max-width: 100%; height: var(--testa-panel-height, 600px); max-height: calc(100vh - 140px); min-height: 460px; }
.testa-drawer { min-width: 0; }
.testa-drawer-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.testa-total { margin: 0; font-weight: 650; }
.testa-turns { display: grid; gap: 10px; padding: 12px; }
.testa-turn { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.testa-turn[open] { background: var(--surface-2); }
.testa-turn-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 14px; cursor: pointer; list-style: none; min-height: 44px; }
.testa-turn-summary::-webkit-details-marker { display: none; }
.testa-turn-n { font-weight: 650; }
.testa-turn-meta { margin-left: auto; color: var(--muted); font-size: 13px; }
.testa-turn-body { display: grid; gap: 14px; padding: 4px 14px 14px; min-width: 0; }
.testa-sec { display: grid; gap: 6px; min-width: 0; }
.testa-sec-title { margin: 0; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.testa-sec p { margin: 0; }
.testa-quote { padding: 8px 12px; border-left: 3px solid var(--brand); background: var(--surface); border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.testa-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.testa-hit { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
.testa-hit-head { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.testa-hit-text { margin: 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

.ut { display: grid; gap: 16px; min-width: 0; }
.ut-pickers { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; }
.ut-picker { display: grid; gap: 6px; }
.ut-grid { display: grid; gap: 20px; align-items: start; min-width: 0; }
@media (min-width: 1100px) {
  .ut-grid { grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr); }
  .ut-preview { position: sticky; top: 16px; }
}
.ut-form, .ut-preview { min-width: 0; }
.ut-color-row { display: grid; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.ut-color-row:last-child { border-bottom: 0; padding-bottom: 0; }
.ut-color-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ut-color { width: 48px; height: 44px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.ut-color:disabled { opacity: 0.5; cursor: default; }
.ut-hex { width: 110px; }
.ut-contrast { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 13px; }
.ut-contrast .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.ut-contrast.is-ok { color: var(--ok); }
.ut-contrast.is-bad { color: var(--danger); font-weight: 550; }
.ut-group { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.ut-group[open] { background: var(--surface-2); }
.ut-group-summary { padding: 12px 14px; min-height: 44px; font-weight: 650; cursor: pointer; }
.ut-group-body { display: grid; gap: 12px; padding: 0 14px 14px; }
.ut-preview-head { margin-bottom: 10px; }
.ut-mock { position: relative; height: max(560px, var(--ut-mock-height, 720px)); overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #FFFFFF; }
.ut-mock-bar { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; background: #EDEDF1; border-bottom: 1px solid #D5D5DE; }
.ut-mock-dot { width: 10px; height: 10px; border-radius: 50%; background: #B9B9C6; }
.ut-mock-url { font: 12px var(--mono); color: #3D3D4D; }
.ut-mock-page { display: grid; gap: 12px; padding: 24px 20px; }
.ut-mock-title { width: 55%; height: 18px; border-radius: 4px; background: #D9D9E2; }
.ut-mock-line { height: 10px; border-radius: 4px; background: #E8E8EE; }
.ut-mock-line-0 { width: 92%; }
.ut-mock-line-1 { width: 78%; }
.ut-mock-line-2 { width: 64%; }
.ut-host { position: absolute; inset: 36px 0 0 0; }
@media (max-width: 767px) {
  .site-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .site-row .input { grid-column: 1 / -1; }
  .testa-fields .field { min-width: 0; flex: 1 1 140px; }
  .testa-panel { height: min(var(--testa-panel-height, 600px), calc(100vh - 120px)); }
}

/* Webbchatt, release tests: a version's release status (the deploy dialog, Översikt, Releasetester) and one run's cases. */
.notice-ok { background: var(--ok-soft); }
.notice-ok .icon { color: var(--ok); }
.release-block .gate-list { padding: 4px 0 0; }
.release-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.release-block .link-btn { font-weight: 600; }
.modal-body .release-block { margin-top: 4px; }
.rt-set-body { padding: 0 20px 16px; }
.rt-cases { display: grid; gap: 8px; padding: 0 20px 20px; }
.rt-case-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.rt-turns { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.rt-turn { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
.rt-who { margin: 0; font-size: 13px; font-weight: 650; color: var(--muted); }
.rt-msg { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rt-answer { display: grid; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
@media (max-width: 767px) {
  .rt-cases { padding: 0 16px 16px; }
  .rt-set-body { padding: 0 16px 14px; }
}

/* The manipulation section (hardening B14, pages/manipulation-shared.js): flag chips, the tests toggle, the visitors. */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; }
.chip-warn { background: var(--warn-soft); border-color: transparent; }
.chip-count { font-weight: 650; font-variant-numeric: tabular-nums; }
.switch-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.stack-sm { display: grid; gap: 6px; align-content: start; min-width: 0; }
/* Inställningar, Nödbrytare (hardening B14): the revoke date and its button on one line where there is room. */
.form-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.form-row .field { flex: 1 1 220px; min-width: 0; }
/* Webbchatt, Skydd (pages/webbchatt-skydd.js): grouped limits, the visitor texts and a conversation's turns. */
.guard-group { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 12px; }
.guard-group legend { padding: 0; margin-bottom: 8px; font-weight: 650; font-size: 14px; }
.guard-texts { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 8px 16px; margin: 0; }
.guard-texts dt { color: var(--muted); font-size: 13px; font-weight: 600; }
.guard-texts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.guard-turn { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.guard-turn p { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .guard-texts { grid-template-columns: 1fr; gap: 2px 0; }
  .guard-texts dd { margin-bottom: 8px; }
}
