/*
 * Affilmaster Partner — design system (Apple style)
 * Autor: Dex Agent — 2026-04-10
 * Reference: @Claude/Partner Development/design-system-apple (Dex).md
 */

:root {
  /* Neutrály */
  --bg:        #ffffff;
  --surface:   #ffffff;
  --surface-2: #fafafa;
  --border:    rgba(0, 0, 0, 0.08);
  --border-2:  rgba(0, 0, 0, 0.12);

  --text:      #1d1d1f;
  --text-2:    #6e6e73;
  --text-3:    #86868b;

  /* Akcenty */
  --accent:        #0071e3;
  --accent-hover:  #0077ed;
  --accent-light:  rgba(0, 113, 227, 0.08);

  --green:  #34c759;
  --red:    #ff3b30;
  --orange: #ff9500;
  --purple: #af52de;
  --teal:   #5ac8fa;
  --pink:   #ff2d55;
  --indigo: #5856d6;

  /* Affilmaster brand purple — z loga (tmavá indigo-fialová) */
  --brand-purple:        #5b3f96;
  --brand-purple-light:  rgba(91, 63, 150, 0.09); /* ~ #eeeafa na bílé */
  --brand-purple-border: rgba(91, 63, 150, 0.30);
  --brand-purple-text:   #4a3280;

  /* Rádiusy a stíny */
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow:    0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

/* Scrollbar gutter — zabrání jitteringu loga/menu při přepnutí mezi
   stránkami s různou délkou obsahu. Browser rezervuje místo pro
   scrollbar i když obsah fit, takže viewport width zůstává konstantní. */
html {
  scrollbar-gutter: stable;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
input { font-family: inherit; }

/* ========== TOPBAR ========== */

.topbar {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
}
.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--border-2);
  flex-shrink: 0;
}
.partner-brand {
  display: flex;
  align-items: center;
  height: 30px;
}
.partner-brand-name {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.partner-brand[hidden] { display: none; }

/* Admin impersonation badge — oranžový "admin view" vedle názvu partnera
   s × tlačítkem pro návrat na výchozí scope. Zobrazuje se jen adminům
   kteří si explicitně přepnuli scope přes /admin/partners. */
.impersonation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 9px;
  background: transparent;
  color: #b86800;
  border: 1px solid rgba(255, 149, 0, 0.35);
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
}
.impersonation-badge-text {
  padding-right: 2px;
}
.impersonation-badge-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: #b86800;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.impersonation-badge-close:hover {
  background: rgba(255, 149, 0, 0.25);
  color: #8a4e00;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logo-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(88, 86, 214, 0.25);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo-text span {
  color: var(--text-3);
  font-weight: 500;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.topnav a {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.topnav a:hover { color: var(--text); }
.topnav a.active {
  color: var(--brand-purple, #5b3f96);
  background: transparent;
  font-weight: 600;
}
.topnav a svg {
  flex-shrink: 0;
  opacity: 0.5;
  width: 18px;
  height: 18px;
}
.topnav a.active svg {
  opacity: 1;
  color: var(--brand-purple, #5b3f96);
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 7px 14px;
  width: 220px;
  color: var(--text-2);
}
.search-box svg { flex-shrink: 0; }
.search-box input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.search-box input::placeholder { color: var(--text-3); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.lang-indicator {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-3);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}
.lang-indicator:hover { color: var(--text); }
/* Svislítka v user-chip */
.user-chip-divider {
  width: 1px;
  height: 16px;
  background: var(--border-2, #d1d1d6);
  flex-shrink: 0;
}
.user-chip-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  color: var(--text-2);
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}
.user-menu-btn:hover {
  color: var(--red);
  background: rgba(255, 59, 48, 0.08);
}
.user-menu-btn.icon-settings:hover {
  color: var(--text);
  background: transparent;
}
.user-menu-btn.icon-settings.active {
  color: var(--text-3);
  background: transparent;
}

/* ========== CONTAINER ========== */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 36px 32px 60px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 20px;
  flex-wrap: wrap;
}
.page-head-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.page-breadcrumb {
  font-size: 0.76rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  margin: 0;
  color: var(--text);
}
.page-subtitle {
  font-size: 0.92rem;
  color: var(--text-3);
  margin: 0;
  font-weight: 500;
}

/* --- Admin sub-nav --- */
.admin-subnav {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: fit-content;
}
.admin-subnav a {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.admin-subnav a:hover { color: var(--text); }
.admin-subnav a.active {
  color: white;
  background: var(--text);
}

/* --- Compact primary button (for toolbar) --- */
.btn-compact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 0.85rem;
  margin: 0;
}

/* --- Partner thumbnail in table --- */
.partner-thumb {
  width: 72px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: transparent;
  padding: 4px;
  border: 1px solid var(--border);
  padding: 4px;
}
.partner-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 0.8rem;
}

/* --- Country badge (CZ / SK) v tabulce partnerů --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  pointer-events: none;
  user-select: none;
  background: transparent;
}
.badge-cz { color: #0071e3; border: 1px solid rgba(0, 113, 227, 0.35); }
.badge-sk { color: #b86800; border: 1px solid rgba(255, 149, 0, 0.35); }
.badge-ok { color: #1b8a3a; border: 1px solid rgba(52, 199, 89, 0.35); }
.badge-warn { color: #b86800; border: 1px solid rgba(255, 149, 0, 0.35); }
.badge-err { color: #c82b23; border: 1px solid rgba(255, 59, 48, 0.35); }
.badge-exclusive { color: #5b3f96; border: 1px solid rgba(91, 63, 150, 0.35); background: rgba(91, 63, 150, 0.06); font-weight: 600; }
.badge-non-exclusive { color: #6e6e73; border: 1px solid rgba(110, 110, 115, 0.35); }

/* Sync progress bar (admin sync page) */
.sync-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
  min-width: 100px;
  display: inline-block;
  vertical-align: middle;
}
.sync-bar-fill {
  height: 100%;
  background: var(--accent, #0071e3);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.sync-bar-complete {
  background: #34c759;
}
.sync-bar-error {
  background: #ff3b30;
}
.sync-bar-indeterminate {
  width: 40%;
  animation: sync-indeterminate 1.5s ease-in-out infinite;
}
@keyframes sync-indeterminate {
  0% { margin-left: 0; width: 30%; }
  50% { margin-left: 40%; width: 40%; }
  100% { margin-left: 0; width: 30%; }
}
.sync-pct {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-left: 6px;
  vertical-align: middle;
}
/* Admin data page — unified grid */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
/* Hero karta — zabere 3 sloupce ale stejná výška jako partnerské */
.data-card-hero {
  grid-column: span 3;
}
.data-main-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.data-main-icon {
  color: var(--text-3);
  flex-shrink: 0;
}
.data-main-info { flex: 1; }
.data-main-value {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}
.data-main-label {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.data-main-pct {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-2);
}
/* Shared progress bar */
.data-bar {
  height: 5px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2.5px;
  overflow: hidden;
}
.data-bar-fill {
  height: 100%;
  background: var(--brand-purple, #5b3f96);
  border-radius: inherit;
  transition: width 0.5s ease;
}
.data-bar-fill.warn { background: #ff9500; }
.data-bar-fill.critical { background: #ff3b30; }
/* Partner card extras */
.data-partner-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.data-partner-logo {
  width: 28px;
  height: 16px;
  object-fit: contain;
  border-radius: 3px;
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .data-grid { grid-template-columns: 1fr 1fr; }
  .data-card-hero { grid-column: span 2; }
}

/* Action cards (admin /actions page) */
.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.action-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.action-card-icon {
  color: var(--text-3);
  flex-shrink: 0;
}
.action-card-info { flex: 1; }
.action-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.action-card-desc {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 2px;
}
.action-card-meta {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.action-card-logs {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.action-log-entry {
  font-size: 0.72rem;
  color: var(--text-3);
  padding: 3px 0;
  font-family: 'SF Mono', Monaco, monospace;
}
.action-log-entry.error { color: var(--red); }
.action-log-entry.warning { color: #b86800; }

/* Action detail modal */
.action-detail-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.action-detail-last {
  font-size: 0.82rem;
  color: var(--text-3);
}
.action-detail-msg {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 16px;
}
.action-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin: 20px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.action-runs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.action-run-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
}
.action-run-time {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  min-width: 130px;
}
.action-run-msg {
  color: var(--text-2);
  flex: 1;
}
.action-log-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 400px;
  overflow-y: auto;
}
.action-log-row {
  font-size: 0.72rem;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  color: var(--text-2);
  padding: 3px 0;
  line-height: 1.4;
}
.action-log-row.error { color: var(--red); }
.action-log-row.warning { color: #b86800; }
.action-log-time {
  color: var(--text-3);
  margin-right: 6px;
}

/* Dashboard notification pills (page-head) */
.dash-notif {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.dash-notif[hidden] { display: none; }
.dash-notif-overdue {
  background: transparent;
  color: #c82b23;
  border: 1px solid rgba(255, 59, 48, 0.3);
}
.dash-notif-overdue:hover { background: rgba(255, 59, 48, 0.05); }
.dash-notif-request {
  background: transparent;
  color: #5b3f96;
  border: 1px solid rgba(91, 63, 150, 0.3);
}
.dash-notif-request:hover { background: rgba(91, 63, 150, 0.05); }

.section-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin: 0 0 12px;
}
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); }
th.sort-active { color: var(--accent); }

/* --- Row actions (edit / delete icons) --- */
/* Display flex na <td> rozbíjí table-cell layout (TD přestane být table-cell),
   proto používáme text-align + inline-flex na tlačítka uvnitř. */
.row-actions {
  text-align: right;
  white-space: nowrap;
}
.row-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.row-actions .row-btn + .row-btn {
  margin-left: 4px;
}
.row-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}
.row-btn-danger:hover {
  background: rgba(255, 59, 48, 0.08);
  color: var(--red);
}
.row-btn-view:hover {
  background: rgba(91, 63, 150, 0.10);
  color: var(--brand-purple, #5b3f96);
}

.muted { color: var(--text-3); }

/* --- Modal --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 29, 31, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  animation: modal-in 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-card-lg {
  max-width: 880px;
}
.modal-card-md {
  max-width: 640px;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}
.modal-form {
  padding: 20px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.btn-secondary {
  padding: 11px 18px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(0, 0, 0, 0.08); }

body.modal-open { overflow: hidden; }

/* --- Modal tabs --- */
.modal-tabs {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.modal-tab {
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.modal-tab:hover:not(:disabled) { color: var(--text); }
.modal-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.modal-tab:disabled {
  color: var(--text-3);
  cursor: not-allowed;
  opacity: 0.5;
}
.modal-tab-hint {
  padding: 10px 24px 0;
  font-size: 0.8rem;
  color: var(--text-3);
  font-style: italic;
}
.modal-tab-hint[hidden] { display: none; }

.modal-tab-content {
  padding: 6px 0 0;
}
.modal-tab-content[hidden] { display: none; }
.modal-tab-content .modal-form { padding-top: 16px; }

.tab-intro {
  padding: 20px 24px 4px;
  font-size: 0.88rem;
  color: var(--text-2);
}

.inline-form {
  padding: 14px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inline-form-actions {
  display: flex;
  justify-content: flex-end;
}

.list-wrap {
  padding: 0 24px 22px;
  max-height: 360px;
  overflow-y: auto;
}

.table.table-sm {
  font-size: 0.82rem;
}
.table.table-sm thead th {
  padding: 8px 10px;
  font-size: 0.72rem;
}
.table.table-sm tbody td {
  padding: 10px 10px;
}

.placeholder-box {
  margin: 24px;
  padding: 40px 24px;
  text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  color: var(--text-3);
}
.placeholder-box svg { color: var(--text-3); margin-bottom: 10px; }
.placeholder-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
}
.placeholder-sub {
  font-size: 0.85rem;
  color: var(--text-2);
  margin: 0;
  max-width: 380px;
  margin: 0 auto;
}

/* --- DB size cell --- */
.db-size {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-size: 0.82rem;
}

/* --- Select (admin user form) --- */
.field select {
  padding: 12px 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.92rem;
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  transition: border 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.field select:focus {
  border-color: var(--accent);
  background-color: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-light);
}

/* --- Permissions tree --- */
.perm-tree {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 4px 0;
  max-height: 420px;
  overflow-y: auto;
}
.perm-loading, .perm-empty, .perm-error {
  padding: 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.85rem;
}
.perm-error { color: var(--red); }

.perm-section {
  padding: 6px 0;
}
.perm-section + .perm-section {
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.perm-section-head {
  padding: 10px 16px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.perm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  gap: 14px;
  cursor: pointer;
}
.perm-row:hover { background: rgba(0, 0, 0, 0.03); }
.perm-label {
  font-size: 0.85rem;
  color: var(--text);
}
.perm-checks {
  display: flex;
  gap: 14px;
}
.perm-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-2);
  cursor: pointer;
}
.perm-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.perm-partner {
  margin: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.perm-partner summary {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}
.perm-partner summary::-webkit-details-marker { display: none; }
.perm-partner summary::before {
  content: '▸';
  color: var(--text-3);
  font-size: 0.75rem;
  transition: transform 0.15s;
}
.perm-partner[open] summary::before {
  transform: rotate(90deg);
}
.perm-partner summary strong { flex: 1; }
.perm-partner .perm-pages {
  border-top: 1px solid var(--border);
  padding: 4px 0;
}
.perm-quick {
  font-size: 0.72rem;
  color: var(--accent);
  background: transparent;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
}
.perm-quick:hover { background: var(--accent-light); }

.perm-hint {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.5;
}
.perm-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: -apple-system, 'SF Mono', Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
}

/* --- Audit log --- */
.audit-time {
  font-size: 0.78rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table code {
  font-family: -apple-system, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text-2);
}

/* --- Link button (inline text action) --- */
.link-btn {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
  background: transparent;
  padding: 0 0 0 6px;
  margin-left: 6px;
}
.link-btn:hover { text-decoration: underline; }

/* --- Campaigns toolbar (filter + toggle) --- */
.campaigns-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px 0;
}
.search-input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
}
.search-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-light);
}
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.filter-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* --- Campaigns counter --- */
.campaigns-counter {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 24px 0;
  font-size: 0.82rem;
  color: var(--text-2);
}
.campaigns-counter[hidden] { display: none; }
.campaigns-counter-paired {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.campaigns-counter-sep {
  color: var(--text-3);
}
.campaigns-counter-label {
  margin-left: 4px;
}

/* --- Campaigns list (rows with checkbox) --- */
.campaigns-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}
.campaign-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  position: relative;
}
.campaign-row:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
}
.campaign-row.paired {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: inset 4px 0 0 var(--accent);
  padding-left: 14px;
}
.campaign-row.paired:hover {
  background: rgba(0, 113, 227, 0.12);
}
.campaign-row.paired .campaign-name {
  color: var(--accent);
}
.campaign-row.is-updating {
  opacity: 0.6;
  pointer-events: none;
}
.campaign-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.campaign-paired-badge {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.campaign-row.paired .campaign-paired-badge {
  display: inline-flex;
}
.campaign-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.campaign-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.campaign-meta {
  font-size: 0.74rem;
  color: var(--text-3);
  display: flex;
  gap: 10px;
}
.campaign-meta code {
  font-family: -apple-system, 'SF Mono', Menlo, monospace;
  font-size: 0.72rem;
  color: var(--text-2);
}
.campaign-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.campaign-status.active {
  background: rgba(52, 199, 89, 0.12);
  color: var(--green);
}

/* --- UOL status card --- */
.uol-status {
  padding: 24px;
}
.uol-status-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.uol-status-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.uol-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}
.uol-badge.paired { background: rgba(52, 199, 89, 0.12); color: var(--green); }
.uol-badge.pending { background: rgba(255, 149, 0, 0.12); color: var(--orange); }
.uol-badge.no-ic { background: rgba(255, 59, 48, 0.12); color: var(--red); }
.uol-status-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.uol-status-sub {
  font-size: 0.82rem;
  color: var(--text-2);
  margin: 2px 0 0;
}
.uol-status-text { flex: 1; }
.uol-sources {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}
.uol-sync-message {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.uol-sync-message.success {
  background: rgba(52, 199, 89, 0.1);
  color: var(--green);
  border: 1px solid rgba(52, 199, 89, 0.2);
}
.uol-sync-message.error {
  background: rgba(255, 59, 48, 0.08);
  color: var(--red);
  border: 1px solid rgba(255, 59, 48, 0.2);
}
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: var(--accent, #0071e3);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 0.88rem;
}
.loading-inline .spin {
  color: var(--text-3);
  flex-shrink: 0;
}

/* --- Vyúčtování --- */
.invoices-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
.toolbar-select:hover { border-color: var(--border-2); }
.toolbar-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

/* --- Affiliates --- */
.aff-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Jednotný kompaktní info pruh (období + sync info + refresh) */
.info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.info-bar-text {
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}
.info-bar-text strong {
  color: var(--text);
  font-weight: 600;
}
.info-bar-text .dot {
  color: var(--text-3);
  opacity: 0.5;
}
.info-bar-text .test-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  background: rgba(255, 149, 0, 0.12);
  color: var(--orange);
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 4px;
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  background: transparent;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.icon-btn-sm:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.icon-btn-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.test-row {
  opacity: 0.88;
}
.test-row td:first-child {
  border-left: 2px solid var(--orange);
}

.affiliates-meta {
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-3);
}
.aff-cell-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.aff-cell-compact .aff-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.88rem;
}
.aff-cell-compact .aff-meta {
  font-size: 0.72rem;
  color: var(--text-3);
}
.aff-cell-compact .aff-meta code {
  font-family: -apple-system, 'SF Mono', Menlo, monospace;
  font-size: 0.7rem;
  background: transparent;
  color: var(--text-2);
  padding: 0;
}
.affiliates-table .num.muted { color: var(--text-3); }

/* --- Partner cell: název + NGR ROI progress bar + Deposit ROI text --- */
.aff-partner-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
}
.aff-partner-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.88rem;
  margin-bottom: 5px; /* prostor nad progress barem — jinak moc nahnacano */
  line-height: 1.25;
}

/* NGR ROI — primární, s jemným progress barem (maximálně kompaktní).
   Individual margins místo gap, aby mezera „NGR ROI ↔ 300%" byla těsná
   a „bar ↔ NGR ROI" byla delší. */
.aff-roi-row {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 0.66rem;
  color: var(--text-3);
  line-height: 1.2;
}
.aff-roi-bar {
  flex: 1;
  height: 2px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 1.5px;
  overflow: hidden;
  min-width: 35px;
  max-width: 65px;
  margin-right: 7px;
}
.aff-roi-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
  opacity: 0.85;
}
.aff-roi-fill.negative   { background: #ff3b30; }
.aff-roi-fill.break-even { background: #ff9500; }
.aff-roi-fill.healthy    { background: #34c759; }
.aff-roi-fill.excellent  { background: #2ca244; }
.aff-roi-fill.unknown    { background: rgba(0, 0, 0, 0.12); }

.aff-roi-label {
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.01em;
  white-space: nowrap;
  margin-right: 4px; /* malá mezera před hodnotou (žádná mezera → hodnota by lepila k labelu) */
}
.aff-roi-value {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-2);
  min-width: 0; /* žádný implicitní prostor — hodnota je hned za labelem */
  text-align: left;
}
.aff-roi-value.positive { color: #1b8a3a; }
.aff-roi-value.negative { color: #c82b23; }

/* Deposit ROI — sekundární, jen text, menší font */
.aff-deposit-roi {
  font-size: 0.65rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.aff-deposit-roi .label {
  color: var(--text-3);
  opacity: 0.8;
}
.aff-deposit-roi .value {
  font-weight: 500;
  color: var(--text-2);
}
.aff-deposit-roi .value.positive { color: #1b8a3a; opacity: 0.85; }
.aff-deposit-roi .value.negative { color: #c82b23; opacity: 0.85; }

/* ========================================================= */
/* BOTTOM DRAWER — detail affiliate                            */
/* ========================================================= */

/* Centrovaný modal (refactored z bottom-drawer → centered) */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.drawer[hidden] { display: none !important; }

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  animation: drawer-fade-in 0.2s ease forwards;
  pointer-events: auto;
  cursor: pointer;
}

.drawer-panel {
  position: relative;
  width: min(1040px, calc(100vw - 64px));
  min-height: min(700px, calc(100vh - 80px));
  max-height: calc(100vh - 48px);
  background: var(--surface, #fff);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  opacity: 0;
  animation: drawer-scale-in 0.22s ease forwards;
  pointer-events: auto;
  overflow: hidden;
}

@keyframes drawer-fade-in {
  to { opacity: 1; }
}
@keyframes drawer-scale-in {
  to { transform: scale(1); opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 32px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-head-left {
  flex: 1;
  min-width: 0;
}
.drawer-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
  word-break: break-word;
}
.drawer-subtitle {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 3px;
}
.drawer-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-2);
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.drawer-close:hover {
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  color: var(--text);
}

.drawer-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
/* "Celkem období" button — větší zvýraznění */
.period-picker .period-all {
  font-weight: 600;
  margin-left: 6px;
  position: relative;
}
.period-picker .period-all::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 20%;
  bottom: 20%;
  width: 1px;
  background: var(--border);
}

.drawer-body {
  padding: 28px 32px 36px;
  overflow-y: auto;
  flex: 1;
  position: relative;
  min-height: 360px; /* pevná minimální výška — zabraňuje skákání drawer při period switch */
}
.drawer-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 40px 0;
  justify-content: center;
  color: var(--text-2);
  font-size: 0.9rem;
}
.drawer-loading[hidden],
.drawer-content[hidden] {
  display: none !important;
}

/* Soft refresh overlay — při změně období necháváme content vidět, jen ho
   přikryjeme semi-transparentním loaderem, aby drawer neskákal (nejdřív
   content schová, výška se zmenší, pak content vrátí). */
.drawer-body.is-refreshing .drawer-content {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.drawer-body .refresh-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.drawer-body.is-refreshing .refresh-overlay {
  display: flex;
}
.refresh-overlay-inner {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.drawer-error {
  padding: 14px 18px;
  background: rgba(255, 59, 48, 0.08);
  color: #c82b23;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-top: 16px;
}
.drawer-error[hidden] { display: none; }

/* --- ROI duo (dvě podlouhlé dlaždice s horizontálním progress barem) --- */
.roi-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
.roi-tile {
  background: var(--surface-2, rgba(0, 0, 0, 0.025));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.roi-tile-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.roi-tile-label {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.roi-tile-value {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
}
.roi-tile-value.negative { color: #c82b23; }
.roi-tile-value.positive { color: #1b8a3a; }

.roi-tile-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.roi-tile-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: #34c759;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.3s ease;
}
.roi-tile-fill.negative   { background: #ff3b30; }
.roi-tile-fill.break-even { background: #ff9500; }
.roi-tile-fill.healthy    { background: #34c759; }
.roi-tile-fill.excellent  { background: #2ca244; }
.roi-tile-fill.unknown    { background: rgba(0, 0, 0, 0.12); }

.roi-tile-hint {
  font-size: 0.68rem;
  color: var(--text-3);
  font-style: italic;
  opacity: 0.85;
}

@media (max-width: 640px) {
  .roi-duo { grid-template-columns: 1fr; gap: 10px; }
  .roi-tile-value { font-size: 1.35rem; }
}

/* --- Metric grid (9 dlaždic s metrikami) --- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.metric-card {
  background: var(--surface-2, rgba(0, 0, 0, 0.025));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.metric-card-label {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.metric-card-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.15;
}
.metric-card-hint {
  font-size: 0.7rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.metric-card-value.positive { color: #1b8a3a; }
.metric-card-value.negative { color: #c82b23; }

/* Kompaktnější metric cards uvnitř month-drawer (stránka /vypis) —
   je jich 11 + pod nimi graf, tak ušetříme vertikální prostor. */
#month-drawer .metric-grid {
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
#month-drawer .metric-card {
  padding: 10px 12px 11px;
  gap: 3px;
  min-height: 0;
  border-radius: 10px;
}
#month-drawer .metric-card-label {
  font-size: 0.64rem;
  letter-spacing: 0.05em;
}
#month-drawer .metric-card-value {
  font-size: 1rem;
  line-height: 1.15;
}
#month-drawer .metric-card-money .metric-card-value {
  font-size: 0.92rem;
}
#month-drawer .metric-card-roi .metric-card-value {
  font-size: 1.15rem;
}
#month-drawer .metric-card-bar {
  height: 3px;
  border-radius: 1.5px;
  margin-top: 6px;
}
#month-drawer .money-czk {
  font-size: 0.66rem;
  margin-top: 1px;
}

/* ========== DASHBOARD / ========== */

.dash-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 0;
  color: var(--text-2);
  font-size: 0.95rem;
}
.dash-loading[hidden] { display: none !important; }

.dash-content[hidden] { display: none !important; }

/* Grid 4×2 na desktop, responzivní */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 124px;
}
.dash-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.dash-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-3, #86868b);
}

.dash-card-label {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-card-value {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
  margin-top: 2px;
  word-break: break-word;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.dash-card-hint {
  font-size: 0.72rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  margin-top: auto;
  padding-top: 6px;
}
/* Tight varianta — neumisťuje hint na dno karty, drží se přímo pod hodnotou
   (pro Náklady aby text "odměna affiliates vč. FTD" nebyl odsunut dolů) */
.dash-card-hint-tight {
  margin-top: 2px;
  padding-top: 0;
}

/* Inline hint za ratio procentem ("z prokliků", "z registrací") — stejný
   styl jako .dash-card-hint ale v baseline řádku s hodnotou. */
.dash-card-ratio-hint {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Ratio inline za hlavní hodnotou (Reg ratio, FTD ratio) — menší než
   hlavní value ale pořád výrazný, v akcentové barvě */
.dash-card-ratio {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brand-purple, #5b3f96);
  font-variant-numeric: tabular-nums;
}

/* Nebold sub hodnota inline za hlavní (Vklady počet, Požadavky "aktivní") */
.dash-card-sub {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* CZK přepočet pod hlavní EUR hodnotou (Vklady, Náklady) */
.dash-card-czk {
  font-size: 0.78rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  min-height: 1em; /* zachovává layout i když je prázdné (czkOnly mode) */
}
.dash-card-czk:empty::before {
  content: '\00a0';
}

/* Klikatelná karta — používá se na Požadavky (celá karta = <a> na /pozadavky) */
.dash-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.dash-card-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--brand-purple-border, rgba(91, 63, 150, 0.3));
}
.dash-card-link:active {
  transform: translateY(0);
}

/* NGR ROI karta — progress bar hned pod hintem, ne na dně karty
   (margin-top: auto na barě roztahovalo celou NGR kartu a via grid stretch
   i všechny okolní boxy na stejnou výšku) */
.dash-card-roi .dash-card-hint {
  margin-top: 4px;
  padding-top: 0;
  padding-bottom: 4px;
}
.dash-roi-val { font-weight: 600; }
.dash-roi-val.positive { color: #1b8a3a; }
.dash-roi-val.negative { color: #c82b23; }
.dash-roi-bar {
  height: 5px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 2.5px;
  overflow: hidden;
  margin-top: 0;
}
.dash-roi-fill {
  height: 100%;
  width: 0;
  border-radius: 2.5px;
  background: #34c759;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.3s ease;
}
.dash-roi-fill.negative   { background: #ff3b30; }
.dash-roi-fill.break-even { background: #ff9500; }
.dash-roi-fill.healthy    { background: #34c759; }
.dash-roi-fill.excellent  { background: #2ca244; }
.dash-roi-fill.unknown    { background: rgba(0, 0, 0, 0.12); }

/* Chart card na Dashboardu */
.dash-chart-card {
  padding: 18px 20px 20px;
}
.dash-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.chart-wrap-dash {
  position: relative;
  height: 220px;
  width: 100%;
}

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-card-value { font-size: 1.35rem; }
  .chart-wrap-dash { height: 180px; }
}
@media (max-width: 520px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* Chart section — graf po dnech uvnitř drawer (stránka /vypis month detail) */
.chart-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.chart-toolbar {
  display: inline-flex;
  background: transparent;
  border-radius: 0;
  padding: 0;
  gap: 6px;
  gap: 2px;
  margin-bottom: 14px;
}
.chart-toolbar button {
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-3);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.chart-toolbar button:hover { color: var(--text); }
.chart-toolbar button.active,
.chart-toolbar button.active-secondary {
  border-radius: 6px;
  font-weight: 600;
}
}
.chart-wrap {
  position: relative;
  height: 280px;
  width: 100%;
}
@media (max-width: 720px) {
  .chart-wrap { height: 220px; }
  .chart-toolbar button { padding: 6px 10px; font-size: 0.75rem; }
}

/* NGR ROI card — speciální metric-card s progress barem pod hlavní hodnotou.
   Stejná velikost a chování jako ostatní metric-cards ve stejném gridu,
   jen dole přidaný thin progress bar se stejnými bucket barvami jako
   na list page (.aff-roi-fill). */
.metric-card-roi {
  /* Žádné extra styly — dědí z .metric-card */
}
.metric-card-roi .metric-card-value {
  font-size: 1.45rem; /* ROI hodnotu uděláme o něco větší aby byl akcent */
}
.metric-card-bar {
  margin-top: auto;
  height: 4px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 2px;
  overflow: hidden;
}
.metric-card-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: #34c759;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.3s ease;
}
.metric-card-bar-fill.negative   { background: #ff3b30; }
.metric-card-bar-fill.break-even { background: #ff9500; }
.metric-card-bar-fill.healthy    { background: #34c759; }
.metric-card-bar-fill.excellent  { background: #2ca244; }
.metric-card-bar-fill.unknown    { background: rgba(0, 0, 0, 0.12); }

/* --- Detail button v řádku tabulky --- */
.affiliates-table .btn-detail-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-3);
  transition: all 0.12s ease;
}
.affiliates-table .btn-detail-row:hover {
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  color: var(--text);
  border-color: var(--border-strong, var(--border));
}

@media (max-width: 820px) {
  .drawer-panel { max-height: 94vh; border-radius: 14px 14px 0 0; }
  .drawer-panel {
    width: calc(100vw - 16px);
    min-height: auto;
    max-height: calc(100vh - 32px);
    border-radius: 14px;
  }
  .drawer-head, .drawer-toolbar, .drawer-body { padding-left: 16px; padding-right: 16px; }
  .drawer-title { font-size: 1.15rem; }
}

/* --- FTD ratio badge --- */
.ftd-ratio-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(52, 199, 89, 0.12);
  color: #1b8a3a;
  font-variant-numeric: tabular-nums;
}
.ftd-ratio-badge.low  { background: rgba(255, 149, 0, 0.12); color: #8a5800; }
.ftd-ratio-badge.none { background: rgba(0, 0, 0, 0.06); color: var(--text-3); }

/* Orientační CZK přepočet v závorce za EUR hodnotou */
.money-czk {
  display: block;
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  white-space: nowrap;
}

/* Page footer s kurzem a drobnými poznámkami */
.page-footer {
  margin-top: 22px;
  padding: 10px 4px 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: 0.01em;
}
.page-footer[hidden] { display: none; }

.invoices-table .duzp-cell {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.invoices-table .muted-cell {
  color: var(--text-3);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.invoices-table .month-cell {
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
  white-space: nowrap;
}
.invoices-table .month-cell.continued { color: transparent; }
.invoices-table .month-cell.continued::before {
  content: '↳';
  color: var(--text-3);
  font-weight: 400;
}
.invoices-table .invoice-number {
  font-family: -apple-system, 'SF Mono', Menlo, monospace;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}
.invoices-table .amount-cell {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.invoices-table .row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--accent);
  background: transparent;
  text-decoration: none;
  transition: background 0.15s;
}
.invoices-table .row-btn:hover {
  background: var(--accent-light);
}
.uol-source {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.uol-source-name {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}
.uol-source-count {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 4px 0;
}
.uol-source-meta {
  font-size: 0.76rem;
  color: var(--text-3);
}

@media (max-width: 560px) {
  .uol-sources { grid-template-columns: 1fr; }
  .campaigns-toolbar { flex-direction: column; align-items: stretch; }
}

/* --- Field row (2 columns) --- */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
/* Top 4 affiliate řádky — levá čárka pro odlišení */
.aff-top-row td {
  background: #fff;
}
.aff-top-row td:first-child {
  border-left: 3px solid var(--accent);
}

/* Admin hint pro anonymní affiliates — reálné jméno vedle "Partner 01" */
.anon-hint {
  font-size: 0.7rem;
  color: var(--text-3);
  font-weight: 400;
  font-style: italic;
  margin-left: 6px;
}

/* Settings — dva sloupce vedle sebe */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.settings-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}
.settings-tile-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
@media (max-width: 500px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* Compact segment picker (Apple style) */
.seg-picker {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 3px;
}
.seg-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--surface, #fff);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Řádek Apple toggleů v admin modal */
.field-toggles {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 8px 0;
}

.field-hint {
  font-weight: 400;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

/* --- File upload field --- */
.file-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.file-field input[type="file"] {
  padding: 10px 14px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.85rem;
  color: var(--text-2);
  cursor: pointer;
}
.file-field input[type="file"]:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.file-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 100px;
}
.file-preview img {
  max-height: 72px;
  max-width: 200px;
  object-fit: contain;
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .modal { padding: 12px; }
}

.period-picker {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  gap: 2px;
}
.period-picker button {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.period-picker button:hover { color: var(--text); }
.period-picker button.active {
  background: var(--brand-purple, #5b3f96);
  color: white;
}

/* Hint — slovo s tečkovaným podtržením + custom tooltip via CSS.
   Používá data-hint atribut místo title (native tooltipy jsou pomalé
   a v <th> s position:sticky je browser občas vůbec neukáže).
   Tooltip je absolute-positioned ::after pseudo-element, viditelný
   okamžitě při hoveru. */
.hint {
  position: relative;
  text-decoration: underline dotted;
  text-decoration-color: var(--text-3);
  text-underline-offset: 3px;
  cursor: help;
  display: inline-block;
}
.hint::after {
  content: attr(data-hint);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: rgba(29, 29, 31, 0.95);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.hint::before {
  content: '';
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  border: 4px solid transparent;
  border-bottom-color: rgba(29, 29, 31, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 20;
}
.hint:hover::after,
.hint:focus::after,
.hint:hover::before,
.hint:focus::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Hint v thead — overflow visible aby tooltip nebyl ořezán */
thead th .hint { overflow: visible; }

/* ========== Apple-style toggle switch ========== */

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 4px 2px;
}
.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: relative;
  width: 34px;
  height: 20px;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 20px;
  transition: background 0.22s ease;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18),
              0 1px 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.toggle input:checked ~ .toggle-slider {
  background: var(--brand-purple, #5b3f96);
}
.toggle input:checked ~ .toggle-slider::after {
  transform: translateX(14px);
}
.toggle input:focus-visible ~ .toggle-slider {
  box-shadow: 0 0 0 3px rgba(91, 63, 150, 0.25);
}
.toggle-label {
  font-size: 0.82rem;
  color: var(--text-2);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

/* ========== MONTHLY TABLE /vypis — měsíční výpis partnera ========== */

.monthly-table {
  font-size: 0.88rem;
}
.monthly-table thead th {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  /* Sticky je aplikován jen na min-width: 1500px níže (tam kde se tabulka
     vejde bez horizontálního scrollu). Pod 1500px je horizontal scroll
     povolen přes overflow-x: auto na wrapperu — to vytváří scroll kontext
     a sticky by tam nefungoval. */
}

/* Numerické sloupce v měsíční tabulce — centrovat hlavičku i hodnotu,
   aby hodnota vizuálně seděla pod názvem sloupce. Specifita `.table.monthly-table`
   přebíjí obecné `.table thead th.num { text-align: right }` o řád níže v souboru. */
.table.monthly-table thead th.num,
.table.monthly-table tbody td.num { text-align: center; }
.table.monthly-table tbody td.num .cell-stack { align-items: center; }

/* Horizontal scroll wrapper — jen overflow-x, page scroll řeší vertical.
   Žádný max-height, žádný druhý scrollbar. */
.table-wrap.table-wrap-sticky {
  overflow-x: auto;
}

/* Sticky první sloupec — left: 0 funguje uvnitř overflow-x: auto */
.table-wrap-sticky .table th:first-child,
.table-wrap-sticky .table td:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}

/* JS-managed sticky header clone */
.sticky-thead-clone {
  position: fixed;
  top: 64px;
  background: #fff;
  z-index: 50;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  pointer-events: none;
  display: none;
}
.sticky-thead-clone::-webkit-scrollbar { display: none; }
.sticky-thead-clone table {
  border-collapse: collapse;
  table-layout: fixed;
}
.sticky-thead-clone th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
}
.sticky-thead-clone th {
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  padding: 10px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.monthly-table tbody td {
  padding: 14px 14px;
  vertical-align: top;
}
.monthly-table .month-cell {
  min-width: 200px;
}
.monthly-table .month-main {
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  line-height: 1.25;
}
/* NGR ROI progress bar v month-cell */
.monthly-table .month-cell .aff-roi-row {
  margin-top: 2px;
}
.monthly-table .muted {
  color: var(--text-3);
}
.monthly-table .positive { color: #1b8a3a; }
.monthly-table .negative { color: #c82b23; }

/* Hero row — první (nejnovější) měsíc, jemně zvýrazněný.
   Aktuální měsíc nemá delta srovnání, takže cellu stačí nižší výška. */
.monthly-table .monthly-hero td {
  background: #fff;
  font-size: 1rem;
  padding-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.monthly-table .monthly-hero .month-main {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.monthly-table .monthly-hero .num {
  font-weight: 600;
}
.hero-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  border: 1px solid rgba(91, 63, 150, 0.35);
  color: var(--brand-purple-text);
  vertical-align: middle;
}

/* Cell stack — hlavní hodnota nahoře, delta vždy dole ve stejné výšce.
   Všechny sloupce tak mají delta řádek vertikálně zarovnaný. */
.monthly-table .cell-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* .num sloupce = pravé zarovnání */
  gap: 2px;
  justify-content: flex-start;
}
.monthly-table .month-cell .cell-stack,
.monthly-table :not(.num) .cell-stack {
  align-items: flex-start;
}
.monthly-table .cell-main {
  line-height: 1.25;
}
.monthly-table .cell-delta {
  line-height: 1;
  min-height: 12px;
}

/* Delta indicator — šipka + % srovnání s předchozím měsícem */
.monthly-table .delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1;
}
.monthly-table .delta-up   { color: #1b8a3a; }
.monthly-table .delta-down { color: #c82b23; }
.monthly-table .delta-flat { color: var(--text-3); }
.monthly-table .delta-na   {
  color: var(--text-3);
  font-style: italic;
  font-size: 0.66rem;
}
.monthly-table .delta-placeholder {
  visibility: hidden; /* zachovává výšku ale je neviditelný */
}

/* Hero row nemá delta srovnání → neaplikuje min-height ani delta
   placeholder výšku, čímž se celý řádek zkrátí na přirozenou výšku
   samotné hodnoty */
.monthly-table .monthly-hero .cell-stack {
  min-height: 0;
  gap: 0;
}
.monthly-table .monthly-hero .cell-delta {
  display: none;
}

@media (max-width: 1200px) {
  .monthly-table {
    font-size: 0.82rem;
  }
  .monthly-table thead th { padding: 10px 10px; }
  .monthly-table tbody td { padding: 11px 10px; }
  .monthly-table .monthly-hero .month-main { font-size: 1rem; }
}

/* ========== OVERVIEW (Dashboard boxíky — pro budoucí přesun na /) ========== */

.overview-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 0;
  color: var(--text-2);
  font-size: 0.95rem;
}
.overview-loading[hidden] { display: none !important; }

.overview-error {
  padding: 18px 22px;
  background: rgba(255, 59, 48, 0.08);
  color: #c82b23;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-top: 16px;
}
.overview-error[hidden] { display: none; }

.overview-content[hidden] { display: none !important; }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 112px;
}
.overview-card-label {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.overview-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
  margin-top: 2px;
  word-break: break-word;
}
.overview-card-money .overview-card-value {
  font-size: 1.5rem; /* peněžní částky bývají delší, o něco menší */
}
.overview-card-hint {
  font-size: 0.72rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  margin-top: auto;
  padding-top: 4px;
  min-height: 1em;
}

@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  .overview-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-card-value { font-size: 1.5rem; }
  .overview-card-money .overview-card-value { font-size: 1.3rem; }
}
@media (max-width: 520px) {
  .overview-grid { grid-template-columns: 1fr; }
}

/* ========== METRICS ========== */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.metric-icon.i-blue   { background: rgba(0, 113, 227, 0.1);  color: var(--accent); }
.metric-icon.i-green  { background: rgba(52, 199, 89, 0.1);  color: var(--green); }
.metric-icon.i-orange { background: rgba(255, 149, 0, 0.1);  color: var(--orange); }
.metric-icon.i-purple { background: rgba(175, 82, 222, 0.1); color: var(--purple); }

.metric-menu {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--text-3);
  font-size: 1rem;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.metric-menu:hover { background: rgba(0, 0, 0, 0.05); }

.metric-label {
  font-size: 0.8rem;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
  color: var(--text);
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  margin-right: 6px;
}
.metric-trend.up {
  background: rgba(52, 199, 89, 0.12);
  color: var(--green);
}
.metric-trend.down {
  background: rgba(255, 59, 48, 0.12);
  color: var(--red);
}
.metric-trend-period {
  font-size: 0.76rem;
  color: var(--text-3);
}

/* ========== CARDS ========== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-3);
  margin-top: 2px;
}
.card-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-2);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.link-more {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
}
.link-more:hover { color: var(--accent-hover); }

/* ========== CHARTS ROW ========== */

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.chart-card {
  min-height: 340px;
  display: flex;
  flex-direction: column;
}
.chart-wrap {
  flex: 1;
  position: relative;
  min-height: 240px;
}

.doughnut-wrap {
  position: relative;
  width: 100%;
  max-width: 240px;
  height: 240px;
  margin: 0 auto 16px;
}
.doughnut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.doughnut-center-big {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.doughnut-center-label {
  font-size: 0.76rem;
  color: var(--text-3);
  margin-top: 2px;
}

.sources-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.sources-legend .legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-2);
}
.sources-legend .legend-row .label { display: flex; align-items: center; gap: 6px; }
.sources-legend .legend-row .value { font-weight: 600; color: var(--text); }

/* ========== TABLE ========== */

.table-card { padding: 24px; }
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 0.72rem;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table thead th.num { text-align: right; }

/* --- Sortable column headers --- */
.table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.12s ease;
}
.table thead th.sortable:hover {
  color: var(--text);
}
.table thead th.sortable.active {
  color: var(--text);
}
.sort-ind {
  display: inline-block;
  width: 10px;
  margin-left: 4px;
  opacity: 0.6;
  font-size: 0.85em;
  vertical-align: middle;
}
.table thead th.sortable.active .sort-ind {
  opacity: 1;
}
.table thead th.sortable .sort-ind::before {
  content: '';
}
.table thead th.sortable.sort-asc .sort-ind::before {
  content: '▲';
}
.table thead th.sortable.sort-desc .sort-ind::before {
  content: '▼';
}
.table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--surface-2); }

.loading-cell {
  text-align: center;
  color: var(--text-3);
  padding: 30px !important;
  font-style: italic;
}

.aff-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.aff-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: white;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aff-avatar.c1 { background: linear-gradient(135deg, #0071e3, #5856d6); }
.aff-avatar.c2 { background: linear-gradient(135deg, #34c759, #5ac8fa); }
.aff-avatar.c3 { background: linear-gradient(135deg, #ff9500, #ff2d55); }
.aff-avatar.c4 { background: linear-gradient(135deg, #af52de, #ff2d55); }
.aff-avatar.c5 { background: linear-gradient(135deg, #5ac8fa, #0071e3); }

.aff-name { font-weight: 600; color: var(--text); font-size: 0.88rem; }
.aff-email { font-size: 0.78rem; color: var(--text-3); margin-top: 1px; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
}
.pill.green  { background: rgba(52, 199, 89, 0.12); color: var(--green); }
.pill.blue   { background: rgba(0, 113, 227, 0.12); color: var(--accent); }
.pill.orange { background: rgba(255, 149, 0, 0.12); color: var(--orange); }
.pill.red    { background: rgba(255, 59, 48, 0.12); color: var(--red); }
.pill.gray   { background: rgba(0, 0, 0, 0.06);     color: var(--text-2); }

/* ========== LOGIN ========== */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f7;
  padding: 24px;
}

.login-wrap {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-card {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 40px 36px 36px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* Logo nad card */
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}
.login-logo .logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(88, 86, 214, 0.15);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-logo .logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.login-logo .logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}
.login-logo .logo-text span {
  color: #86868b;
  font-weight: 500;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-align: center;
  margin: 0 0 32px;
  color: #1d1d1f;
}

/* ap. brand logo pod kartou */
.login-brand-link {
  display: block;
  margin-top: 28px;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.login-brand-link:hover { opacity: 0.6; }
.login-brand-img {
  width: 44px;
  height: 44px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.login-form .btn-primary {
  margin-top: 24px;
}

/* Inline login rows — label vlevo, input vpravo */
.login-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e5e5e7;
  padding: 16px 0;
}
.login-row:first-child { padding-top: 0; }
.login-label {
  width: 80px;
  flex-shrink: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: #6e6e73;
}
.login-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: #1d1d1f;
  background: transparent;
  padding: 0;
  font-family: inherit;
}
.login-input::placeholder { color: #c7c7cc; }
.login-input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 40px #fff inset;
  -webkit-text-fill-color: #1d1d1f;
}
.login-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-input-wrap .login-input { flex: 1; }
.pwd-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: #86868b;
  padding: 4px;
  display: flex;
  border-radius: 4px;
}
.pwd-toggle:hover { color: #5b3f96; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: #86868b;
}
.field input {
  padding: 13px 14px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  color: #1d1d1f;
  transition: border 0.15s, box-shadow 0.15s;
  outline: none;
}
.field input:focus {
  border-color: var(--brand-purple, #5b3f96);
  box-shadow: 0 0 0 3px rgba(91, 63, 150, 0.15);
}
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 40px #fff inset;
  -webkit-text-fill-color: #1d1d1f;
}

.login-error {
  background: rgba(255, 59, 48, 0.06);
  color: #c82b23;
  border: 1px solid rgba(255, 59, 48, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 500;
}

.btn-primary {
  background: var(--brand-purple, #5b3f96);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: 8px;
  transition: background 0.15s, transform 0.05s;
}
.btn-primary:hover:not(:disabled) { background: #4a3280; }
.btn-primary:active:not(:disabled) { transform: scale(0.995); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-3);
}

/* Overdue modal — uvítací upozornění na nezaplacené faktury */
.overdue-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.overdue-modal[hidden] { display: none; }
.overdue-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 29, 31, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.overdue-modal-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  max-width: 420px;
  width: 100%;
  padding: 40px 36px 32px;
  text-align: center;
  animation: modal-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.overdue-modal-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin: 0 auto 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.overdue-modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 12px;
}
.overdue-modal-text {
  font-size: 0.92rem;
  color: #6e6e73;
  line-height: 1.55;
  margin: 0 0 8px;
}
.overdue-modal-amount {
  font-size: 1.4rem;
  font-weight: 700;
  color: #c82b23;
  margin: 12px 0 20px;
}
.overdue-modal-footer {
  font-size: 0.78rem;
  color: #86868b;
  margin: 0 0 24px;
}
.overdue-modal-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: var(--brand-purple, #5b3f96);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.overdue-modal-btn:hover { background: #4a3280; }

/* Input s prefix labelem (https:// prefix pro URL pole) */
/* Input + tlačítko vedle sebe (např. heslo + generovat) */
.input-with-btn {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.input-with-btn input { flex: 1; }
.btn-generate-pwd {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: rgba(91, 63, 150, 0.08);
  color: var(--brand-purple, #5b3f96);
  border: 1px solid rgba(91, 63, 150, 0.2);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border 0.15s;
}
.btn-generate-pwd:hover {
  background: rgba(91, 63, 150, 0.14);
  border-color: rgba(91, 63, 150, 0.35);
}

.input-prefix-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  transition: border 0.15s, box-shadow 0.15s;
}
.input-prefix-wrap:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-light);
}
.input-prefix {
  display: flex;
  align-items: center;
  padding: 0 0 0 14px;
  font-size: 0.92rem;
  color: var(--text-3);
  white-space: nowrap;
  user-select: none;
}
.input-prefix-wrap input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  flex: 1;
  min-width: 0;
  padding-left: 2px;
}

/* =============================================================
   Page: Požadavky — seznam + modal pro nový požadavek
   ============================================================= */

/* Chyba uvnitř modalu (validační / API error) */
.modal-error {
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.2);
  color: #c82b23;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Textarea v .field */
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.field input[type="file"] {
  font-size: 0.85rem;
  color: var(--text-2);
}

/* Tabulka požadavků */
.requests-table tbody td {
  vertical-align: top;
}
.req-date-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.req-date-primary {
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.req-date-meta {
  font-size: 0.72rem;
  color: var(--text-3);
}

/* Subject badge (druh požadavku) */
.req-subject-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.req-subject-obecny {
  background: rgba(88, 86, 214, 0.12);
  color: #3a38a8;
}
.req-subject-pozvanka {
  background: rgba(255, 149, 0, 0.12);
  color: #8a5800;
}
.req-subject-jine {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-2);
}

/* Text preview */
.req-body-preview {
  color: var(--text);
  line-height: 1.45;
  max-width: 500px;
  word-break: break-word;
}
.req-attachment-icon {
  display: inline-block;
  margin-left: 6px;
  opacity: 0.75;
  cursor: help;
}

/* Status badge */
.req-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.req-status-pending {
  background: rgba(0, 113, 227, 0.10);
  color: #0058b8;
}
.req-status-in-progress {
  background: rgba(255, 149, 0, 0.12);
  color: #8a5800;
}
.req-status-on-hold {
  background: rgba(255, 204, 0, 0.18);
  color: #8a6c00;
}
.req-status-done {
  background: rgba(52, 199, 89, 0.14);
  color: #1b8a3a;
}
.req-status-cancelled {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-3);
}
.req-status-failed {
  background: rgba(255, 59, 48, 0.10);
  color: #c82b23;
}

.req-completed-at {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-size: 0.85rem;
}

/* Title cell (nadpis) */
.req-title-cell {
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
  max-width: 480px;
  word-break: break-word;
}

/* Detail button in list */
.btn-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.btn-detail:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong, var(--border));
}
.btn-detail svg {
  opacity: 0.7;
}

/* Detail modal — read-only preview */
.detail-view {
  gap: 18px;
}
.detail-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 0;
  justify-content: center;
  color: var(--text-2);
}
.detail-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* Přebíjí flex když je element skrytý přes [hidden] atribut */
.detail-loading[hidden],
.detail-content[hidden],
.detail-meta-row[hidden],
.detail-section[hidden] {
  display: none !important;
}
.detail-meta {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  padding: 12px 14px;
  background: var(--surface-2, rgba(0, 0, 0, 0.02));
  border-radius: 8px;
  border: 1px solid var(--border);
}
.detail-meta-row {
  display: contents;
}
.detail-meta-label {
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 500;
  align-self: center;
}
.detail-meta-val {
  font-size: 0.88rem;
  color: var(--text);
  align-self: center;
}
.detail-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-section-val {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}
.detail-title-val {
  font-size: 1.02rem;
  font-weight: 600;
}
.detail-body-val {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 12px 14px;
  background: var(--surface-2, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 340px;
  overflow-y: auto;
}

/* Detail modal — attachment row */
.detail-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
}
.detail-attachment-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.detail-attachment-name {
  font-weight: 500;
  word-break: break-word;
  color: var(--text);
}
.detail-attachment-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}

/* ========== HAMBURGER (mobile/tablet menu) ========== */

.hamburger-btn {
  display: none;
  background: transparent;
  border: 0;
  padding: 8px;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.hamburger-btn:hover { background: rgba(0, 0, 0, 0.06); color: var(--text); }

/* ========== RESPONSIVE ========== */

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .doughnut-wrap { max-width: 280px; }
}

/* Tablet + mobile: topnav → hamburger dropdown (brand group may overflow s 5 links) */
@media (max-width: 1024px) {
  .hamburger-btn { display: inline-flex; }
  .topbar-inner {
    grid-template-columns: 1fr auto;
  }
  .topnav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 12px 16px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transform: translateY(-120%);
    transition: transform 0.22s ease;
    z-index: 95;
    pointer-events: none;
  }
  .topnav.open {
    transform: translateY(0);
    pointer-events: auto;
  }
  .topnav a {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.98rem;
  }
  .topnav a.active {
    background: var(--accent-light);
    color: var(--accent);
  }
}

@media (max-width: 720px) {
  .topbar-inner { padding: 0 16px; gap: 16px; height: 56px; }
  .container { padding: 24px 16px 40px; }
  .topnav { top: 56px; }
  .topnav a { padding: 12px 14px; font-size: 0.95rem; }
  .search-box { display: none; }
  .user-chip-name { display: none; }
  .logo-text { display: none; }
  .brand-divider { display: none; }
  .partner-brand { display: none; }
  .metrics { grid-template-columns: 1fr; }
  .page-title { font-size: 1.6rem; }
  .login-card { padding: 32px 24px 24px; }
}
