:root {
  /* ===== Soft gray palette =====
   * Cíl: mezi předchozím light a dark. Jemně šedý canvas (viditelně
   * ne-bílý), karty jsou off-white — světlejší šedá, žádná čistá bílá.
   * Text tmavý a čitelný.
   */
  --canvas: #d4d8e0;          /* page bg — soft gentle gray */
  --canvas-deep: #c2c7d0;     /* edges/dividers */
  --surface: #e2e6ec;          /* card bg — jen mírně světlejší než canvas */
  --surface-alt: #d6dae1;      /* alt rows / inner sections (between canvas & surface) */
  --soft: #cdd1d9;             /* subtle highlights */

  /* ===== Text ===== */
  --ink: #1a2230;              /* primary */
  --ink-2: #3a4660;            /* primary alt */
  --muted: #5a6478;            /* secondary */
  --subtle: #98a0b0;           /* tertiary */
  --on-brand: #ffffff;

  /* ===== Borders ===== */
  --line: #c8ccd4;             /* default */
  --line-strong: #a8aebb;      /* emphasized */
  --line-soft: #d4d8df;        /* subtle separator */

  /* ===== Brand (platform default — CSBot) ===== */
  --brand: #C83676;
  --brand-dark: #a82d63;
  /* Soft variants jsou derived z aktivního --brand pres color-mix.
   * Když KB Sport přepíše --brand inline na <body>, soft varianty se
   * automaticky obarví podle KBS — žádné CSBot pink residue. */
  --brand-soft: color-mix(in srgb, var(--brand) 16%, transparent);
  --brand-softer: color-mix(in srgb, var(--brand) 8%, transparent);

  /* ===== Per-board brandable =====
   * Default header-bg = čistá bílá (topbar je vyhrazené UI, vystupuje
   * proti šedému canvas). Per-board branding přebíjí inline na <body>. */
  --header-bg: #ffffff;
  --button-bg: var(--brand);

  /* ===== Semantic ===== */
  --ok: #16835b;
  --ok-soft: color-mix(in srgb, var(--ok) 14%, transparent);
  --warning: #a66a00;
  --warning-soft: color-mix(in srgb, var(--warning) 16%, transparent);
  --error: #bd2d2d;
  --error-soft: color-mix(in srgb, var(--error) 14%, transparent);
  --expecting: #2f80ed;
  --expecting-soft: color-mix(in srgb, var(--expecting) 14%, transparent);
  --stale: #7d695a;
  --unknown: #697887;

  /* ===== Radius ===== */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* ===== Shadow ===== */
  --shadow-xs: 0 1px 1px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow: 0 2px 4px rgba(15, 23, 42, 0.06), 0 4px 8px -2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 16px -4px rgba(15, 23, 42, 0.14), 0 4px 6px rgba(15, 23, 42, 0.06);

  /* ===== Focus ring color (derived z aktivního button-bg) =====
   * Použij jako: box-shadow: 0 0 0 3px var(--focus-color);
   * Když je tlačítko boardu jiné barvy, focus ring odpovídá. */
  --focus-color: color-mix(in srgb, var(--button-bg) 35%, transparent);

  /* ===== Typography ===== */
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  overflow-x: hidden;
}

button {
  font: inherit;
}

.topbar {
  position: relative;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line-soft);
}

/* Hamburger — viditelný jen pod breakpointem (viz @media 900px níže). */
.topbar__menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.topbar__menu-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.topbar__menu-toggle:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.topbar__brand,
.topbar__user {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__brand {
  color: inherit;
  text-decoration: none;
}

.logo {
  width: 156px;
  height: auto;
  display: block;
}

.topbar__title {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
}

.brand-line {
  height: 3px;
  background: var(--brand);
}

.shell {
  min-height: calc(100vh - 75px);
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0;
}

/* Content inside .shell má max-width pro řízenou šířku obsahu, ale
 * sidebar zůstává fixlý vlevo. Cap ~1640px aby na 1920 viewport zaplnil,
 * ale na 4K+ se neroztáhl do nesmyslna. */
.shell .content {
  max-width: 1640px;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 20px;
}

.sidebar__head,
.content__head,
.toolbar,
.automation-card__top,
.automation-card__footer,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-actions {
  justify-content: flex-end;
  gap: 8px;
}

.sidebar h2,
.content h1,
.automation-card h2 {
  margin: 0;
}

.sidebar h2 {
  font-size: 16px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand);
  cursor: pointer;
}

.icon-button svg,
.primary-button svg,
.quick-menu svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.category-list {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.sidebar-links {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-links a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.sidebar-links a:hover {
  color: var(--brand);
}

.category-item {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.category-item.is-active {
  background: var(--soft);
}

.category-item__mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--category-color);
}

.category-item__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-item__count {
  color: var(--muted);
  font-size: 13px;
}

.content {
  min-width: 0;
  padding: 30px clamp(18px, 4vw, 42px);
}

.content__head {
  align-items: flex-start;
}

.content h1 {
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.1;
}

.content p {
  color: var(--muted);
}

.summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.summary span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  margin: 24px 0;
}

.segmented {
  display: inline-flex;
  max-width: 100%;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow-x: auto;
}

.segmented button {
  white-space: nowrap;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.segmented button.is-active {
  background: var(--button-bg);
  color: #fff;
}

.primary-button,
.detail-button {
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.05s ease;
}

.primary-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: var(--on-brand);
  background: var(--button-bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.10);
  font-size: 14px;
}

.primary-button:hover {
  filter: brightness(0.94);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14);
}

.primary-button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.10);
}

.primary-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-color), 0 1px 2px rgba(15, 23, 42, 0.10);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

.automation-card {
  min-width: 0;
  min-height: 292px;
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-top: 4px solid var(--category-color);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.automation-card:hover {
  box-shadow: var(--shadow-md);
}

.quick-menu {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}

.quick-menu:hover,
.quick-menu.is-open {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-softer);
}

.category-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--category-color);
  background: var(--surface-alt);
}

.category-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 13px;
  background: var(--soft);
  color: var(--health-color);
}

.health-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.automation-card h2 {
  margin-top: 16px;
  font-size: 19px;
  line-height: 1.25;
}

.meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.description {
  overflow-wrap: anywhere;
  min-height: 44px;
  margin: 14px 0 16px;
  line-height: 1.45;
}

.metrics {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(80px, 1fr);
  gap: 10px;
  margin: 0;
  align-items: stretch;
}

.metric {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metrics dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.metrics dd {
  margin: 4px 0 0;
  font-weight: 600;
  color: var(--ink);
}

/* Last item — name as primary, visible fields uprostřed, outcome+time pod */
.metric--item dd {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric__visible {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.metric__visible:empty {
  display: none;
}

.metric__visible li {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.metric__outcome {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--unknown);
}

.metric__outcome[data-outcome="ok"]      { background: var(--ok); }
.metric__outcome[data-outcome="warning"] { background: var(--warning); }
.metric__outcome[data-outcome="error"]   { background: var(--error); }
.metric__outcome[data-outcome="running"] { background: var(--expecting); }

/* Problémy — quiet (0) je decentní, loud (>0) je výrazný */
.metric--problems dd {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 700;
}

.metric--problems[data-state="quiet"] dd {
  color: var(--subtle);
}

.metric--problems[data-state="loud"] {
  background: var(--error-soft);
  border-color: var(--error);
}

.metric--problems[data-state="loud"] dd {
  color: var(--error);
}

.automation-card__footer {
  margin-top: auto;
  padding-top: 16px;
}

.source {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sekundární neutrální tlačítko (Sdílení / Vyúčtování / Konfigurace /
 * Upravit v hlavičce detailu). Záměrně neutrální — brand barva je
 * vyhrazena pro brand line, topbar a primární akce. */
.detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  color: var(--ink-2);
  background: var(--surface);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  cursor: pointer;
}

.detail-button:hover {
  background: var(--soft);
  border-color: var(--line-strong);
  color: var(--ink);
}

.detail-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-color);
}

.ghost-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--ink-2);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.ghost-button:hover {
  background: var(--soft);
  border-color: var(--line-strong);
  color: var(--ink);
}

.ghost-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-color);
}

.login-screen,
.error-screen {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  background: var(--surface);
}

.login-logo {
  width: 168px;
  display: block;
  margin-bottom: 28px;
}

.login-panel h1,
.error-screen h1 {
  margin: 0;
  font-size: 28px;
}

.google-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 18px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  text-decoration: none;
  font-weight: 700;
}

.form-shell {
  padding: 28px clamp(18px, 4vw, 42px);
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-shell > * { margin: 0; }

.form-panel {
  max-width: 760px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.form-panel h1 {
  margin: 16px 0 20px;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.stack-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.stack-form input:hover:not(:focus),
.stack-form select:hover:not(:focus),
.stack-form textarea:hover:not(:focus) {
  border-color: var(--line-strong);
}

.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus {
  outline: none;
  border-color: var(--button-bg);
  box-shadow: 0 0 0 3px var(--focus-color);
}

.stack-form input::placeholder,
.stack-form textarea::placeholder {
  color: var(--subtle);
}

.stack-form input[type="color"] {
  width: 70px;
  min-height: 42px;
  padding: 4px;
}

.checkbox-label {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 10px !important;
  color: var(--ink) !important;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.form-error {
  border: 1px solid rgba(237, 100, 100, 0.30);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--error);
  background: var(--error-soft);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.50);
  backdrop-filter: blur(2px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(100%, 520px);
  max-height: min(90vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-md), 0 22px 60px rgba(15, 23, 42, 0.20);
}

.modal-panel--wide {
  width: min(100%, 780px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid__full {
  grid-column: 1 / -1;
}

.detail-shell {
  padding: 28px clamp(18px, 4vw, 42px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1640px;
  margin: 0 auto;
}

.detail-shell > section,
.detail-shell > details {
  margin: 0;
}

.detail-shell .items-panel,
.detail-shell .detail-panel,
.detail-shell .tech-panel,
.detail-shell .orphan-panel,
.detail-shell .danger-panel,
.detail-shell .flash {
  margin: 0;
}

.back-link {
  color: var(--brand);
  text-decoration: none;
}

.detail-header,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.detail-header {
  padding: 20px 24px 24px;
}

/* Top row: back-link vlevo, actions vpravo. Akce mají flex-wrap nowrap
 * aby se nezalamovaly (vejdou se na 1920px viewport bez problému,
 * na užším se objeví horizontal scroll fallback). */
.detail-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.detail-header__meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.detail-description {
  color: var(--muted);
}

.detail-header__title,
.detail-header h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
}

.detail-status {
  text-transform: capitalize;
}

.detail-description {
  max-width: 760px;
  line-height: 1.5;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.25fr);
  gap: 16px;
  margin-top: 16px;
}

.detail-panel {
  padding: 20px;
}

.detail-panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
}

.detail-list dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.webhook-panel h3 {
  margin: 18px 0 10px;
  font-size: 14px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.copy-input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-alt);
}

.copy-button {
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
}

.code-block {
  overflow-x: auto;
  margin: 0;
  border-radius: 8px;
  padding: 14px;
  color: #dbe7ef;
  background: #172834;
  font-size: 13px;
  line-height: 1.5;
}

.events-panel {
  margin-top: 16px;
}

.danger-panel {
  margin-top: 16px;
  border-color: var(--brand);
}

.danger-panel p {
  color: var(--muted);
}

.danger-button {
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
}

.danger-button:hover {
  background: #a92f65;
}

.sharing-panel {
  margin-top: 16px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.panel-title-row p {
  margin: -4px 0 0;
  color: var(--muted);
}

/* Filtr „Zobrazit systémové logy" na detailu automatizace (vpravo v hlavičce). */
.system-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.saved-badge {
  align-self: flex-start;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--ok);
  background: var(--ok-soft);
  font-size: 13px;
}

.sharing-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.share-user {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #edf1f4;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-alt);
}

.share-user input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.share-user small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.share-submit {
  justify-self: start;
  margin-top: 6px;
}

.empty-state {
  color: var(--muted);
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #edf1f4;
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-alt);
}

.event-item span,
.event-item time {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 860px) {
  .detail-grid,
  .detail-header__main,
  .event-item {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}

.quick-panel {
  position: absolute;
  top: 56px;
  right: 16px;
  z-index: 2;
  width: min(220px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(23, 40, 52, 0.14);
}

.quick-panel button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.quick-panel button:hover {
  background: var(--surface-alt);
}

/* Form ve quick-panelu (test toggle) nesmí rozbít layout tlačítek. */
.quick-panel__form {
  display: contents;
}

.quick-panel__test-toggle {
  color: #92400e;
  font-weight: 600;
}

.quick-panel__test-toggle:hover {
  background: #fef3c7;
}

/* Testovací režim — decentní chip vedle ikony vlevo nahoře. Skrytý,
   dokud karta nemá class --test (řízeno z app.js dle testMode). */
.test-mode-flag {
  display: none;
  align-items: center;
  margin-right: auto;        /* drží se vlevo u ikony, card-actions zůstanou vpravo */
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 999px;
}

.automation-card--test .test-mode-flag {
  display: inline-flex;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px 18px;
  }

  .category-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .category-item {
    flex: 0 0 auto;
    width: auto;
    min-width: 140px;
  }

  .content__head,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .summary {
    justify-content: flex-start;
  }

  .primary-button {
    justify-content: center;
  }
}

/* Pod 900px: tlačítka topbaru se sbalí do dropdownu pod hamburgerem.
   Hodně položek (switcher + admin/superadmin akce + user + odhlásit) se
   na užší obrazovky nevejde do řádku. */
@media (max-width: 900px) {
  .topbar__menu-toggle {
    display: inline-flex;
  }

  /* .topbar prefix zvyšuje specificitu nad base .topbar__right{display:flex},
     které je v souboru níž — jinak by base pravidlo přebilo a menu by bylo
     pořád rozbalené. */
  .topbar .topbar__right {
    position: absolute;
    top: calc(100% + 1px);
    right: 0;
    left: 0;
    z-index: 60;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px clamp(18px, 4vw, 48px) 18px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--line-soft);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  }

  .topbar .topbar__right.is-open {
    display: flex;
  }

  .topbar__right .ghost-button {
    width: 100%;
    text-align: left;
  }

  .topbar__switcher-label {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .topbar__switcher-label select {
    width: 100%;
  }

  .topbar__user {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
  }

  .topbar__user form {
    margin-left: auto;
  }
}

@media (max-width: 560px) {
  .logo {
    width: 132px;
  }

  .topbar__title {
    white-space: normal;
  }

  .content,
  .detail-shell,
  .form-shell {
    padding: 18px 14px;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .copy-row {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-panel {
    width: 100%;
    max-height: 92vh;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Etapa A: white-label / superadmin */

.logo--client {
  width: auto;
  max-height: 48px;
  max-width: 220px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__switcher {
  margin: 0;
}

.topbar__switcher-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topbar__switcher-label select {
  font: inherit;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.shell--single {
  display: block;
  padding: 24px clamp(18px, 4vw, 48px);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
  vertical-align: middle;
}

.data-table thead th {
  background: var(--surface-alt);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.data-table tbody tr {
  transition: background 0.08s ease;
}

.data-table tbody tr:hover {
  background: var(--surface-alt);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Tabulky s víc sloupci (vyúčtování — ceník event_type, přehled eventů) na
   úzkém displeji vodorovně scrollují uvnitř panelu místo aby rozhodily celou
   stránku. Na desktopu se tabulka vejde → scroll se neobjeví. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 560px) {
  .data-table th,
  .data-table td {
    padding: 8px 10px;
    font-size: 13px;
  }
}

.brand-thumb {
  display: inline-block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--soft);
  vertical-align: middle;
}

.brand-thumb--placeholder {
  display: inline-block;
}

.brand-thumb--inline {
  width: 80px;
  height: auto;
  margin-left: 8px;
  vertical-align: middle;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill--active {
  background: rgba(22, 131, 91, 0.12);
  color: var(--ok);
}

.pill--archived {
  background: rgba(125, 105, 90, 0.14);
  color: var(--stale);
}

.form-note {
  font-size: 13px;
  color: var(--muted);
  background: var(--soft);
  border-left: 3px solid var(--brand);
  padding: 8px 12px;
  border-radius: 6px;
}

.form-hint {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* B.0.4: Superadmin redesign — board cards + form */

.shell--single {
  display: block;
  padding: 28px clamp(18px, 4vw, 48px) 64px;
  max-width: 1200px;
  margin: 0 auto;
}

.cards--boards {
  margin-top: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.board-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 240px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 10px;
  padding: 20px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.board-card:hover {
  box-shadow: 0 6px 20px -8px rgba(23, 40, 52, 0.15);
}

.board-card--archived {
  opacity: 0.55;
}

.board-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.board-card__logo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--soft);
}

.board-card__logo--image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.board-card__logo--initial {
  background: var(--brand);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}

.board-card__name {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.board-card__slug {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.board-card__slug code {
  background: var(--soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.board-card__metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.board-card__metrics div {
  border: 1px solid #edf1f4;
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-alt);
}

.board-card__metrics dt {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.board-card__metrics dd {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.board-card__footer {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.board-card--new {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 240px;
  border: 2px dashed var(--line);
  border-top: 2px dashed var(--line);
  color: var(--muted);
  background: transparent;
}

.board-card--new:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-softer);
}

.board-card__plus {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 300;
  color: var(--brand);
}

.board-card__new-label {
  font-weight: 600;
}

.pill--active {
  background: rgba(22, 131, 91, 0.12);
  color: var(--ok);
}

.pill--archived {
  background: rgba(125, 105, 90, 0.18);
  color: var(--stale);
}

/* Form (wide, sectioned) — pro superadmin/companies/{new,edit} */

.form-wide {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 32px clamp(20px, 4vw, 40px);
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 10px;
  background: var(--surface);
}

.form-wide h1 {
  margin: 14px 0 4px;
  font-size: 26px;
}

.form-wide__sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.form-wide__sub code {
  background: var(--soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.form-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 12px;
}

.form-section {
  border: 0;
  padding: 0;
  margin: 0;
}

.form-section legend {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 12px;
  padding: 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field--narrow {
  max-width: 280px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.form-field input[type="text"],
.form-field input:not([type]),
.form-field input[type="file"],
.form-field textarea,
.form-field select {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-color);
}

.form-field textarea {
  resize: vertical;
  min-height: 80px;
}

.form-field .form-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.form-field .form-hint code {
  background: var(--soft);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.color-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-input input[type="color"] {
  width: 52px;
  height: 40px;
  padding: 2px;
  cursor: pointer;
}

.color-input__hex {
  font-size: 13px;
  color: var(--muted);
  background: var(--soft);
  padding: 4px 8px;
  border-radius: 4px;
}

.logo-uploader {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.logo-uploader__preview {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--soft);
}

.logo-uploader__preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.logo-uploader__placeholder {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

@media (max-width: 540px) {
  .logo-uploader {
    grid-template-columns: 1fr;
  }
  .logo-uploader__preview {
    width: 100%;
    max-width: 200px;
  }
}

/* Etapa B.1: 3-color branding — form preview + reset buttons */

.color-input__reset {
  min-height: 28px;
  width: 28px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  border-radius: 6px;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
}

.color-input__reset:hover {
  color: var(--error);
  border-color: var(--error);
}

.form-row--colors {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}

.brand-preview {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}

.brand-preview__label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.brand-preview__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--header-bg);
}

.brand-preview__topbar .primary-button {
  cursor: default;
  opacity: 1;
}

.brand-preview__title {
  font-weight: 600;
  color: var(--ink);
}

.brand-preview__line {
  height: 4px;
  background: var(--brand);
  border-radius: 0 0 8px 8px;
}

/* Etapa C.0: team UI */

.flash {
  margin-bottom: 18px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
}

.flash--success {
  background: rgba(22, 131, 91, 0.10);
  color: var(--ok);
  border: 1px solid rgba(22, 131, 91, 0.25);
}

.flash--error {
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid rgba(237, 100, 100, 0.30);
}

.invite-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px auto;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.invite-form input,
.invite-form select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  background: var(--surface);
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.inline-form select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  background: var(--surface);
}

.inline-form .hint {
  color: var(--muted);
  font-size: 12px;
}

.danger-text {
  color: var(--error);
}

@media (max-width: 540px) {
  .invite-form {
    grid-template-columns: 1fr;
  }
}

/* B.1: per-category action menu in sidebar */

.category-list {
  position: relative; /* contains dropdown */
}

.category-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}

.category-row .category-item {
  flex: 1;
  min-width: 0;
}

.category-menu {
  position: relative;
  flex-shrink: 0;
}

.category-menu__trigger {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.category-row:hover .category-menu__trigger,
.category-menu__trigger:focus-visible,
.category-menu__trigger[aria-expanded="true"] {
  opacity: 1;
}

.category-menu__trigger:hover {
  background: var(--soft);
  color: var(--ink);
}

.category-menu__trigger svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.category-menu__panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 10;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px -8px rgba(23, 40, 52, 0.18);
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.category-menu__panel[hidden] {
  display: none;
}

.category-menu[hidden] {
  display: none;
}

.category-menu__action,
.category-menu__action button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.category-menu__action:hover,
.category-menu__action button:hover {
  background: var(--soft);
}

.category-menu__action[data-action="delete-form"] {
  margin: 0;
  padding: 0;
}

.category-menu__action--danger {
  color: var(--error);
}

.category-menu__action--danger:hover {
  background: var(--error-soft) !important;
}

/* C.1: config editor textarea */

.form-panel--wide {
  max-width: 960px;
}

.config-textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  color: var(--ink);
  resize: vertical;
  min-height: 320px;
  tab-size: 2;
}

.config-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-color);
  background: var(--surface);
}

/* D.1: Item layer cards */

.items-panel {
  margin-top: 16px;
}

.item-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.item-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--unknown);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.item-card:hover {
  box-shadow: var(--shadow-sm);
}

.item-card[open] {
  box-shadow: var(--shadow-sm);
}

.item-card--ok      { border-left-color: var(--ok); }
.item-card--warning { border-left-color: var(--warning); }
.item-card--error   { border-left-color: var(--error); }
.item-card--running { border-left-color: var(--expecting); }
.item-card--neutral { border-left-color: var(--unknown); }

.item-card__head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.outcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
}

.outcome-badge__icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.outcome-badge--ok      { background: var(--ok-soft);        color: var(--ok); }
.outcome-badge--ok .outcome-badge__icon       { background: var(--ok); }

.outcome-badge--warning { background: var(--warning-soft);   color: var(--warning); }
.outcome-badge--warning .outcome-badge__icon  { background: var(--warning); }

.outcome-badge--error   { background: var(--error-soft);     color: var(--error); }
.outcome-badge--error .outcome-badge__icon    { background: var(--error); }

.outcome-badge--running { background: var(--expecting-soft); color: var(--expecting); }
.outcome-badge--running .outcome-badge__icon  { background: var(--expecting); }

.item-card__summary {
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.item-card__summary::-webkit-details-marker {
  display: none;
}

.item-card__summary::before {
  content: "›";
  display: inline-block;
  width: 14px;
  margin-right: 6px;
  color: var(--subtle);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.12s ease, color 0.12s ease;
}

.item-card:hover .item-card__summary::before {
  color: var(--muted);
}

.item-card[open] .item-card__summary::before {
  transform: rotate(90deg);
  color: var(--ink);
}

.item-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-card__name {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.item-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--soft);
  color: var(--muted);
  white-space: nowrap;
}

.item-status--ok      { background: var(--ok-soft); color: var(--ok); }
.item-status--error   { background: var(--error-soft); color: var(--error); }
.item-status--warning { background: var(--warning-soft); color: var(--warning); }
.item-status--running { background: var(--expecting-soft); color: var(--expecting); }
.item-status--neutral { background: var(--soft); color: var(--muted); }

.item-card__fields {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 6px;
  margin: 14px 0 16px 20px;
  padding: 12px 16px;
  background: var(--surface-alt);
  border-radius: var(--radius);
}

.item-card__fields dt {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  align-self: center;
}

.item-card__fields dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  overflow-wrap: anywhere;
  align-self: center;
}

@media (max-width: 540px) {
  .item-card__fields {
    grid-template-columns: 1fr;
    row-gap: 10px;
    margin-left: 0;
  }
  .item-card__fields dt {
    margin-bottom: -4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
}

.item-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-left: 20px;
  font-size: 12px;
  color: var(--muted);
}

.item-card__footer > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.item-card__id code {
  background: var(--soft);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--ink-2);
}

.item-events {
  list-style: none;
  margin: 0;
  padding: 12px 16px 14px 20px;
  border-top: 1px dashed var(--line);
  background: var(--surface-alt);
}

.item-event {
  display: grid;
  grid-template-columns: 100px 90px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 4px 0;
  font-size: 13px;
  line-height: 1.4;
}

.item-event time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.item-event__type {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.item-event__message {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.item-event--success .item-event__type { color: var(--ok); }
.item-event--error .item-event__type, .item-event--critical .item-event__type { color: var(--error); }
.item-event--warning .item-event__type { color: var(--warning); }

.orphan-panel {
  margin-top: 16px;
  opacity: 0.85;
}

.orphan-panel summary {
  cursor: pointer;
  list-style: none;
}

.orphan-panel summary::-webkit-details-marker {
  display: none;
}

/* D.2: Vyuctovani */

.month-nav {
  display: flex;
  gap: 8px;
}

.statement-block {
  margin-top: 16px;
}

.statement-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.statement-block__head h2 {
  margin: 0;
}

.statement-subtotal td {
  border-top: 2px solid var(--line);
  padding-top: 10px;
}

.statement-totals {
  margin-top: 24px;
  border-top: 4px solid var(--brand);
}

.statement-grand td {
  font-size: 18px;
  padding: 16px 16px !important;
  background: var(--soft);
}

/* Centrovaný obsahový sloupec přiměřené šířky, panely vyplní celou šířku
   (přebíjí .form-panel max-width 760px, kvůli kterému byly stránky úzké a
   zarovnané vlevo). .shell--single dodává margin:0 auto → vycentrováno.
   Používá vyúčtování i tým boardu. */
.shell--col {
  max-width: 1040px;
}

.shell--col .form-panel {
  max-width: none;
}

/* D.3: TEST badge */

.test-badge {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid rgba(224, 165, 72, 0.40);
  vertical-align: middle;
}

.item-card--test {
  background: linear-gradient(to right, #fffbeb 0%, #ffffff 30%);
  border-style: dashed;
}

.item-card--test .item-card__name {
  color: var(--muted);
}

/* D.4: per-event raw JSON view for devs/testers (board admin only) */

/* Přebít .item-event grid layout — když má položka <details> dovnitř,
 * grid by jí zúžil na 100px sloupec a text by se zalomil po písmenku.
 * Layout dáme až vnitřnímu <summary>. */
.item-event--expandable {
  display: block;
}

.item-event--expandable .event-raw-wrap {
  display: block;
}

.item-event--expandable .item-event__row {
  display: grid;
  grid-template-columns: 100px 90px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}

.item-event--expandable .item-event__row::-webkit-details-marker {
  display: none;
}

.event-raw-toggle {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  background: var(--surface);
  opacity: 0;
  transition: opacity 0.1s ease;
}

.item-event--expandable:hover .event-raw-toggle,
.event-raw-wrap[open] .event-raw-toggle {
  opacity: 1;
}

.event-raw-wrap[open] .event-raw-toggle {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.event-raw {
  margin: 8px 0 4px 100px;
  padding: 10px 12px;
  background: var(--canvas-deep);
  color: var(--ink);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

@media (max-width: 700px) {
  .item-event--expandable .item-event__row {
    grid-template-columns: auto;
  }
  .event-raw {
    margin-left: 0;
  }
}

/* D.5: tech-panel (Stav + Webhook collapsed) */

.tech-panel {
  margin-top: 16px;
  opacity: 0.95;
}

.tech-panel summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
}

.tech-panel summary::-webkit-details-marker {
  display: none;
}

.tech-panel summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  margin-right: 6px;
  color: var(--muted);
  transition: transform 0.1s ease;
}

.tech-panel[open] summary::before {
  transform: rotate(90deg);
}

.tech-panel summary h2 {
  font-size: 16px;
  margin: 0;
  color: var(--ink);
}

.tech-panel__body {
  padding: 12px 0 4px 20px;
}

.tech-panel__body .detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.tech-panel__body .detail-list dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tech-panel__body .detail-list dd {
  margin: 4px 0 0;
  font-weight: 600;
  font-size: 14px;
}

.tech-panel__body h3 {
  margin: 8px 0 6px;
  font-size: 14px;
}

/* „Načíst další" položky na detailu */
.load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.load-more {
  min-width: 220px;
}

.load-more[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* Detail — akce (Sdílení/Vyúčtování/Pole/Konfigurace/Upravit) na mobilu.
   Base má flex-wrap:nowrap → na úzkých obrazovkách přetékaly. */
@media (max-width: 768px) {
  .detail-header__top {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .detail-actions {
    flex-wrap: wrap;
    white-space: normal;
  }

  .detail-actions .detail-button {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
  }

  .detail-status {
    flex-basis: 100%;
  }
}
