/* === Buttons === */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.4;
}

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

.btn-primary {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(200,16,46,0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--red-dark);
  box-shadow: 0 2px 8px rgba(200,16,46,0.35);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-full {
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  font-size: 16px;
  border-radius: 12px;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-light);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--cream-dark);
  color: var(--red);
}

.btn-this-week {
  background: var(--red-pale);
  border: 1px solid rgba(200,16,46,0.2);
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.2s ease;
}
.btn-this-week:hover {
  background: var(--red);
  color: var(--white);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-secondary {
  background: transparent;
  color: var(--text-mid);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--cream-dark);
  border-color: #ccc6bc;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-danger {
  background: var(--red-pale);
  color: var(--danger);
  border: 1.5px solid #fcdad6;
}

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

/* === Loading === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px;
  color: var(--text-mid);
  font-size: 15px;
}

.loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--cream-border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* === Upload Status Strip === */
.upload-status {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.week-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--white);
  border-radius: 20px;
  font-size: 13px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.week-slot .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.week-slot .status-dot.uploaded {
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(22,163,74,0.2);
}

.week-slot .status-dot.missing {
  border: 2px solid #d1cdc6;
  background: transparent;
}

.week-slot .slot-label {
  font-weight: 600;
  color: var(--text);
}

.week-slot .slot-detail {
  color: var(--text-light);
  font-size: 11px;
}

/* Legacy status-icon support */
.week-slot .status-icon { font-size: 12px; }

.week-delete-btn {
  background: none;
  border: none;
  color: #c0bab3;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 4px;
  transition: color 0.15s ease;
}

.week-delete-btn:hover {
  color: var(--danger);
}

.week-show-more {
  background: none;
  border: 1px solid var(--cream-border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.week-show-more:hover {
  border-color: var(--red);
  color: var(--red);
}


/* === Midweek Banner (used in drilldown/drill) === */
.midweek-banner {
  background: var(--colour-amber-bg);
  border: 1px solid var(--colour-amber-border);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--colour-amber-text);
  font-weight: 500;
}

.week-complete-banner {
  background: var(--green-pale);
  border: 1px solid #a9dfbf;
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--green);
  font-weight: 500;
}

/* === Collapsible Status Strip (dashboard) === */
.status-strip {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--white);
  transition: all 0.2s ease;
}
.status-strip-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  min-height: 36px;
}
.status-strip-bar:hover { background: var(--cream); }
.status-strip-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.status-strip-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.status-strip-chip.amber {
  background: var(--colour-amber-bg);
  color: var(--colour-amber-text);
  border: 1px solid var(--colour-amber-border);
}
.status-strip-chip.green {
  background: var(--green-pale);
  color: var(--green);
  border: 1px solid #a9dfbf;
}
.status-strip-toggle {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  padding: 0 4px;
  transition: transform 0.2s;
}
.status-strip.collapsed .status-strip-toggle {
  transform: rotate(-90deg);
}
.status-strip-body {
  padding: 8px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.status-strip.collapsed .status-strip-body {
  display: none;
}
.status-strip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  height: 44px;
  box-sizing: border-box;
}
.status-strip-item.amber {
  background: var(--colour-amber-bg);
  color: var(--colour-amber-text);
}
.status-strip-item.green {
  background: var(--green-pale);
  color: var(--green);
}
.status-strip-item.muted {
  background: #fef2f2;
  color: #991b1b;
}
.status-strip-item.neutral {
  background: #f0f4f8;
  color: #475569;
}
.status-strip-chip.neutral {
  background: #f0f4f8;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.status-strip-chip.muted {
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
}
.status-strip-chip.red {
  background: var(--red-pale);
  color: var(--red);
  border: 1px solid #fecaca;
}
.status-strip-item.red {
  background: var(--red-pale);
  color: var(--red);
  border: 1px solid #fecaca;
  align-items: flex-start;
  height: auto;
  min-height: 44px;
  padding: 10px 12px;
  line-height: 1.45;
}
.status-strip-item.red > span { min-width: 0; flex: 1; }
.status-strip-item .btn-unlock,
.status-strip-item .btn {
  flex-shrink: 0;
}

/* === Summary Card === */
.summary-card {
  background: var(--white);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--red);
  animation: fadeInUp 0.4s ease both;
}

.summary-card .label {
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.summary-card .value {

  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text);
}

.summary-card .sub {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 4px;
}

/* === Store Cards === */
.store-card {
  background: var(--white);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  border-top: 3px solid transparent;
  position: relative;
}

.store-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.store-card .store-name {

  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.rag-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.rag-badge-wrap {
  position: relative;
  display: inline-block;
  cursor: default;
}

.rag-badge-wrap {
  position: relative;
  display: inline-block;
}

.rag-popup {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 180px;
  z-index: 300;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text);
}

.rag-popup::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 16px;
  border: 6px solid transparent;
  border-bottom-color: #e0e0e0;
}

.rag-popup::after {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 17px;
  border: 5px solid transparent;
  border-bottom-color: #fff;
}

.rag-popup--open {
  display: block;
}

.rag-popup-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.rag-popup-row {
  font-size: 14px;
  color: var(--text);
  padding: 4px 0;
}

.rag-popup-row strong {
  color: #27ae60;
}

.rag-popup-or {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  padding: 2px 0;
}

.labour-hint-row td {
  font-size: 12px;
  color: var(--text-light);
  padding-top: 2px;
  padding-bottom: 6px;
}

.labour-hint-cell {
  font-weight: 600;
  color: #27ae60 !important;
}

.card-divider {
  border: none;
  border-top: 1px solid var(--cream-dark);
  margin: 16px 0;
}

.card-section {
  margin-top: 14px;
}

.card-section .section-label {
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
  font-weight: 600;
}

.big-number {

  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.diff { font-weight: 600; font-size: 14px; }
.diff.positive { color: var(--green); }
.diff.negative { color: var(--danger); }

.diff-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 14px;
}

.diff-row svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.supporting {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 4px;
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-mid);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {

  font-size: 16px;
  margin-bottom: 8px;
}

.empty-state .empty-hint {
  font-size: 14px;
  color: var(--text-light);
}

/* === Back button === */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 16px;
}

.back-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-pale);
}

.back-btn svg {
  flex-shrink: 0;
}

/* === Data Tables === */
.table-wrapper {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--cream-border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 10px 14px;
  text-align: right;
  background: var(--cream-dark);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.data-table th:first-child {
  text-align: left;
}

.data-table th.clickable {
  cursor: pointer;
  color: var(--red);
  transition: color 0.2s;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.data-table th.clickable:hover {
  color: var(--red-dark);
}

.data-table td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid var(--cream-dark);
  color: var(--text);
}

.data-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-mid);
}

.data-table tbody tr:nth-child(even) td {
  background: var(--cream);
}

.data-table tbody tr:hover td {
  background: var(--cream-dark);
}

.data-table tr.section-header td {
  background: var(--cream-dark);
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 14px 14px 8px;
  border-bottom: none;
}

.data-table .forecast-day {
  font-style: italic;
  color: #b0aaa2;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--white);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.modal-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200,16,46,0.1);
}

.confirm-modal {
  max-width: 420px;
}

/* === Missing Sales Modal === */
.missing-sales-modal {
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.missing-sales-modal .modal-hint {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.5;
  margin: 0 0 16px;
}
.missing-sales-body {
  overflow-y: auto;
  flex: 1;
  margin: 0 -4px;
  padding: 0 4px;
}
.missing-sales-day {
  margin-bottom: 18px;
}
.missing-sales-day h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.missing-sales-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.missing-sales-table th,
.missing-sales-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light, #eee);
  text-align: left;
}
.missing-sales-table th.num,
.missing-sales-table td.num {
  text-align: right;
}
.missing-sales-table th {
  font-weight: 600;
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
}
.missing-sales-table input[type="number"] {
  width: 110px;
  padding: 5px 8px;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  font-size: 13px;
  text-align: right;
}
.missing-sales-table input[type="number"]:focus {
  outline: none;
  border-color: #C8102E;
  box-shadow: 0 0 0 2px rgba(200,16,46,0.12);
}
.missing-sales-upload {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 22px;
  padding: 14px 16px;
  background: #f7f7f8;
  border: 1px solid var(--border-light, #e5e5e5);
  border-radius: 8px;
}
.missing-sales-upload label {
  cursor: pointer;
  margin: 0;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.missing-sales-upload-status {
  font-size: 12.5px;
  color: var(--text-mid);
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}
.missing-sales-upload-status:empty::before {
  content: 'Prefill Actual Sales from a StockLink Net After Adjustment export.';
  color: var(--text-light);
}
.missing-sales-upload-status.success { color: #005921; }
.missing-sales-upload-status.error { color: #C8102E; }
.missing-sales-table input.prefilled {
  background: rgba(0, 89, 33, 0.06);
  border-color: rgba(0, 89, 33, 0.4);
}
.badge-manual {
  display: inline-block;
  background: #C8102E;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}
.status-strip-item.clickable:hover {
  background: rgba(200,16,46,0.06);
}

.confirm-message {
  font-size: 15px;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 0;
}

.form-hint {
  font-size: 11px;
  color: var(--text-light);
  display: block;
  margin-top: 4px;
}

/* === Toggle Switch === */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  vertical-align: middle;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1cdc6;
  border-radius: 26px;
  transition: 0.25s ease;
}

.toggle .slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle input:checked + .slider {
  background: var(--green);
}

.toggle input:checked + .slider::before {
  transform: translateX(22px);
}

/* Impersonation banner */
.impersonation-banner {
  background: #fef3c7;
  border-bottom: 2px solid #f59e0b;
  color: #92400e;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.impersonation-banner strong {
  font-weight: 700;
}

.impersonation-return-btn {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.impersonation-return-btn:hover {
  background: #d97706;
}

@media (max-width: 768px) {
  .btn, .header-upload-btn {
    min-height: 44px;
  }

  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }

  .data-table {
    font-size: 13px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table td:first-child,
  .data-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
  }

  .data-table td:first-child {
    background: var(--white);
  }

  .data-table th:first-child {
    background: var(--cream-dark);
  }

  .modal {
    margin: auto 12px;
  }
}

.weather-summary { color: var(--text-light); margin-top: 4px; }

/* Allowance toggle */
.allowance-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  cursor: pointer;
}
.allowance-toggle-label { font-size: 13px; font-weight: 600; color: var(--text-mid); }
.allowance-toggle .toggle-switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.allowance-toggle .toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.allowance-toggle .toggle-track { position: absolute; inset: 0; background: #d1d5db; border-radius: 20px; cursor: pointer; transition: background 0.2s; }
.allowance-toggle .toggle-track::after { content: ''; position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 50%; top: 3px; left: 3px; transition: transform 0.2s; }
.allowance-toggle input:checked + .toggle-track { background: var(--red); }
.allowance-toggle input:checked + .toggle-track::after { transform: translateX(16px); }

/* Area filter */
.area-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 12px;
}
.area-pill {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.area-pill:hover { border-color: var(--red); color: var(--red); }
.area-pill.active { background: var(--red); color: #fff; border-color: var(--red); }
