:root {
  --staff-ink: #111827;
  --staff-muted: #667085;
  --staff-canvas: #f3f5f8;
  --staff-panel: #ffffff;
  --staff-line: #dfe3e8;
  --staff-header: #090e16;
  --staff-header-soft: #111a27;
  --staff-red: #f2053b;
  --staff-green: #159947;
  --staff-blue: #1d4ed8;
  --staff-amber: #d97706;
  --staff-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  --staff-shadow-raised: 0 18px 42px rgba(16, 24, 40, 0.13);
  --staff-focus: 0 0 0 3px rgba(242, 5, 59, 0.17);
}

html {
  color-scheme: light;
  background: var(--staff-canvas);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.staff-pwa {
  min-height: 100dvh;
  background: var(--staff-canvas);
  font-family: Inter, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
}

.staff-pwa .app,
.staff-pwa .app-inner {
  min-height: 100dvh;
}

.staff-pwa .app {
  background: var(--staff-canvas);
}

.staff-pwa .topbar {
  background: rgba(9, 14, 22, 0.97);
  border-bottom: 2px solid var(--staff-red);
  box-shadow: 0 5px 18px rgba(9, 14, 22, 0.18);
  padding: 10px 16px;
}

.staff-pwa .brand-row {
  gap: 14px;
}

.staff-pwa .brand {
  flex: 1 1 auto;
}

.staff-pwa .ck-brand-full {
  width: 190px;
  height: 44px;
  max-width: 46vw;
  background-image: url("/assets/carkonnect-logo-header.png");
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
}

.staff-pwa .brand-subtitle {
  margin-top: 0;
  color: #aeb8c7;
  font-size: 11px;
  font-weight: 650;
}

.staff-pwa .top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.staff-pwa .staff-identity {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 150px;
  height: 30px;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  color: #d7deea;
  background: #151e2b;
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-pwa .install-app-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: #ffffff;
  background: #151e2b;
}

.staff-pwa .install-app-btn svg {
  width: 16px;
  height: 16px;
}

.staff-pwa .status-pill {
  height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 9px;
  background: #151e2b;
  font-size: 10px;
  font-weight: 800;
}

.staff-pwa .status-pill.good {
  border-color: rgba(75, 222, 128, 0.35);
  background: rgba(21, 153, 71, 0.14);
  color: #baf2cb;
}

.staff-pwa .status-pill.bad {
  border-color: rgba(255, 103, 132, 0.38);
  background: rgba(242, 5, 59, 0.14);
  color: #ffc2cf;
}

.staff-pwa .vehicle-context {
  max-width: 1180px;
  margin: 8px auto 0;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: #111a27;
}

.staff-pwa .page {
  max-width: 1240px;
  padding: 18px;
}

.staff-pwa .page.active {
  animation: staffPageIn 190ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

@keyframes staffPageIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.staff-pwa .hero {
  margin: -18px -18px 18px;
  padding: 22px 20px 24px;
  border: 0;
  border-bottom: 1px solid #243143;
  border-radius: 0;
  background: var(--staff-header-soft);
  box-shadow: inset 4px 0 0 var(--staff-red);
}

.staff-pwa .hero-kicker {
  color: #ff91aa;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.staff-pwa .hero-title {
  max-width: 700px;
  margin-top: 7px;
  color: #ffffff;
  font-size: 29px;
  line-height: 1.12;
  letter-spacing: 0;
  font-weight: 850;
}

.staff-pwa .hero-copy {
  max-width: 720px;
  color: #b6c0cf;
  font-size: 13px;
  line-height: 1.55;
}

.staff-pwa .card,
.staff-pwa .card.soft,
.staff-pwa .card.flat,
.staff-pwa .recent-card,
.staff-pwa .vehicle-card,
.staff-pwa .info-tile,
.staff-pwa .check-row,
.staff-pwa .empty {
  border-radius: 8px;
}

.staff-pwa .card,
.staff-pwa .card.soft,
.staff-pwa .card.flat {
  border: 1px solid var(--staff-line);
  background: var(--staff-panel);
  box-shadow: var(--staff-shadow);
}

.staff-pwa .card {
  padding: 17px;
  margin-bottom: 13px;
}

.staff-pwa .card.flat {
  box-shadow: 0 2px 7px rgba(16, 24, 40, 0.04);
}

.staff-pwa .section-title {
  color: var(--staff-ink);
  font-size: 15px;
  line-height: 1.28;
  font-weight: 820;
  letter-spacing: 0;
}

.staff-pwa .section-subtitle {
  color: var(--staff-muted);
  font-size: 12px;
  line-height: 1.52;
}

.staff-pwa .module-band-title {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 830;
}

.staff-pwa .home-primary-column,
.staff-pwa .home-operations-column {
  display: contents;
}

.staff-pwa .module-band-kicker,
.staff-pwa .module-label {
  color: var(--staff-green);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
}

.staff-pwa .acquisition-card {
  min-height: 238px;
  border-top: 3px solid var(--module-accent, var(--staff-blue));
}

.staff-pwa .secondary-tool-card {
  min-height: 164px;
}

.staff-pwa .btn,
.staff-pwa .mini-btn,
.staff-pwa .recent-action,
.staff-pwa .link-btn,
.staff-pwa .file-link,
.staff-pwa .input,
.staff-pwa .select,
.staff-pwa .textarea,
.staff-pwa .file-input,
.staff-pwa .search-input {
  border-radius: 6px;
  letter-spacing: 0;
}

.staff-pwa .btn {
  min-height: 44px;
  padding: 0 15px;
  font-size: 12px;
  font-weight: 800;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.staff-pwa .btn.primary,
.staff-pwa .recent-action.primary,
.staff-pwa .link-btn {
  border-color: #153a91;
  background: #1747b5;
  box-shadow: 0 5px 12px rgba(29, 78, 216, 0.18);
}

.staff-pwa .btn.green {
  background: #147c3a;
  border-color: #116731;
}

.staff-pwa .btn.ghost {
  color: #243246;
  border-color: #cdd4de;
  background: #ffffff;
}

.staff-pwa .btn.danger {
  background: #c91d3f;
}

.staff-pwa button:focus-visible,
.staff-pwa input:focus-visible,
.staff-pwa select:focus-visible,
.staff-pwa textarea:focus-visible {
  outline: none;
  box-shadow: var(--staff-focus);
}

.staff-pwa .search-input {
  height: 48px;
  border: 2px solid #cfd6df;
  font-size: 16px;
  font-weight: 820;
}

.staff-pwa .search-input:focus {
  border-color: var(--staff-red);
  box-shadow: var(--staff-focus);
}

.staff-pwa .plate,
.staff-pwa .context-plate {
  border-radius: 5px;
  letter-spacing: 0;
}

.staff-pwa .recent-card {
  min-width: 0;
  overflow: hidden;
  border-color: #dfe3e8;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(16, 24, 40, 0.06);
}

.staff-pwa .recent-title-block,
.staff-pwa .recent-action-row,
.staff-pwa .recent-action {
  min-width: 0;
}

.staff-pwa .recent-action {
  overflow: hidden;
  padding: 0 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-pwa .vehicle-hero,
.staff-pwa .inspection-grade-hero,
.staff-pwa .sale-hero {
  border-radius: 8px;
  background: #111a27;
  box-shadow: 0 10px 24px rgba(9, 14, 22, 0.16);
}

.staff-pwa .metric,
.staff-pwa .badge,
.staff-pwa .check-row,
.staff-pwa .upload-box,
.staff-pwa .inspection-summary-tile,
.staff-pwa .inspection-recommendation {
  border-radius: 6px;
}

.staff-pwa .bottom-nav {
  border-top: 1px solid #cfd6df;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -8px 24px rgba(16, 24, 40, 0.09);
}

.staff-pwa .nav-btn {
  min-width: 0;
  border-radius: 6px;
  color: #536174;
  font-size: 10px;
  font-weight: 750;
}

.staff-pwa .nav-btn.active {
  color: #ffffff;
  background: #111a27;
  box-shadow: inset 0 2px 0 var(--staff-red), 0 5px 13px rgba(9, 14, 22, 0.18);
}

.staff-pwa .nav-icon svg,
.staff-pwa .mobile-nav-more svg {
  width: 18px;
  height: 18px;
}

.staff-pwa .mobile-nav-more {
  border-radius: 8px;
  box-shadow: var(--staff-shadow-raised);
}

.staff-pwa .mobile-nav-more button {
  border-radius: 6px;
}

.staff-pwa .mobile-nav-more button span {
  border-radius: 5px;
  background: #111a27;
}

.staff-pwa .toast,
.staff-pwa .loader-card {
  border-radius: 8px;
}

.staff-pwa .loader-card {
  border-top: 3px solid var(--staff-red);
}

.connection-banner {
  position: fixed;
  z-index: 80;
  top: 68px;
  left: 50%;
  max-width: calc(100% - 28px);
  padding: 9px 12px;
  transform: translate(-50%, -16px);
  border: 1px solid #f3ba63;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  color: #713f12;
  background: #fff8e8;
  box-shadow: var(--staff-shadow);
  font-size: 12px;
  font-weight: 750;
  transition: opacity 160ms ease, transform 160ms ease;
}

.connection-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (hover: hover) and (pointer: fine) {
  .staff-pwa .btn:hover,
  .staff-pwa .recent-action:hover,
  .staff-pwa .install-app-btn:hover {
    transform: translateY(-1px);
  }

  .staff-pwa .card:hover {
    border-color: #cbd3de;
  }
}

@media (max-width: 719px) {
  .staff-pwa .topbar {
    padding: 8px 12px;
  }

  .staff-pwa .ck-brand-full {
    width: 168px;
    height: 39px;
  }

  .staff-pwa .staff-identity {
    display: none;
  }

  .staff-pwa .page {
    padding: 14px 12px;
  }

  .staff-pwa .hero {
    margin: -14px -12px 14px;
    padding: 18px 14px 20px;
  }

  .staff-pwa .hero-title {
    font-size: 25px;
  }

  .staff-pwa .card {
    padding: 14px;
  }

  .staff-pwa .recent-action-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 410px) {
  .staff-pwa .ck-brand-full {
    width: 148px;
    max-width: 44vw;
  }

  .staff-pwa .status-pill {
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .staff-pwa .recent-action-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .staff-pwa .recent-action:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .staff-pwa .card-header-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (orientation: landscape) and (max-height: 700px) {
  .staff-pwa .app {
    min-height: 100dvh;
    padding-left: 78px;
    padding-bottom: 0;
  }

  .staff-pwa .app-inner {
    width: auto;
    max-width: none;
  }

  .staff-pwa .topbar {
    position: sticky;
    top: 0;
    min-height: 45px;
    padding: 4px 12px;
    border-bottom-width: 2px;
  }

  .staff-pwa .brand-row {
    min-height: 35px;
  }

  .staff-pwa .ck-brand-full {
    width: 156px;
    height: 34px;
  }

  .staff-pwa .brand-subtitle,
  .staff-pwa .vehicle-context,
  .staff-pwa .staff-identity {
    display: none !important;
  }

  .staff-pwa .page {
    max-width: none;
    padding: 10px 12px 14px;
  }

  .staff-pwa .hero {
    display: none;
  }

  .staff-pwa .card {
    padding: 12px;
    margin-bottom: 9px;
  }

  .staff-pwa .section-title {
    margin-bottom: 7px;
    font-size: 14px;
  }

  .staff-pwa .section-subtitle {
    margin-bottom: 9px;
    line-height: 1.4;
  }

  .staff-pwa .sale-hero {
    padding: 10px 12px;
    margin-bottom: 9px;
  }

  .staff-pwa .sale-hero p {
    display: none;
  }

  .staff-pwa .bottom-nav {
    position: fixed;
    z-index: 45;
    inset: 0 auto 0 0;
    width: 78px;
    height: 100dvh;
    max-width: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    padding: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    transform: none;
    border: 0;
    border-right: 1px solid #cfd6df;
    border-radius: 0;
    box-shadow: 5px 0 18px rgba(16, 24, 40, 0.09);
  }

  .staff-pwa .nav-btn,
  .staff-pwa .nav-btn[data-page="reports"],
  .staff-pwa .nav-btn[data-page="history"],
  .staff-pwa .nav-btn[data-page="diagnostics"],
  .staff-pwa .nav-btn[data-page="help"] {
    width: 100%;
    min-height: 34px;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    place-items: center start;
    gap: 5px;
    padding: 3px 5px;
    text-align: left;
  }

  .staff-pwa .nav-btn span:last-child {
    display: block;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .staff-pwa .nav-icon {
    width: 22px;
    height: 22px;
  }

  .staff-pwa .nav-icon svg {
    width: 16px;
    height: 16px;
  }

  .staff-pwa .mobile-more-btn,
  .staff-pwa .mobile-nav-more,
  .staff-pwa .mobile-nav-backdrop {
    display: none !important;
  }

  .staff-pwa .toast {
    right: 14px;
    bottom: 12px;
    left: auto;
    max-width: min(420px, calc(100% - 110px));
    transform: translateY(12px);
  }

  .staff-pwa .toast.show {
    transform: translateY(0);
  }

  .connection-banner {
    top: 50px;
    left: calc(50% + 39px);
  }
}

@media (orientation: landscape) and (min-width: 700px) and (max-height: 700px) {
  .staff-pwa #page-home.active {
    display: grid;
    grid-template-columns: minmax(250px, 0.82fr) minmax(320px, 1.18fr);
    gap: 12px;
    align-items: start;
  }

  .staff-pwa #page-home > .hero {
    display: none;
  }

  .staff-pwa #page-home > .home-primary-column,
  .staff-pwa #page-home > .home-operations-column {
    display: block;
    min-width: 0;
  }

  .staff-pwa #page-home > .home-primary-column {
    grid-column: 1;
    grid-row: 1;
  }

  .staff-pwa #page-home > .home-operations-column {
    grid-column: 2;
    grid-row: 1;
  }

  .staff-pwa .home-operations-column > .module-band,
  .staff-pwa .home-operations-column > .home-secondary-grid {
    margin-top: 0;
  }

  .staff-pwa .home-tool-grid,
  .staff-pwa .home-secondary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .staff-pwa .acquisition-card,
  .staff-pwa .secondary-tool-card {
    min-height: 0;
  }
}

@media (min-width: 1100px) and (min-height: 701px) and (hover: hover) and (pointer: fine) {
  .staff-pwa .app {
    padding-left: 104px;
    padding-bottom: 0;
  }

  .staff-pwa .bottom-nav {
    inset: 0 auto 0 0;
    width: 104px;
    height: 100dvh;
    padding: 14px 8px;
    gap: 4px;
    background: #ffffff;
  }

  .staff-pwa .nav-btn {
    min-height: 54px;
  }

  .staff-pwa .topbar {
    padding-right: 24px;
    padding-left: 24px;
  }

  .staff-pwa .page {
    padding: 24px;
  }

  .staff-pwa .hero {
    margin: -24px -24px 22px;
    padding-left: 26px;
  }

  .staff-pwa .home-secondary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .staff-pwa *,
  .staff-pwa *::before,
  .staff-pwa *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
