/* Mechanic Phase 4C-β — service reminders island styles.
 *
 * Mobile-first; ≥44×44 px tap targets on all interactive elements
 * (filter chips, instance cards, rule cards, action sheet buttons).
 * Theme-aware via portal :root + .light vars — NO hardcoded hex per
 * inspections.css convention.
 */

/* =====================================================================
 * Page shell + tabs
 * ===================================================================== */

.sr-page {
  padding: 0;
  max-width: 100%;
}

.sr-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sr-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--fg-muted, #aaa);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.sr-tab:hover {
  color: var(--fg, #fff);
}

.sr-tab--active {
  color: var(--fg, #fff);
  border-bottom-color: var(--accent, #00D4AA);
}

.sr-page__body {
  padding: 0 16px 24px;
}

/* =====================================================================
 * Filter chips (Upcoming reminders tab)
 * ===================================================================== */

.sr-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.sr-filter-chip {
  min-height: 44px;
  padding: 10px 14px;
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  border-radius: 20px;
  color: var(--fg-muted, #aaa);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sr-filter-chip:hover {
  background: var(--bg-2, rgba(255, 255, 255, 0.07));
  color: var(--fg, #fff);
}

.sr-filter-chip--active {
  background: var(--accent, #00D4AA);
  color: var(--accent-fg);
  border-color: var(--accent, #00D4AA);
}

.sr-filter-chip__count {
  font-size: 11px;
  font-weight: 600;
  background: var(--hover-strong);
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* =====================================================================
 * Instance cards (upcoming reminders)
 * ===================================================================== */

.sr-instance-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sr-instance-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title due"
    "vehicle due"
    "customer due";
  gap: 4px 12px;
  align-items: center;
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  border-left-width: 4px;
  border-radius: 8px;
  padding: 14px 16px;
  min-height: 44px;
  cursor: pointer;
  transition: background 120ms ease, transform 200ms ease, opacity 200ms ease;
}

.sr-instance-card:hover,
.sr-instance-card:focus {
  background: var(--bg-2, rgba(255, 255, 255, 0.07));
  outline: none;
}

.sr-instance-card--overdue {
  border-left-color: var(--danger, #ff5a5f);
}

.sr-instance-card--due-soon {
  border-left-color: var(--warning, #f5a623);
}

.sr-instance-card--neutral {
  border-left-color: var(--line, rgba(255, 255, 255, 0.06));
}

.sr-instance-card--dismissing {
  transform: translateX(20px);
  opacity: 0;
  pointer-events: none;
}

.sr-instance-card__title {
  grid-area: title;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg, #fff);
}

.sr-instance-card__vehicle {
  grid-area: vehicle;
  font-size: 13px;
  color: var(--fg-muted, #aaa);
}

.sr-instance-card__customer {
  grid-area: customer;
  font-size: 12px;
  color: var(--fg-subtle, #888);
}

.sr-instance-card__due {
  grid-area: due;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted, #aaa);
  text-align: right;
  white-space: nowrap;
}

.sr-instance-card--overdue .sr-instance-card__due {
  color: var(--danger, #ff5a5f);
}

.sr-instance-card--due-soon .sr-instance-card__due {
  color: var(--warning, #f5a623);
}

/* =====================================================================
 * Rules list
 * ===================================================================== */

.sr-rules-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0;
  gap: 16px;
}

.sr-rules-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.sr-btn {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  color: var(--fg, #fff);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.sr-btn--primary {
  background: var(--accent, #00D4AA);
  color: var(--accent-fg);
  border-color: var(--accent, #00D4AA);
}

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

.sr-rule-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sr-rule-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  border-radius: 8px;
  padding: 14px 16px;
  min-height: 44px;
  cursor: pointer;
  transition: background 120ms ease;
}

.sr-rule-card:hover,
.sr-rule-card:focus {
  background: var(--bg-2, rgba(255, 255, 255, 0.07));
  outline: none;
}

.sr-rule-card--inactive {
  opacity: 0.55;
}

.sr-rule-card__main {
  flex: 1 1 auto;
  min-width: 0;
}

.sr-rule-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg, #fff);
}

.sr-rule-card__subtitle {
  font-size: 13px;
  color: var(--fg-muted, #aaa);
  margin-top: 2px;
}

/* Operator help text — currently only on the Declined Work Follow-up
   rule card, whose behavior isn't inferable from interval fields. */
.sr-rule-card__help {
  font-size: 12px;
  color: var(--fg-subtle, #888);
  margin-top: 4px;
  line-height: 1.4;
}

.sr-rule-card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: 0 0 auto;
}

.sr-trigger-pill {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg-2, rgba(255, 255, 255, 0.07));
  color: var(--fg-muted, #aaa);
}

.sr-trigger-pill--mileage      { background: rgba(74, 144, 226, 0.15); color: #4a90e2; }
.sr-trigger-pill--time         { background: rgba(91, 192, 222, 0.15); color: #5bc0de; }
.sr-trigger-pill--both         { background: rgba(92, 184, 92, 0.15); color: #5cb85c; }
.sr-trigger-pill--seasonal     { background: rgba(240, 173, 78, 0.15); color: #f0ad4e; }
.sr-trigger-pill--declined_work { background: rgba(217, 83, 79, 0.15); color: #d9534f; }

.sr-rule-count {
  font-size: 12px;
  color: var(--fg-subtle, #888);
}

.sr-rule-inactive-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-subtle, #888);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =====================================================================
 * Modal form (create/edit rule)
 * ===================================================================== */

.sr-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sr-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.sr-form-row > span {
  font-size: 13px;
  color: var(--fg-muted, #aaa);
}

.sr-form-row input[type="text"],
.sr-form-row input[type="number"],
.sr-form-row select,
.sr-form-row textarea {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  border-radius: 6px;
  background: var(--bg, #111);
  color: var(--fg, #fff);
  font-size: 14px;
}

.sr-form-row textarea {
  min-height: 80px;
  resize: vertical;
}

.sr-trigger-fieldset {
  border: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  border-radius: 6px;
  padding: 12px;
  margin: 0;
}

.sr-trigger-fieldset > legend {
  padding: 0 6px;
  font-size: 13px;
  color: var(--fg-muted, #aaa);
}

.sr-trigger-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  min-height: 44px;
  cursor: pointer;
}

.sr-trigger-radio input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.sr-trigger-radio input:disabled + span {
  opacity: 0.5;
}

.sr-form-hint {
  font-size: 12px;
  color: var(--fg-subtle, #888);
  margin: 0 0 8px 0;
  padding-left: 4px;
}

.sr-form-conditional {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--line, rgba(255, 255, 255, 0.06));
}

/* =====================================================================
 * Bottom action sheet (mobile dismiss/view-vehicle picker)
 * ===================================================================== */

.sr-action-sheet {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.sr-action-sheet__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  animation: sr-fade-in 200ms ease;
}

.sr-action-sheet__panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: sr-slide-up 220ms ease;
}

.sr-action-sheet__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-muted, #aaa);
  text-align: center;
  margin-bottom: 8px;
}

.sr-action-sheet__btn {
  min-height: 50px;
  padding: 14px 16px;
  background: var(--bg-2, rgba(255, 255, 255, 0.07));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  border-radius: 8px;
  color: var(--fg, #fff);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.sr-action-sheet__btn--danger {
  color: var(--danger, #ff5a5f);
}

.sr-action-sheet__btn--cancel {
  margin-top: 8px;
  background: transparent;
  color: var(--fg-muted, #aaa);
}

@keyframes sr-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sr-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* =====================================================================
 * Dashboard widget (#dashboard-reminders-widget)
 * ===================================================================== */

.sr-widget {
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.sr-widget__heading {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--fg, #fff);
}

.sr-widget__summary {
  font-size: 13px;
  color: var(--fg-muted, #aaa);
  margin-bottom: 12px;
}

.sr-widget__list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sr-widget__item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line, rgba(255, 255, 255, 0.06));
}

.sr-widget__rule {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg, #fff);
}

.sr-widget__vehicle {
  font-size: 12px;
  color: var(--fg-subtle, #888);
}

.sr-widget__due {
  font-size: 13px;
  color: var(--fg-muted, #aaa);
  grid-row: span 2;
  align-self: center;
  white-space: nowrap;
}

.sr-widget__view-all {
  display: inline-block;
  min-height: 44px;
  padding: 12px 0;
  font-size: 13px;
  color: var(--accent, #00D4AA);
  text-decoration: none;
}

.sr-widget__view-all:hover {
  text-decoration: underline;
}

/* =====================================================================
 * Toasts (inline — duplicated from inspections per reviewer invariant #3)
 * ===================================================================== */

.sr-toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.sr-toast {
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.06));
  color: var(--fg, #fff);
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: auto;
}

.sr-toast-show {
  opacity: 1;
  transform: translateY(0);
}

.sr-toast--success { border-left: 4px solid var(--success, #00d4aa); }
.sr-toast--error   { border-left: 4px solid var(--danger, #ff5a5f); }
.sr-toast--info    { border-left: 4px solid var(--accent, #00D4AA); }

/* =====================================================================
 * Loading / empty / error states
 * ===================================================================== */

.sr-loading,
.sr-empty,
.sr-error {
  padding: 40px 20px;
  text-align: center;
  color: var(--fg-muted, #aaa);
}

.sr-empty p,
.sr-error p {
  margin: 8px 0;
  font-size: 14px;
}

.sr-error h3 {
  color: var(--danger, #ff5a5f);
  margin: 0 0 8px 0;
}

/* =====================================================================
 * Recall badge (vehicle detail panel extension — defined here so the
 * vehicles island can opt into it without duplicating; rendered by
 * portal/vehicles/modal.js)
 * ===================================================================== */

.veh-recall-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* Phase 4C-β reviewer fix — tap target ≥44 px (was 4px vertical
   * padding → ~24 px effective height). Buttons inside operator tables
   * still need to clear the 44 px floor. */
  min-height: 44px;
  padding: 8px 14px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 90, 95, 0.15);
  color: var(--danger, #ff5a5f);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.veh-recall-list {
  margin: 12px 0;
  padding: 12px;
  background: var(--bg-2, rgba(255, 255, 255, 0.07));
  border-left: 3px solid var(--danger, #ff5a5f);
  border-radius: 4px;
}

.veh-recall-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.veh-recall-list li {
  font-size: 13px;
}

.veh-recall-list__title {
  font-weight: 600;
  color: var(--fg, #fff);
  margin-bottom: 4px;
}

.veh-recall-list__detail {
  color: var(--fg-muted, #aaa);
  line-height: 1.4;
}

/* =====================================================================
 * Recall banner (WO detail page extension — defined here for symmetry
 * with the badge; rendered by portal/work-orders/detail-page.js)
 * ===================================================================== */

.wo-recall-banner {
  background: rgba(217, 83, 79, 0.12);
  border: 1px solid rgba(217, 83, 79, 0.3);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 0 0 16px 0;
  font-size: 13px;
  color: var(--fg, #fff);
  cursor: pointer;
}

.wo-recall-banner__title {
  font-weight: 600;
  color: var(--danger, #ff5a5f);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wo-recall-banner__hint {
  font-size: 11px;
  color: var(--fg-subtle, #888);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wo-recall-banner__list {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(217, 83, 79, 0.2);
}

.wo-recall-banner__list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wo-recall-banner__list li {
  font-size: 12px;
  color: var(--fg-muted, #aaa);
}

.wo-recall-banner__list .veh-recall-list__title {
  color: var(--fg, #fff);
}
