/* ── Dashboard ── */
.dash { display: grid; gap: 20px; min-width: 0; overflow-x: hidden; max-width: 100%; }

/* Header */
.dash-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dash-header__title { margin: 0; font-size: 22px; font-weight: 700; color: var(--text-primary); }
.dash-header__badges { display: flex; gap: 14px; margin-top: 4px; }
.dash-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); }
.dash-badge__icon { width: 15px; height: 15px; }

/* Quick action buttons */
.dash-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
}
.dash-action-btn svg { width: 14px; height: 14px; }
.dash-action-btn--default { background: var(--bg-card); color: var(--text-primary); }
.dash-action-btn--default:hover { background: var(--bg-hover); }
.dash-action-btn--green { background: #059669; color: #fff; border-color: #059669; }
.dash-action-btn--green:hover { background: #10b981; border-color: #10b981; }
.dash-action-btn--amber { background: #d97706; color: #fff; border-color: #d97706; }
.dash-action-btn--amber:hover { background: #f59e0b; border-color: #f59e0b; }
.dash-action-btn--purple { background: #6366f1; color: #fff; border-color: #6366f1; }
.dash-action-btn--purple:hover { background: #818cf8; border-color: #818cf8; }

/* Date filter */
.dash-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.dash-filter__label { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); }
.dash-filter__icon { width: 15px; height: 15px; }
.dash-filter__tabs { display: flex; min-width: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 3px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); overflow-x: auto; }
.dash-filter__tab { padding: 5px 10px; border: none; background: none; border-radius: 7px; font-size: 12px; font-weight: 500; color: var(--text-secondary); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.dash-filter__tab:hover { color: var(--text-primary); }
.dash-filter__tab--active { background: var(--bg-hover); color: var(--text-primary); }
.dash-filter__custom { display: flex; align-items: center; gap: 6px; }
.dash-filter__date { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 12px; color: var(--text-primary); }
.dash-filter__date:focus { outline: none; box-shadow: 0 0 0 3px rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.5); }
.dash-filter__sep { font-size: 12px; color: var(--text-muted); }

/* Metric cards grid */
.dash-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .dash-metrics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .dash-metrics { grid-template-columns: 1fr 1fr; } }

.dash-metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-metric--highlight {
  background: var(--bg-base);
  border-color: rgba(16,185,129,0.3);
}
[data-theme="dark"] .dash-metric--highlight { border-color: rgba(16,185,129,0.15); }
.dash-metric--link { text-decoration: none; cursor: pointer; transition: border-color .15s, box-shadow .15s; display: block; color: inherit; }
.dash-metric--link:hover { border-color: rgba(16,185,129,0.4); box-shadow: 0 2px 8px rgba(16,185,129,0.1); }
.dash-badge--link { text-decoration: none; cursor: pointer; transition: opacity .15s; }
.dash-badge--link:hover { opacity: 0.8; }
.dash-overhead--link { text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s; display: flex; }
.dash-overhead--link:hover { border-color: rgba(16,185,129,0.4); }
.dash-metric__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dash-metric__label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.dash-metric__icon-wrap {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.dash-metric__icon-wrap--green { background: #ecfdf5; color: #059669; }
.dash-metric__icon-wrap--red   { background: #fef2f2; color: #dc2626; }
.dash-metric__icon-wrap--blue  { background: #eff6ff; color: #2563eb; }
.dash-metric__icon-wrap--emerald { background: #ecfdf5; color: #059669; }
[data-theme="dark"] .dash-metric__icon-wrap--green   { background: rgba(16,185,129,0.1); color: #34d399; }
[data-theme="dark"] .dash-metric__icon-wrap--red     { background: rgba(220,38,38,0.1); color: #f87171; }
[data-theme="dark"] .dash-metric__icon-wrap--blue    { background: rgba(37,99,235,0.1); color: #60a5fa; }
[data-theme="dark"] .dash-metric__icon-wrap--emerald { background: rgba(16,185,129,0.1); color: #34d399; }
.dash-metric__svg { width: 16px; height: 16px; }
.dash-metric__value { font-size: 24px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.dash-metric__value--pos { color: #059669; }
.dash-metric__value--neg { color: #dc2626; }
[data-theme="dark"] .dash-metric__value--pos { color: #34d399; }
[data-theme="dark"] .dash-metric__value--neg { color: #f87171; }
.dash-metric__sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Business overhead banner */
.dash-overhead {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-overhead__left { display: flex; align-items: center; gap: 10px; }
.dash-overhead__icon-wrap {
  width: 36px; height: 36px; border-radius: 8px;
  background: #fffbeb; display: flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .dash-overhead__icon-wrap { background: rgba(217,119,6,0.1); }
.dash-overhead__svg { width: 18px; height: 18px; color: #d97706; }
[data-theme="dark"] .dash-overhead__svg { color: #fbbf24; }
.dash-overhead__title { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.dash-overhead__subtitle { font-size: 12px; color: var(--text-muted); }
.dash-overhead__amount { font-size: 16px; font-weight: 600; color: #dc2626; font-variant-numeric: tabular-nums; }
[data-theme="dark"] .dash-overhead__amount { color: #f87171; }

/* Two-column grid */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-sidebar-col { display: grid; gap: 20px; align-content: start; }

/* Generic card */
.dash-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow: hidden; display: flex; flex-direction: column;
}
.dash-card--wide { grid-column: 1; }
.dash-card__head { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.dash-card__title { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.dash-card__body--flush { padding: 0; }
.dash-card__body--scroll { max-height: 400px; overflow-y: auto; }

.dash-empty { padding: 28px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* Vehicle rows */
.dash-vehicle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; transition: background .12s;
}
.dash-vehicle-row:last-child { border-bottom: none; }
.dash-vehicle-row:hover { background: var(--bg-hover); }
.dash-vehicle-row__thumb {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  background: var(--bg-base); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); overflow: hidden;
}
.dash-vehicle-row__thumb svg { width: 20px; height: 20px; }
.dash-vehicle-row__thumb--has-img { border: none; }
.dash-vehicle-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.dash-vehicle-row__info { flex: 1; min-width: 0; }
.dash-vehicle-row__right { margin-left: auto; display: flex; align-items: center; gap: 10px; text-align: right; flex-shrink: 0; }
.dash-vehicle-row__name { font-size: 14px; font-weight: 500; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.dash-vehicle-row:hover .dash-vehicle-row__name { color: #059669; }
[data-theme="dark"] .dash-vehicle-row:hover .dash-vehicle-row__name { color: #34d399; }
.dash-stock {
  display: inline-block; padding: 1px 5px; border-radius: 4px;
  background: var(--bg-hover); font-size: 10px; font-family: monospace; color: var(--text-secondary);
}
.dash-vehicle-row__sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.dash-vehicle-row__label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.dash-vehicle-row__profit { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.dash-vehicle-row__profit--pos { color: #059669; }
.dash-vehicle-row__profit--neg { color: #dc2626; }
[data-theme="dark"] .dash-vehicle-row__profit--pos { color: #34d399; }
[data-theme="dark"] .dash-vehicle-row__profit--neg { color: #f87171; }
.dash-vehicle-row__arrow { width: 16px; height: 16px; color: var(--text-muted); transition: color .12s; }
.dash-vehicle-row:hover .dash-vehicle-row__arrow { color: #059669; }

/* List rows (parts, tech hours) */
.dash-list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.dash-list-row:last-child { border-bottom: none; }
.dash-list-row__name { font-size: 13px; font-weight: 500; color: var(--text-primary); word-break: break-word; }
.dash-list-row__value { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.dash-pill {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500; background: #eff6ff; color: #2563eb; flex-shrink: 0;
}
[data-theme="dark"] .dash-pill { background: rgba(37,99,235,0.1); color: #60a5fa; }

/* Sale rows */
.dash-sale-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.dash-sale-row:last-child { border-bottom: none; }
.dash-sale-row__part { font-size: 14px; font-weight: 500; color: var(--text-primary); word-break: break-word; }
.dash-sale-row__meta { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.dash-sale-row__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--border-hover, #d4d4d8); }
.dash-sale-row__old { color: #3b82f6; }
[data-theme="dark"] .dash-sale-row__old { color: #60a5fa; }
.dash-sale-row__sold-by { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.dash-sale-row__amount { font-size: 14px; font-weight: 500; color: #059669; font-variant-numeric: tabular-nums; flex-shrink: 0; }
[data-theme="dark"] .dash-sale-row__amount { color: #34d399; }
.dash-sale-row--link { text-decoration: none; color: inherit; transition: background .12s; cursor: pointer; }
.dash-sale-row--link:hover { background: var(--bg-hover); }
.dash-sale-row--link:hover .dash-sale-row__part { color: #059669; }
[data-theme="dark"] .dash-sale-row--link:hover .dash-sale-row__part { color: #34d399; }

/* ── Mobile polish ── */
@media (max-width: 640px) {
  .dash-header__actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .dash-action-btn { justify-content: center; padding: 8px 6px; font-size: 11px; min-width: 0; }
  .dash-filter { flex-direction: column; align-items: stretch; }
  .dash-filter__tabs { width: 100%; overflow-x: auto; }
  .dash-filter__custom { width: 100%; }
  .dash-filter__date { flex: 1; min-width: 0; }
  .dash-header__badges { flex-wrap: wrap; gap: 8px; }
  .dash-metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dash-metric { padding: 10px; border-radius: 8px; }
  .dash-metric__header { margin-bottom: 4px; }
  .dash-metric__label { font-size: 10px; }
  .dash-metric__value { font-size: 16px; }
  .dash-metric__icon-wrap { display: none; }
  .dash-metric__sub { font-size: 10px; margin-top: 2px; }
  .dash-overhead { padding: 12px 14px; gap: 8px; }
  .dash-vehicle-row { padding: 10px 12px; flex-wrap: wrap; gap: 6px; }
  .dash-vehicle-row__right { flex-shrink: 1; min-width: 0; }
  .dash-vehicle-row__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .dash-sale-row { padding: 10px 12px; flex-wrap: wrap; gap: 6px; }
  .dash-list-row { padding: 8px 12px; flex-wrap: wrap; gap: 4px; }
  .dash-card__head { padding: 12px 14px; }
  .dash-platform-bar { margin: 0 10px 8px; }
}
@media (max-width: 400px) {
  .dash-filter__tab { padding: 4px 8px; font-size: 11px; }
  .dash-metrics { grid-template-columns: 1fr 1fr; gap: 6px; }
}

/* ── Platform Breakdown ── */
.dash-platform-bar {
  display: flex; height: 8px; border-radius: 4px; overflow: hidden;
  margin: 0 16px 8px; gap: 2px;
}
.dash-platform-bar__seg { min-width: 4px; border-radius: 2px; transition: width .3s; }
.dash-platform-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.dash-text-muted { color: var(--text-secondary); font-size: 11px; }

/* ── Clickable Platform Rows ── */
.dash-list-row--link {
  text-decoration: none; cursor: pointer; transition: background .15s;
}
.dash-list-row--link:hover { background: var(--bg-hover); }

/* ── Sale Badges ── */
.dash-sale-badge {
  display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 6px;
  border-radius: 4px; margin-left: 6px; vertical-align: middle;
  background: var(--bg-hover); color: var(--text-secondary);
}
.dash-sale-badge--ebay { background: #3665f3; color: #fff; }

/* ── Team Activity Row ── */
.dash-activity-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.dash-activity-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted); margin-right: 4px; vertical-align: middle;
}
.dash-activity-dot--on { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,.5); }
.dash-clock-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-clock-vehicle { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-clock-elapsed {
  font-size: 12px; font-weight: 600; color: var(--accent);
  white-space: nowrap; margin-left: auto; padding-left: 8px;
}
.dash-card__subtitle { font-size: 11px; color: var(--text-secondary); font-weight: 400; }

/* ── Weekly Tasks ── */
.dash-week-progress { margin-bottom: 16px; }
.dash-week-progress__bar {
  height: 6px; border-radius: 3px; background: var(--bg-hover); overflow: hidden;
}
.dash-week-progress__fill {
  height: 100%; border-radius: 3px; background: #22c55e; transition: width .3s;
}
.dash-week-progress__label {
  display: block; font-size: 11px; color: var(--text-secondary); margin-top: 4px; text-align: right;
}
.dash-week-days { display: flex; gap: 4px; justify-content: space-between; }
.dash-week-day {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 2px; border-radius: 6px; transition: background .15s;
}
.dash-week-day--today { background: var(--bg-hover); }
.dash-week-day__label { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.dash-week-day--today .dash-week-day__label { color: var(--accent); }
.dash-week-day__bar-wrap {
  width: 100%; height: 40px; display: flex; align-items: flex-end; justify-content: center;
}
.dash-week-day__bar {
  width: 70%; min-width: 8px; border-radius: 3px 3px 0 0; background: #3b82f6;
  transition: height .3s;
}
.dash-week-day--today .dash-week-day__bar { background: #22c55e; }
.dash-week-day__count { font-size: 10px; font-weight: 600; color: var(--text-primary); }

@media (max-width: 900px) {
  .dash-activity-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-week-day__bar-wrap { height: 30px; }
}

/* ── PWA Install Instructions Modal ── */
.pwa-instructions-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.pwa-instructions-modal {
  background: var(--bg-card, #1e293b); color: var(--text-primary, #f1f5f9);
  border-radius: 12px; padding: 1.5rem; max-width: 380px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.pwa-instructions-modal h3 { margin: 0 0 .75rem; font-size: 1.1rem; }
.pwa-instructions-modal p { margin: 0; line-height: 1.6; font-size: .9rem; color: var(--text-secondary, #94a3b8); }
