/*
 * Apple-style skin for the logged-in app (loaded last in new_base.html).
 * Same tokens as auth.css: calm grey canvas, white cards, system font, flat tinted controls.
 */
html:root,
html[data-bs-theme="light"] {
  --apl-bg: #f5f5f7;
  --apl-surface: #ffffff;
  --apl-text: #1d1d1f;
  --apl-text-soft: #6e6e73;
  --apl-text-faint: #86868b;
  --apl-border: #d2d2d7;
  --apl-hairline: #e8e8ed;
  --apl-fill: #f5f5f7;
  --apl-fill-strong: #ebebf0;
  --apl-blue: #0071e3;
  --apl-blue-hover: #0077ed;
  --apl-blue-ring: rgba(0, 113, 227, 0.18);
  --apl-green: #248a3d;
  --apl-green-fill: #34c759;
  --apl-red: #d70015;
  --apl-orange: #c93400;
  --apl-yellow: #a05a00;
  --apl-purple: #8944ab;
  --apl-radius-card: 18px;
  --apl-radius-control: 10px;
  --apl-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 28px rgba(0, 0, 0, 0.045);
  --apl-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --apl-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;

  --bs-font-sans-serif: var(--apl-font);
  --bs-body-font-family: var(--apl-font);
  --bs-body-bg: var(--apl-bg);
  --bs-body-color: var(--apl-text);
  --bs-heading-color: var(--apl-text);
  --bs-secondary-color: var(--apl-text-soft);
  --bs-border-color: var(--apl-hairline);
  --bs-primary: #0071e3;
  --bs-primary-rgb: 0, 113, 227;
  --bs-primary-bg-subtle: #e8f2fd;
  --bs-primary-border-subtle: #b9d7f7;
  --bs-primary-text-emphasis: #00509e;
  --bs-link-color: #0066cc;
  --bs-link-color-rgb: 0, 102, 204;
  --bs-link-hover-color: #0066cc;
  --bs-paper-bg: var(--apl-surface);
  --bs-border-radius: var(--apl-radius-control);
  --bs-border-radius-lg: 14px;
  --bs-border-radius-xl: var(--apl-radius-card);
  --bs-box-shadow: var(--apl-shadow-card);
  --bs-box-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --bs-box-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
}

/* ---------- Canvas & typography ---------- */
body {
  background: var(--apl-bg) !important;
  color: var(--apl-text);
  font-family: var(--apl-font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--apl-font-display);
  color: var(--apl-text);
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: #0066cc;
}

.text-muted,
.text-body-secondary {
  color: var(--apl-text-soft) !important;
}

.layout-wrapper,
.layout-container,
.layout-page,
.content-wrapper {
  background: var(--apl-bg);
}

/* Theme customizer gear is a template leftover; not part of the product. */
#template-customizer,
.template-customizer-open-btn {
  display: none !important;
}

/* ---------- Sidebar ---------- */
.layout-menu.menu-vertical,
.layout-menu {
  background: #fff !important;
  border-right: 1px solid var(--apl-hairline);
  box-shadow: none !important;
}

.layout-menu .app-brand-text {
  font-family: var(--apl-font-display);
  font-weight: 600 !important;
  letter-spacing: -0.03em;
  color: var(--apl-text) !important;
}

.layout-menu .sidebar-powered-by {
  color: var(--apl-text-faint) !important;
  font-size: 12px;
}

.layout-menu .menu-header {
  padding-top: 1.1rem !important;
  padding-bottom: 0.35rem !important;
}

.layout-menu .menu-header::before {
  display: none !important;
}

.layout-menu .menu-header .menu-header-text {
  color: var(--apl-text-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.layout-menu .menu-inner > .menu-item > .menu-link {
  border-radius: var(--apl-radius-control);
  color: var(--apl-text);
  font-size: 14px;
  font-weight: 500;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.layout-menu .menu-inner > .menu-item > .menu-link .menu-icon {
  color: var(--apl-text-soft);
}

.layout-menu .menu-inner > .menu-item:not(.active) > .menu-link:hover {
  background: var(--apl-fill-strong) !important;
}

.layout-menu .menu-inner > .menu-item.active > .menu-link {
  background: rgba(0, 113, 227, 0.1) !important;
  color: var(--apl-blue) !important;
  box-shadow: none !important;
}

.layout-menu .menu-inner > .menu-item.active > .menu-link .menu-icon {
  color: var(--apl-blue) !important;
}

.layout-menu .menu-inner > .menu-item.active::before,
.layout-menu .menu-inner > .menu-item.active:before {
  display: none !important;
}

.layout-menu-toggle {
  box-shadow: none !important;
}

/* ---------- Top bar ---------- */
.layout-navbar {
  background: rgba(255, 255, 255, 0.78) !important;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--apl-hairline) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
}

.admin-global-search {
  background: var(--apl-fill) !important;
  border: 1px solid transparent !important;
  border-radius: var(--apl-radius-control) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.admin-global-search:focus-within {
  background: var(--apl-surface) !important;
  border-color: var(--apl-blue) !important;
  box-shadow: 0 0 0 4px var(--apl-blue-ring);
}

.admin-global-search .form-control {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#sessionCountdown {
  background: var(--apl-fill) !important;
  color: var(--apl-text-soft) !important;
  font-weight: 500;
  font-size: 12px;
}

#sessionCountdown.bg-label-warning {
  background: #fff4e5 !important;
  color: var(--apl-orange) !important;
}

/* ---------- Cards ---------- */
.card {
  background: var(--apl-surface);
  border: 0 !important;
  border-radius: var(--apl-radius-card) !important;
  box-shadow: var(--apl-shadow-card) !important;
}

.card.border,
.card.border-1 {
  border: 0 !important;
}

.card > .card-header,
.card > .card-header-colour,
.card-header-colour {
  margin: 0 !important;
  padding: 1.15rem 1.4rem 0.35rem !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: var(--apl-radius-card) var(--apl-radius-card) 0 0 !important;
  color: var(--apl-text) !important;
  font-family: var(--apl-font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  box-shadow: none !important;
}

.card > .card-header h1, .card > .card-header h2, .card > .card-header h3,
.card > .card-header h4, .card > .card-header h5, .card > .card-header h6 {
  font-size: 17px;
  margin-bottom: 0;
}

.card > .card-header i.fad,
.card > .card-header i.fas,
.card > .card-header i.far {
  color: var(--apl-text-soft);
}

.card-header-blue,
.card-header-green,
.card-header-orange,
.card-header-purple,
.card-header-red,
.card-header-yellow {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--apl-text) !important;
}

.card > .card-header + .card-body,
.card > .card-header-colour + .card-body {
  padding-top: 0.85rem !important;
}

.card-body {
  padding: 1.25rem 1.4rem;
}

/* Soft colored borders become neutral hairlines. */
.border-blue,
.border-green,
.border-orange,
.border-red,
.border-purple,
.border-gray,
.border-black {
  border-color: var(--apl-hairline) !important;
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--apl-radius-control) !important;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow: none !important;
  transform: none !important;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:focus-visible {
  box-shadow: 0 0 0 4px var(--apl-blue-ring) !important;
}

.btn.rounded-4,
.btn.rounded-pill {
  border-radius: 999px !important;
}

.btn-primary,
.btn-blue,
.btn-info {
  background: var(--apl-blue) !important;
  border-color: var(--apl-blue) !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-blue:hover,
.btn-info:hover {
  background: var(--apl-blue-hover) !important;
  border-color: var(--apl-blue-hover) !important;
}

.btn-success {
  background: var(--apl-green-fill) !important;
  border-color: var(--apl-green-fill) !important;
  color: #fff !important;
}

.btn-danger,
.btn-red {
  background: #ff3b30 !important;
  border-color: #ff3b30 !important;
  color: #fff !important;
}

.btn-warning,
.btn-yellow {
  background: #ff9f0a !important;
  border-color: #ff9f0a !important;
  color: #fff !important;
}

.btn-purple {
  background: #af52de !important;
  border-color: #af52de !important;
  color: #fff !important;
}

.btn-secondary {
  background: var(--apl-fill-strong) !important;
  border-color: var(--apl-fill-strong) !important;
  color: var(--apl-text) !important;
}

/* Tinted buttons (iOS "tinted" style): colored text on a soft fill, no border. */
.btn-label-blue,
.btn-label-primary,
.btn-label-info,
.btn-outline-primary {
  color: var(--apl-blue) !important;
  background: rgba(0, 113, 227, 0.1) !important;
  border-color: transparent !important;
}

.btn-label-green,
.btn-label-success {
  color: var(--apl-green) !important;
  background: rgba(52, 199, 89, 0.13) !important;
  border-color: transparent !important;
}

.btn-label-orange,
.btn-label-warning {
  color: var(--apl-orange) !important;
  background: rgba(255, 149, 0, 0.13) !important;
  border-color: transparent !important;
}

.btn-label-yellow {
  color: var(--apl-yellow) !important;
  background: rgba(255, 204, 0, 0.16) !important;
  border-color: transparent !important;
}

.btn-label-red,
.btn-label-danger {
  color: var(--apl-red) !important;
  background: rgba(255, 59, 48, 0.1) !important;
  border-color: transparent !important;
}

.btn-label-purple {
  color: var(--apl-purple) !important;
  background: rgba(175, 82, 222, 0.12) !important;
  border-color: transparent !important;
}

.btn-label-gray,
.btn-label-grey,
.btn-label-secondary,
.btn-outline-secondary {
  color: var(--apl-text) !important;
  background: var(--apl-fill-strong) !important;
  border-color: transparent !important;
}

[class*="btn-label-"]:hover,
.btn-outline-primary:hover,
.btn-outline-secondary:hover {
  filter: brightness(0.96);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.45;
}

/* ---------- Forms ---------- */
.form-label,
label.form-label {
  color: var(--apl-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
}

.form-control,
.form-select {
  border: 1px solid var(--apl-border);
  border-radius: var(--apl-radius-control);
  background-color: var(--apl-surface);
  color: var(--apl-text);
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control::placeholder {
  color: #a1a1a6;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--apl-blue) !important;
  box-shadow: 0 0 0 4px var(--apl-blue-ring) !important;
}

.form-control[readonly],
.form-control:disabled {
  background-color: var(--apl-fill);
  color: var(--apl-text-soft);
}

.input-group-text {
  border-color: var(--apl-border);
  background: var(--apl-fill);
  color: var(--apl-text-soft);
}

.input-group:focus-within .input-group-text {
  border-color: var(--apl-blue);
}

.input-group-merge:focus-within {
  border-radius: var(--apl-radius-control);
  box-shadow: 0 0 0 4px var(--apl-blue-ring);
}

.input-group-merge:focus-within .form-control:focus {
  box-shadow: none !important;
}

/* iOS switches */
.form-switch .form-check-input {
  width: 2.2em;
  height: 1.3em;
  border: 0;
  background-color: #e9e9eb;
  box-shadow: none !important;
  cursor: pointer;
}

.form-switch .form-check-input:checked {
  background-color: var(--apl-green-fill);
  border-color: var(--apl-green-fill);
}

.form-check-input:checked {
  background-color: var(--apl-blue);
  border-color: var(--apl-blue);
}

.form-check-input:focus {
  box-shadow: 0 0 0 4px var(--apl-blue-ring) !important;
}

/* ---------- Tables ---------- */
.table {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--apl-hairline);
  color: var(--apl-text);
}

.table > thead > tr > th,
.table thead th {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--apl-text-soft) !important;
  background: transparent !important;
  border-bottom: 1px solid var(--apl-hairline) !important;
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--apl-hairline);
}

.table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: var(--apl-fill);
}

/* ---------- Badges ---------- */
.badge {
  border-radius: 6px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.badge.rounded-pill {
  border-radius: 999px;
}

.bg-label-secondary,
.bg-label-gray,
.bg-label-dark {
  background: var(--apl-fill-strong) !important;
  color: var(--apl-text-soft) !important;
}

.bg-label-primary,
.bg-label-blue,
.bg-label-info {
  background: rgba(0, 113, 227, 0.1) !important;
  color: var(--apl-blue) !important;
}

.bg-label-success,
.bg-label-green {
  background: rgba(52, 199, 89, 0.13) !important;
  color: var(--apl-green) !important;
}

.bg-label-warning,
.bg-label-orange {
  background: rgba(255, 149, 0, 0.13) !important;
  color: var(--apl-orange) !important;
}

.bg-label-danger,
.bg-label-red {
  background: rgba(255, 59, 48, 0.1) !important;
  color: var(--apl-red) !important;
}

.bg-label-purple {
  background: rgba(175, 82, 222, 0.12) !important;
  color: var(--apl-purple) !important;
}

/* ---------- Alerts ---------- */
.alert {
  border: 0 !important;
  border-radius: 12px;
  box-shadow: none;
  font-size: 14px;
}

.alert-primary,
.alert-info {
  background: rgba(0, 113, 227, 0.08) !important;
  color: #00509e !important;
}

.alert-success {
  background: #effaf1 !important;
  color: var(--apl-green) !important;
}

.alert-warning {
  background: #fff7ea !important;
  color: #b25000 !important;
}

.alert-danger {
  background: #fff1f0 !important;
  color: var(--apl-red) !important;
}

.alert-secondary {
  background: var(--apl-fill) !important;
  color: var(--apl-text-soft) !important;
}

/* ---------- Modals & dropdowns ---------- */
.modal-content {
  border: 0;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}

.modal-header {
  border-bottom: 0;
}

.modal-footer {
  border-top: 0;
}

.splitex-modal-headline {
  border: 0 !important;
  background: transparent !important;
  padding-left: 0.4rem !important;
}

.splitex-modal-title {
  font-weight: 600 !important;
  color: var(--apl-text) !important;
}

.splitex-modal-close {
  background: var(--apl-fill) !important;
  border-radius: 50% !important;
}

.dropdown-menu {
  border: 1px solid var(--apl-hairline);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  padding: 6px;
}

.dropdown-item {
  border-radius: 8px;
  font-size: 14px;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--apl-fill);
}

.dropdown-item:active {
  background: var(--apl-blue);
  color: #fff;
}

/* ---------- Footer ---------- */
.content-footer,
.content-footer .footer-container {
  color: var(--apl-text-faint);
  font-size: 13px;
}

.content-footer a {
  color: var(--apl-text-soft) !important;
}

/* ---------- Tool / Remote Tool pages ---------- */
.tool-shell {
  border: 0 !important;
}

.tool-shell .card-header {
  background: transparent !important;
}

.tool-group,
.cloud-packet-shell {
  border: 0 !important;
  background: var(--apl-fill) !important;
  border-radius: 14px !important;
}

.tool-group-title,
.cloud-packet-title,
.detect-label {
  text-transform: none !important;
  letter-spacing: -0.01em !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--apl-text-soft) !important;
}

.tool-shell .tool-action {
  background: var(--apl-surface) !important;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
  font-weight: 500;
}

.tool-shell .tool-action:hover:not(:disabled) {
  background: #fbfbfd !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.tool-shell .tool-action.btn-label-blue {
  background: rgba(0, 113, 227, 0.1) !important;
  box-shadow: none !important;
}

.tool-shell .tool-action.btn-label-green {
  background: rgba(52, 199, 89, 0.13) !important;
  box-shadow: none !important;
}

.tool-shell .tool-action.btn-label-purple {
  background: rgba(175, 82, 222, 0.12) !important;
  box-shadow: none !important;
}

.tool-shell .tool-action.btn-label-orange {
  background: rgba(255, 149, 0, 0.13) !important;
  box-shadow: none !important;
}

.tool-shell .tool-action.btn-label-red {
  background: rgba(255, 59, 48, 0.1) !important;
  box-shadow: none !important;
}

.detect-shell {
  border: 0 !important;
  background: var(--apl-surface) !important;
  box-shadow: var(--apl-shadow-card) !important;
  border-radius: var(--apl-radius-card) !important;
}

.detect-input,
.detect-input[readonly] {
  background-color: var(--apl-fill) !important;
  border: 1px solid transparent !important;
  color: var(--apl-text) !important;
}

.sw-table-wrap {
  border: 1px solid var(--apl-hairline) !important;
  border-radius: 12px !important;
}

.tool-output,
.tool-output:focus,
.cloud-packet-output {
  border-radius: 12px !important;
  background: #1d1d1f !important;
  border-color: #1d1d1f !important;
}

/* ---------- Select2 ---------- */
/* The theme forces every .select2-container to 100% width; the open dropdown lives in <body>
   with a left offset, so it overflowed the page and added a scrollbar on every open. */
body > .select2-container {
  inline-size: auto !important;
}

.select2-container--default .select2-selection {
  border-color: var(--apl-border) !important;
  border-radius: var(--apl-radius-control) !important;
}

.select2-container--focus .select2-selection,
.select2-container--open .select2-selection {
  border-color: var(--apl-blue) !important;
  box-shadow: 0 0 0 4px var(--apl-blue-ring) !important;
}

.select2-dropdown {
  border: 1px solid var(--apl-hairline) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12) !important;
  overflow: hidden;
}

.select2-results__option--highlighted,
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--apl-blue) !important;
  color: #fff !important;
}

/* ---------- Wallet & services ---------- */
.navbar-wallet {
  background: rgba(0, 113, 227, 0.1) !important;
  color: var(--apl-blue) !important;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
}

.navbar-wallet:hover {
  background: rgba(0, 113, 227, 0.16) !important;
}

.apl-balance {
  font-family: var(--apl-font-display);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--apl-text);
}

.apl-eyebrow {
  font-size: 13px;
  font-weight: 500;
  color: var(--apl-text-soft);
}

.apl-segment {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.apl-segment button {
  height: 48px;
  border: 1px solid var(--apl-border);
  border-radius: var(--apl-radius-control);
  background: var(--apl-surface);
  color: var(--apl-text);
  font-size: 16px;
  font-weight: 500;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.apl-segment button:hover {
  background: var(--apl-fill);
}

.apl-segment button.is-selected {
  border-color: var(--apl-blue);
  background: rgba(0, 113, 227, 0.08);
  color: var(--apl-blue);
}

.apl-input-lg {
  height: 48px;
  font-size: 16px;
}

.apl-vin-input {
  height: 52px;
  font-size: 20px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.apl-stat {
  background: var(--apl-fill);
  border-radius: 14px;
  padding: 14px 16px;
  height: 100%;
}

.apl-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--apl-text-soft);
  margin-bottom: 4px;
}

.apl-stat-value {
  font-size: 17px;
  font-weight: 600;
  color: var(--apl-text);
  word-break: break-all;
}

.apl-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--apl-text);
  background: var(--apl-fill);
  border-radius: 6px;
  padding: 2px 8px;
}

.apl-list-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--apl-radius-control);
  color: var(--apl-text);
  text-decoration: none;
}

.apl-list-link:hover {
  background: var(--apl-fill);
  color: var(--apl-text);
}

.apl-list-link.is-active {
  background: rgba(0, 113, 227, 0.08);
}

.apl-amount-positive {
  color: var(--apl-green);
  font-weight: 600;
}

.apl-amount-negative {
  color: var(--apl-text);
  font-weight: 600;
}

.apl-stat-value.font-monospace {
  font-size: 14px;
  word-break: normal;
  overflow-wrap: anywhere;
}

/* Disclosure (expand / collapse) sections */
.apl-disclosure {
  border-top: 1px solid var(--apl-hairline);
}

.apl-disclosure:last-child {
  border-bottom: 1px solid var(--apl-hairline);
}

.apl-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.apl-disclosure > summary::-webkit-details-marker {
  display: none;
}

.apl-disclosure > summary:focus-visible {
  outline: none;
  border-radius: var(--apl-radius-control);
  box-shadow: 0 0 0 4px var(--apl-blue-ring);
}

.apl-disclosure-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--apl-text);
}

.apl-disclosure-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--apl-blue);
}

.apl-disclosure-hint::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s ease;
}

.apl-disclosure[open] .apl-disclosure-hint::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.apl-disclosure .when-open,
.apl-disclosure[open] .when-closed {
  display: none;
}

.apl-disclosure[open] .when-open {
  display: inline;
}

.apl-disclosure-body {
  padding: 0 0 16px;
}

/* ---------- SVT / ECU module viewer ---------- */
.svt-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.svt-view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--apl-fill-strong);
  border-radius: 12px;
  flex: 0 0 auto;
}

.svt-view-toggle button {
  width: 44px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--apl-text-soft);
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.svt-view-toggle button:hover {
  color: var(--apl-text);
}

.svt-view-toggle button.is-active {
  background: var(--apl-surface);
  color: var(--apl-blue);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.svt-view-toggle button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--apl-blue-ring);
}

.svt-source {
  flex: 1;
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--apl-fill);
  border-radius: 12px;
  font-size: 14px;
  color: var(--apl-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.svt-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  margin-bottom: 12px;
  background: var(--apl-fill-strong);
  border-radius: 12px;
  color: var(--apl-text-soft);
}

.svt-search:focus-within {
  box-shadow: 0 0 0 4px var(--apl-blue-ring);
}

.svt-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--apl-text);
}

.svt-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 14px;
  scrollbar-width: thin;
}

.svt-chips button {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--apl-border);
  border-radius: 999px;
  background: var(--apl-surface);
  color: var(--apl-text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.svt-chips button span {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 400;
  color: var(--apl-text-soft);
  margin-left: 4px;
}

.svt-chips button.is-active {
  background: var(--apl-blue);
  border-color: var(--apl-blue);
  color: #fff;
}

.svt-chips button.is-active span {
  color: rgba(255, 255, 255, 0.8);
}

.svt-cards {
  display: grid;
  gap: 12px;
}

.svt-card {
  background: var(--apl-fill);
  border-radius: 16px;
  padding: 8px;
}

.svt-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 12px;
}

.svt-card-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #30c8d6 0%, #0a9fb5 100%);
  box-shadow: 0 4px 12px rgba(10, 159, 181, 0.3);
}

.svt-card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--apl-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.svt-addr {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--apl-text-soft);
  background: var(--apl-fill-strong);
  border-radius: 6px;
  padding: 2px 7px;
}

.svt-card-sub {
  font-size: 13px;
  color: var(--apl-text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.svt-rows {
  background: var(--apl-surface);
  border-radius: 12px;
  overflow: hidden;
}

.svt-row {
  display: grid;
  grid-template-columns: 64px 110px 110px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--apl-hairline);
  font-size: 14px;
}

.svt-row:last-child {
  border-bottom: 0;
}

.svt-class {
  display: inline-flex;
  justify-content: center;
  min-width: 52px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--apl-fill-strong);
  color: var(--apl-text-soft);
}

.svt-class-btld { background: rgba(88, 86, 214, 0.12); color: #5856d6; }
.svt-class-cafd { background: rgba(52, 199, 89, 0.14); color: #248a3d; }
.svt-class-swfl,
.svt-class-swff,
.svt-class-swfk,
.svt-class-swpf { background: rgba(0, 113, 227, 0.1); color: var(--apl-blue); }
.svt-class-flsl { background: rgba(48, 176, 199, 0.14); color: #0e7f93; }
.svt-class-hwel,
.svt-class-hwap { background: var(--apl-fill-strong); color: var(--apl-text-faint); }
.svt-class-ibad,
.svt-class-entd,
.svt-class-navd { background: rgba(255, 149, 0, 0.13); color: var(--apl-orange); }

.svt-id {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--apl-text);
}

.svt-version {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--apl-text-soft);
}

.svt-label {
  color: var(--apl-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .svt-row {
    grid-template-columns: 56px minmax(0, 1fr) auto;
  }

  .svt-label {
    grid-column: 2 / -1;
  }

  .svt-toolbar {
    flex-wrap: wrap;
  }
}

/* Tree view */
.svt-tree {
  font-size: 15px;
}

.svt-tree details {
  margin-left: 0;
}

.svt-tree details details {
  margin-left: 18px;
  padding-left: 12px;
  border-left: 1px solid var(--apl-hairline);
}

.svt-tree summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
  color: var(--apl-text);
}

.svt-tree summary::-webkit-details-marker {
  display: none;
}

.svt-tree summary::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-right: 1.8px solid var(--apl-text-soft);
  border-bottom: 1.8px solid var(--apl-text-soft);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  margin-right: 4px;
}

.svt-tree details[open] > summary::before {
  transform: rotate(45deg);
}

.svt-tree summary:hover {
  background: var(--apl-fill);
}

.svt-folder {
  width: 20px;
  height: 16px;
  flex: 0 0 20px;
  border: 1.8px solid var(--apl-blue);
  border-radius: 3px 3px 4px 4px;
  position: relative;
}

.svt-folder::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -1.8px;
  width: 9px;
  height: 5px;
  border: 1.8px solid var(--apl-blue);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.svt-tree ul {
  list-style: none;
  margin: 2px 0 6px 18px;
  padding: 0 0 0 12px;
  border-left: 1px solid var(--apl-hairline);
}

.svt-tree-leaf {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 6px;
  font-size: 14px;
}

/* ---------- Alert dialog (macOS style) ---------- */
.apl-alert-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.apl-alert-backdrop.is-visible {
  opacity: 1;
}

.apl-alert {
  width: 100%;
  max-width: 300px;
  padding: 24px 18px 18px;
  text-align: center;
  background: rgba(246, 246, 246, 0.96);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border-radius: 14px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 22px 70px rgba(0, 0, 0, 0.28);
  transform: scale(0.94);
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.apl-alert-backdrop.is-visible .apl-alert {
  transform: scale(1);
}

.apl-alert-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #3a9bff 0%, #0071e3 100%);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.apl-alert-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--apl-text);
  margin: 0 0 6px;
}

.apl-alert-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--apl-text);
  margin: 0 0 18px;
}

.apl-alert-actions {
  display: grid;
  gap: 8px;
}

.apl-alert-btn {
  display: block;
  width: 100%;
  height: 32px;
  line-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  color: var(--apl-text);
  background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.06);
  cursor: pointer;
}

.apl-alert-btn:hover {
  color: var(--apl-text);
  background: #fafafa;
}

.apl-alert-btn.is-primary {
  color: #fff;
  background: linear-gradient(180deg, #2a8bf2 0%, #0071e3 100%);
  box-shadow: 0 0 0 0.5px rgba(0, 80, 170, 0.5), 0 1px 1px rgba(0, 0, 0, 0.08);
}

.apl-alert-btn.is-primary:hover {
  color: #fff;
  filter: brightness(1.05);
}

.apl-alert-btn.is-plain {
  background: transparent;
  box-shadow: none;
  color: var(--apl-text-soft);
}

.apl-alert-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--apl-blue-ring);
}

/* ---------- My Cars ---------- */
.apl-page-title {
  font-family: var(--apl-font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.apl-car-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.apl-car-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--apl-surface);
  border-radius: var(--apl-radius-card);
  box-shadow: var(--apl-shadow-card);
  color: var(--apl-text);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.apl-car-card:hover {
  color: var(--apl-text);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 14px 36px rgba(0, 0, 0, 0.08);
}

.apl-car-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--apl-blue-ring);
}

.apl-car-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.apl-car-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #3a9bff 0%, #0071e3 100%);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.25);
}

.apl-car-model {
  font-family: var(--apl-font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apl-car-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--apl-text-soft);
}

.apl-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 6px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--apl-blue);
}

.apl-pill-warning {
  background: rgba(255, 149, 0, 0.13);
  color: var(--apl-orange);
}

.apl-car-vin {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  background: var(--apl-fill);
  border-radius: 10px;
}

.apl-car-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 0.6fr);
  gap: 8px;
}

.apl-car-facts strong.font-monospace {
  font-size: 13px;
}

.apl-car-facts div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.apl-car-facts span {
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-car-facts strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apl-car-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--apl-hairline);
  font-size: 12px;
  color: var(--apl-text-faint);
}

.apl-car-open {
  color: var(--apl-blue);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

/* ---------- Car detail ---------- */
.apl-back-link {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--apl-blue);
  text-decoration: none;
}

.apl-back-link:hover {
  text-decoration: underline;
}

.apl-car-hero {
  display: flex;
  align-items: center;
  gap: 18px;
}

.apl-car-icon-lg {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 20px;
}

.apl-service-dot {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  color: #fff !important;
  background: linear-gradient(145deg, #3a9bff 0%, #0071e3 100%);
}

.apl-service-dot i {
  color: #fff !important;
}

.apl-car-hero .apl-car-vin {
  background: var(--apl-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ---------- Service results (CarPlay verdicts, detail grid) ---------- */
.apl-verdict {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  height: 100%;
  padding: 16px;
  border-radius: 16px;
  background: var(--apl-fill);
}

.apl-verdict-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: var(--apl-text-faint);
}

.apl-verdict.is-yes .apl-verdict-icon { background: var(--apl-green-fill); }
.apl-verdict.is-no .apl-verdict-icon { background: #ff3b30; }

.apl-verdict-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--apl-text-soft);
}

.apl-verdict-value {
  font-family: var(--apl-font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--apl-text);
}

.apl-verdict.is-yes .apl-verdict-value { color: var(--apl-green); }
.apl-verdict.is-no .apl-verdict-value { color: var(--apl-red); }

.apl-verdict-message {
  margin-top: 2px;
  font-size: 13px;
  color: var(--apl-text-soft);
}

.apl-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.apl-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--apl-fill);
  min-width: 0;
}

.apl-detail-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 15px;
  color: #fff;
}

.apl-detail-icon i {
  color: #fff !important;
  --fa-primary-color: #fff;
  --fa-secondary-color: #fff;
  --fa-secondary-opacity: 0.55;
}

.apl-detail-icon.tint-blue   { background: linear-gradient(145deg, #3a9bff, #0071e3); }
.apl-detail-icon.tint-indigo { background: linear-gradient(145deg, #7d7aff, #5856d6); }
.apl-detail-icon.tint-purple { background: linear-gradient(145deg, #c27ef0, #af52de); }
.apl-detail-icon.tint-orange { background: linear-gradient(145deg, #ffb340, #ff9500); }
.apl-detail-icon.tint-green  { background: linear-gradient(145deg, #4cd964, #28a745); }
.apl-detail-icon.tint-teal   { background: linear-gradient(145deg, #5ac8fa, #30b0c7); }
.apl-detail-icon.tint-pink   { background: linear-gradient(145deg, #ff6b8b, #ff2d55); }
.apl-detail-icon.tint-gray   { background: linear-gradient(145deg, #a1a1a6, #8e8e93); }

.apl-detail-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.apl-detail-label {
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-detail-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--apl-text);
  overflow-wrap: anywhere;
}

.apl-car-services {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.apl-pill-neutral {
  background: var(--apl-fill-strong);
  color: var(--apl-text-soft);
}

.apl-list-link > span:last-child {
  flex: 0 0 auto;
  white-space: nowrap;
}

.apl-pill-ncd {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(88, 86, 214, 0.12);
  color: #5856d6;
  letter-spacing: 0.02em;
}

/* ---------- NCD upload + jobs ---------- */
.apl-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 150px;
  padding: 18px;
  text-align: center;
  border: 1.5px dashed var(--apl-border);
  border-radius: 16px;
  background: var(--apl-fill);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.apl-drop:hover,
.apl-drop:focus-within {
  border-color: var(--apl-blue);
  background: rgba(0, 113, 227, 0.05);
}

.apl-drop.has-file {
  border-style: solid;
  border-color: var(--apl-green-fill);
  background: rgba(52, 199, 89, 0.07);
}

.apl-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.apl-drop-icon {
  font-size: 28px;
  color: var(--apl-blue);
}

.apl-drop-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--apl-text);
}

.apl-drop-name {
  font-size: 13px;
  color: var(--apl-text-soft);
  word-break: break-all;
}

.apl-job {
  padding: 12px 0;
  border-bottom: 1px solid var(--apl-hairline);
}

.apl-job:last-child {
  border-bottom: 0;
}

.apl-job-state {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--apl-fill-strong);
  color: var(--apl-text-soft);
  white-space: nowrap;
}

.apl-job-state.is-busy { background: rgba(0, 113, 227, 0.1); color: var(--apl-blue); }
.apl-job-state.is-completed { background: rgba(52, 199, 89, 0.14); color: var(--apl-green); }
.apl-job-state.is-failed,
.apl-job-state.is-timeout { background: rgba(255, 59, 48, 0.1); color: var(--apl-red); }

.apl-job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.apl-job-actions:empty {
  display: none;
}

.btn.apl-btn-generating,
.btn.apl-btn-generating:disabled {
  opacity: 1;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ======================================================================
   Mobile
   ====================================================================== */
.apl-page-search {
  min-width: 260px;
}

@media (max-width: 767.98px) {
  /* Top bar: admin search lives on Admin Users; keep the bar to menu, alerts, balance, timer, avatar. */
  .layout-navbar .admin-global-search,
  .layout-navbar .navbar-nav-right > .navbar-nav:not(.flex-row) {
    display: none !important;
  }

  .layout-navbar {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .layout-navbar .layout-menu-toggle {
    margin-right: 8px !important;
  }

  .layout-navbar .navbar-nav-right .navbar-nav.flex-row {
    margin-left: auto;
    gap: 6px;
  }

  .layout-navbar .navbar-nav-right .navbar-nav.flex-row > .nav-item {
    margin-right: 0 !important;
  }

  .container-p-y,
  .container-xxl.container-p-y {
    padding-top: 1rem !important;
  }

  .card-body {
    padding: 1rem 1.1rem;
  }

  .card > .card-header,
  .card > .card-header-colour,
  .card-header-colour {
    padding: 1rem 1.1rem 0.25rem !important;
  }

  .card-header.d-flex {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .apl-page-title {
    font-size: 28px;
  }

  .apl-page-head,
  .apl-page-actions {
    width: 100%;
  }

  .apl-page-search {
    min-width: 0;
    flex: 1;
  }

  .apl-car-hero {
    gap: 14px;
  }

  .apl-car-icon-lg {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    border-radius: 16px;
  }

  .apl-car-grid {
    grid-template-columns: 1fr;
  }

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

  .svt-source {
    font-size: 13px;
  }

  /* Tables become stacked cards: each cell shows its column name on the left. */
  .apl-stack-table thead {
    display: none;
  }

  .apl-stack-table,
  .apl-stack-table tbody,
  .apl-stack-table tr,
  .apl-stack-table td {
    display: block;
    width: 100%;
  }

  .apl-stack-table tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--apl-hairline);
  }

  .apl-stack-table tr:last-child {
    border-bottom: 0;
  }

  .apl-stack-table > :not(caption) > * > * {
    border-bottom: 0;
    padding: 3px 0 !important;
  }

  .apl-stack-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    text-align: right !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .apl-stack-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--apl-text-soft);
    text-align: left;
  }

  .apl-stack-table td[data-label="Adjust"] {
    display: block;
    text-align: left !important;
  }

  .apl-stack-table td[data-label="Adjust"]::before {
    display: block;
    margin-bottom: 4px;
  }

  .apl-stack-table td[data-label="Adjust"] form input {
    width: 100% !important;
    min-width: 0 !important;
  }

  .apl-stack-table td[data-label="Actions"] {
    justify-content: flex-end;
  }

  .apl-stack-table td[data-label="Actions"]::before {
    content: none;
  }
}

@media (max-width: 575.98px) {
  .navbar-wallet,
  #sessionCountdown {
    padding: 6px 10px !important;
  }

  .layout-navbar .dropdown-user .avatar {
    width: 34px;
    height: 34px;
  }

  .apl-verdict-value {
    font-size: 18px;
  }

  .apl-detail-grid {
    grid-template-columns: 1fr;
  }

  .svt-row {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    row-gap: 2px;
  }

  .svt-label {
    grid-column: 2 / -1;
    font-size: 13px;
    color: var(--apl-text-soft);
  }

  .apl-alert {
    max-width: 320px;
  }
}

/* Sidebar as an overlay drawer (below xl): solid white, no sideways scrolling. */
@media (max-width: 1199.98px) {
  .layout-menu.menu-vertical,
  .layout-menu {
    background: #fff !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.18) !important;
  }
}

.layout-menu .menu-inner,
.layout-menu .menu-inner.ps {
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
}

@media (max-width: 1199.98px) {
  .layout-menu {
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
  }
}

.layout-menu .menu-inner > .menu-item,
.layout-menu .menu-inner > .menu-header {
  max-width: 100%;
}

.layout-menu .menu-inner-shadow {
  display: none !important;
}

.layout-menu .sidebar-powered-by {
  position: relative;
  z-index: 2;
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: -6px 0 0 !important;
  padding: 0 1rem 10px 39px;
  background: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The theme parks the menu's collapse button half outside the drawer; inside the mobile drawer
   that made the menu scroll sideways, so keep it inside the edge there. */
@media (max-width: 1199.98px) {
  .layout-menu .app-brand .layout-menu-toggle {
    right: 12px !important;
    left: auto !important;
    transform: translateY(-50%) !important;
  }
}

/* ---------- Top bar: page title, quick actions ---------- */
.apl-nav-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-right: 16px;
}

.apl-nav-title img {
  flex: 0 0 auto;
  object-fit: contain;
}

.apl-nav-title-text {
  font-family: var(--apl-font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--apl-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apl-nav-icon,
.apl-nav-cars {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-radius: 999px;
  background: var(--apl-fill);
  color: var(--apl-text);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.apl-nav-icon {
  width: 34px;
}

.apl-nav-cars {
  padding: 0 11px 0 9px;
  font-size: 13px;
  font-weight: 600;
}

.apl-nav-icon:hover,
.apl-nav-cars:hover {
  background: var(--apl-fill-strong);
  color: var(--apl-text);
}

.apl-nav-icon:focus-visible,
.apl-nav-cars:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--apl-blue-ring);
}

.layout-navbar .navbar-nav.flex-row {
  gap: 8px;
}

@media (min-width: 1200px) {
  /* Desktop already shows the page in the sidebar; keep the title compact next to the search. */
  .apl-nav-title-text {
    font-size: 17px;
  }
}

@media (max-width: 767.98px) {
  .apl-nav-title {
    flex: 1;
    margin-right: 8px;
  }

  .apl-nav-title-text {
    font-size: 17px;
  }

  .layout-navbar .navbar-nav-right {
    flex: 0 0 auto;
  }
}

@media (max-width: 399.98px) {
  .apl-nav-title img + .apl-nav-title-text {
    display: none;
  }
}

/* ---------- Sidebar badges ---------- */
.layout-menu .menu-link .apl-menu-badge {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--apl-fill-strong);
  color: var(--apl-text-soft);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 18px;
}

.layout-menu .menu-link .apl-menu-badge.is-money {
  background: rgba(0, 113, 227, 0.1);
  color: var(--apl-blue);
}

.layout-menu .menu-item.active .apl-menu-badge {
  background: #fff;
}

html.layout-menu-collapsed:not(.layout-menu-hover) .layout-menu .apl-menu-badge {
  display: none;
}

/* ---------- Quick VIN search popover (drops down from the top-bar icon) ---------- */
.apl-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.apl-sheet-backdrop.is-visible {
  opacity: 1;
}

.apl-sheet {
  position: fixed;
  padding: 18px 18px 10px;
  background: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-radius: 18px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.1), 0 18px 50px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.apl-sheet-backdrop.is-visible .apl-sheet {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.apl-sheet-arrow {
  position: absolute;
  top: -7px;
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: -0.5px -0.5px 0 0 rgba(0, 0, 0, 0.08);
}

.apl-sheet-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.apl-sheet-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--apl-fill-strong);
  color: var(--apl-text-soft);
  font-size: 20px;
  line-height: 1;
}

.apl-sheet-hint {
  margin: 8px 2px 14px;
  font-size: 13px;
  color: var(--apl-text-soft);
}

.apl-sheet-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: var(--apl-fill);
  color: var(--apl-text);
  text-decoration: none;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.apl-sheet-action:hover {
  background: var(--apl-fill-strong);
  color: var(--apl-text);
}

.apl-sheet-action.is-disabled {
  opacity: 0.45;
}

.apl-sheet-action.is-garage {
  background: rgba(52, 199, 89, 0.12);
}

.apl-sheet-action > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.apl-sheet-action small {
  font-size: 12px;
  color: var(--apl-text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apl-sheet-action-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #fff !important;
  background: linear-gradient(145deg, #3a9bff 0%, #0071e3 100%);
}

.apl-sheet-action-icon i {
  color: #fff !important;
}

.apl-sheet-action.is-garage .apl-sheet-action-icon {
  background: linear-gradient(145deg, #4cd964 0%, #28a745 100%);
}

.apl-sheet-chevron {
  font-size: 22px;
  color: var(--apl-text-faint);
}

@media (min-width: 768px) {
  .apl-nav-title {
    flex: 0 0 auto;
    max-width: 280px;
  }
}

/* Collapse button on the sidebar edge: white circle, grey chevron. */
.layout-menu .app-brand .layout-menu-toggle {
  background: #fff !important;
  color: var(--apl-text-soft) !important;
  border: 0 !important;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}

.layout-menu .app-brand .layout-menu-toggle:hover {
  color: var(--apl-blue) !important;
}

.layout-menu .app-brand .layout-menu-toggle i {
  color: inherit !important;
}

/* Bootstrap has no min-width utility; flex children need it to truncate text. */
.min-w-0 {
  min-width: 0 !important;
}

/* ---------- File rows (car page) ---------- */
.apl-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--apl-radius-control);
  color: var(--apl-text);
  text-decoration: none;
}

.apl-file-row:hover {
  background: var(--apl-fill);
  color: var(--apl-text);
}

.apl-file-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.apl-file-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.apl-file-top .apl-pill {
  flex: 0 0 auto;
}

.apl-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.apl-file-meta {
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-file-download {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 113, 227, 0.1);
  color: var(--apl-blue);
}

.apl-sheet-action-icon.is-ncd {
  background: linear-gradient(145deg, #7d7aff 0%, #5856d6 100%);
}

/* ---------- Admin pricing ---------- */
.apl-price-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--apl-hairline);
}

.apl-price-row .apl-service-dot {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 15px;
  flex: 0 0 36px;
}

.apl-price-info {
  flex: 1;
  min-width: 0;
}

.apl-price-name {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--apl-text);
  margin: 0;
}

.apl-price-meta {
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-price-input {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.apl-price-input span {
  font-size: 17px;
  font-weight: 600;
  color: var(--apl-text-soft);
}

.apl-price-input input {
  width: 110px;
  height: 44px;
  font-size: 17px;
  font-weight: 600;
  text-align: right;
}

/* Icons inside filled buttons are white (duotone icons included: both layers white, second one softer). */
.btn-primary i,
.btn-blue i,
.btn-info i,
.btn-success i,
.btn-danger i,
.btn-red i,
.btn-warning i,
.btn-yellow i,
.btn-purple i {
  color: #fff !important;
  --fa-primary-color: #fff;
  --fa-secondary-color: #fff;
  --fa-primary-opacity: 1;
  --fa-secondary-opacity: 0.55;
}

.btn-primary i.fad::before,
.btn-primary i.fad::after,
.btn-blue i.fad::before,
.btn-blue i.fad::after,
.btn-info i.fad::before,
.btn-info i.fad::after,
.btn-success i.fad::before,
.btn-success i.fad::after,
.btn-danger i.fad::before,
.btn-danger i.fad::after,
.btn-red i.fad::before,
.btn-red i.fad::after,
.btn-warning i.fad::before,
.btn-warning i.fad::after,
.btn-yellow i.fad::before,
.btn-yellow i.fad::after,
.btn-purple i.fad::before,
.btn-purple i.fad::after {
  color: #fff !important;
}

/* Spotlight: the service card you came to opens with a short zoom and a deeper shadow, then settles.
   The card's own shadow is !important (animations can't override it), so the deeper shadow is a layer. */
@keyframes apl-spotlight-zoom {
  0%, 100% { transform: scale(1); }
  35%, 70% { transform: scale(1.025); }
}

@keyframes apl-spotlight-shadow {
  0%, 100% { opacity: 0; }
  35%, 70% { opacity: 1; }
}

.card.apl-spotlight {
  position: relative;
  z-index: 3;
  animation: apl-spotlight-zoom 1.6s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}

.card.apl-spotlight::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14), 0 26px 64px rgba(0, 0, 0, 0.32);
  animation: apl-spotlight-shadow 1.6s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .card.apl-spotlight,
  .card.apl-spotlight::after {
    animation: none;
  }
}

@media (min-width: 1200px) {
  .apl-detail-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.layout-menu .menu-link .apl-menu-badge.is-price {
  background: rgba(52, 199, 89, 0.13);
  color: var(--apl-green);
}

/* ---------- Sidebar group (Tools dropdown) ---------- */
.layout-menu .menu-inner > .apl-menu-group.active > .menu-link,
.layout-menu .menu-inner > .apl-menu-group.open > .menu-link {
  background: transparent !important;
  color: var(--apl-text) !important;
}

.layout-menu .menu-inner > .apl-menu-group.active > .menu-link .menu-icon {
  color: var(--apl-text-soft) !important;
}

.layout-menu .apl-menu-group > .menu-link.menu-toggle::after {
  color: var(--apl-text-faint);
}

.layout-menu .apl-menu-group .menu-sub {
  padding: 2px 0 4px;
}

.layout-menu .apl-menu-group .menu-sub > .menu-item > .menu-link {
  border-radius: var(--apl-radius-control);
  padding-left: 2.25rem !important;
  font-size: 14px;
  font-weight: 500;
  color: var(--apl-text);
}

.layout-menu .apl-menu-group .menu-sub > .menu-item > .menu-link::before {
  display: none !important;
}

.layout-menu .apl-menu-group .menu-sub > .menu-item > .menu-link .menu-icon {
  color: var(--apl-text-soft);
  font-size: 1rem;
}

.layout-menu .apl-menu-group .menu-sub > .menu-item:not(.active) > .menu-link:hover {
  background: var(--apl-fill-strong) !important;
}

.layout-menu .apl-menu-group .menu-sub > .menu-item.active > .menu-link {
  background: rgba(0, 113, 227, 0.1) !important;
  color: var(--apl-blue) !important;
}

.layout-menu .apl-menu-group .menu-sub > .menu-item.active > .menu-link .menu-icon {
  color: var(--apl-blue) !important;
}

/* ---------- Vehicle Order (FA) codes ---------- */
.apl-code-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.apl-code-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--apl-fill);
  font-size: 13px;
  color: var(--apl-text-soft);
}

.apl-code-chip strong {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--apl-text);
}

.apl-code-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apl-sheet-action-icon.is-fa {
  background: linear-gradient(145deg, #ffb340 0%, #ff9500 100%);
}


/* ---------- NCD upload: file analysis animation ---------- */
.apl-drop {
  overflow: hidden;
  transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.25s ease;
}

.apl-drop-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: var(--apl-green-fill);
  opacity: 0;
  transform: scale(0.4);
}

.apl-drop-check .apl-tick {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}

.apl-drop.is-analysed {
  animation: apl-drop-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.apl-drop.is-analysed .apl-drop-check {
  animation: apl-check-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.4) 0.1s forwards;
}

.apl-drop.is-analysed .apl-drop-check .apl-tick {
  animation: apl-tick-draw 0.35s ease-out 0.35s forwards;
}

.apl-drop-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.apl-drop-stats:empty {
  display: none;
}

.apl-drop-count {
  font-size: 15px;
  font-weight: 500;
  color: var(--apl-text-soft);
  animation: apl-fade-up 0.4s ease both 0.15s;
}

.apl-drop-count b {
  font-family: var(--apl-font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--apl-green);
  font-variant-numeric: tabular-nums;
  margin-right: 2px;
}

.apl-drop-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
}

.apl-drop-chips span {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--apl-text);
  opacity: 0;
  animation: apl-fade-up 0.35s ease forwards;
}

.apl-drop.is-invalid {
  border-style: solid;
  border-color: #ff3b30;
  background: rgba(255, 59, 48, 0.06);
}

.apl-drop-error {
  font-size: 13px;
  font-weight: 500;
  color: var(--apl-red);
}

@keyframes apl-drop-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@keyframes apl-check-in {
  to { opacity: 1; transform: scale(1); }
}

@keyframes apl-tick-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes apl-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .apl-drop.is-analysed,
  .apl-drop.is-analysed .apl-drop-check,
  .apl-drop.is-analysed .apl-drop-check .apl-tick,
  .apl-drop-count,
  .apl-drop-chips span {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }
}

/* "Already in your database" hint on service search pages */
.apl-known-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(52, 199, 89, 0.12);
  color: var(--apl-green);
  font-size: 14px;
  animation: apl-fade-up 0.25s ease both;
}

.apl-known-hint[hidden] {
  display: none;
}

.apl-known-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--apl-green-fill);
  color: #fff;
}

.apl-known-text {
  flex: 1;
  min-width: 0;
}

.apl-known-text span {
  color: var(--apl-text-soft);
}

.apl-known-open {
  font-weight: 600;
  color: var(--apl-green);
  text-decoration: none;
  white-space: nowrap;
}

.apl-known-open:hover {
  color: var(--apl-green);
  text-decoration: underline;
}

/* Small download button used inside clickable cards / list rows */
.apl-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--apl-blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.apl-dl-btn:hover {
  background: var(--apl-blue-hover);
}

.apl-dl-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--apl-blue-ring);
}

.apl-dl-btn i {
  color: #fff !important;
  --fa-primary-color: #fff;
  --fa-secondary-color: #fff;
  --fa-secondary-opacity: 0.55;
}

/* FA tree leaves */
.apl-tree-key {
  min-width: 110px;
  font-size: 13px;
  color: var(--apl-text-soft);
}

.apl-tree-desc {
  font-size: 14px;
  color: var(--apl-text);
}

.apl-fa-download {
  flex: 0 0 auto;
  height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 12px !important;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .apl-fa-download {
    width: 100%;
    justify-content: center;
  }
}

/* NCD: files stay visible while the job runs, but can't be changed. */
#ncdForm.is-generating .apl-drop {
  cursor: default;
  pointer-events: none;
}

/* Two-option segment (PayPal sandbox/live on the Pricing page). */
.apl-segment.apl-segment-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.apl-segment.apl-segment-2 button {
  height: auto;
  min-height: 56px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
}

.apl-segment.apl-segment-2 button small {
  font-size: 12px;
  font-weight: 400;
  color: var(--apl-text-soft);
}

.apl-segment button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Admin user page */
.apl-user-balance {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--apl-text);
  line-height: 1.2;
}

.apl-user-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.apl-user-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--apl-fill);
  min-width: 0;
}

.apl-user-stats span {
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-user-stats strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--apl-text);
  overflow-wrap: anywhere;
}

.apl-price-custom {
  color: var(--apl-blue);
  font-weight: 600;
}

.apl-price-input input::placeholder {
  color: var(--apl-text-soft);
  opacity: 0.6;
  font-weight: 500;
}

/* Users list: the email opens the user page */
.apl-user-link {
  color: var(--apl-text);
  font-weight: 500;
}

.apl-user-link:hover {
  color: var(--apl-blue);
}

/* Admin API usage */
.apl-usage-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.apl-usage-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--apl-radius-card, 18px);
  background: var(--apl-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
}

.apl-usage-tile span {
  font-size: 13px;
  color: var(--apl-text-soft);
}

.apl-usage-tile strong {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--apl-text);
}

.apl-usage-tile.is-balance strong { color: var(--apl-blue); }
.apl-usage-tile.is-ok strong { color: #248a3d; }
.apl-usage-tile.is-warn strong { color: #c93400; }
.apl-usage-tile.is-bad strong { color: #d70015; }

.apl-usage-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--apl-hairline);
}

.apl-usage-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

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

.apl-usage-bar {
  height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--apl-fill);
  overflow: hidden;
}

.apl-usage-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #34c759;
}

.apl-usage-bar.is-mid span { background: #ff9f0a; }
.apl-usage-bar.is-high span { background: #ff3b30; }

.apl-usage-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--apl-text-soft);
}

.apl-usage-counts .is-ok { color: #248a3d; }
.apl-usage-counts .is-warn { color: #c93400; }
.apl-usage-counts .is-bad { color: #d70015; }

.apl-usage-brackets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.apl-usage-brackets span {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--apl-fill);
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-usage-brackets span.is-current {
  background: rgba(0, 113, 227, 0.1);
  color: var(--apl-blue);
  font-weight: 600;
}

/* Owner-only vinrequest PAYG balance in the top bar */
#paygPillItem[hidden],
#paygMenuItem[hidden] {
  display: none !important;
}

.navbar-payg {
  background: rgba(52, 199, 89, 0.12) !important;
  color: #248a3d !important;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
}

.navbar-payg:hover {
  background: rgba(52, 199, 89, 0.2) !important;
}

.navbar-payg-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.75;
}

/* Dashboard: all services */
.apl-dash-services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding-top: 4px;
}

.apl-dash-service {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--apl-fill);
  color: var(--apl-text);
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.apl-dash-service:hover {
  background: rgba(0, 113, 227, 0.08);
  color: var(--apl-text);
  transform: translateY(-1px);
}

.apl-dash-service .apl-service-dot {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 11px;
  font-size: 17px;
}

.apl-dash-service-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.apl-dash-service-name {
  font-size: 15px;
  font-weight: 600;
}

.apl-dash-service-desc {
  font-size: 12px;
  color: var(--apl-text-soft);
  line-height: 1.35;
}

.apl-dash-price {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.14);
  color: #248a3d;
  font-size: 12px;
  font-weight: 600;
}

/* Dashboard period cards (today / yesterday / last 7 days / months) */
.apl-stat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 4px;
  font-size: 17px;
  font-weight: 600;
  color: var(--apl-text);
}

.apl-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.apl-stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border-radius: var(--apl-radius-card);
  background: var(--apl-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  min-width: 0;
}

.apl-stat-card.is-today {
  background: linear-gradient(145deg, #3a9bff 0%, #0071e3 100%);
  color: #fff;
}

.apl-stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--apl-text-soft);
}

.apl-stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--apl-text);
  line-height: 1.2;
}

.apl-stat-caption {
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-stat-rows {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--apl-hairline);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.apl-stat-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.apl-stat-rows dt {
  font-weight: 400;
  color: var(--apl-text-soft);
}

.apl-stat-rows dd {
  margin: 0;
  font-weight: 600;
  color: var(--apl-text);
}

.apl-stat-card.is-today .apl-stat-label,
.apl-stat-card.is-today .apl-stat-caption,
.apl-stat-card.is-today .apl-stat-rows dt {
  color: rgba(255, 255, 255, 0.8);
}

.apl-stat-card.is-today .apl-stat-value,
.apl-stat-card.is-today .apl-stat-rows dd {
  color: #fff;
}

.apl-stat-card.is-today .apl-stat-rows {
  border-top-color: rgba(255, 255, 255, 0.25);
}

@media (max-width: 1199.98px) {
  .apl-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .apl-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .apl-stat-value {
    font-size: 22px;
  }
}

/* Sample car every new account gets */
.apl-pill.apl-pill-demo {
  background: rgba(255, 159, 10, 0.14);
  color: #c93400;
  font-weight: 600;
}

/* Users list on phones: one card per user, switches and buttons centred on their row. */
@media (max-width: 767.98px) {
  .apl-users-table td {
    align-items: center;
  }

  .apl-users-table td[data-label="ID"] {
    font-size: 12px;
    color: var(--apl-text-soft);
  }

  .apl-users-table td[data-label="Email"] .apl-user-link {
    font-size: 16px;
    font-weight: 600;
    word-break: break-all;
  }

  .apl-users-table td > form,
  .apl-users-table td > .d-flex {
    justify-content: flex-end;
  }

  .apl-users-table td[data-label="Actions"] > * {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }
}

/* Admin user page: role switch */
.apl-role-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--apl-hairline);
  border-bottom: 1px solid var(--apl-hairline);
}

.apl-role-segment {
  width: 240px;
  max-width: 100%;
}

.apl-segment.apl-segment-2.apl-role-segment button {
  height: 40px;
  min-height: 0;
  font-size: 15px;
}

/* Top-ups: owner dashboard list and user page */
.apl-topup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--apl-hairline);
  color: var(--apl-text);
  text-decoration: none;
}

.apl-topup-row:last-child {
  border-bottom: 0;
}

a.apl-topup-row:hover .apl-topup-email {
  color: var(--apl-blue);
}

.apl-topup-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(52, 199, 89, 0.14);
  color: #248a3d;
  font-size: 13px;
}

.apl-topup-who {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.apl-topup-email {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apl-topup-amount {
  color: #248a3d;
  font-weight: 600;
  white-space: nowrap;
}

.apl-topup-chart {
  min-height: 300px;
  margin: 0 -8px;
}

/* Users table: sign-up period cards that filter the rows */
.apl-period-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.apl-period-filter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--apl-fill);
  color: var(--apl-text);
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  min-width: 0;
}

.apl-period-filter:hover {
  background: rgba(0, 113, 227, 0.08);
}

.apl-period-filter.is-active {
  background: linear-gradient(145deg, #3a9bff 0%, #0071e3 100%);
  color: #fff;
}

.apl-period-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--apl-text-soft);
}

.apl-period-count {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.apl-period-meta {
  font-size: 11px;
  color: var(--apl-text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.apl-period-filter.is-active .apl-period-label,
.apl-period-filter.is-active .apl-period-meta {
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 1199.98px) {
  .apl-period-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .apl-period-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Users as cards, grouped by sign-up day */
.apl-users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.apl-ucard-day + .apl-ucard-day {
  margin-top: 26px;
}

.apl-ucard-day-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--apl-text);
}

.apl-ucard-day-title span {
  margin-left: 6px;
  font-size: 14px;
  font-weight: 400;
  color: var(--apl-text-soft);
}

.apl-ucard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.apl-ucard {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--apl-hairline);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--apl-surface) 0%, var(--apl-fill) 260%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  color: var(--apl-text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}

.apl-ucard:hover {
  color: var(--apl-text);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 14px 32px rgba(0, 0, 0, 0.08);
}

.apl-ucard[hidden],
.apl-ucard-day[hidden] {
  display: none !important;
}

.apl-ucard-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--apl-hairline);
}

.apl-ucard-tile {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.22);
}

.apl-ucard-tile.tint-blue   { background: linear-gradient(145deg, #3a9bff, #0071e3); }
.apl-ucard-tile.tint-indigo { background: linear-gradient(145deg, #7d7aff, #5856d6); }
.apl-ucard-tile.tint-purple { background: linear-gradient(145deg, #c27ef0, #af52de); }
.apl-ucard-tile.tint-orange { background: linear-gradient(145deg, #ffb340, #ff9500); }
.apl-ucard-tile.tint-green  { background: linear-gradient(145deg, #4cd964, #28a745); }
.apl-ucard-tile.tint-teal   { background: linear-gradient(145deg, #5ac8fa, #30b0c7); }
.apl-ucard-tile.tint-pink   { background: linear-gradient(145deg, #ff6b8b, #ff2d55); }

.apl-ucard-email {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apl-ucard-sub {
  font-size: 13px;
  color: var(--apl-text-soft);
}

.apl-ucard-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.apl-ucard-badges:empty {
  display: none;
}

.apl-ucard-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--apl-hairline);
  flex: 1;
  align-content: flex-start;
}

.apl-uchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.apl-uchip i { font-size: 13px; }
.apl-uchip.is-blue   { background: rgba(0, 113, 227, 0.1);   color: #0071e3; }
.apl-uchip.is-teal   { background: rgba(48, 176, 199, 0.12); color: #1f8fa3; }
.apl-uchip.is-green  { background: rgba(52, 199, 89, 0.13);  color: #248a3d; }
.apl-uchip.is-orange { background: rgba(255, 149, 0, 0.14);  color: #c45f00; }
.apl-uchip.is-red    { background: rgba(255, 59, 48, 0.12);  color: #d70015; }
.apl-uchip.is-pink   { background: rgba(255, 45, 85, 0.1);   color: #d3214c; }
.apl-uchip.is-purple { background: rgba(175, 82, 222, 0.12); color: #8e3fbf; }
.apl-uchip.is-indigo { background: rgba(88, 86, 214, 0.12);  color: #4b49c4; }
.apl-uchip.is-gray   { background: var(--apl-fill);          color: var(--apl-text-soft); }

.apl-ucard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  font-size: 14px;
  font-weight: 500;
}

.apl-ucard-foot > span:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.apl-ucard-foot i {
  font-size: 20px;
  color: var(--apl-text-soft);
}

.apl-ucard-foot small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--apl-text-soft);
}

@media (max-width: 575.98px) {
  .apl-ucard-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Activity: the user's service orders */
.apl-usage-tile-text {
  font-size: 20px !important;
  line-height: 1.3;
}

.apl-order-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--apl-hairline);
  color: var(--apl-text);
  text-decoration: none;
}

.apl-order-row:last-child {
  border-bottom: 0;
}

.apl-order-row:hover .apl-order-title {
  color: var(--apl-blue);
}

.apl-order-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: #fff;
  font-size: 16px;
}

.apl-order-icon i {
  --fa-primary-color: #fff;
  --fa-secondary-color: #fff;
  --fa-secondary-opacity: 0.6;
  color: #fff;
}

.apl-order-main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.apl-order-title {
  font-size: 15px;
  font-weight: 600;
}

.apl-order-sub {
  font-size: 13px;
  color: var(--apl-text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apl-order-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  white-space: nowrap;
}

.apl-order-side strong {
  font-size: 15px;
  font-weight: 600;
}

.apl-order-side span {
  font-size: 12px;
  color: var(--apl-text-soft);
}

/* Public service pages: visitor sign-up */
.apl-nav-auth {
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  border-radius: 999px;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .apl-nav-auth.btn-label-secondary {
    display: none;
  }
}

.apl-guest-cta .card-body {
  padding: 24px;
}

.apl-guest-cta-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 20px;
  margin-bottom: 14px;
}

.apl-guest-cta-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.apl-guest-cta-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}

.apl-guest-cta-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 0;
  font-size: 14px;
}

.apl-guest-cta-list i {
  width: 18px;
  margin-top: 3px;
  color: var(--apl-blue);
}

/* =====================================================================
 * Dark mode (html[data-bs-theme="dark"]) — Apple system dark colours.
 * Tokens first; then the few rules above that use fixed light colours.
 * ===================================================================== */
html[data-bs-theme="dark"] {
  color-scheme: dark;
  --apl-bg: #000000;
  --apl-surface: #1c1c1e;
  --apl-text: #f5f5f7;
  --apl-text-soft: #a1a1a6;
  --apl-text-faint: #8e8e93;
  --apl-border: #3a3a3c;
  --apl-hairline: #2c2c2e;
  --apl-fill: #2c2c2e;
  --apl-fill-strong: #3a3a3c;
  --apl-blue: #0a84ff;
  --apl-blue-hover: #409cff;
  --apl-blue-ring: rgba(10, 132, 255, 0.32);
  --apl-green: #30d158;
  --apl-green-fill: #30d158;
  --apl-red: #ff453a;
  --apl-orange: #ff9f0a;
  --apl-yellow: #ffd60a;
  --apl-purple: #bf5af2;
  --apl-shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 28px rgba(0, 0, 0, 0.5);

  --bs-body-bg: var(--apl-bg);
  --bs-body-bg-rgb: 0, 0, 0;
  --bs-body-color: var(--apl-text);
  --bs-body-color-rgb: 245, 245, 247;
  --bs-heading-color: var(--apl-text);
  --bs-secondary-color: var(--apl-text-soft);
  --bs-border-color: var(--apl-hairline);
  --bs-paper-bg: var(--apl-surface);
  --bs-paper-bg-rgb: 28, 28, 30;
  --bs-primary: #0a84ff;
  --bs-primary-rgb: 10, 132, 255;
  --bs-primary-bg-subtle: rgba(10, 132, 255, 0.18);
  --bs-primary-border-subtle: rgba(10, 132, 255, 0.4);
  --bs-primary-text-emphasis: #64b0ff;
  --bs-link-color: #2997ff;
  --bs-link-color-rgb: 41, 151, 255;
  --bs-link-hover-color: #64b0ff;
  --bs-tertiary-bg: var(--apl-fill);
  --bs-secondary-bg: var(--apl-fill);
  --bs-box-shadow: var(--apl-shadow-card);
  --bs-box-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --bs-box-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* Chrome: sidebar, top bar, sheets */
html[data-bs-theme="dark"] .layout-menu,
html[data-bs-theme="dark"] .layout-menu .sidebar-powered-by,
html[data-bs-theme="dark"] .layout-menu .app-brand .layout-menu-toggle {
  background: var(--apl-surface) !important;
}

html[data-bs-theme="dark"] .layout-navbar {
  background: rgba(28, 28, 30, 0.78) !important;
}

html[data-bs-theme="dark"] .layout-menu .menu-item.active .apl-menu-badge,
html[data-bs-theme="dark"] .apl-alert-btn {
  background: var(--apl-fill-strong);
}

html[data-bs-theme="dark"] .apl-alert-btn:hover {
  background: #48484a;
}

html[data-bs-theme="dark"] .apl-sheet,
html[data-bs-theme="dark"] .apl-sheet-arrow {
  background: rgba(44, 44, 46, 0.98);
}

html[data-bs-theme="dark"] .apl-drop-chips span {
  background: rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="dark"] .tool-shell .tool-action:hover:not(:disabled) {
  background: var(--apl-fill) !important;
}

html[data-bs-theme="dark"] .cloud-packet-output {
  border-color: var(--apl-border) !important;
}

/* Alerts and status tints */
html[data-bs-theme="dark"] #sessionCountdown.bg-label-warning,
html[data-bs-theme="dark"] .alert-warning {
  background: rgba(255, 159, 10, 0.16) !important;
}

html[data-bs-theme="dark"] .alert-danger {
  background: rgba(255, 69, 58, 0.16) !important;
}

/* Cards and controls take the dark surface */
html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .modal-content,
html[data-bs-theme="dark"] .dropdown-menu,
html[data-bs-theme="dark"] .apl-ucard,
html[data-bs-theme="dark"] .apl-usage-tile,
html[data-bs-theme="dark"] .apl-stat-card {
  background: var(--apl-surface);
  color: var(--apl-text);
}

html[data-bs-theme="dark"] .apl-ucard {
  background: linear-gradient(180deg, #1c1c1e 0%, #151517 100%);
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select {
  background-color: var(--apl-fill);
  border-color: var(--apl-border);
  color: var(--apl-text);
}

html[data-bs-theme="dark"] .form-control::placeholder {
  color: var(--apl-text-faint);
}

html[data-bs-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--apl-text);
  --bs-table-border-color: var(--apl-hairline);
}

html[data-bs-theme="dark"] .btn-label-secondary {
  background: var(--apl-fill-strong);
  color: var(--apl-text);
}

/* Charts (ApexCharts) */
html[data-bs-theme="dark"] .apexcharts-tooltip {
  background: #2c2c2e !important;
  border-color: #3a3a3c !important;
  color: var(--apl-text) !important;
}

html[data-bs-theme="dark"] .apexcharts-tooltip-title {
  background: #3a3a3c !important;
  border-color: #3a3a3c !important;
}

html[data-bs-theme="dark"] .apexcharts-legend-text {
  color: var(--apl-text-soft) !important;
}

/* Theme switch in the top bar */
.apl-theme-menu {
  min-width: 170px;
  padding: 6px;
  border-radius: 14px;
}

.apl-theme-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 9px;
  padding: 8px 10px;
}

.apl-theme-menu .dropdown-item.is-active {
  color: var(--apl-blue);
  font-weight: 600;
}

.apl-theme-menu .dropdown-item i {
  width: 18px;
  text-align: center;
}

/* Dark: tinted "today" cards keep their blue */
html[data-bs-theme="dark"] .apl-stat-card.is-today {
  background: linear-gradient(145deg, #2f8cff 0%, #0060d0 100%);
  color: #fff;
}

/* Dark: legacy page styles (Users overview, agent modals) that use fixed light colours */
html[data-bs-theme="dark"] .admin-overview-stat .card,
html[data-bs-theme="dark"] .keys-agent-card,
html[data-bs-theme="dark"] .agent-info-item {
  background: var(--apl-surface) !important;
  border-color: var(--apl-hairline) !important;
}

html[data-bs-theme="dark"] .admin-overview-stat .stat-label,
html[data-bs-theme="dark"] .agent-status-note,
html[data-bs-theme="dark"] .agent-info-key,
html[data-bs-theme="dark"] .agent-info-label {
  color: var(--apl-text-soft) !important;
}

html[data-bs-theme="dark"] .admin-overview-stat .stat-value,
html[data-bs-theme="dark"] .agent-info-value,
html[data-bs-theme="dark"] .admin-create-modal .form-label {
  color: var(--apl-text) !important;
}

html[data-bs-theme="dark"] .admin-overview-stat .stat-icon {
  background: rgba(10, 132, 255, 0.18) !important;
  color: #64b0ff !important;
}

html[data-bs-theme="dark"] .admin-overview-stat .stat-meta-chip,
html[data-bs-theme="dark"] .keys-agent-btn.btn-label-gray {
  background: var(--apl-fill) !important;
  border-color: var(--apl-border) !important;
  color: var(--apl-text-soft) !important;
}

html[data-bs-theme="dark"] .admin-create-modal .form-control {
  background: var(--apl-fill);
  border-color: var(--apl-border);
  color: var(--apl-text);
}

/* Phones: no room for the page title next to the top-bar icons (logged-in bar). */
@media (max-width: 575.98px) {
  .layout-navbar .apl-nav-title {
    display: none !important;
  }

  .layout-navbar .navbar-nav-right {
    flex: 1 1 auto;
  }

  .layout-navbar .navbar-nav-right > .navbar-nav {
    margin-left: auto;
  }
}

/* Dark: the avatar sits on the dark bar without a light frame. */
html[data-bs-theme="dark"] .layout-navbar .dropdown-user .avatar,
html[data-bs-theme="dark"] .layout-navbar .dropdown-user .nav-link {
  background: transparent !important;
  box-shadow: none !important;
}

html[data-bs-theme="dark"] .layout-navbar .dropdown-user .avatar img {
  border-color: transparent !important;
  background: transparent !important;
}

/* How-to guides */
.apl-howto-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.apl-howto-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px;
  border-radius: 22px;
  background: var(--apl-surface);
  box-shadow: var(--apl-shadow-card);
  color: var(--apl-text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.apl-howto-choice:hover {
  color: var(--apl-text);
  transform: translateY(-2px);
}

.apl-howto-choice-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: #fff;
  font-size: 24px;
  margin-bottom: 6px;
}

.apl-howto-choice-icon.tint-blue { background: linear-gradient(145deg, #3a9bff, #0071e3); }
.apl-howto-choice-icon.tint-purple { background: linear-gradient(145deg, #c27ef0, #af52de); }
.apl-howto-choice-icon i { --fa-primary-color: #fff; --fa-secondary-color: #fff; --fa-secondary-opacity: 0.6; color: #fff; }

.apl-howto-choice-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.apl-howto-choice-text {
  color: var(--apl-text-soft);
  font-size: 15px;
  flex: 1;
}

.apl-howto-choice-more {
  color: var(--apl-blue);
  font-weight: 600;
}

.apl-howto-h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 8px 4px 12px;
}

.apl-howto-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.apl-howto-step {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border-radius: var(--apl-radius-card);
  background: var(--apl-surface);
  box-shadow: var(--apl-shadow-card);
}

.apl-howto-step span:not(.apl-howto-step-num) {
  color: var(--apl-text-soft);
  font-size: 14px;
}

.apl-howto-step a {
  font-weight: 600;
  font-size: 14px;
}

.apl-howto-step-num {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 113, 227, 0.12);
  color: var(--apl-blue);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.apl-howto-services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.apl-howto-service {
  margin: 0;
  scroll-margin-top: 90px;
}

.apl-howto-service .card-body {
  display: flex;
  flex-direction: column;
}

.apl-howto-service .card-body > .btn {
  margin-top: auto;
}

.apl-howto-service-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.apl-howto-service-head .apl-service-dot {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 11px;
  font-size: 17px;
}

.apl-howto-service-head h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 2px;
}

.apl-howto-service-head .min-w-0 {
  flex: 1;
}

.apl-howto-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.apl-howto-list li {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  font-size: 14px;
}

.apl-howto-list i {
  color: var(--apl-green);
  margin-top: 4px;
  font-size: 12px;
}

.apl-howto-faq details {
  border-bottom: 1px solid var(--apl-hairline);
  padding: 12px 0;
}

.apl-howto-faq details:last-child {
  border-bottom: 0;
}

.apl-howto-faq summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
}

.apl-howto-faq summary::-webkit-details-marker {
  display: none;
}

.apl-howto-faq summary::after {
  content: "+";
  color: var(--apl-text-soft);
  font-weight: 400;
  font-size: 20px;
  line-height: 1;
}

.apl-howto-faq details[open] summary::after {
  content: "–";
}

.apl-howto-faq p {
  margin: 8px 0 0;
  color: var(--apl-text-soft);
}

@media (max-width: 991.98px) {
  .apl-howto-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .apl-howto-steps,
  .apl-howto-services {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Dark: the Tool guide's own light styles */
html[data-bs-theme="dark"] .howto-hero,
html[data-bs-theme="dark"] .howto-flow-card,
html[data-bs-theme="dark"] .howto-module-card,
html[data-bs-theme="dark"] .howto-detail-card,
html[data-bs-theme="dark"] .howto-detail-step {
  background: var(--apl-surface) !important;
  border-color: var(--apl-hairline) !important;
}

html[data-bs-theme="dark"] .howto-note {
  background: var(--apl-fill) !important;
  border-color: var(--apl-border) !important;
  color: var(--apl-text-soft) !important;
}

html[data-bs-theme="dark"] .howto-subtitle,
html[data-bs-theme="dark"] .howto-detail-step p,
html[data-bs-theme="dark"] .howto-list {
  color: var(--apl-text-soft) !important;
}

html[data-bs-theme="dark"] .howto-flow-step {
  background: rgba(10, 132, 255, 0.18) !important;
  color: #64b0ff !important;
}

html[data-bs-theme="dark"] .howto-list li,
html[data-bs-theme="dark"] .howto-flow-card p,
html[data-bs-theme="dark"] .howto-module-card li {
  color: #c7c7cc !important;
}

.apl-howto-disclaimer {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--apl-radius-card);
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid rgba(255, 59, 48, 0.4);
}

.apl-howto-disclaimer-icon {
  color: #d70015;
  font-size: 22px;
  line-height: 1.2;
}

.apl-howto-disclaimer strong {
  display: block;
  margin-bottom: 4px;
  color: #d70015;
}

.apl-howto-disclaimer p {
  margin: 0;
  color: var(--apl-text-soft);
}

html[data-bs-theme="dark"] .apl-howto-disclaimer-icon,
html[data-bs-theme="dark"] .apl-howto-disclaimer strong {
  color: #ff453a;
}

html[data-bs-theme="dark"] .apl-howto-disclaimer {
  background: rgba(255, 69, 58, 0.14);
  border-color: rgba(255, 69, 58, 0.45);
}

/* Legal pages (Terms, Privacy, Cookies) and footer links */
.apl-legal .card-body {
  max-width: 820px;
  padding: 32px;
}

.apl-legal h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 26px 0 8px;
}

.apl-legal p,
.apl-legal li {
  color: var(--apl-text);
  line-height: 1.6;
}

.apl-legal ul {
  padding-left: 1.2rem;
}

.apl-legal li {
  margin-bottom: 6px;
}

.apl-legal-highlight {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 59, 48, 0.4);
  background: rgba(255, 59, 48, 0.08);
}

.apl-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 13px;
}

.apl-legal-links a {
  color: var(--apl-text-soft);
  text-decoration: none;
}

.apl-legal-links a:hover {
  color: var(--apl-blue);
}

@media (max-width: 575.98px) {
  .apl-legal .card-body {
    padding: 22px 18px;
  }
}

.apl-legal-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.apl-trademark-note {
  margin: 0;
  font-size: 11px;
  color: var(--apl-text-faint);
  text-align: right;
  max-width: 460px;
}

@media (max-width: 767.98px) {
  .apl-legal-footer {
    align-items: center;
  }

  .apl-trademark-note {
    text-align: center;
  }
}

/* "Automated service" badge next to the service name on its page */
.apl-auto-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.14);
  color: #248a3d;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.apl-auto-badge i {
  font-size: 11px;
}

html[data-bs-theme="dark"] .apl-auto-badge {
  background: rgba(48, 209, 88, 0.16);
  color: #30d158;
}

/* Manual services (AIR History): badge, steps, order status, admin orders */
.apl-manual-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 149, 0, 0.14);
  color: #c45f00;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

html[data-bs-theme="dark"] .apl-manual-badge {
  background: rgba(255, 159, 10, 0.16);
  color: #ff9f0a;
}

.apl-manual-steps {
  margin: 0 0 18px;
  padding-left: 1.2rem;
  color: var(--apl-text-soft);
  font-size: 14px;
}

.apl-manual-steps li {
  padding: 2px 0;
}

.apl-order-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--apl-hairline);
}

.apl-order-item:last-child {
  border-bottom: 0;
}

.apl-order-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.apl-order-status.is-pending { background: rgba(255, 149, 0, 0.14); color: #c45f00; }
.apl-order-status.is-completed { background: rgba(52, 199, 89, 0.14); color: #248a3d; }
.apl-order-status.is-rejected { background: var(--apl-fill); color: var(--apl-text-soft); }

html[data-bs-theme="dark"] .apl-order-status.is-pending { color: #ff9f0a; }
html[data-bs-theme="dark"] .apl-order-status.is-completed { color: #30d158; }

.layout-menu .menu-link .apl-menu-badge.is-alert {
  background: #ff3b30;
  color: #fff;
}

.layout-menu .menu-toggle .apl-menu-badge.is-alert {
  margin-right: 22px;
}

/* "See a sample report" link on manual service pages */
.apl-sample-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 10px;
  border: 1px solid var(--apl-hairline);
  border-radius: 14px;
  background: var(--apl-fill);
  color: var(--apl-text);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.apl-sample-btn:hover {
  border-color: rgba(255, 59, 48, 0.4);
  color: var(--apl-text);
}

.apl-sample-btn-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #ff6b5e, #e0261b);
  color: #fff;
  font-size: 17px;
}

.apl-sample-btn-icon i {
  --fa-primary-color: #fff;
  --fa-secondary-color: #fff;
  --fa-secondary-opacity: 0.6;
  color: #fff;
}

.apl-sample-btn strong {
  display: block;
  font-size: 14px;
}

.apl-sample-btn small {
  display: block;
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-sample-btn-go {
  margin-left: 6px;
  color: var(--apl-text-soft);
  font-size: 12px;
}

/* Manual order: "report into the tray → check" animation, then the new order pops into the list */
.apl-order-anim {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease;
}

.apl-order-anim[hidden] {
  display: none;
}

.apl-order-anim.is-playing {
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.apl-order-anim-card {
  width: min(320px, calc(100% - 40px));
  padding: 28px 24px 24px;
  border-radius: 24px;
  background: var(--apl-surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
  transform: scale(0.9) translateY(12px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.25s ease;
}

.apl-order-anim.is-playing .apl-order-anim-card {
  transform: none;
  opacity: 1;
}

.apl-order-anim-stage {
  position: relative;
  width: 140px;
  height: 130px;
  margin: 0 auto 14px;
}

.apl-order-anim-tray {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 34px;
  border-radius: 6px 6px 14px 14px;
  background: linear-gradient(180deg, #3a9bff, #0071e3);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.35);
  z-index: 2;
}

.apl-order-anim-tray::before {
  content: "";
  position: absolute;
  left: 34%;
  right: 34%;
  top: 10px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.55);
}

.apl-order-anim-doc {
  position: absolute;
  left: 32px;
  width: 76px;
  height: 92px;
  top: -6px;
  padding: 10px 9px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e5e5ea;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 1;
  transform: translateY(-30px) rotate(-6deg);
  opacity: 0;
}

.apl-order-anim.is-playing .apl-order-anim-doc {
  animation: apl-doc-drop 1.2s cubic-bezier(0.5, 0, 0.3, 1) 0.15s forwards;
}

.apl-order-anim-doc-head {
  height: 8px;
  width: 60%;
  border-radius: 3px;
  background: #ff3b30;
}

.apl-order-anim-doc-vin {
  padding: 2px 3px;
  border-radius: 3px;
  background: #d70015;
  color: #fff;
  font-size: 6.5px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.02em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

.apl-order-anim-line {
  height: 5px;
  border-radius: 3px;
  background: #e5e5ea;
}

.apl-order-anim-line.is-short {
  width: 65%;
}

@keyframes apl-doc-drop {
  0% { opacity: 0; transform: translateY(-34px) rotate(-6deg); }
  20% { opacity: 1; transform: translateY(-20px) rotate(-3deg); }
  70% { opacity: 1; transform: translateY(30px) rotate(0deg); }
  100% { opacity: 1; transform: translateY(44px) rotate(0deg) scale(0.96); }
}

.apl-order-anim-check {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  z-index: 3;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.2s ease, transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.apl-order-anim-check svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 8px 22px rgba(52, 199, 89, 0.45);
}

.apl-order-anim-check circle {
  fill: none;
  stroke: none;
}

.apl-order-anim-check path {
  fill: none;
  stroke: #fff;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
}

.apl-order-anim.is-done .apl-order-anim-check {
  opacity: 1;
  transform: scale(1);
}

.apl-order-anim.is-done .apl-order-anim-check path {
  animation: apl-check-draw 0.4s ease 0.15s forwards;
}

@keyframes apl-check-draw {
  to { stroke-dashoffset: 0; }
}

.apl-order-anim-title {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--apl-text);
}

.apl-order-anim-sub {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--apl-text-soft);
}

/* The order that was just placed slides into "Your orders" and glows briefly. */
.apl-order-item.is-new {
  animation: apl-order-in 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2), apl-order-glow 2.4s ease 0.4s;
  border-radius: 12px;
}

@keyframes apl-order-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes apl-order-glow {
  0% { background: rgba(255, 149, 0, 0.18); box-shadow: 0 0 0 6px rgba(255, 149, 0, 0.18); }
  100% { background: transparent; box-shadow: 0 0 0 6px transparent; }
}

html[data-bs-theme="dark"] .apl-order-anim-doc {
  background: #2c2c2e;
  border-color: #3a3a3c;
}

html[data-bs-theme="dark"] .apl-order-anim-line {
  background: #48484a;
}

@media (prefers-reduced-motion: reduce) {
  .apl-order-item.is-new {
    animation: none;
  }
}

/* Reduced motion: static confirmation card */
.apl-order-anim.is-reduced .apl-order-anim-card,
.apl-order-anim.is-reduced .apl-order-anim-check {
  transition: none;
}

.apl-order-anim.is-reduced .apl-order-anim-doc {
  animation: none;
  opacity: 1;
  transform: translateY(44px) scale(0.96);
}

.apl-order-anim.is-reduced .apl-order-anim-check path {
  animation: none;
  stroke-dashoffset: 0;
}

/* Manual service: an order for this VIN is already in progress */
.apl-pending-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 149, 0, 0.12);
  color: #c45f00;
  font-size: 13px;
}

.apl-pending-hint[hidden] {
  display: none;
}

.apl-pending-hint span span {
  color: var(--apl-text-soft);
}

html[data-bs-theme="dark"] .apl-pending-hint {
  color: #ff9f0a;
}

/* Confirm dialog: white card that springs in (keyframes, so it always plays), content fades in after it */
.apl-alert-backdrop {
  transition: opacity 0.28s ease;
}

.apl-alert {
  background: #ffffff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-radius: 18px;
  opacity: 0;
  transform: scale(0.86) translateY(14px);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.apl-alert-backdrop.is-visible .apl-alert {
  animation: apl-alert-in 0.48s cubic-bezier(0.2, 0.9, 0.25, 1.25) forwards;
}

.apl-alert-backdrop.is-visible .apl-alert-icon,
.apl-alert-backdrop.is-visible .apl-alert-title,
.apl-alert-backdrop.is-visible .apl-alert-text,
.apl-alert-backdrop.is-visible .apl-alert-actions {
  animation: apl-alert-content-in 0.4s ease both;
}

.apl-alert-backdrop.is-visible .apl-alert-title { animation-delay: 0.08s; }
.apl-alert-backdrop.is-visible .apl-alert-text { animation-delay: 0.14s; }
.apl-alert-backdrop.is-visible .apl-alert-actions { animation-delay: 0.2s; }

/* Closing: the card shrinks slightly while the backdrop fades (the element is removed after 180ms). */
.apl-alert-backdrop:not(.is-visible) .apl-alert {
  opacity: 0;
  transform: scale(0.95);
}

@keyframes apl-alert-in {
  0% { opacity: 0; transform: scale(0.86) translateY(14px); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes apl-alert-content-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

html[data-bs-theme="dark"] .apl-alert {
  background: #2c2c2e;
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.08), 0 22px 70px rgba(0, 0, 0, 0.6);
}

@media (prefers-reduced-motion: reduce) {
  .apl-alert-backdrop.is-visible .apl-alert,
  .apl-alert-backdrop.is-visible .apl-alert-icon,
  .apl-alert-backdrop.is-visible .apl-alert-title,
  .apl-alert-backdrop.is-visible .apl-alert-text,
  .apl-alert-backdrop.is-visible .apl-alert-actions {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.apl-alert {
  max-width: 320px;
  padding: 26px 20px 18px;
}

.apl-alert-btn {
  height: 42px;
  line-height: 42px;
  border-radius: 12px;
  font-size: 15px;
}

.apl-alert-btn:not(.is-primary):not(.is-plain) {
  background: #f2f2f7;
  box-shadow: none;
}

html[data-bs-theme="dark"] .apl-alert-btn:not(.is-primary):not(.is-plain) {
  background: #3a3a3c;
}

.apl-alert-btn.is-primary {
  background: #0071e3;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.28);
}

.apl-alert-title {
  font-size: 17px;
}

.apl-alert-text {
  font-size: 14px;
  margin-bottom: 18px;
}

/* "Files are kept 30 days" note under file lists */
.apl-retention-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--apl-fill);
  color: var(--apl-text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.apl-retention-note i {
  margin-top: 2px;
  color: var(--apl-blue);
}

/* My Cars: a manual service that was ordered but isn't delivered yet */
.apl-pill.apl-pill-pending {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 149, 0, 0.14);
  color: #c45f00;
  font-weight: 600;
}

html[data-bs-theme="dark"] .apl-pill.apl-pill-pending {
  color: #ff9f0a;
}

/* Public home (/dashboard for visitors) */
.apl-home-hero .card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding: 32px;
}

.apl-home-hero-text {
  flex: 1 1 420px;
  max-width: 680px;
}

.apl-home-points {
  list-style: none;
  margin: 0;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--apl-fill);
  flex: 0 1 340px;
}

.apl-home-points li {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
}

.apl-home-points i {
  width: 18px;
  margin-top: 3px;
  color: var(--apl-blue);
}

@media (max-width: 575.98px) {
  .apl-home-hero .card-body {
    padding: 22px 18px;
  }
}

/* Top bar icons with a count in the top-right corner (My Cars, admin pending orders) */
.apl-nav-icon {
  position: relative;
}

.apl-nav-count {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--apl-blue, #007aff);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bs-body-bg, #fff);
  pointer-events: none;
}

.apl-nav-count.is-alert {
  background: #ff3b30;
}

/* Admin top-bar search: one ring on the pill only (the inner input has no focus style of its own) */
.admin-global-search .form-control:focus,
.admin-global-search .form-control:focus-visible {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.admin-global-search:focus-within {
  box-shadow: 0 0 0 3px var(--apl-blue-ring) !important;
}

.admin-global-search .form-control::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--apl-text-faint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 5l6 6M11 5l-6 6' stroke='white' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 16px no-repeat;
  cursor: pointer;
  opacity: 0.8;
}

/* Admin top-bar search: VIN results */
.admin-global-search {
  position: relative;
}

.apl-vin-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 420px;
  max-height: 420px;
  overflow-y: auto;
  z-index: 1080;
  padding: 6px;
  background: var(--apl-surface, #fff);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: apl-vin-in 0.16s ease both;
}

@keyframes apl-vin-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.apl-vin-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--apl-text-soft);
}

.apl-vin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 12px;
  color: var(--apl-text) !important;
  text-decoration: none;
}

.apl-vin-item:hover,
.apl-vin-item.is-active {
  background: var(--apl-fill-strong);
}

.apl-vin-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--apl-blue);
}

.apl-vin-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.apl-vin-vin {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.apl-vin-vin mark {
  padding: 0;
  background: none;
  color: var(--apl-blue);
  font-weight: 700;
}

.apl-vin-model {
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-vin-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  max-width: 50%;
  font-size: 12px;
}

.apl-vin-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apl-vin-meta i {
  width: 12px;
  text-align: center;
  color: var(--apl-text-faint);
}

.apl-vin-meta .is-date {
  color: var(--apl-text-soft);
}

.apl-vin-go {
  flex-shrink: 0;
  color: var(--apl-text-faint);
  font-size: 18px;
  line-height: 1;
}

.apl-vin-item:hover .apl-vin-go,
.apl-vin-item.is-active .apl-vin-go {
  color: var(--apl-blue);
}

.apl-vin-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  font-size: 13px;
  color: var(--apl-text-soft);
}

.apl-vin-empty i {
  font-size: 18px;
  color: var(--apl-text-faint);
}

html[data-bs-theme="dark"] .apl-vin-results {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="dark"] .apl-vin-icon {
  background: rgba(10, 132, 255, 0.18);
  color: #4ea1ff;
}

/* ECU Validation: CBB request upload with step-by-step checks */
.apl-cbb-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 20px;
  border: 1.5px dashed var(--apl-border);
  border-radius: 16px;
  text-align: center;
  color: var(--apl-text-soft);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.apl-cbb-drop:hover,
.apl-cbb-drop:focus-visible,
.apl-cbb-drop.is-over {
  outline: none;
  border-color: var(--apl-blue);
  background: rgba(0, 113, 227, 0.05);
}

.apl-cbb-drop.is-over {
  transform: scale(1.01);
}

.apl-cbb-drop-icon {
  font-size: 26px;
  color: var(--apl-text-faint);
  margin-bottom: 4px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.apl-cbb-drop:hover .apl-cbb-drop-icon,
.apl-cbb-drop.is-over .apl-cbb-drop-icon {
  color: var(--apl-blue);
  transform: translateY(-2px);
}

.apl-cbb-drop small {
  font-size: 12px;
  color: var(--apl-text-faint);
  overflow-wrap: anywhere;
}

.apl-cbb-pick-note {
  margin: 8px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-cbb-check {
  border: 1px solid var(--apl-hairline);
  border-radius: 16px;
  padding: 14px;
  animation: apl-cbb-in 0.3s ease both;
}

.apl-cbb-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--apl-hairline);
}

.apl-cbb-file > i {
  font-size: 20px;
  color: var(--apl-blue);
}

.apl-cbb-file > span {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.apl-cbb-file strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apl-cbb-file small {
  color: var(--apl-text-soft);
}

.apl-cbb-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.apl-cbb-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  font-size: 14px;
  color: var(--apl-text-faint);
  transition: color 0.2s ease;
}

.apl-cbb-steps li[class] {
  color: var(--apl-text);
}

.apl-cbb-label {
  flex-shrink: 0;
}

.apl-cbb-detail {
  margin-left: auto;
  font-size: 12px;
  color: var(--apl-text-soft);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

.apl-cbb-mark {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--apl-border);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}

.apl-cbb-steps li.is-run .apl-cbb-mark {
  border-color: var(--apl-blue);
  border-right-color: transparent;
  animation: apl-cbb-spin 0.7s linear infinite;
}

.apl-cbb-steps li.is-ok .apl-cbb-mark,
.apl-cbb-steps li.is-warn .apl-cbb-mark,
.apl-cbb-steps li.is-fail .apl-cbb-mark {
  border: 0;
  animation: apl-cbb-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.apl-cbb-steps li.is-ok .apl-cbb-mark {
  background: var(--apl-green-fill);
}

.apl-cbb-steps li.is-ok .apl-cbb-mark::after {
  content: "";
  width: 9px;
  height: 5px;
  border: solid #fff;
  border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg);
}

.apl-cbb-steps li.is-warn .apl-cbb-mark {
  background: #ff9500;
}

.apl-cbb-steps li.is-warn .apl-cbb-mark::after {
  content: "!";
}

.apl-cbb-steps li.is-fail .apl-cbb-mark {
  background: #ff3b30;
}

.apl-cbb-steps li.is-fail .apl-cbb-mark::after {
  content: "×";
  font-size: 15px;
  line-height: 1;
}

.apl-cbb-steps li.is-fail {
  color: var(--apl-red);
}

.apl-cbb-steps li.is-warn .apl-cbb-detail {
  color: var(--apl-yellow);
}

.apl-cbb-error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 59, 48, 0.1);
  color: var(--apl-red);
  font-size: 13px;
  animation: apl-cbb-shake 0.4s ease;
}

.apl-cbb-summary {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--apl-hairline);
  animation: apl-cbb-in 0.35s ease both;
}

.apl-cbb-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.apl-cbb-summary-head > div:first-child {
  display: flex;
  flex-direction: column;
}

.apl-cbb-summary-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--apl-text-soft);
}

.apl-cbb-summary-head strong {
  font-size: 17px;
}

.apl-cbb-counts,
.apl-cbb-ecus {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.apl-cbb-ecu {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--apl-fill);
  font-size: 12px;
  animation: apl-cbb-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.apl-cbb-ecu small {
  color: var(--apl-text-soft);
}

.apl-cbb-ecu i {
  color: #ff9500;
  font-size: 11px;
}

.apl-cbb-check.is-done {
  border-color: rgba(52, 199, 89, 0.45);
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.1);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

@keyframes apl-cbb-spin {
  to { transform: rotate(360deg); }
}

@keyframes apl-cbb-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes apl-cbb-in {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes apl-cbb-shake {
  0%, 100% { transform: none; }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  .apl-cbb-check,
  .apl-cbb-summary,
  .apl-cbb-ecu,
  .apl-cbb-error,
  .apl-cbb-steps li .apl-cbb-mark {
    animation: none !important;
  }
}

@media (max-width: 575.98px) {
  .apl-cbb-steps li {
    flex-wrap: wrap;
  }

  .apl-cbb-detail {
    flex-basis: 100%;
    margin-left: 30px;
    text-align: left;
  }
}

/* Admin orders: ECUs of an uploaded CBB request */
.apl-admin-request {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

/* Top bar (tablet/desktop): the admin search takes only the room left, the icons and pills never get pushed out. */
@media (min-width: 768px) {
  .layout-navbar .navbar-nav-right {
    flex: 1 1 auto;
    min-width: 0;
  }

  .layout-navbar .navbar-nav-right > .navbar-nav:not(.flex-row) {
    flex: 1 1 auto;
    min-width: 0;
    margin-right: 12px;
  }

  .layout-navbar .admin-global-search {
    width: 100% !important;
    min-width: 220px !important;
    max-width: 480px !important;
  }

  .layout-navbar .apl-nav-title {
    flex-shrink: 0;
  }

  .layout-navbar .admin-global-search .form-control {
    min-width: 0;
    text-overflow: ellipsis;
  }

  .layout-navbar .navbar-nav-right > .navbar-nav.flex-row {
    flex: 0 0 auto;
  }
}

/* Narrower desktops: shorten the timer first, then drop it, then move the search to Admin Users. */
@media (max-width: 1439.98px) {
  #sessionCountdown > .d-md-inline {
    display: none !important;
  }
}

@media (max-width: 1199.98px) {
  .layout-navbar #sessionCountdown {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  .layout-navbar .navbar-nav-right > .navbar-nav:not(.flex-row) {
    display: none !important;
  }
}

/* Admin looking at a customer's car */
.apl-admin-viewing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 149, 0, 0.12);
  color: var(--apl-orange);
  font-size: 13px;
}

.apl-admin-viewing a {
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
}

/* Profile menu: the top-bar figures as rows */
.apl-menu-stat {
  display: flex !important;
  align-items: center;
  gap: 12px;
}

.apl-menu-stat.is-static {
  cursor: default;
}

.apl-menu-stat.is-static:hover,
.apl-menu-stat.is-static:active {
  background: transparent !important;
  color: inherit !important;
}

.apl-menu-stat-icon {
  width: 22px;
  display: inline-flex;
  justify-content: center;
  color: var(--apl-text-soft);
  font-size: 16px;
}

.apl-stat-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.apl-stat-pill.is-blue {
  background: rgba(0, 113, 227, 0.12);
  color: var(--apl-blue);
}

.apl-stat-pill.is-green {
  background: rgba(52, 199, 89, 0.14);
  color: var(--apl-green);
}

.apl-stat-pill.is-red {
  background: #ff3b30;
  color: #fff;
}

.apl-stat-pill.is-gray {
  background: var(--apl-fill-strong);
  color: var(--apl-text-soft);
}

.apl-stat-pill.is-orange {
  background: rgba(255, 149, 0, 0.16);
  color: var(--apl-orange);
}

/* admin/users/<id>: desktop agents */
.apl-user-agents {
  display: grid;
  gap: 8px;
}

.apl-user-agent {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--apl-fill);
}

.apl-user-agent > .min-w-0 {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.apl-user-agent small,
.apl-user-agent-meta {
  font-size: 12px;
  color: var(--apl-text-soft);
}

.apl-user-agent-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.apl-user-agent-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--apl-border);
}

.apl-user-agent-dot.is-online {
  background: var(--apl-green-fill);
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.2);
}

@media (max-width: 575.98px) {
  .apl-user-agent {
    flex-wrap: wrap;
  }

  .apl-user-agent-meta {
    align-items: flex-start;
    text-align: left;
    flex-basis: 100%;
    padding-left: 22px;
  }
}

/* VO Coding Fix: delivered feature code */
.apl-feature-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: 12px;
  background: var(--apl-fill);
  border: 1px solid var(--apl-hairline);
}

.apl-feature-code .font-monospace {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  user-select: all;
}

.apl-feature-code.is-large {
  padding: 14px 14px 14px 18px;
}

.apl-feature-code.is-large .font-monospace {
  font-size: 22px;
}

/* Admin: new manual order notifications */
[data-pending-orders][hidden] {
  display: none !important;
}

.apl-nav-count.is-bump,
.apl-menu-badge.is-bump {
  animation: apl-badge-bump 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes apl-badge-bump {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.apl-order-toasts {
  position: fixed;
  top: 88px;
  right: 20px;
  z-index: 1095;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.apl-order-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border-radius: 16px;
  background: var(--apl-surface);
  color: var(--apl-text) !important;
  text-decoration: none;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
  pointer-events: auto;
  animation: apl-toast-in 0.4s cubic-bezier(0.2, 1.2, 0.4, 1) both;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.apl-order-toast.is-leaving {
  opacity: 0;
  transform: translateX(24px);
}

.apl-order-toast-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #ff3b30;
  color: #fff;
  font-size: 16px;
}

.apl-order-toast-icon i {
  animation: apl-bell 1s ease 0.3s 2;
  transform-origin: 50% 0;
}

.apl-order-toast-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.apl-order-toast-text strong {
  font-size: 14px;
}

.apl-order-toast-text small {
  font-size: 12px;
  color: var(--apl-text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apl-order-toast-close {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--apl-fill-strong);
  color: var(--apl-text-soft);
  line-height: 1;
  font-size: 16px;
}

@keyframes apl-toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes apl-bell {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(18deg); }
  40% { transform: rotate(-14deg); }
  60% { transform: rotate(8deg); }
  80% { transform: rotate(-4deg); }
}

html[data-bs-theme="dark"] .apl-order-toast {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@media (prefers-reduced-motion: reduce) {
  .apl-order-toast,
  .apl-order-toast-icon i,
  .apl-nav-count.is-bump,
  .apl-menu-badge.is-bump {
    animation: none !important;
  }
}

/* Admin orders: service name in burgundy */
.apl-order-service {
  color: #9b1c31;
  font-weight: 600;
}

html[data-bs-theme="dark"] .apl-order-service {
  color: #ff6b81;
}

/* "In progress" orders: the hourglass turns and a soft light sweeps across the pill while we work on it. */
.apl-order-status.is-pending,
.apl-pill-pending {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.apl-order-status.is-pending::after,
.apl-pill-pending::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.75) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: apl-pending-sweep 2.4s ease-in-out infinite;
}

.apl-order-status.is-pending i,
.apl-pill-pending i {
  display: inline-block;
  animation: apl-hourglass 2.4s ease-in-out infinite;
}

@keyframes apl-hourglass {
  0%, 35% { transform: rotate(0deg); }
  50%, 85% { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}

@keyframes apl-pending-sweep {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

html[data-bs-theme="dark"] .apl-order-status.is-pending::after,
html[data-bs-theme="dark"] .apl-pill-pending::after {
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.12) 50%, transparent 80%);
}

@media (prefers-reduced-motion: reduce) {
  .apl-order-status.is-pending::after,
  .apl-pill-pending::after,
  .apl-order-status.is-pending i,
  .apl-pill-pending i {
    animation: none !important;
  }
}

/* Top bar: the customer's order in progress — hourglass turning, light sweeping over the service name */
.apl-nav-progress {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 149, 0, 0.14);
  color: #c45f00 !important;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.apl-nav-progress:hover {
  background: rgba(255, 149, 0, 0.22);
}

.apl-nav-progress > i {
  display: inline-block;
  animation: apl-hourglass 2.4s ease-in-out infinite;
}

.apl-nav-progress-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  /* The text itself carries the moving light. */
  background: linear-gradient(100deg, #c45f00 0%, #c45f00 40%, #ffd8a8 50%, #c45f00 60%, #c45f00 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: apl-name-sweep 2.4s linear infinite;
}

.apl-nav-progress-more {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(196, 95, 0, 0.15);
  font-size: 11px;
}

@keyframes apl-name-sweep {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

html[data-bs-theme="dark"] .apl-nav-progress {
  color: #ff9f0a !important;
}

html[data-bs-theme="dark"] .apl-nav-progress-name {
  background-image: linear-gradient(100deg, #ff9f0a 0%, #ff9f0a 40%, #fff3e0 50%, #ff9f0a 60%, #ff9f0a 100%);
}

@media (max-width: 767.98px) {
  /* Phones: just the turning hourglass. */
  .apl-nav-progress {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .apl-nav-progress-name,
  .apl-nav-progress-more {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .apl-nav-progress > i,
  .apl-nav-progress-name {
    animation: none !important;
  }

  .apl-nav-progress-name {
    color: inherit;
    background: none;
  }
}

button.apl-nav-progress {
  border: 0;
}

.apl-nav-progress-caret {
  font-size: 10px;
  opacity: 0.7;
}

.apl-progress-menu {
  min-width: 280px;
  padding: 6px;
  border-radius: 14px;
}

.apl-progress-menu-head {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--apl-text-soft);
}

.apl-progress-menu-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 8px 10px !important;
  border-radius: 10px;
}

.apl-progress-menu-item .min-w-0 {
  display: flex;
  flex-direction: column;
}

.apl-progress-menu-item strong {
  font-size: 13px;
  max-width: none;
}

.apl-progress-menu-item small {
  font-size: 11px;
  color: var(--apl-text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apl-progress-menu-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 149, 0, 0.14);
  color: #c45f00;
}

.apl-progress-menu-icon i {
  display: inline-block;
  animation: apl-hourglass 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .apl-progress-menu-icon i {
    animation: none !important;
  }
}

@media (max-width: 767.98px) {
  .apl-nav-progress-caret {
    display: none;
  }
}

/* Admin orders: a card that arrived while the page was open */
.apl-admin-order.is-arriving {
  animation: apl-order-arrive 0.6s cubic-bezier(0.2, 1.2, 0.4, 1) both, apl-order-glow 2.4s ease 0.6s 1;
}

@keyframes apl-order-arrive {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes apl-order-glow {
  0%, 100% { box-shadow: var(--apl-shadow-card); }
  30% { box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.35), var(--apl-shadow-card); }
}

@media (prefers-reduced-motion: reduce) {
  .apl-admin-order.is-arriving {
    animation: none;
  }
}
