/* Kurso — HUD shell (driver), classic topbar (admin) and grouped Settings modal.
 * Palette: asphalt, emerald, amber, sky, slate.
 */

.shell-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.modal-backdrop {
  z-index: 65;
}

/* ---------- Account capsule (top-right) ---------- */

.acct-pill {
  min-height: 40px;
  padding: 4px 12px 4px 6px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease;
}

.acct-pill:hover,
.acct-pill.open {
  border-color: var(--primary);
}

.acct-avatar {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.16);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.acct-avatar.lg {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.acct-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--surface);
  background: var(--primary);
}

.acct-dot.warn {
  background: var(--secondary);
}

.acct-name-hide {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .acct-name-hide {
    display: none;
  }
}

/* ---------- Driver HUD shell ---------- */

.shell-hud .topbar {
  background: transparent;
  border-bottom: none;
  backdrop-filter: none;
  pointer-events: none;
}

.shell-hud .hud-capsule,
.shell-hud .acct-pill,
.shell-hud .kurso-theme-switch {
  pointer-events: auto;
}

.shell-hud .hud-capsule,
.shell-hud .acct-pill {
  background: var(--card-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
}

.shell-hud .hud-capsule {
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 6px 14px 6px 12px;
}

.shell-hud .container {
  width: 100%;
  max-width: 1140px;
  padding-bottom: 104px;
}

.shell-hud #mapBox {
  height: calc(100vh - 230px);
  min-height: 460px;
}

.floating-dock {
  position: fixed;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  border-radius: 9999px;
  background: var(--card-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.dock-btn {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.dock-btn.active {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(52, 209, 134, 0.28);
}

/* Brand Dot + Unified Dashboard Cards matching Landing Page */
.kd-brand-dot {
  position: relative;
  width: 11px;
  height: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kd-brand-dot-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.45;
  animation: kdPulse 1.8s ease-in-out infinite;
}

.kd-brand-dot-core {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
}

@keyframes kdPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.48;
  }

  50% {
    transform: scale(1.45);
    opacity: 0.15;
  }
}

.kd-hero-strip {
  border-radius: 24px;
  padding: 22px 24px;
  background:
    radial-gradient(circle at 92% 15%, var(--tint-brand-bg) 0%, transparent 52%),
    var(--surface);
}

.kd-hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.kd-hero-text {
  min-width: 0;
  flex: 1;
}

.kd-hero-name {
  font-size: clamp(22px, 3vw, 29px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.03em;
  margin: 0;
}

.kd-hero-plan {
  font-size: clamp(18px, 2.2vw, 23px);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 5px;
}

.kd-hero-plan strong {
  font-weight: 800;
  color: var(--brand-accent);
}

.ev-close-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 130ms ease, border-color 130ms ease;
}

.ev-close-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

.ev-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.ev-filter-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 9999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.ev-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
}

.ev-next-train {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--tint-warn-bg);
  border: 1px solid var(--tint-warn-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ev-list-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 2px;
}

.ev-train-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
}

.ev-time-pill {
  padding: 5px 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.ev-time-pill.high {
  background: var(--tint-warn-bg);
  border-color: var(--tint-warn-border);
  color: var(--secondary);
}

.ev-item-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 11px 12px;
}

.ev-sched-box {
  width: 96px;
  min-width: 96px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
  padding: 9px 7px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.ev-sched-box.high {
  background: var(--tint-warn-bg);
  border-color: var(--tint-warn-border);
}

.ev-sched-date {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--brand-accent);
}

.ev-sched-box.high .ev-sched-date {
  color: var(--secondary);
}

.ev-sched-time {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.ev-sched-exit {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed var(--border);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.ev-sched-exit span {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.ev-sched-exit strong {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--brand-accent);
}

.ev-sched-box.high .ev-sched-exit strong {
  color: var(--secondary);
}

.ev-detail-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 2px 0;
}

.ev-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ev-detail-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
}

.ev-detail-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.ev-detail-venue {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.ev-detail-snippet {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ev-detail-foot {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-waze {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.13);
  border-color: rgba(56, 189, 248, 0.38);
  color: #38BDF8;
  font-weight: 700;
}

.btn-waze:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38BDF8;
}

.ev-detail-foot .btn-waze {
  min-height: 24px;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 7px;
  gap: 4px;
}

.ev-detail-foot .btn-waze svg {
  width: 11px;
  height: 11px;
}

[data-theme="daylight"] .btn-waze {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.32);
  color: #0284C7;
}

.ev-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-accent);
}

.kd-sync-icon-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kd-sync-icon-btn.is-syncing svg {
  animation: kdSpin 0.85s linear infinite;
}

@keyframes kdSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.kd-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kd-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kd-kpi-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kd-kpi-ico.brand {
  background: var(--tint-brand-bg);
  color: var(--brand-accent);
  border: 1px solid var(--tint-brand-border);
}

.kd-kpi-ico.live {
  background: var(--tint-live-bg);
  color: var(--info);
  border: 1px solid var(--tint-live-border);
}

.kd-kpi-ico.warn {
  background: var(--tint-warn-bg);
  color: var(--secondary);
  border: 1px solid var(--tint-warn-border);
}

.kd-event-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.kd-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

table tbody tr:hover {
  background: var(--surface-2);
}

/* Map tiles: dark rendering of OpenStreetMap on dark themes */
body[data-theme="asphalt"] .leaflet-tile-pane,
body[data-theme="amber"] .leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) brightness(92%) contrast(92%);
}

/* ---------- Settings modal ---------- */

.set-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(5, 8, 14, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px));
}

.set-modal {
  width: min(920px, 100%);
  height: min(720px, 92vh);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  box-shadow: var(--shadow-lg);
  animation: spSlideUp 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes spSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.set-rail {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.set-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.set-identity strong {
  font-size: 13.5px;
  display: block;
}

.set-identity span {
  font-size: 11.5px;
  color: var(--muted);
}

.set-group-lbl {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 10px 4px;
}

.set-nav-btn {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.set-nav-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.set-nav-btn.active {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--primary);
}

.set-nav-btn .set-nav-meta {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.set-nav-btn.danger {
  color: var(--danger);
}

.set-rail-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.set-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.set-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
}

.set-head h2 {
  font-size: 20px;
}

.set-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.set-body {
  padding: 20px 24px 28px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.set-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
}

.set-card-head {
  padding: 14px 16px 0;
}

.set-card-head h3 {
  font-size: 15px;
}

.set-card-head p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.set-card-body {
  padding: 14px 16px 4px;
}

.set-card-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.set-card-foot .kpi-sub {
  margin: 0 auto 0 0;
}

.set-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: -4px;
}

.set-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 13.5px;
  cursor: pointer;
}

.set-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Integration rows (Conexiuni) */
.int-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.int-card summary::-webkit-details-marker {
  display: none;
}

.int-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.int-meta {
  flex: 1;
  min-width: 0;
}

.int-meta strong {
  display: block;
  font-size: 14.5px;
}

.int-meta span {
  font-size: 12.5px;
  color: var(--muted);
}

.int-chevron {
  color: var(--muted);
  transition: transform 180ms ease;
}

.int-card[open] .int-chevron {
  transform: rotate(180deg);
}

.int-card[open] summary {
  border-bottom: 1px solid var(--border);
}

.danger-zone {
  border-color: rgba(239, 68, 68, 0.4);
}

@media (max-width: 760px) {
  .set-modal {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 90vh;
    height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
  }

  .set-rail {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 10px;
    gap: 6px;
  }

  .set-identity,
  .set-group-lbl,
  .set-nav-btn .set-nav-meta {
    display: none;
  }

  .set-nav-btn {
    width: auto;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .set-rail-foot {
    margin: 0;
    padding: 0;
    border: none;
  }

  .set-head,
  .set-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ---------- 3A: Weekly Shift Planner Matrix ---------- */

.wp-card {
  margin-top: 16px;
}

.wp-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wp-preset-btn {
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.wp-preset-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.wp-preset-clear {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wp-preset-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--tint-danger-bg);
}

.wp-grid-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 12px;
  padding-bottom: 4px;
}

.wp-matrix {
  display: grid;
  grid-template-columns: minmax(112px, 132px) repeat(7, minmax(64px, 1fr));
  gap: 6px;
  min-width: 590px;
  align-items: center;
}

.wp-col-head {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 4px 2px;
}

.wp-row-lbl {
  display: flex;
  flex-direction: column;
  padding-right: 6px;
}

.wp-row-lbl strong {
  font-size: 13px;
  font-weight: 700;
}

.wp-row-lbl span {
  font-size: 11px;
  color: var(--muted);
}

.wp-slot-btn {
  position: relative;
  min-height: 46px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 110ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.wp-slot-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.wp-slot-btn:active {
  transform: scale(0.96);
}

.wp-slot-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(52, 209, 134, 0.24);
}

.wp-peak-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--surge);
}

.wp-slot-btn.active .wp-peak-dot {
  background: var(--on-primary);
  opacity: 0.75;
}

.wp-surge-legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.wp-surge-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.wp-week-nav-lbl {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 148px;
  text-align: center;
  line-height: 1.15;
}

.wp-week-nav-lbl strong {
  font-size: 13.5px;
  font-weight: 800;
}

.wp-week-nav-lbl span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.wp-col-head.is-today {
  color: var(--brand-accent);
}

.wp-surge-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surge);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
  animation: wpSurgeDot 2.4s ease-in-out infinite;
}

.wp-slot-btn.is-peak,
.cal-slot-pill.is-peak {
  background: var(--tint-surge-bg);
  border-color: var(--tint-surge-border);
  color: var(--text);
  animation: wpSurgePulse 2.8s ease-in-out infinite;
}

.wp-slot-btn.active.is-peak,
.cal-slot-pill.active.is-peak {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  animation: wpSurgePulseActive 2.8s ease-in-out infinite;
}

@keyframes wpSurgePulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
  }

  50% {
    box-shadow: 0 0 13px 1.5px rgba(168, 85, 247, 0.34);
  }
}

@keyframes wpSurgePulseActive {

  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.45), 0 6px 16px rgba(52, 209, 134, 0.24);
  }

  50% {
    box-shadow: 0 0 0 2.5px rgba(168, 85, 247, 0.78), 0 6px 18px rgba(52, 209, 134, 0.30);
  }
}

@keyframes wpSurgeDot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.45;
    transform: scale(0.82);
  }
}

@media (prefers-reduced-motion: reduce) {

  .wp-slot-btn.is-peak,
  .cal-slot-pill.is-peak,
  .wp-slot-btn.active.is-peak,
  .cal-slot-pill.active.is-peak,
  .wp-surge-swatch {
    animation: none;
  }
}

.wp-summary-bar {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wp-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

.wp-disclaimer {
  margin: 10px 2px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------- 2B: CFO pentru PFA Panel ---------- */

.cfo-flow-bar {
  width: 100%;
  height: 14px;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  gap: 2px;
}

.cfo-flow-seg {
  height: 100%;
  transition: width 360ms ease;
}

.cfo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  margin-top: 10px;
}

.cfo-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cfo-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cfo-score-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.cfo-score-ring {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}

.cfo-score-ring svg {
  transform: rotate(-90deg);
  width: 88px;
  height: 88px;
}

.cfo-score-num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
}

.cfo-insight-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--tint-live-bg);
  border: 1px solid var(--tint-live-border);
  font-size: 13px;
  line-height: 1.45;
}

/* ---------- 1B: 3-Step Driver Onboarding Wizard ---------- */

.ob-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 12, 18, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

.ob-modal {
  width: min(760px, 100%);
  max-height: 92vh;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: spSlideUp 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ob-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0 20px;
}

.ob-step-pill {
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.ob-step-pill.active {
  background: var(--tint-brand-bg);
  border-color: var(--tint-brand-border);
  color: var(--brand-accent);
}

.ob-step-pill.done {
  border-color: var(--primary);
  color: var(--text);
}

.ob-fuel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.ob-fuel-card {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.ob-fuel-card.selected {
  border-color: var(--primary);
  background: var(--tint-brand-bg);
}

/* ---------- Varianta 1: Monthly Calendar & Day Editor ---------- */

.wp-top-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wp-top-title {
  min-width: 0;
  flex: 1;
}

.wp-subbar {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wp-view-switch {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  gap: 3px;
}

.wp-view-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.wp-view-btn.active {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
}

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.cal-toolbar.wp-subbar {
  margin-top: 12px;
}

.cal-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.cal-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.cal-leg-dot.ok {
  background: var(--primary);
}

.cal-leg-dot.planned {
  background: var(--info);
}

.cal-leg-dot.override {
  background: var(--secondary);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 4px 0;
}

.cal-cell {
  min-height: 70px;
  padding: 7px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  transition: border-color 130ms ease, transform 110ms ease, background-color 130ms ease;
}

.cal-cell:hover {
  border-color: var(--primary);
}

.cal-cell:active {
  transform: scale(0.97);
}

.cal-blank {
  background: transparent;
  border-color: transparent;
  cursor: default;
  pointer-events: none;
}

.cal-cell.is-today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--tint-brand-border);
}

.cal-cell.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

.cal-cell.st-ok {
  background: var(--tint-brand-bg);
  border-color: var(--tint-brand-border);
}

.cal-cell.st-warn {
  background: var(--tint-warn-bg);
  border-color: var(--tint-warn-border);
}

.cal-cell.st-planned {
  background: var(--tint-live-bg);
  border-color: var(--tint-live-border);
}

.cal-cell.st-missed {
  opacity: 0.65;
}

.cal-cell.st-off .cal-cell-val {
  color: var(--muted);
  font-weight: 600;
}

.cal-cell-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.cal-day-num {
  font-size: 12px;
  font-weight: 800;
}

.cal-today-tag {
  font-size: 10px;
  font-weight: 800;
  color: var(--brand-accent);
  text-transform: uppercase;
}

.cal-override-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--secondary);
  flex-shrink: 0;
}

.cal-cell-val {
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.15;
}

.cal-cell-sub {
  font-size: 10.5px;
  color: var(--muted);
}

.cal-day-editor {
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--tint-brand-border);
}

.cal-slot-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

.cal-slot-pill {
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 130ms ease, background-color 130ms ease;
}

.cal-slot-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

/* ---------- Asistent AI Kurso ---------- */

.ai-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: min(680px, calc(100vh - 190px));
}

.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 9999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.ai-chip:hover {
  border-color: var(--primary);
  color: var(--text);
  background: var(--tint-brand-bg);
}

.ai-thread {
  flex: 1;
  min-height: 280px;
  max-height: 440px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 4px;
}

.ai-msg {
  max-width: min(85%, 640px);
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.ai-msg.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.ai-msg.user {
  align-self: flex-end;
  background: var(--tint-brand-bg);
  border: 1px solid var(--tint-brand-border);
  color: var(--text);
}

.ai-msg-role {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}

.ai-msg.assistant .ai-msg-role {
  color: var(--brand-accent);
}

.ai-typing {
  opacity: 0.8;
}

.ai-composer {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.ai-composer .input {
  flex: 1;
}

.ai-composer .btn {
  min-width: 48px;
  padding: 0 16px;
}

.ai-attach-btn {
  min-width: 44px !important;
  width: 44px;
  padding: 0 !important;
  flex-shrink: 0;
}

.ai-chip-upload {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: var(--tint-brand-border);
  background: var(--tint-brand-bg);
  color: var(--brand-accent);
  font-weight: 700;
}

.ai-shell.is-dragover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--tint-brand-border);
}

.td-doc-card {
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.td-doc-card.editable {
  border-color: var(--tint-warn-border);
}

.td-doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.td-doc-reason {
  font-size: 12px;
  line-height: 1.4;
  padding: 7px 9px;
  border-radius: 9px;
  background: var(--tint-warn-bg);
  border: 1px solid var(--tint-warn-border);
  color: var(--text);
}

.td-doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.td-doc-grid .td-span-2 {
  grid-column: span 2;
}

.td-doc-field label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 3px;
}

.td-doc-field .input,
.td-doc-field select {
  min-height: 36px;
  padding: 6px 9px;
  font-size: 13px;
}

.td-doc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.td-hist-drawer {
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 560px) {
  .td-doc-grid {
    grid-template-columns: 1fr;
  }
  .td-doc-grid .td-span-2 {
    grid-column: span 1;
  }
  .ai-msg {
    max-width: 94%;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 12px;
  }

  .shell-hud .container {
    padding-bottom: 92px;
  }

  .topbar-inner {
    padding: 10px 12px;
  }

  .card {
    padding: 14px;
    border-radius: 18px;
  }

  .card-elevated {
    padding: 12px;
    border-radius: 14px;
  }

  .grid {
    gap: 10px;
  }

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

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi-val {
    font-size: 21px;
  }

  .kpi-sub {
    font-size: 12px;
  }

  .floating-dock {
    width: calc(100vw - 16px);
    justify-content: space-between;
    padding: 5px;
    border-radius: 22px;
  }

  .dock-btn {
    flex: 1;
    min-height: 46px;
    padding: 5px 4px;
    border-radius: 16px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    font-size: 10.5px;
  }

  .kd-hero-strip {
    padding: 15px 16px;
    border-radius: 18px;
  }

  .kd-hero-name {
    font-size: 24px;
    line-height: 1.15;
  }

  .kd-hero-plan {
    font-size: 19px;
    line-height: 1.24;
    margin-top: 4px;
  }

  .ev-filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .ev-filter-row::-webkit-scrollbar {
    display: none;
  }

  .ev-filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .ev-list-scroll {
    max-height: none;
  }

  .ev-item-row {
    gap: 10px;
    padding: 10px;
  }

  .ev-sched-box {
    width: 84px;
    min-width: 84px;
    padding: 8px 6px;
  }

  .ev-sched-time {
    font-size: 16px;
  }

  .ev-detail-title {
    font-size: 13.5px;
  }

  .cfo-score-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .cfo-score-wrap .grid-3 {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .cfo-score-wrap .card-elevated {
    padding: 8px 6px;
  }

  .wp-top-head {
    gap: 8px;
  }

  .wp-top-title h3 {
    font-size: 15.5px !important;
  }

  .wp-view-btn {
    padding: 5px 10px;
    font-size: 11.5px;
  }

  .wp-matrix {
    min-width: 440px;
    grid-template-columns: 76px repeat(7, minmax(46px, 1fr));
    gap: 4px;
  }

  .wp-row-lbl strong {
    font-size: 11.5px;
  }

  .wp-row-lbl span {
    font-size: 10px;
  }

  .wp-slot-btn {
    min-height: 40px;
    font-size: 11px;
    border-radius: 9px;
    padding: 0 2px;
  }

  .wp-summary-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }

  .wp-summary-bar .row-gap {
    justify-content: space-between;
  }

  .wp-summary-stats {
    gap: 12px;
  }

  .cal-toolbar.wp-subbar {
    margin-top: 10px;
    gap: 8px;
  }

  .wp-week-nav-lbl {
    min-width: 126px;
  }

  .cal-grid {
    gap: 4px;
  }

  .cal-cell {
    min-height: 58px;
    padding: 5px;
    border-radius: 9px;
  }

  .cal-cell-val {
    font-size: 10.5px;
  }

  .cal-cell-sub {
    display: none;
  }

  .cal-day-editor {
    padding: 12px;
  }

  .cal-slot-pills {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .ai-shell {
    min-height: calc(100dvh - 168px);
    gap: 10px;
  }

  .ai-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .ai-chips::-webkit-scrollbar {
    display: none;
  }

  .ai-chip {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 11.5px;
    padding: 6px 10px;
  }

  .ai-thread {
    max-height: none;
    min-height: 220px;
  }

  .ai-msg {
    max-width: 92%;
    font-size: 13px;
    padding: 10px 12px;
  }

  .ai-composer .input {
    font-size: 16px;
    min-height: 44px;
  }
}