.home-page {
  display: grid;
  gap: 20px;
  padding-bottom: 28px;
  min-width: 0;
  max-width: 100%;
}

.home-date-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 0;
  padding-bottom: 2px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.home-date-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.home-date-actions .ui-field-inline {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.home-date-actions .ui-field-inline input {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.home-day-summary { display: grid; gap: 18px; padding: 20px; }
.home-day-header { align-items: center; margin-bottom: 0; }
.home-day-header h1 { margin: 0; color: var(--text); font-family: var(--font-display); font-size: clamp(28px, 4vw, 46px); font-weight: 400; letter-spacing: -0.04em; line-height: 1.15; word-break: break-word; }

.home-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 0;
}

.home-periods { min-width: 0; }

.home-period-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.home-period {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-warm);
}

.home-period-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.home-period-header .ui-kicker { margin-bottom: 4px; }
.home-period-header h3 { margin: 0; color: var(--text); font-family: var(--font-display); font-size: 20px; font-weight: 400; }

.home-period-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding-top: 12px;
}

.home-period-stats > div { min-width: 0; }
.home-period-stats dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.home-period-stats dd { margin: 4px 0 2px; color: var(--text); font-size: 18px; font-weight: 800; line-height: 1.1; }
.home-period-stats small { display: block; color: var(--muted); font-size: 10px; line-height: 1.35; }

.home-shifts,
.home-insights { min-width: 0; }

.home-shifts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.home-shifts-header .ui-kicker { margin: 0; }

.home-insights { padding: 20px; }

.home-shift-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-shift {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-warm);
}

.home-shift-noche { background: var(--surface-subtle); }

.home-shift-header,
.home-shift-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.home-shift-header { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.home-shift-header .ui-kicker { margin-bottom: 4px; }
.home-shift-header h3 { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 400; }

.home-shift-sales { padding: 15px 0 12px; }
.home-shift-sales strong { display: block; color: var(--text); font-family: var(--font-display); font-size: 31px; font-weight: 400; letter-spacing: -0.04em; line-height: 1; }
.home-shift-sales span,
.home-shift-sales small { display: block; color: var(--muted); }
.home-shift-sales span { margin-top: 6px; font-size: 11px; }
.home-shift-sales small { margin-top: 3px; font-size: 10px; }

.home-shift-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}

.home-shift-stats > div { min-width: 0; padding-top: 9px; border-top: 1px solid var(--border); }
.home-shift-stats dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.home-shift-stats dd { margin: 5px 0 2px; color: var(--text); font-size: 18px; font-weight: 800; line-height: 1.1; }
.home-shift-stats small { display: block; color: var(--muted); font-size: 10px; line-height: 1.35; }

.home-shift-footer {
  align-items: center;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
}

.home-insights-list { display: grid; gap: 9px; }

.home-insight {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-warm);
}

.home-insight-marker { width: 8px; height: 8px; margin-top: 4px; border-radius: 99px; background: var(--muted); }
.home-insight p { margin: 0; color: var(--text); font-size: 12px; line-height: 1.45; }
.home-insight-positive { border-color: color-mix(in srgb, var(--ok) 22%, var(--border)); background: var(--surface-success); }
.home-insight-positive .home-insight-marker { background: var(--ok); }
.home-insight-warning { border-color: color-mix(in srgb, var(--warn) 24%, var(--border)); background: var(--surface-warning); }
.home-insight-warning .home-insight-marker { background: var(--warn); }
.home-insight-info .home-insight-marker { background: var(--brand); }

@media (max-width: 960px) {
  .home-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-period-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .home-date-toolbar {
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .home-date-actions {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .home-date-actions .ui-field-inline {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .home-date-actions .ui-field-inline input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 640px) {
  .home-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-day-summary { padding: 15px; }
  .home-day-header { align-items: flex-start; }
  .home-day-header h1 { font-size: clamp(22px, 6vw, 32px); line-height: 1.15; }
  .home-insights { padding: 15px; }
  .home-shift-grid { grid-template-columns: 1fr; }
  .home-period-stats { grid-template-columns: 1fr; }

  .home-chart-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 8px;
  }

  .home-chart-tooltip {
    display: none !important;
  }

  .home-detail-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Home Period Bar Chart (Venta Real vs Estimada) */
.home-period-chart {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.home-chart-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.home-legend-items {
  display: flex;
  align-items: center;
  gap: 14px;
}

.home-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-neutral);
}

.home-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.home-legend-real {
  background: var(--text);
}

.home-legend-forecast {
  background: var(--accent);
}

.home-legend-hint {
  font-size: 10px;
  color: var(--muted);
}

.home-chart-card {
  position: relative;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.home-chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  box-sizing: border-box;
}

.home-chart-box {
  position: relative;
  width: 100%;
  min-width: 0;
}

.home-chart-scroll.is-monthly .home-chart-box {
  min-width: 780px;
}

.home-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  user-select: none;
  touch-action: pan-x pan-y;
}

.home-bar-col {
  cursor: pointer;
  outline: none;
  touch-action: pan-x pan-y;
}

.home-bar-col:hover .home-bar-hover-zone,
.home-bar-col:focus-visible .home-bar-hover-zone,
.home-bar-col.is-selected .home-bar-hover-zone {
  fill: rgba(0, 0, 0, 0.05);
}

.home-bar-col:hover .home-bar-real,
.home-bar-col:focus-visible .home-bar-real,
.home-bar-col.is-selected .home-bar-real {
  filter: brightness(1.2);
}

.home-bar-col:hover .home-bar-forecast,
.home-bar-col:focus-visible .home-bar-forecast,
.home-bar-col.is-selected .home-bar-forecast {
  filter: brightness(1.15);
}

.home-bar-col.is-selected .home-bar-real {
  stroke: var(--text);
  stroke-width: 1.5;
}

.home-bar-col.is-selected .home-bar-forecast {
  stroke: var(--accent);
  stroke-width: 1.5;
}

.home-bar-real {
  fill: var(--text);
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.home-bar-forecast {
  fill: var(--accent);
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.home-bar-forecast-future {
  fill: color-mix(in srgb, var(--accent) 70%, transparent);
}

.home-bar-empty {
  fill: var(--border);
  opacity: 0.5;
}

.home-bar-future-slot {
  fill: var(--border);
  opacity: 0.25;
}

.home-bar-target-bg {
  fill: color-mix(in srgb, var(--brand) 10%, transparent);
  stroke: color-mix(in srgb, var(--brand) 28%, transparent);
  stroke-width: 1;
}

.home-bar-col.is-target .home-bar-hover-zone {
  fill: transparent;
}

.home-bar-label-day {
  font-size: 10px;
  font-weight: 600;
  fill: var(--muted);
  text-anchor: middle;
}

.home-bar-label-date {
  font-size: 11px;
  font-weight: 700;
  fill: var(--text);
  text-anchor: middle;
}

.home-bar-col.is-target .home-bar-label-date,
.home-bar-col.is-selected .home-bar-label-date {
  fill: var(--brand);
  font-weight: 800;
}

.home-bar-col.is-target .home-bar-label-day,
.home-bar-col.is-selected .home-bar-label-day {
  fill: var(--brand);
  font-weight: 700;
}

.home-bar-value {
  font-size: 9px;
  font-weight: 700;
  fill: var(--muted);
  text-anchor: middle;
}

/* Tooltip (matching comparable-chart-tooltip) */
.home-chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(29, 29, 27, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  color: #ffffff;
  font-size: 11px;
  padding: 8px 10px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 20;
  transition: transform 0.05s ease;
}

.home-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.home-tooltip-head strong {
  font-size: 11px;
  font-weight: 800;
}

.home-tooltip-badge {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  text-transform: uppercase;
}

.home-tooltip-badge.is-target {
  background: var(--brand);
  color: #ffffff;
}

.home-tooltip-body {
  display: grid;
  gap: 3px;
}

.home-tooltip-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.home-tooltip-row span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
}

.home-tooltip-row strong {
  font-weight: 700;
}

.home-tooltip-row.shift-lunch strong {
  color: #fbd38d;
}

.home-tooltip-row.shift-night strong {
  color: #90cdf4;
}

.home-tooltip-row.delta {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 2px;
  padding-top: 3px;
}

.home-tooltip-row .delta-positive {
  color: #68d391;
}

.home-tooltip-row .delta-negative {
  color: #fc8181;
}

/* Selected Day Detail Card */
.home-chart-detail {
  margin-top: 10px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.home-detail-card {
  padding: 10px 12px;
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.home-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.home-detail-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-detail-title strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.home-detail-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-detail-badge.is-target {
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--brand);
}

.home-detail-badge.is-future {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.home-detail-badge.is-closed {
  background: var(--surface-subtle);
  color: var(--muted);
}

.home-detail-delta {
  font-size: 11px;
}

.home-detail-delta span {
  color: var(--muted);
}

.home-detail-delta.is-positive strong {
  color: var(--ok, #10b981);
}

.home-detail-delta.is-negative strong {
  color: var(--danger, #ef4444);
}

.home-detail-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  gap: 8px;
}

.home-detail-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.home-detail-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.home-detail-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.home-detail-metric.shift-lunch .home-detail-val {
  color: #b7791f;
}

.home-detail-metric.shift-night .home-detail-val {
  color: #2b6cb0;
}

