/* ============================================
   Reset i zmienne
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-bg: #eff6ff;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-success: #16a34a;
  --color-warning: #f59e0b;
  --color-bg: #f1f5f9;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-border-focus: #93c5fd;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --transition: 150ms ease;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max-width: 1200px;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   Utility
   ============================================ */
.hidden { display: none !important; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.header-row h1 { flex-shrink: 0; }

.controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filters-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* ============================================
   Nawigacja
   ============================================ */
.navbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  height: 56px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--color-primary);
}

.navbar-links {
  display: flex;
  gap: 4px;
  margin-left: 24px;
  flex: 1;
}

.nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover, .nav-link.active {
  background: #eff6ff;
  color: var(--color-primary);
  text-decoration: none;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-display {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text);
}

/* ============================================
   Przyciski
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
  line-height: 1.5;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }

.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover:not(:disabled) { background: var(--color-bg); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: var(--color-danger-hover); }

.btn-block { width: 100%; }

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8125rem;
}

/* ============================================
   Formularze
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

input, select, textarea {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group.inline input,
.form-group.inline select {
  width: auto;
}

textarea { resize: vertical; }

.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--color-danger);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-top: 8px;
}

/* ============================================
   Komunikaty (flash)
   ============================================ */
.flash {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 200;
  max-width: 90vw;
  box-shadow: var(--shadow-md);
  animation: flashIn 200ms ease;
}

.flash.success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.flash.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

@keyframes flashIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================
   Karty
   ============================================ */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ============================================
   Logowanie
   ============================================ */
.page {
  min-height: calc(100vh - 56px);
}

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

.login-container .card {
  width: 100%;
  max-width: 400px;
}

.login-container h1 {
  font-size: 1.25rem;
  margin-bottom: 20px;
  text-align: center;
}

.login-container .form-group { margin-bottom: 16px; }

/* ============================================
   Sprzedaż — layout
   ============================================ */
.sales-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

.products-section h2,
.cart-section h2 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ============================================
   Lista produktów (grid przycisków)
   ============================================ */
.products-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Przycisk produktu */
.product-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 40px;
  padding: 8px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition), background var(--transition);
  text-align: left;
  user-select: none;
  box-shadow: var(--shadow);
}

.product-btn:hover,
.product-btn:focus-visible {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  outline: none;
}

.product-btn:focus-visible {
  background: var(--color-primary-bg);
}

.product-btn:active {
  transform: scale(0.97);
}
.product-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Tooltip z opóźnionym opisem */
.product-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  z-index: 10;
  max-width: 260px;
  padding: 8px 12px;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 6px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: var(--shadow-lg);
}

/* Strzałka tooltipu */
.product-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-text);
}

/* Pokaż tooltip po opóźnieniu — przez klasę dodawaną JS */
.product-btn.showing-tooltip .product-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Modal ilości — mały, centrowany */
.quantity-modal-content {
  max-width: 340px;
  width: 90%;
}

.quantity-modal-content .modal-header h2 {
  font-size: 1rem;
}

/* ============================================
   Koszyk
   ============================================ */
.cart-section {
  position: sticky;
  top: 80px;
  align-self: start;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-meta { color: var(--color-text-muted); }

/* Quantity control in cart */
.cart-qty-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.cart-qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.cart-qty-btn:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
}

.cart-qty-input {
  width: 44px;
  height: 26px;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--color-text);
  -moz-appearance: textfield;
}
.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Sale type selector (radio toggle in cart) */
.sale-type-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.radio-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.radio-label:hover {
  border-color: var(--color-primary);
}
.radio-label input[type="radio"] {
  accent-color: var(--color-primary);
}
.radio-label:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

/* Disabled submit button */
#submitSaleBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.cart-qty-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.cart-item-remove {
  background: none;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.cart-item-remove:hover { background: #fef2f2; }

.cart-empty {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  padding: 24px;
}
.cart-section textarea {
  font-size: 0.8125rem;
  font-family: inherit;
}

/* ============================================
   Tabela
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  margin-top: 16px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.table th {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.table tbody tr {
  background: var(--color-surface);
  transition: background var(--transition);
}

.table tbody tr:hover { background: var(--color-bg); }

.table tbody tr.clickable { cursor: pointer; }

/* ============================================
   Paginacja
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.admin-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
}

.admin-section .header-row { margin-bottom: 0; }

/* ============================================
   Modal
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
}

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

.modal-header h2 {
  font-size: 1.125rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--color-text); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.modal .form-group { margin-bottom: 16px; }

/* ============================================
   Szczegóły sprzedaży (modal content)
   ============================================ */
#saleDetailContent { font-size: 0.875rem; }
#saleDetailContent .detail-row {
  display: flex;
  gap: 8px;
  padding: 4px 0;
}
#saleDetailContent .detail-label {
  font-weight: 600;
  min-width: 100px;
  color: var(--color-text-muted);
}
#saleDetailContent table { margin-top: 12px; }

/* ============================================
   Loading
   ============================================ */
.loading {
  text-align: center;
  padding: 32px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.empty {
  text-align: center;
  padding: 32px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

h1 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ============================================
   Responsywność
   ============================================ */
@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 16px;
  }

  .menu-toggle { display: block; }

  .navbar-links {
    display: none;
    flex-direction: column;
    width: 100%;
    margin-left: 0;
    order: 10;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    margin-top: 8px;
  }

  .navbar-links.open { display: flex; }

  .navbar-right {
    margin-left: auto;
  }

  .sales-layout {
    grid-template-columns: 1fr;
  }

  .cart-section {
    position: static;
  }

  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls, .filters-row {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .controls .form-group.inline,
  .filters-row .form-group.inline {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-group.inline input,
  .form-group.inline select {
    width: 100%;
  }

}

/* ============================================
   Plany sprzedazy — banner pracownika
   ============================================ */
.plan-banner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.plan-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.plan-banner-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.plan-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 160px;
  max-width: 280px;
}

.plan-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.plan-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.plan-progress-fill.pct-green { background: #22c55e; }
.plan-progress-fill.pct-yellow { background: #eab308; }
.plan-progress-fill.pct-red { background: #ef4444; }

.plan-progress-text {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 36px;
  text-align: right;
}

.plan-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.plan-mini-table th,
.plan-mini-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.plan-mini-table th {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* ============================================
   Plany sprzedazy — kolory postępu (span)
   ============================================ */
.pct-green { color: #22c55e; font-weight: 600; }
.pct-yellow { color: #eab308; font-weight: 600; }
.pct-red { color: #ef4444; font-weight: 600; }

/* ============================================
   Plany sprzedazy — modal formularza
   ============================================ */
.plan-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.plan-product-select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
}

.plan-product-select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.plan-qty-input {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  -moz-appearance: textfield;
}

.plan-qty-input::-webkit-outer-spin-button,
.plan-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.plan-qty-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Plan modal — slightly wider */
#planModal .modal-content {
  max-width: 640px;
}

/* ============================================
   Tabela obrotowa historii (pivot)
   ============================================ */

.pivot-table {
  border-collapse: separate;
  border-spacing: 0;
}

/* First column — sticky on horizontal scroll */
.pivot-table .pivot-label {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--color-surface);
  min-width: 180px;
  max-width: 220px;
  white-space: normal;
  vertical-align: top;
  border-right: 2px solid var(--color-border);
}

thead .pivot-label {
  z-index: 3;
  background: var(--color-header-bg);
}

/* Product header columns */
.pivot-table thead th:not(.pivot-label) {
  min-width: 80px;
  text-align: center;
}

/* Plan row */
.pivot-plan {
  background: #f0f4ff;
}

.pivot-plan-cell {
  text-align: center;
  font-weight: 600;
  color: #1d4ed8;
}

/* Totals row */
.pivot-totals {
  background: #f0fdf4;
  border-top: 2px solid var(--color-border);
}

.pivot-total-cell {
  text-align: center;
  font-weight: 700;
  color: #15803d;
}

/* Data cells */
.pivot-table tbody td:not(.pivot-label) {
  text-align: center;
}

/* Metadata under sale label */
.pivot-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Label cell in body */
.pivot-table tbody .pivot-label {
  background: var(--color-surface);
}

/* Hover effect — don't override sticky bg */
.pivot-table tbody tr:hover .pivot-label {
  background: var(--color-bg);
}

/* ============================================
   Dashboard
   ============================================ */

/* Team summary */
.dashboard-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.dashboard-summary h2 {
  margin: 0 0 16px 0;
  font-size: 1.125rem;
  color: var(--color-text);
}

.dashboard-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-stat {
  text-align: center;
}

.dashboard-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.dashboard-stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

/* Category section */
.dashboard-category-section {
  margin-bottom: 32px;
}

.dashboard-category-section h3 {
  font-size: 1rem;
  color: var(--color-text);
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}

.priority-section h3 {
  border-bottom-color: var(--color-primary);
  color: var(--color-primary);
}

/* Cards grid */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Individual plan card */
.dashboard-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
  transition: box-shadow 0.2s;
}

.dashboard-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.dashboard-card-employee {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.dashboard-card-pct {
  font-size: 1.125rem;
  font-weight: 700;
}

.dashboard-card-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.dashboard-card-stat {
  display: flex;
  justify-content: space-between;
}

.dashboard-card-stat span {
  color: var(--color-text-muted);
}

.dashboard-card-stat strong {
  color: var(--color-text);
}

/* Toggle button */
.dashboard-card-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  color: var(--color-primary);
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.dashboard-card-toggle:hover {
  background: var(--color-bg);
}

.dashboard-card-items {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

/* Over-plan styling */
.over-plan {
  color: #22c55e !important;
  font-weight: 600;
}

/* Dashboard my plan section */
#dashboardMyPlan {
  margin-top: 24px;
}

#myPlanDetails {
  margin-top: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-summary-stats {
    grid-template-columns: repeat(2, 1fr);
  }

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

/* ── Working days control ── */
.working-days-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.working-days-control label {
  margin-bottom: 0;
  margin-right: 4px;
  font-size: 0.8125rem;
}

.working-days-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 4px;
  cursor: pointer;
}

.working-days-btn:hover {
  background: var(--color-bg);
}

.working-days-input {
  width: 44px;
  text-align: center;
  padding: 4px 2px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface);
  color: var(--color-text);
  pointer-events: none;
}

/* ── Dashboard pivot table ── */
.dashboard-pivot {
  font-size: 0.875rem;
}

.dashboard-pivot .pivot-label {
  font-weight: 600;
  background: var(--color-surface);
  border-right: 2px solid var(--color-border);
  min-width: 140px;
}

.dashboard-pivot thead th {
  text-align: center;
  white-space: nowrap;
  padding: 8px 6px;
  font-size: 0.8125rem;
}

.dashboard-pivot thead th.pivot-label {
  text-align: left;
}

.dashboard-pivot tbody td {
  text-align: center;
  padding: 6px;
}

.dashboard-pivot tbody td.pivot-label {
  text-align: left;
}

.dashboard-pivot .pivot-plan {
  background: #f0f4ff;
}

.dashboard-pivot .pivot-plan-cell {
  font-weight: 700;
}

/* ── Dashboard my products table ── */
.dashboard-my-products {
  font-size: 0.875rem;
}

.dashboard-my-products thead th {
  text-align: center;
}

.dashboard-my-products thead th:first-child {
  text-align: left;
}

.dashboard-my-products tbody td {
  text-align: center;
  vertical-align: middle;
}

.dashboard-my-products tbody td:first-child {
  text-align: left;
  font-weight: 500;
}

/* ── Inline progress bar (in table cell) ── */
.progress-cell {
  padding: 6px 8px;
}

.inline-progress-bar {
  position: relative;
  height: 20px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
  min-width: 100px;
}

.inline-progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
}

.inline-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e293b;
  text-shadow: 0 0 2px rgba(255,255,255,0.8);
  white-space: nowrap;
}

/* ── Dashboard controls layout ── */
#page-dashboard .controls {
  flex-wrap: wrap;
  gap: 8px 16px;
}