/* Pebble design tokens over vendored Bootstrap 5.3 (CSS custom properties only,
   no Sass, no CDN). Calm pine/teal accent; offline is gray (a parked RV being
   offline is normal), red is reserved for failures + destructive confirms. */

:root,
[data-bs-theme="light"] {
  --bs-primary: #1d7a6e;
  --bs-primary-rgb: 29, 122, 110;
  --pebble-primary-hover: #17655b;
  --bs-link-color: #17655b;
  --bs-link-color-rgb: 23, 101, 91;
  --bs-link-hover-color: #0f4a43;
  --pebble-surface: #ffffff;
}

[data-bs-theme="dark"] {
  --bs-primary: #4dcbb8;
  --bs-primary-rgb: 77, 203, 184;
  --pebble-primary-hover: #6bd6c6;
  --bs-link-color: #6bd6c6;
  --bs-link-color-rgb: 107, 214, 198;
  --bs-link-hover-color: #8fe1d4;
  --pebble-surface: #1b2124;
}

.btn-primary {
  --bs-btn-bg: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: var(--pebble-primary-hover);
  --bs-btn-hover-border-color: var(--pebble-primary-hover);
  --bs-btn-active-bg: var(--pebble-primary-hover);
}

.pebble-navbar {
  background-color: var(--pebble-surface);
  backdrop-filter: saturate(120%);
}

/* Cards get a soft lift and a consistent radius. */
.card {
  --bs-card-border-color: color-mix(in srgb, var(--bs-border-color) 60%, transparent);
  border-radius: 0.75rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card.pebble-hover:hover {
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* Presence dot. */
.presence-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--bs-secondary);
}
.presence-dot.is-online {
  background: var(--bs-success);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-success-rgb), 0.2);
}
.presence-dot.is-stale {
  background: var(--bs-warning);
}

/* Control cards: touch-friendly, clear lifecycle. */
.control-card {
  min-height: 100%;
}
.control-card .control-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.control-card[data-state="pending"] {
  outline: 2px solid rgba(var(--bs-primary-rgb), 0.4);
  outline-offset: -2px;
}
.control-card[data-state="failed"] {
  outline: 2px solid rgba(var(--bs-danger-rgb), 0.5);
  outline-offset: -2px;
}
.control-card.is-offline {
  opacity: 0.55;
  filter: grayscale(0.4);
}
/* Every interactive control meets the 44px touch target (plan 6.11). */
.control-card .btn,
.rv-quick-action .btn {
  min-height: 44px;
}

/* Stale data gets visibly dimmed with an "as of" caption (plan 6.8). */
.is-stale-data {
  opacity: 0.7;
}

/* Staff sidebar. */
.ops-sidebar .nav-link {
  border-radius: 0.5rem;
  color: var(--bs-body-color);
}
.ops-sidebar .nav-link:hover {
  background: rgba(var(--bs-primary-rgb), 0.08);
}
.ops-sidebar .nav-link.active {
  background: rgba(var(--bs-primary-rgb), 0.14);
  color: var(--bs-primary);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card.pebble-hover:hover {
    transition: none;
    transform: none;
  }
}

/* --- Staff tools ------------------------------------------------------- */

.ops-nav-group {
  margin: 0.75rem 0 0.15rem;
  padding: 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}
.ops-nav-group:first-child { margin-top: 0; }

/* Chart series tokens. The pine primary is too low-chroma as a series color, so
   slot 1 is a stepped teal. Status colors back the command-outcome stacks. */
:root,
[data-bs-theme="light"] {
  --pebble-chart-1: #0f9e8a;
  --pebble-chart-2: #eb6834;
  --pebble-chart-3: #2a78d6;
  --pebble-chart-4: #eda100;
  --pebble-chart-5: #e87ba4;
  --pebble-chart-6: #6250d6;
  --pebble-chart-ok: #1a8a4a;
  --pebble-chart-bad: #d6453d;
  --pebble-chart-expired: #e8a09b;
  --pebble-chart-inflight: #2a78d6;
  --pebble-chart-grid: rgba(0, 0, 0, 0.08);
}
[data-bs-theme="dark"] {
  --pebble-chart-1: #26a894;
  --pebble-chart-2: #d95926;
  --pebble-chart-3: #3987e5;
  --pebble-chart-4: #c98500;
  --pebble-chart-5: #d55181;
  --pebble-chart-6: #9085e9;
  --pebble-chart-ok: #3fb36b;
  --pebble-chart-bad: #e66767;
  --pebble-chart-expired: #8c4a4a;
  --pebble-chart-inflight: #3987e5;
  --pebble-chart-grid: rgba(255, 255, 255, 0.1);
}
.chart-canvas { position: relative; height: 240px; }
.chart-data summary { cursor: pointer; }

.ops-kpi .value {
  font-size: 1.5rem;
  font-weight: 650;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.ops-kpi .label { font-size: 0.78rem; color: var(--bs-secondary-color); }

.ops-chip {
  display: inline-flex;
  flex-direction: column;
  min-width: 7rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.6rem;
  background: var(--pebble-surface);
  color: var(--bs-body-color);
  text-decoration: none;
}
.ops-chip:hover { border-color: var(--bs-primary); }
.ops-chip[aria-pressed="true"] {
  border-color: var(--bs-primary);
  box-shadow: inset 0 0 0 1px var(--bs-primary);
}
.ops-chip .n { font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.ops-chip .t { font-size: 0.75rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: 0.04em; }

.vin { font-family: var(--bs-font-monospace); letter-spacing: 0.02em; }
.vin b { font-weight: 700; }

.user-picker { position: relative; }
.user-picker-list {
  position: absolute;
  z-index: 1030;
  width: 100%;
  max-height: 20rem;
  overflow-y: auto;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}
.user-picker-list [aria-selected="true"] { background: rgba(var(--bs-primary-rgb), 0.14); }

.identity-card { border-left: 3px solid var(--bs-primary); }
.identity-card.is-losing { border-left-color: var(--bs-danger); }

.activity-strip { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; }
.activity-strip span {
  height: 14px;
  border-radius: 2px;
  background: var(--bs-tertiary-bg);
}
.activity-strip span.on { background: var(--pebble-chart-1); }

.copy-field .form-control[readonly] { background: var(--bs-body-bg); }

.proportion { height: 0.9rem; }
.note-body { white-space: pre-wrap; }
progress.proportion { appearance: none; border: 0; border-radius: 0.45rem; overflow: hidden; background: var(--bs-tertiary-bg); }
progress.proportion::-webkit-progress-bar { background: var(--bs-tertiary-bg); }
progress.proportion::-webkit-progress-value { background: var(--pebble-chart-1); }
progress.proportion::-moz-progress-bar { background: var(--pebble-chart-1); }
