:root {
  --bg-app: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-subtle: #fbfbfd;
  --border-hairline: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.16);
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent-blue: #0071e3;
  --accent-blue-hover: #0077ed;
  --accent-green: #34c759;
  --accent-green-bg: rgba(52, 199, 89, 0.12);
  --accent-orange: #ff9500;
  --accent-orange-bg: rgba(255, 149, 0, 0.12);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  padding: 12px 16px;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* 100% využití celé šířky monitoru bez přetékání */
.app-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  min-width: 0;
}

/* Kompaktní horní lišta - vždy v jedné čisté řadě */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-hairline);
  margin-bottom: 14px;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0071e3, #42a5f5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 113, 227, 0.25);
}

.brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Horní dlaždice služeb a akcí — stejná velikost, hranatější s oblými rohy */
.header-tiles {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 122px;
  height: 32px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  white-space: nowrap;
  box-sizing: border-box;
  padding: 0 8px;
  margin: 0;
  transition: all 0.15s ease;
  user-select: none;
}

button.header-tile {
  cursor: pointer;
  outline: none;
}

button.header-tile:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

button.header-tile:active {
  transform: scale(0.97);
}

.dot-green {
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.2);
  flex-shrink: 0;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.2);
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-blue-hover);
}

/* Kompaktní horní řada KPI — všechny 4 karty stejně dlouhé */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-card {
  background: var(--bg-card);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Jemná Apple aura pro 4 hlavní ukazatele (všechny 4 se stejnou šířkou) */
.kpi-card:nth-child(1) {
  box-shadow: 0 8px 28px rgba(52, 199, 89, 0.18);
  border-color: rgba(52, 199, 89, 0.3);
  background: #ffffff;
}
.kpi-card:nth-child(1) .kpi-value {
  color: #248a3d;
  font-size: 28px;
}

#cardFuturePayout {
  box-shadow: 0 8px 28px rgba(255, 149, 0, 0.18);
  border-color: rgba(255, 149, 0, 0.3);
  background: #ffffff;
}
#cardFuturePayout .kpi-value {
  color: #b26500;
}

#cardNextPayout {
  box-shadow: 0 8px 28px rgba(0, 113, 227, 0.18);
  border-color: rgba(0, 113, 227, 0.3);
  background: #ffffff;
}
#cardNextPayout .kpi-value {
  color: #0071e3;
}

#cardMrr {
  box-shadow: 0 8px 28px rgba(0, 113, 227, 0.15);
  border-color: rgba(0, 113, 227, 0.3);
  background: #ffffff;
}
#cardMrr .kpi-value {
  color: #0071e3;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.kpi-badge.success {
  background: var(--accent-green-bg);
  color: #248a3d;
}

.kpi-badge.warning {
  background: var(--accent-orange-bg);
  color: #b26500;
}

.kpi-badge.primary {
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent-blue);
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 3px;
  font-feature-settings: "tnum";
}

.kpi-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* HLAVNÍ ROZLOŽENÍ - KAŽDÝ BLOK SAMOSTATNĚ PŘES CELOU ŠÍŘKU */
.widescreen-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.card.panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-hairline);
}

.panel-header h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.panel-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.badge-count {
  font-size: 10px;
  font-weight: 700;
  background: rgba(0, 113, 227, 0.08);
  color: #0071e3;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(0, 113, 227, 0.2);
  flex-shrink: 0;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin: 8px 0 6px 0;
}

/* Tabulky */
.table-container {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-app { width: 140px; }
.col-country { width: 85px; }
.col-type { width: 80px; }
.col-started { width: 85px; }
.col-expires { width: 85px; }
.col-daysleft { width: 80px; }
.col-status { width: 130px; }
.col-netamount { width: 85px; }
.col-gross { width: 85px; }
.col-platform { width: 95px; }

.data-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 6px 7px;
  border-bottom: 1px solid var(--border-hairline);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.data-table td {
  font-size: 12px;
  padding: 7px 7px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
  vertical-align: middle;
  white-space: nowrap;
}

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

.data-table tr:hover td {
  background: var(--bg-card-subtle);
}

.app-badge {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
}

.status-tag.converted {
  background: var(--accent-green-bg);
  color: #248a3d;
}

.status-tag.paid {
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent-blue);
}

.amount-highlight {
  font-weight: 700;
  font-feature-settings: "tnum";
}

/* Vnitřní rozložení výplat */
.payouts-dual-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.payout-subblock {
  min-width: 0;
  width: 100%;
}

.payout-subblock:first-child {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-hairline);
}


/* Rotace ikony při obnově */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinning {
  animation: spin 0.8s linear infinite;
}

/* Zápatí */
.app-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* INTELIGENTNÍ RESPONZIVITA PRO POLOVINU MONITORU (cca 850px - 1280px) */
@media (max-width: 1280px) {
  /* Skrytí dlouhého podtitulu pro zachování jedné čisté linky v hlavičce */
  .subtitle {
    display: none;
  }

  /* Horní 4 karty do přehledné mřížky 2 x 2 */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Každý blok samostatně přes celou šířku */
  .widescreen-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* Ve spodním roztaženém panelu výplat jsou obě tabulky čistě pod sebou bez překrývání */
  .payouts-dual-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
}

/* Úzké okno / menší displej (< 820px) */
@media (max-width: 820px) {
  body {
    padding: 10px 10px;
  }

  .top-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    width: 100%;
    justify-content: space-between;
  }

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

  .widescreen-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .payouts-dual-grid {
    display: flex;
    flex-direction: column;
  }
}

/* Tlačítko Nastavení */
.btn-secondary {
  background: var(--bg-card-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-hairline);
}

.btn-secondary:hover {
  background: #f0f2f7;
  border-color: #d1d6e2;
}

/* Modální okno Nastavení (Apple Light Mode) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 90%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.18s ease-out;
}

@keyframes slideUp {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  font-size: 24px;
}

.modal-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.modal-title p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  line-height: 1;
}

.btn-close:hover {
  background: var(--bg-card-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: 14px 20px;
  max-height: 380px;
  overflow-y: auto;
}

.sounds-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sound-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-hairline);
  background: #fbfbfc;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sound-item:hover {
  background: #f2f5fb;
  border-color: #cbd5e1;
}

.sound-item.active {
  background: #edf5ff;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 1px var(--accent-blue);
}

.sound-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sound-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sound-item.active .sound-radio {
  border-color: var(--accent-blue);
  background: var(--accent-blue);
}

.sound-item.active .sound-radio::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
}

.sound-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.sound-item.active .sound-name {
  color: var(--accent-blue);
}

.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-play:hover {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fbfbfc;
}

.save-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-green);
}

/* Panel Header Controls & Switcher */
.panel-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ranking-tab-switcher {
  display: inline-flex;
  background: var(--bg-card-subtle);
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  gap: 3px;
}

.tab-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  font-weight: 700;
}

/* Filter Chips */
.filter-chips {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 15px;
  border: 1px solid var(--border-hairline);
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: rgba(0,0,0,0.2);
  color: var(--text-primary);
}

.chip.active {
  background: #1d1d1f;
  color: #ffffff;
  border-color: #1d1d1f;
}

/* Sortable Table Headers */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.sortable-th:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
}

.sort-icon {
  display: inline-block;
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.35;
}

.sortable-th.sorted-asc .sort-icon,
.sortable-th.sorted-desc .sort-icon {
  opacity: 1;
  color: var(--accent-blue);
}

/* Tags & Badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
}

.tag-green { background: var(--accent-green-bg); color: #248a3d; }
.tag-orange { background: var(--accent-orange-bg); color: #b26500; }
.tag-red { background: var(--accent-red-bg); color: #d70015; }
.tag-blue { background: rgba(0, 113, 227, 0.1); color: var(--accent-blue); }
.tag-purple { background: var(--accent-purple-bg); color: #8944ab; }
.tag-gray { background: rgba(0, 0, 0, 0.05); color: var(--text-secondary); }

/* Column Settings Modal */
.columns-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.column-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin: 10px 0 6px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-hairline);
}

.column-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.column-checkbox-label:hover {
  background: var(--bg-card-subtle);
}

.column-checkbox-label input {
  cursor: pointer;
  accent-color: var(--accent-blue);
}

.col-hidden {
  display: none !important;
}

/* FORECAST PANEL (Očekávané příjmy — 12 měsíců — Návrh 1) */
.forecast-panel {
  padding: 20px 22px;
}

.forecast-months-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

@media (max-width: 1000px) {
  .forecast-months-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.forecast-month-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 90px;
  transition: all 0.15s ease;
}

.forecast-month-card.has-revenue {
  background: #ffffff;
  border: 1px solid rgba(36, 138, 61, 0.25);
  box-shadow: 0 2px 8px rgba(36, 138, 61, 0.05);
}

.forecast-month-card.has-pending {
  background: #ffffff;
  border: 1px solid rgba(215, 0, 21, 0.25);
  box-shadow: 0 2px 8px rgba(215, 0, 21, 0.05);
}

.forecast-month-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.forecast-month-amount {
  font-size: 18px;
  font-weight: 700;
  color: #248a3d;
  margin-top: 6px;
}

.forecast-month-amount.empty {
  color: var(--text-tertiary);
  font-size: 15px;
  font-weight: 500;
}

.forecast-month-amount.pending {
  color: #d70015;
}

.forecast-month-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}

.forecast-month-date.empty {
  color: var(--text-tertiary);
  font-weight: 400;
}

.forecast-month-date.pending {
  color: #d70015;
  font-weight: 700;
}

/* =====================================================================
   4 STEJNĚ VELKÉ DLAŽDICE NAD TABULKOU & BUBILNA SLOUPCŮ (POPOVER)
   ===================================================================== */
.mini-tiles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.mini-tile-box {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 68px;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.mini-tile-box.clickable {
  cursor: pointer;
  border-color: rgba(0, 113, 227, 0.3);
  background: #ffffff;
}

.mini-tile-box.clickable:hover {
  border-color: #0071e3;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.12);
  transform: translateY(-1px);
}

.mini-tile-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mini-tile-value {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.columns-popover-box {
  position: absolute;
  right: 0;
  top: 72px;
  width: 250px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18);
  border: 1px solid rgba(0,0,0,0.12);
  padding: 14px 16px;
  z-index: 100;
}

.columns-popover-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-primary);
}

.columns-popover-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  user-select: none;
}

.columns-popover-list input[type="checkbox"] {
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.unified-table-panel {
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-hairline);
  background: #ffffff;
}

/* =====================================================================
   RESPONZIVNÍ STYLY PRO MOBILNÍ TELEFONY (IPHONE / PWA)
   ===================================================================== */
@media (max-width: 900px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
  }

  .app-container {
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
  }

  body {
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .card.panel,
  .forecast-panel {
    padding: 12px 10px;
    border-radius: 12px;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
  }

  .mini-tiles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
  }

  .top-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
    overflow: hidden;
    max-width: 100%;
    width: 100%;
  }

  .brand {
    width: 100%;
    flex-shrink: 0;
  }

  .header-tiles {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 6px;
    scrollbar-width: none;
    flex-shrink: 0;
  }

  .header-tiles::-webkit-scrollbar {
    display: none;
  }

  .forecast-months-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .forecast-month-card {
    min-width: 0;
    min-height: 68px;
    padding: 8px 4px;
    border-radius: 8px;
    overflow: hidden;
  }

  .forecast-month-amount {
    font-size: 14px;
    white-space: nowrap;
  }

  .forecast-month-date {
    font-size: 9.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .kpi-value {
    font-size: 21px;
  }

  .mini-tile-value {
    font-size: 16px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-bottom: 8px;
  }

  .panel-header-controls {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
  }

  .columns-popover-box {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 24px;
    width: auto;
    max-width: 380px;
    margin: 0 auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  }

  .table-container {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
  }

  #customersDataTable {
    min-width: 680px;
    table-layout: fixed;
  }
}

@media (max-width: 480px) {
  body {
    padding: 6px 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .card.panel,
  .forecast-panel {
    padding: 10px 8px;
  }

  .kpi-grid,
  .mini-tiles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .kpi-card {
    padding: 10px;
    border-radius: 10px;
    min-width: 0;
    overflow: hidden;
  }

  .kpi-value {
    font-size: 18px;
  }

  .kpi-desc {
    font-size: 10px;
  }

  .mini-tile-box {
    padding: 8px 10px;
    min-height: 58px;
    border-radius: 8px;
    min-width: 0;
    overflow: hidden;
  }

  .mini-tile-label {
    font-size: 10px;
  }

  .mini-tile-value {
    font-size: 14.5px;
  }

  .forecast-months-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
  }

  .forecast-month-card {
    min-height: 64px;
    padding: 6px 3px;
    min-width: 0;
    overflow: hidden;
  }

  .forecast-month-name {
    font-size: 10px;
  }

  .forecast-month-amount {
    font-size: 13px;
    white-space: nowrap;
  }

  .forecast-month-date {
    font-size: 8.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand h1 {
    font-size: 15px;
  }

  .brand .subtitle {
    font-size: 10.5px;
  }
}




