/* ==========================================
   ALLEGRO MODULE - STYLESHEET
   Wzorzec: obrot/css/style.css
   ========================================== */

/* === RESET & BASE === */
* {
  box-sizing: border-box;
}

:root {
  /* Dark Theme Contract - Canonical CSS Tokens */
  --bg: #181818;
  --card-bg: #1e1e1e;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.10);
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --radius: 14px;
  
  /* Additional tokens used by allegro */
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #06b6d4;
  --dark-bg: #181818;
  --dark-card: #1f2937;
  --dark-elevated: #262626;
  --text-tertiary: #6b7280;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-blue: #60a5fa;
  --accent-amber: #fbbf24;
  --accent-gold: #facc15;
  --accent-violet: #a78bfa;
  --accent-orange: #fb923c;
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--dark-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

.topbar {
  height: 56px;
  background: #202020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid rgba(59,130,246,0.15);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  font-family: 'Inter', system-ui, sans-serif;
  position: sticky;
  top: 0;
  z-index: 100;
  box-sizing: border-box;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
}

.topbar-center {
  display: flex;
  align-items: center;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-text {
  color: var(--text-primary);
  font-size: 20px;
}

.topbar-icon {
  width: 18px;
  height: 18px;
  stroke: var(--text-secondary);
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}

.topbar-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 120ms ease, color 120ms ease;
}

.topbar-action:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.ui-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* =================================================
   LAYOUT
   ================================================= */

.allegro-layout {
  display: flex;
  height: calc(100vh - 56px);
}

.allegro-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--dark-bg);
  overscroll-behavior-y: contain;
}

.allegro-content > div[id] {
  max-width: 1400px;
  margin: 0 auto;
}

/* =================================================
   SIDEBAR
   ================================================= */

.allegro-sidebar {
  position: sticky;
  top: 0;
  width: 64px;
  height: 100%;
  background: var(--dark-elevated);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  transition: width 180ms ease;
  overflow: hidden;
  flex-shrink: 0;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.35);
}

.allegro-sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(59, 130, 246, 0.15),
    rgba(59, 130, 246, 0.35),
    rgba(59, 130, 246, 0.15)
  );
  pointer-events: none;
  opacity: 0.4;
  transform: scaleY(0.85);
  transition: opacity 180ms ease, transform 220ms ease;
}

.allegro-sidebar:hover::after {
  opacity: 0.9;
  transform: scaleY(1);
}

.allegro-sidebar:hover {
  width: 220px;
}

.allegro-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.allegro-sidebar .sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.7;
  transition: opacity 150ms ease, background-color 150ms ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.allegro-sidebar .sidebar-item:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
}

.allegro-sidebar .sidebar-item.active {
  opacity: 1;
  background: rgba(59, 130, 246, 0.15);
  border-left: 3px solid var(--primary);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25), 0 0 12px rgba(59, 130, 246, 0.12);
}

.allegro-sidebar .icon {
  width: 18px;
  height: 18px;
  stroke: var(--text-secondary);
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}

.allegro-sidebar .sidebar-item.active .icon {
  stroke: var(--primary);
}

.allegro-sidebar .label {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  display: none;
}

.allegro-sidebar .sidebar-item.active .label {
  font-weight: 600;
}

.allegro-sidebar:hover .label {
  display: inline;
}

/* =================================================
   VIEW HEADERS
   ================================================= */

.view-header {
  margin-bottom: 24px;
}

.view-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.view-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* =================================================
   CAMPAIGN SELECTOR TOOLBAR
   ================================================= */

.ads-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: #1f2937;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.ads-toolbar label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.ads-toolbar select,
.ads-toolbar input[type="month"] {
  padding: 8px 12px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 150ms ease;
  min-width: 180px;
}

.ads-toolbar select:focus,
.ads-toolbar input[type="month"]:focus {
  border-color: var(--primary);
}

.ads-toolbar select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ads-toolbar .btn-analyze {
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 150ms ease, opacity 150ms ease;
}

.ads-toolbar .btn-analyze:hover:not(:disabled) {
  background: var(--primary-dark);
}

.ads-toolbar .btn-analyze:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ads-api-badge {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* =================================================
   METRICS CARDS (SKELETON)
   ================================================= */

.ads-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.ads-metric-card {
  background: #1f2937;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ads-metric-card .metric-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ads-metric-card .metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.ads-metric-card .metric-value.empty {
  color: var(--text-tertiary);
}

/* =================================================
   DECISIONS SUMMARY STRIP
   ================================================= */

.ads-decisions-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.decision-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid;
}

.decision-badge.keep {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.3);
  color: #4ade80;
}

.decision-badge.blacklist {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  color: #f87171;
}

.decision-badge.review {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.decision-badge.zero-traffic {
  background: rgba(107, 114, 128, 0.1);
  border-color: rgba(107, 114, 128, 0.3);
  color: var(--text-secondary);
}

.decision-badge .badge-count {
  font-size: 16px;
  font-weight: 700;
}

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

.ads-table-wrap {
  background: #1f2937;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
}

.ads-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.ads-table-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.ads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ads-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-subtle);
}

.ads-table tbody td {
  padding: 10px 14px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.ads-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.ads-table-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.ads-table-empty .empty-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

/* Decision cell */
.decision-cell {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.decision-cell.KEEP { background: rgba(22, 163, 74, 0.15); color: #4ade80; }
.decision-cell.BLACKLIST { background: rgba(220, 38, 38, 0.15); color: #f87171; }
.decision-cell.REVIEW, .decision-cell.REVIEW_EARLY_TEST,
.decision-cell.REVIEW_LOW_SCALE, .decision-cell.REVIEW_MARGIN_FIXABLE {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.decision-cell.ZERO_TRAFFIC { background: rgba(107, 114, 128, 0.15); color: var(--text-secondary); }

/* =================================================
   PLACEHOLDER / INFO BOX
   ================================================= */

.info-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  text-align: center;
  background: #1f2937;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.info-placeholder .placeholder-icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.info-placeholder h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.info-placeholder p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  max-width: 400px;
}

.info-placeholder .api-info {
  margin-top: 16px;
  padding: 10px 16px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--primary);
  font-family: monospace;
}

/* =================================================
   ADS ANALYZER STYLES
   ================================================= */

.analyzer-upload-card {
  background: linear-gradient(135deg, rgba(31,41,55,0.95) 0%, rgba(17,24,39,0.98) 100%);
  border: 2px dashed rgba(59, 130, 246, 0.4);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  margin-bottom: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px rgba(59,130,246,0.15);
  position: relative;
  overflow: hidden;
}

.analyzer-upload-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.5), transparent);
}

.analyzer-upload-card:hover {
  border-color: rgba(59, 130, 246, 0.6);
  transform: translateY(-4px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 0 30px rgba(59,130,246,0.25);
}

.analyzer-upload-card h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

.analyzer-upload-card input[type="file"] {
  display: none;
}

.upload-label {
  display: inline-block;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.upload-label:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59,130,246,0.4);
}

.btn-show-offers {
  margin-top: 16px;
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.btn-show-offers:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(59,130,246,0.4);
}

/* Dashboard ADS */
/* === FILE CONTEXT HEADER === */

.afc-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 24px;
}

.afc-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.afc-campaign {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.afc-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.afc-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.afc-period-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.afc-period {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-light);
  letter-spacing: 0.3px;
}

/* === END FILE CONTEXT HEADER === */

.ads-dashboard {
  background: linear-gradient(135deg, rgba(31,41,55,0.95) 0%, rgba(17,24,39,0.98) 100%);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px rgba(59,130,246,0.15);
  position: relative;
  overflow: hidden;
}

.ads-dashboard::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.5), transparent);
}

.ads-dashboard h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

.ads-dashboard-header {
  display: flex;
  align-items: stretch;
  margin-bottom: 24px;
  background: rgba(59,130,246,0.04);
  border-radius: 10px;
  border: 1px solid rgba(59,130,246,0.15);
  overflow: hidden;
}

.ads-header-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 20px;
  flex: 1;
  min-width: 0;
}

.ads-header-sep {
  width: 1px;
  background: rgba(59,130,246,0.15);
  flex-shrink: 0;
}

.ads-header-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.ads-header-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ads-channel-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-light);
  white-space: nowrap;
}

.ads-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.ads-summary-card {
  background: rgba(59,130,246,0.05);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all var(--transition-base);
}

.ads-summary-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.2);
}

.ads-summary-value {
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.ads-summary-value.metric-cost {
  color: #f87171;
}

.ads-summary-value.metric-profit {
  color: #4ade80;
}

.ads-summary-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Decyzje grid */
.ads-decisions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.ads-decision-card {
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  border: 2px solid transparent;
  transition: all var(--transition-base);
}

.ads-decision-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.ads-decision-card.keep {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.6);
}

.ads-decision-card.review {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.6);
}

.ads-decision-card.blacklist {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.6);
}

.ads-decision-card.zero-traffic {
  background: linear-gradient(135deg, rgba(107,114,128,0.15) 0%, rgba(75,85,99,0.1) 100%);
  border: 2px solid rgba(107,114,128,0.4);
}

.ads-decision-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.ads-decision-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.ads-decision-card.zero-traffic .ads-decision-label {
  color: #9ca3af;
}

.ads-decision-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ads-decision-cost {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Insights */
.ads-insights {
  background: rgba(59,130,246,0.05);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 20px;
}

.ads-insights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ads-insights h4 {
  margin: 0;
  color: var(--text-primary);
}

.ads-insights-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.ads-insights-body ul {
  flex: 1;
}

.ads-insights-savings {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  text-align: right;
}

.savings-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.savings-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #4ade80;
}

.ads-insights ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ads-insights li {
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Tabela ofert */
.ads-table {
  background: linear-gradient(135deg, rgba(31,41,55,0.95) 0%, rgba(17,24,39,0.98) 100%);
  border: 2px solid rgba(59,130,246,0.3);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px rgba(59,130,246,0.15);
  position: relative;
  overflow: hidden;
}

.ads-table::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.5), transparent);
}

.ads-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.ads-table-header select {
  padding: 8px 14px;
  border-radius: 8px;
  border: 2px solid rgba(59,130,246,0.3);
  background: rgba(59,130,246,0.1);
  color: var(--primary);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.ads-table h4 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

.ads-table-tabs.decision-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.decision-tabs button {
  padding: 10px 18px;
  border-radius: 8px;
  border: 2px solid rgba(59,130,246,0.3);
  background: rgba(59,130,246,0.1);
  color: var(--text-secondary);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.decision-tabs button .count {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  color: inherit;
  font-weight: 700;
}

.decision-tabs button.keep.active {
  border-color: rgba(34,197,94,0.4);
  background: linear-gradient(135deg, rgba(34,197,94,0.25) 0%, rgba(16,185,129,0.18) 100%);
  color: #4ade80;
  box-shadow: 0 2px 8px rgba(34,197,94,0.25);
}

.decision-tabs button.review.active {
  border-color: rgba(251,191,36,0.4);
  background: linear-gradient(135deg, rgba(251,191,36,0.25) 0%, rgba(245,158,11,0.18) 100%);
  color: #fbbf24;
  box-shadow: 0 2px 8px rgba(251,191,36,0.25);
}

.decision-tabs button.blacklist.active {
  border-color: rgba(239,68,68,0.45);
  background: linear-gradient(135deg, rgba(239,68,68,0.25) 0%, rgba(220,38,38,0.18) 100%);
  color: #f87171;
  box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}

.decision-tabs button.neutral.active {
  border-color: rgba(107,114,128,0.4);
  background: linear-gradient(135deg, rgba(107,114,128,0.25) 0%, rgba(75,85,99,0.18) 100%);
  color: #9ca3af;
}

.decision-tabs button:hover {
  transform: translateY(-1px);
}

.ads-table-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Karta oferty */
.ads-offer-card {
  border-radius: 12px;
  padding: 20px;
  border: 2px solid transparent;
  background: rgba(31,41,55,0.85);
  transition: all var(--transition-base);
}

.ads-offer-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(59,130,246,0.2);
  transform: translateY(-2px);
}

.ads-offer-card.keep {
  border-color: rgba(16,185,129,0.6);
  background: rgba(16,185,129,0.06);
}

.ads-offer-card.review {
  border-color: rgba(245,158,11,0.6);
  background: rgba(245,158,11,0.06);
}

.ads-offer-card.blacklist {
  border-color: rgba(239,68,68,0.6);
  background: rgba(239,68,68,0.06);
}

.ads-offer-decision {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.ads-offer-decision.keep {
  background: rgba(16,185,129,0.2);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.4);
}

.ads-offer-decision.review {
  background: rgba(245,158,11,0.2);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.4);
}

.ads-offer-decision.blacklist {
  background: rgba(239,68,68,0.2);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.4);
}

.ads-offer-decision.zero_traffic {
  background: rgba(107,114,128,0.2);
  color: #9ca3af;
  border: 1px solid rgba(107,114,128,0.4);
}

.ads-offer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(59,130,246,0.1);
}

.ads-offer-title {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.ads-offer-meta {
  display: flex;
  gap: 24px;
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 10px;
}

.ads-offer-meta a {
  color: #60a5fa;
  text-decoration: none;
}

.ads-offer-meta a:hover {
  text-decoration: underline;
}

.ads-offer-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 16px;
  margin-bottom: 10px;
  font-size: 13px;
  padding: 12px;
  background: rgba(59,130,246,0.05);
  border-radius: 8px;
}

.ads-offer-stats div { color: var(--text-secondary); }
.ads-offer-stats strong { color: var(--text-primary); }

.ads-offer-reason {
  padding: 12px;
  background: rgba(59,130,246,0.05);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Export */
.ads-export {
  background: linear-gradient(135deg, rgba(31,41,55,0.95) 0%, rgba(17,24,39,0.98) 100%);
  border: 2px solid rgba(59,130,246,0.3);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px rgba(59,130,246,0.15);
  position: relative;
  overflow: hidden;
}

.ads-export::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.5), transparent);
}

.ads-export h4 {
  margin-bottom: 16px;
  color: var(--text-primary);
}

.ads-export-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.ads-export-btn {
  padding: 14px 24px;
  border-radius: 12px;
  border: 2px solid;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.ads-export-btn.keep {
  border-color: rgba(16,185,129,0.4);
  background: linear-gradient(135deg, rgba(16,185,129,0.2) 0%, rgba(5,150,105,0.15) 100%);
  color: #34d399;
  box-shadow: 0 2px 8px rgba(16,185,129,0.2);
}

.ads-export-btn.keep:hover {
  background: linear-gradient(135deg, rgba(16,185,129,0.3) 0%, rgba(5,150,105,0.25) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(16,185,129,0.3);
  border-color: rgba(16,185,129,0.5);
}

.ads-export-btn.review {
  border-color: rgba(251,191,36,0.4);
  background: linear-gradient(135deg, rgba(251,191,36,0.2) 0%, rgba(245,158,11,0.15) 100%);
  color: #fbbf24;
  box-shadow: 0 2px 8px rgba(251,191,36,0.2);
}

.ads-export-btn.review:hover {
  background: linear-gradient(135deg, rgba(251,191,36,0.3) 0%, rgba(245,158,11,0.25) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(251,191,36,0.3);
  border-color: rgba(251,191,36,0.5);
}

.ads-export-btn.blacklist {
  border-color: rgba(239,68,68,0.4);
  background: linear-gradient(135deg, rgba(239,68,68,0.2) 0%, rgba(220,38,38,0.15) 100%);
  color: #f87171;
  box-shadow: 0 2px 8px rgba(239,68,68,0.2);
}

.ads-export-btn.blacklist:hover {
  background: linear-gradient(135deg, rgba(239,68,68,0.3) 0%, rgba(220,38,38,0.25) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(239,68,68,0.3);
  border-color: rgba(239,68,68,0.5);
}

/* Stats view */
.ads-stats-card {
  background: rgba(31,41,55,0.8);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 12px;
  padding: 24px;
}

.ads-stats-card h4 {
  color: var(--text-primary);
  margin-bottom: 16px;
}

.ads-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  font-size: 14px;
}

.ads-stats-grid div {
  padding: 10px 14px;
  background: rgba(59,130,246,0.05);
  border-radius: 8px;
  color: var(--text-secondary);
}

.ads-stats-grid strong {
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .ads-summary-grid { grid-template-columns: 1fr; }
  .ads-decisions-grid { grid-template-columns: 1fr; }
  .ads-export-buttons { grid-template-columns: 1fr; }
}

/* ===== WYKRESY ===== */
.ads-charts-grid {
  display: grid;
  grid-template-columns: 260px 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.ads-chart-card {
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 0;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ads-chart-title {
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 14px 0;
}

.ads-chart-card-donut {
  display: flex;
  flex-direction: column;
}

.ads-donut-canvas-wrap {
  position: relative;
  height: 220px;
}

.ads-donut-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.ads-donut-legend {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.ads-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ads-donut-legend-dot {
  width: 10px;
  height: 10px;
  border: 2px solid;
  display: inline-block;
}

.ads-donut-legend-label {
  color: #9ca3af;
  font-size: 11px;
  line-height: 1.2;
}

@media (max-width: 960px) {
  .ads-charts-grid { grid-template-columns: 1fr; }
}

/* =================================================
   ADS REFACTOR (SPOJNOSC Z MODULEM OBROT)
   ================================================= */

#adsFileInput {
  display: none;
}

.ads-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.ads-module-header-text h2 {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.ads-module-header-text p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.ads-header-file-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 12px 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #202020;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.ads-header-file-btn.is-visible {
  display: inline-flex;
}

.ads-header-file-btn:hover {
  background: rgba(59,130,246,0.22);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.35);
  transform: translateY(-2px);
}

.ads-module-flat .analyzer-upload-card {
  margin-bottom: 16px;
  padding: 28px 20px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.98) 100%);
  box-shadow: none;
  transform: none;
}

.ads-module-flat .analyzer-upload-card.is-hidden {
  display: none;
}

.ads-module-flat .analyzer-upload-card h3 {
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ads-module-flat .upload-label {
  min-height: 42px;
  padding: 12px 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #202020;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: none;
  transform: none;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.ads-module-flat .upload-label:hover {
  background: rgba(59,130,246,0.22);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.35);
  transform: translateY(-2px);
}

.ads-module-flat .analyzer-upload-card::before,
.ads-module-flat .ads-dashboard::before,
.ads-module-flat .ads-table::before,
.ads-module-flat .ads-export::before {
  display: none;
}

.ads-module-flat .ads-context-panel,
.ads-module-flat .ads-dashboard,
.ads-module-flat .ads-table,
.ads-module-flat .ads-export,
.ads-module-flat .ads-chart-card {
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(59, 130, 246, 0.28);
  box-shadow: none;
}

.ads-module-flat .ads-context-panel {
  margin-bottom: 16px;
  padding: 14px 16px;
}

.ads-module-flat .ads-dashboard {
  overflow: visible;
}

.ads-module-flat #adsCharts {
  margin-bottom: 16px;
}

.ads-module-flat .afc-wrap {
  margin: 0;
  padding: 0;
  border-bottom: 0;
}

.ads-module-flat .afc-campaign {
  font-size: 1.4rem;
}

.ads-module-flat .ads-summary-card {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 16px;
}

.ads-module-flat .ads-summary-value {
  font-size: 1.95rem;
}

.ads-module-flat .ads-summary-card.has-tooltip {
  position: relative;
  cursor: help;
}

.ads-module-flat .ads-summary-card.has-tooltip::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.96) transparent transparent transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 30;
}

.ads-module-flat .ads-summary-card.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 4px);
  min-width: 180px;
  max-width: 260px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #e5e7eb;
  font-size: 11px;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 31;
}

.ads-module-flat .ads-summary-card.has-tooltip:hover::before,
.ads-module-flat .ads-summary-card.has-tooltip:focus-visible::before,
.ads-module-flat .ads-summary-card.has-tooltip:hover::after,
.ads-module-flat .ads-summary-card.has-tooltip:focus-visible::after {
  opacity: 1;
}

.ads-module-flat .ads-summary-card.has-tooltip:hover::after,
.ads-module-flat .ads-summary-card.has-tooltip:focus-visible::after {
  transform: translate(-50%, 0);
}

.ads-module-flat .ads-summary-card.has-tooltip:focus-visible {
  outline: 1px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px;
}

.ads-module-flat .ads-summary-card:hover,
.ads-module-flat .ads-decision-card:hover,
.ads-module-flat .ads-export-btn:hover,
.ads-module-flat .ads-offer-card:hover,
.ads-module-flat .decision-tabs button:hover {
  transform: none;
  box-shadow: none;
}

.ads-module-flat .ads-decision-card {
  border-width: 1px;
}

.ads-module-flat .ads-decision-icon {
  width: 16px;
  height: 16px;
  margin: 0 auto 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.ads-module-flat .dot-red {
  background: rgba(239, 68, 68, 0.85);
  border-color: rgba(248, 113, 113, 0.85);
}

.ads-module-flat .dot-yellow {
  background: rgba(245, 158, 11, 0.85);
  border-color: rgba(251, 191, 36, 0.9);
}

.ads-module-flat .dot-green {
  background: rgba(16, 185, 129, 0.85);
  border-color: rgba(74, 222, 128, 0.9);
}

.ads-module-flat .dot-gray {
  background: rgba(107, 114, 128, 0.85);
  border-color: rgba(156, 163, 175, 0.9);
}

.ads-module-flat .ads-insights {
  border: 1px solid rgba(59, 130, 246, 0.32);
  border-left: 1px solid rgba(59, 130, 246, 0.32);
  background: rgba(59, 130, 246, 0.08);
  padding: 16px;
}

.ads-module-flat .ads-insights li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.ads-module-flat .ads-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.ads-module-flat .btn-show-offers {
  margin-top: 0;
  min-height: 38px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #202020;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: none;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.ads-module-flat .btn-show-offers:hover,
.ads-module-flat .btn-show-offers.is-active {
  background: rgba(59,130,246,0.22);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.35);
}

.ads-module-flat .btn-show-offers:hover {
  transform: translateY(-2px);
}

.ads-module-flat .ads-table-header select,
.ads-module-flat .decision-tabs button {
  border-width: 1px;
  background: rgba(59, 130, 246, 0.12);
}

.ads-module-flat .decision-tabs button .count {
  background: rgba(255, 255, 255, 0.12);
}

.ads-module-flat .ads-offer-card {
  border-width: 1px;
}

.ads-module-flat .ads-offer-stats,
.ads-module-flat .ads-offer-reason {
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.07);
}

.ads-module-flat .ads-export-btn {
  border-width: 1px;
  box-shadow: none;
}

.ads-module-flat .ads-stats-card,
.ads-module-flat .ads-stats-grid div {
  border: 1px solid rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.07);
}

.ads-module-flat .analyzer-upload-card,
.ads-module-flat .upload-label,
.ads-module-flat .ads-context-panel,
.ads-module-flat .ads-channel-tag,
.ads-module-flat .ads-dashboard,
.ads-module-flat .ads-summary-card,
.ads-module-flat .ads-decision-card,
.ads-module-flat .ads-insights,
.ads-module-flat .btn-show-offers,
.ads-module-flat .ads-table,
.ads-module-flat .ads-table-header select,
.ads-module-flat .decision-tabs button,
.ads-module-flat .decision-tabs button .count,
.ads-module-flat .ads-offer-card,
.ads-module-flat .ads-offer-stats,
.ads-module-flat .ads-offer-reason,
.ads-module-flat .ads-offer-decision,
.ads-module-flat .ads-export,
.ads-module-flat .ads-export-btn,
.ads-module-flat .ads-stats-card,
.ads-module-flat .ads-stats-grid div,
.ads-module-flat .ads-chart-card {
  border-radius: 0;
}

@media (max-width: 768px) {
  .ads-module-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ads-header-file-btn.is-visible {
    width: 100%;
  }
}

/* =================================================
   BILLINGI ALLEGRO (PRZENIESIONE Z MODULU KOSZTY)
   ================================================= */

/* 2026-05-13 — flat neutral dark instead of the bluish gradient brand
   look, so the Allegro billing card matches the Erli billing card. The
   operator switches between the two pages constantly; visual parity
   removes a "wait is this a different module?" moment. */
#billingView .premium-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 22px;
  transition: border-color 180ms, box-shadow 180ms;
}

#billingView .premium-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#billingView .billing-allegro-card {
  max-width: 1200px;
  margin: 0 auto 16px auto;
}

#billingView .premium-card,
#billingView .billing-period-input,
#billingView .btn-primary,
#billingView .btn-secondary,
#billingView .costs-allegro-preview-summary .summary-item,
#billingView .history-table {
  border-radius: 0;
}

#billingView .costs-allegro-sync-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

#billingView .costs-allegro-sync-header p {
  margin: 6px 0 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

#billingView .costs-allegro-sync-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

/* .billing-period-group/.billing-period-input — przeniesione do shared/css/period-picker.css */

#billingView .btn-primary,
#billingView .btn-secondary {
  min-height: 40px;
  padding: 10px 16px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

#billingView .btn-secondary {
  background: rgba(59, 130, 246, 0.12);
}

#billingView .btn-primary {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.4);
}

#billingView .btn-secondary:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.55);
}

#billingView .btn-primary:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(16, 185, 129, 0.55);
}

#billingView .btn-primary:disabled,
#billingView .btn-secondary:disabled,
#billingView .billing-period-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#billingView .costs-allegro-preview-status {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 0.84rem;
}

#billingView .costs-allegro-preview-summary {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

#billingView .costs-allegro-preview-summary .summary-item {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 10px 12px;
}

#billingView .costs-allegro-preview-summary .summary-item-wide {
  grid-column: span 2;
}

#billingView .costs-allegro-preview-summary .label {
  display: block;
  color: var(--text-tertiary);
  font-size: 0.74rem;
}

#billingView .costs-allegro-preview-summary .value {
  display: block;
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
}

#billingView #billingAllegroPreviewTableWrap {
  margin-top: 12px;
  overflow-x: auto;
}

#billingView #billingAllegroExtraFeesTableWrap {
  margin-top: 10px;
  overflow-x: auto;
}

#billingView .billing-table-caption {
  margin: 6px 0 4px 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}

#billingView .history-table {
  width: 100%;
  min-width: 760px;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 20px;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#billingView .history-table thead tr {
  background: rgba(30, 41, 59, 0.85);
  border: none;
}

#billingView .history-table thead th {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  border: none;
  border-bottom: 2px solid rgba(71, 85, 105, 0.5);
  position: relative;
}

#billingView .history-table thead th:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  bottom: 25%;
  width: 1px;
  background: rgba(71, 85, 105, 0.4);
}

#billingView .history-table thead th:nth-child(1) {
  text-align: left;
}

#billingView .history-table tbody td.amount-charge { color: #ef4444; }
#billingView .history-table tbody td.amount-credit { color: #22c55e; }
#billingView .history-table tbody tr:hover td.amount-charge { color: #f87171; }
#billingView .history-table tbody tr:hover td.amount-credit { color: #4ade80; }
#billingView .history-table thead th:nth-child(2) { text-align: left; }
#billingView .history-table thead th:nth-child(3) { text-align: right; }
#billingView .history-table thead th:nth-child(4) { text-align: right; }

#billingView .history-table tbody tr {
  background: rgba(31, 41, 55, 0.4);
  transition: all var(--transition-fast);
  border: none;
}

#billingView .history-table tbody tr:nth-child(even) {
  background: rgba(31, 41, 55, 0.6);
}

#billingView .history-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.1);
  transform: translateX(4px);
  box-shadow: -4px 0 0 rgba(59, 130, 246, 0.5);
}

#billingView .history-table tbody td {
  padding: 14px 20px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  border: none;
  border-bottom: 1px solid rgba(59, 130, 246, 0.05);
  transition: color var(--transition-fast);
}

#billingView .history-table tbody tr:hover td {
  color: var(--text-primary);
}

#billingView .history-table tbody td:nth-child(1) {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.875rem;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#billingView .history-table tbody td:nth-child(2) {
  color: #ffffff;
  font-weight: 500;
}

#billingView .history-table tbody td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

#billingView .history-table tbody td:nth-child(4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

#billingView .history-table.history-table--extra-fees {
  min-width: 1120px;
  margin-top: 8px;
}

#billingView .history-table.history-table--extra-fees thead th:nth-child(1),
#billingView .history-table.history-table--extra-fees thead th:nth-child(2) {
  text-align: left;
}

#billingView .history-table.history-table--extra-fees thead th:nth-child(3) {
  text-align: left;
}

#billingView .history-table.history-table--extra-fees thead th:nth-child(4),
#billingView .history-table.history-table--extra-fees tbody td:nth-child(4) {
  text-align: center;
  color: #ffffff;
}

#billingView .history-table.history-table--extra-fees thead th:nth-child(5),
#billingView .history-table.history-table--extra-fees thead th:nth-child(6) {
  text-align: right;
}

#billingView .history-table.history-table--extra-fees tbody td:nth-child(1) {
  color: #ffffff;
}

#billingView .history-table.history-table--extra-fees tbody td:nth-child(2) {
  color: var(--text-primary);
}

#billingView .history-table.history-table--extra-fees tbody td:nth-child(3) {
  color: var(--text-primary);
  font-weight: 500;
}

#billingView .history-table.history-table--extra-fees tbody td:nth-child(5) {
  text-align: right;
  color: #ffffff;
  font-weight: 600;
}

#billingView .history-table.history-table--extra-fees tbody td:nth-child(6) {
  text-align: right;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

@media (max-width: 960px) {
  #billingView .costs-allegro-sync-actions {
    flex-direction: column;
    align-items: stretch;
  }

  #billingView .billing-period-group {
    width: 100%;
  }

  #billingView .costs-allegro-preview-summary {
    grid-template-columns: 1fr 1fr;
  }

  #billingView .costs-allegro-preview-summary .summary-item-wide {
    grid-column: span 2;
  }
}

/* =================================================
   OFFER CALCULATOR (PRZENIESIONE Z RENTOWNOSC)
   ================================================= */

/* Zmienne CSS sa zdefiniowane w :root na poczatku pliku */

/* Przyciski akcji */
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 0;
  border: 1.5px solid;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 180ms, box-shadow 180ms, transform 150ms;
  font-family: inherit;
}

.btn-action:active {
  transform: translateY(1px);
}

.btn-save {
  background: rgba(59, 130, 246, 0.10);
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.35);
}

.btn-save:hover {
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Button variants - Dark Theme Contract */
.btn-export {
  background: rgba(16, 185, 129, 0.10);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.btn-export:hover {
  background: rgba(16, 185, 129, 0.18);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.2);
}

.btn-import {
  background: rgba(245, 158, 11, 0.10);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.btn-import:hover {
  background: rgba(245, 158, 11, 0.18);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.10);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.2);
}

.btn-block {
  width: 100%;
}

/* Karty - Dark Theme Contract */
.card,
.premium-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 22px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.card:hover,
.premium-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.section-card {
  margin-bottom: 20px;
}

/* Card variants - Dark Theme Contract */
.card--info .card-icon {
  background: rgba(59,130,246,0.12);
  color: #60a5fa;
}

.card--backup .card-icon,
.card--success .card-icon {
  background: rgba(16,185,129,0.12);
  color: #34d399;
}

.card--finance .card-icon {
  background: rgba(250,204,21,0.12);
  color: #facc15;
}

.card--danger .card-icon {
  background: rgba(239,68,68,0.12);
  color: #f87171;
}

/* Card header - Dark Theme Contract */
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.card-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}

.card-icon .ui-icon {
  width: 17px;
  height: 17px;
}

.card-icon--info {
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary);
}

.card-icon--success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

/* Sekcje - Dark Theme Contract */
.section-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-subtitle {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Info rows - Dark Theme Contract */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.info-row .label {
  color: var(--text-muted);
}

.info-row .value {
  color: var(--text-primary);
  font-weight: 600;
}

.info-row .value.status-ok {
  color: #34d399;
}

.info-row .value.status-err {
  color: #f87171;
}

/* Notatki - Dark Theme Contract */
.notice {
  padding: 9px 12px;
  margin-bottom: 16px;
  border: 1px solid;
  font-size: 0.875rem;
  border-radius: 0;
}

.notice--warn {
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.2);
}

.notice--info {
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.2);
}

.notice--ok {
  background: rgba(16, 185, 129, 0.08);
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.2);
}

/* Ukrywanie */
.is-hidden {
  display: none !important;
}

.offer-shell {
  max-width: 760px;
  margin: 0 auto;
}

.offer-card {
  display: grid;
  gap: 20px;
}

.offer-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.offer-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.offer-mode-btn {
  flex: 1 1 0;
}

.offer-mode-btn.active {
  background: rgba(59, 130, 246, 0.10);
  color: var(--accent-blue);
  border-color: rgba(59, 130, 246, 0.35);
}

.offer-mode-note {
  margin-bottom: 0;
}

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

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

.form-field {
  display: grid;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.premium-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  padding: 9px 12px;
  font-size: 0.875rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 150ms, background 150ms;
}

.premium-input:focus {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.04);
}

.premium-input--compact {
  max-width: 180px;
}

.option-panel {
  padding: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.panel-label {
  margin: 0 0 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
}

.radio-option input {
  margin: 0;
  accent-color: #3b82f6;
}

.input-reveal {
  margin-top: 12px;
}

.info-inline {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--accent-blue);
}

.results-section {
  display: grid;
  gap: 14px;
}

.subsection-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.calc-results {
  display: grid;
  gap: 10px;
}

.calc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.calc-result-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.calc-result-value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: right;
}

.calc-result-value--positive {
  color: var(--accent-green);
  font-size: 1.05rem;
  font-weight: 700;
}

.calc-result-value--negative {
  color: var(--accent-red);
  font-size: 1.05rem;
  font-weight: 700;
}

.calc-meta {
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  font-size: 0.88rem;
}

.calc-status {
  padding: 14px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.calc-status--positive {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.calc-status--negative {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.calc-helper-note {
  padding: 12px 16px;
  font-size: 0.88rem;
  margin-top: 8px;
}

.calc-helper-note--positive {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
}

.calc-helper-note--negative {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

/* =================================================
   SCROLLBAR - Dark Theme Contract
   ================================================= */

body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.14);
}

/* Allegro content scroll area */
.allegro-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.allegro-content::-webkit-scrollbar {
  width: 6px;
}

.allegro-content::-webkit-scrollbar-track {
  background: transparent;
}

.allegro-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
}

.allegro-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.14);
}
