/* LotPilot Design System
   Shared visual language for Dashboard, Recon, Inventory, and VDP workflows. */

:root {
  --lp-canvas: #08121f;
  --lp-canvas-deep: #050c16;
  --lp-shell: #0c1b2c;
  --lp-surface: #102238;
  --lp-surface-raised: #142a43;
  --lp-surface-soft: rgba(18, 42, 68, 0.72);
  --lp-line: rgba(148, 177, 211, 0.16);
  --lp-line-strong: rgba(148, 177, 211, 0.26);
  --lp-text: #edf5ff;
  --lp-text-strong: #ffffff;
  --lp-text-muted: #a5b8cf;
  --lp-text-subtle: #7890aa;
  --lp-blue: #3b82f6;
  --lp-blue-bright: #5da2ff;
  --lp-blue-soft: rgba(59, 130, 246, 0.15);
  --lp-cyan: #22b8e6;
  --lp-green: #22c58b;
  --lp-green-soft: rgba(34, 197, 139, 0.14);
  --lp-amber: #f3b63f;
  --lp-amber-soft: rgba(243, 182, 63, 0.15);
  --lp-red: #ef6b72;
  --lp-red-soft: rgba(239, 107, 114, 0.14);
  --lp-radius-sm: 8px;
  --lp-radius-md: 12px;
  --lp-radius-lg: 16px;
  --lp-radius-xl: 20px;
  --lp-shadow-sm: 0 4px 14px rgba(2, 8, 18, 0.18);
  --lp-shadow-md: 0 14px 36px rgba(2, 8, 18, 0.28);
  --lp-shadow-lg: 0 24px 64px rgba(2, 8, 18, 0.38);
  --lp-focus: 0 0 0 3px rgba(93, 162, 255, 0.24);
  --lp-content-max: 1560px;
  --lp-control-height: 42px;
}

html {
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(900px 520px at 76% -16%, rgba(59, 130, 246, 0.12), transparent 64%),
    linear-gradient(180deg, var(--lp-canvas-deep), var(--lp-canvas)) !important;
  color: var(--lp-text);
  letter-spacing: -0.006em;
}

body::selection {
  background: rgba(59, 130, 246, 0.32);
  color: #fff;
}

a {
  text-underline-offset: 3px;
}

.lp-main,
.vdp-main,
.page,
.container,
.vdp {
  min-width: 0;
}

.lp-main > .page,
.lp-main > main,
main.page {
  max-width: var(--lp-content-max);
  margin-inline: auto;
}

/* Navigation: quieter shell, stronger active state. */
.lp-sidebar {
  background: linear-gradient(180deg, #0a1c2e 0%, #0d263c 100%) !important;
  border-right: 1px solid rgba(135, 178, 220, 0.12);
  box-shadow: 8px 0 32px rgba(2, 8, 18, 0.16) !important;
}

.lp-brand {
  background: #050e19 !important;
  border-color: rgba(93, 162, 255, 0.18) !important;
  box-shadow: inset 0 -1px 0 rgba(93, 162, 255, 0.12) !important;
}

.lp-brand-mark {
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.28)) !important;
}

.lp-nav {
  gap: 3px !important;
  padding-inline: 7px !important;
}

.lp-nav a {
  min-height: 68px;
  height: auto !important;
  border: 1px solid transparent !important;
  border-radius: var(--lp-radius-md);
  color: #adbed0 !important;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
}

.lp-nav a:hover {
  background: rgba(255, 255, 255, 0.045) !important;
  border-color: rgba(148, 177, 211, 0.1) !important;
  color: #eef6ff !important;
}

.lp-nav a.active {
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.2), rgba(34, 184, 230, 0.08)) !important;
  border-color: rgba(93, 162, 255, 0.3) !important;
  color: #fff !important;
  box-shadow: inset 3px 0 0 var(--lp-blue-bright);
}

.lp-topbar,
.topbar,
header.toolbar {
  background: rgba(7, 17, 29, 0.86) !important;
  border-bottom: 1px solid var(--lp-line) !important;
  backdrop-filter: blur(16px);
}

/* Typography and page hierarchy. */
.page-title,
.section-title,
.hero-title,
.vdp h1,
main h1 {
  color: var(--lp-text-strong) !important;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.page-subtitle,
.section-subtitle,
.muted,
.subtitle {
  color: var(--lp-text-muted) !important;
}

.eyebrow,
.kicker,
.section-label {
  color: #86b8f8 !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase;
}

/* Surfaces: one family, restrained shadows, no decorative hover lifting. */
.panel,
.card,
.metric-card,
.kpi-card,
.recon-table-card,
.inventory-table-card,
.summary-card,
.action-card,
.vdp-card,
.action-group {
  border: 1px solid var(--lp-line) !important;
  border-radius: var(--lp-radius-lg) !important;
  box-shadow: var(--lp-shadow-sm) !important;
}

.panel,
.card,
.metric-card,
.kpi-card,
.summary-card,
.action-card,
.vdp-card,
.action-group {
  background: linear-gradient(155deg, rgba(18, 42, 68, 0.9), rgba(11, 28, 47, 0.92)) !important;
}

.panel:hover,
.card:hover,
.metric-card:hover,
.kpi-card:hover {
  transform: none !important;
  box-shadow: var(--lp-shadow-sm) !important;
}

.panel + .panel,
.section + .section {
  margin-top: 18px;
}

/* KPI treatment: value first, ornament second. */
.kpi-value,
.metric-value,
.stat-value,
.summary-value {
  color: var(--lp-text-strong) !important;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.kpi-label,
.metric-label,
.stat-label {
  color: var(--lp-text-muted) !important;
  font-weight: 600;
}

.kpi-icon,
.metric-icon {
  background: var(--lp-blue-soft) !important;
  border: 1px solid rgba(93, 162, 255, 0.18) !important;
  color: #91c1ff !important;
}

/* Controls. */
button,
.btn,
.ghost-btn,
.secondary-btn,
input,
select,
textarea {
  font: inherit;
}

.btn,
button.btn,
.primary-btn {
  min-height: var(--lp-control-height);
  border: 1px solid rgba(93, 162, 255, 0.45) !important;
  border-radius: var(--lp-radius-sm) !important;
  background: linear-gradient(180deg, #438bf4, #2d70d4) !important;
  color: #fff !important;
  font-weight: 700 !important;
  box-shadow: 0 5px 14px rgba(21, 91, 186, 0.2) !important;
}

.btn:hover,
button.btn:hover,
.primary-btn:hover {
  background: linear-gradient(180deg, #5599f7, #347be0) !important;
  transform: none !important;
}

.ghost-btn,
.secondary-btn,
button:not(.btn):not(.primary-btn) {
  border-radius: var(--lp-radius-sm);
}

.ghost-btn,
.secondary-btn {
  min-height: var(--lp-control-height);
  border: 1px solid var(--lp-line-strong) !important;
  background: rgba(14, 33, 54, 0.78) !important;
  color: #dceaff !important;
  font-weight: 600;
}

.ghost-btn:hover,
.secondary-btn:hover {
  border-color: rgba(93, 162, 255, 0.42) !important;
  background: rgba(27, 57, 90, 0.82) !important;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  min-height: var(--lp-control-height);
  border: 1px solid var(--lp-line-strong) !important;
  border-radius: var(--lp-radius-sm) !important;
  background: rgba(6, 18, 31, 0.76) !important;
  color: var(--lp-text) !important;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.18);
}

input::placeholder,
textarea::placeholder {
  color: #7188a2 !important;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: none !important;
  border-color: var(--lp-blue-bright) !important;
  box-shadow: var(--lp-focus) !important;
}

label {
  color: #c8d8ea;
}

/* Tables remain light for fast scanning in bright dealership environments. */
.recon-table-card,
.inventory-table-card,
.vehicle-table-wrap,
.table-card {
  overflow: hidden;
  background: #fbfdfd !important;
  border-color: #d4e4e2 !important;
  box-shadow: 0 12px 30px rgba(3, 16, 27, 0.18) !important;
}

.vehicle-table {
  border-collapse: separate;
  border-spacing: 0;
  color: #1e3740 !important;
  font-variant-numeric: tabular-nums;
}

.vehicle-table thead th {
  background: #edf5f4 !important;
  color: #264653 !important;
  border-bottom: 1px solid #d6e6e3 !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.vehicle-table tbody td {
  color: #263f48 !important;
  border-bottom-color: #e2ecea !important;
  vertical-align: middle;
}

.vehicle-table tbody tr:nth-child(even) td {
  background: #f8fbfa;
}

.vehicle-table tbody tr:hover td {
  background: #edf7f5 !important;
}

.vehicle-table select,
.vehicle-table input {
  min-height: 34px;
  background: #fff !important;
  color: #1f3a44 !important;
  border-color: #cbded9 !important;
  color-scheme: light;
}

.vehicle-table a {
  color: #125f9e;
}

.recon-table-time.is-overdue,
.is-aging,
.needs-attention {
  color: #a72f3b !important;
}

/* Status and attention colors are semantic, never decorative. */
.status-badge,
.badge,
.pill,
.recon-attention-badge,
.inventory-attention-badge {
  border-radius: 999px !important;
  font-weight: 700;
}

.success,
.is-success,
.on-track {
  color: #137257 !important;
}

.warning,
.is-warning {
  color: #90600b !important;
}

.danger,
.is-danger,
.needs-attention {
  color: #a72f3b !important;
}

/* Recon board: operational columns with consistent density. */
.recon-board-column {
  border: 1px solid var(--lp-line) !important;
  border-radius: var(--lp-radius-lg) !important;
  background: rgba(7, 20, 35, 0.72) !important;
  box-shadow: none !important;
}

.recon-board-column-header {
  border-bottom: 1px solid var(--lp-line) !important;
  background: rgba(20, 46, 73, 0.56) !important;
}

.recon-board-column-title strong {
  color: var(--lp-text-strong) !important;
}

.recon-board-column-title span,
.recon-card-identity span,
.recon-card-identifiers,
.recon-card-facts small {
  color: var(--lp-text-muted) !important;
}

.recon-vehicle-card {
  border: 1px solid rgba(148, 177, 211, 0.18) !important;
  border-radius: var(--lp-radius-md) !important;
  background: linear-gradient(155deg, #132a43, #0e2136) !important;
  box-shadow: var(--lp-shadow-sm) !important;
}

.recon-vehicle-card:hover {
  transform: none !important;
  border-color: rgba(93, 162, 255, 0.32) !important;
  box-shadow: var(--lp-shadow-sm) !important;
}

.recon-card-notes {
  background: rgba(3, 13, 24, 0.42) !important;
  border-color: rgba(148, 177, 211, 0.12) !important;
}

.recon-action-queue {
  border-color: rgba(93, 162, 255, 0.22) !important;
  background: linear-gradient(150deg, rgba(19, 45, 72, 0.94), rgba(10, 27, 46, 0.96)) !important;
  box-shadow: var(--lp-shadow-md) !important;
}

/* Modals and VDP forms. */
.modal,
.modal-content,
.dialog,
[role="dialog"] {
  border-radius: var(--lp-radius-xl) !important;
}

.modal-content,
.dialog,
[role="dialog"] {
  border: 1px solid var(--lp-line-strong) !important;
  background: linear-gradient(160deg, #142b45, #0a1b2e) !important;
  color: var(--lp-text) !important;
  box-shadow: var(--lp-shadow-lg) !important;
}

.modal-header,
.dialog-header {
  border-bottom: 1px solid var(--lp-line) !important;
}

.modal-footer,
.dialog-footer {
  border-top: 1px solid var(--lp-line) !important;
}

.form-row {
  gap: 14px !important;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: #b8cbe0 !important;
  font-size: 0.8rem;
  font-weight: 700;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
}

.vdp,
body:not(.dashboard-neo) .container {
  width: min(1180px, calc(100% - 32px));
  max-width: 1180px !important;
  margin-inline: auto;
}

.vdp nav,
body:not(.dashboard-neo) .container > nav {
  border: 1px solid var(--lp-line) !important;
  background: rgba(8, 22, 38, 0.92) !important;
  box-shadow: var(--lp-shadow-sm) !important;
}

/* Loading, empty, and system feedback. */
.recon-state,
.empty-state,
.loading-state,
.error-state,
.queue-filter-notice {
  border-radius: var(--lp-radius-md) !important;
}

.empty-state {
  border: 1px dashed var(--lp-line-strong) !important;
  background: rgba(13, 31, 51, 0.58) !important;
  color: var(--lp-text-muted) !important;
}

/* Responsive operating mode. */
@media (max-width: 980px) {
  .dashboard-shell {
    grid-template-columns: 74px minmax(0, 1fr) !important;
  }

  .lp-nav a {
    min-height: 60px;
    font-size: 10px !important;
  }

  .lp-main,
  .vdp-main {
    padding-inline: 12px !important;
  }

  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 720px) {
  :root {
    --lp-control-height: 46px;
  }

  .dashboard-shell {
    display: block !important;
  }

  .lp-sidebar {
    position: sticky !important;
    top: 0;
    width: 100%;
    height: auto !important;
    flex-direction: row !important;
    overflow-x: auto;
  }

  .lp-brand,
  .lp-sidebar-foot {
    display: none !important;
  }

  .lp-nav {
    width: max-content;
    min-width: 100%;
    margin: 0 !important;
    padding: 6px !important;
    flex-direction: row !important;
  }

  .lp-nav a {
    min-width: 74px;
    min-height: 54px;
    padding: 6px 10px;
    box-shadow: none !important;
  }

  .lp-topbar,
  .topbar {
    position: static !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
  }

  .panel,
  .card,
  .metric-card,
  .kpi-card,
  .recon-table-card,
  .inventory-table-card {
    border-radius: var(--lp-radius-md) !important;
  }

  .vehicle-table-wrap,
  .recon-table-card,
  .inventory-table-card {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .vehicle-table {
    min-width: 880px;
  }

  .vdp,
  body:not(.dashboard-neo) .container {
    width: min(100% - 20px, 1180px);
  }
}

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

/* Signed-in, role-aware notifications and manager action queue. */
.lp-notification-center {
  position: relative;
  z-index: 80;
  margin-left: auto;
  flex: 0 0 auto;
}

.topbar .lp-notification-center {
  margin-left: 0;
}

.lp-notification-bell {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  color: #31506f;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 35, 58, 0.06);
}

.lp-notification-bell:hover,
.lp-notification-bell[aria-expanded="true"] {
  color: #145edb;
  border-color: #b9cff5;
  background: #f5f9ff;
}

.lp-notification-bell:focus-visible,
.lp-notification-panel button:focus-visible,
.lp-notification-panel a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.lp-notification-bell svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lp-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #dc2626;
  font: 800 10px/1 Inter, system-ui, sans-serif;
}

.lp-notification-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(390px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 94px));
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 16px;
  color: #132238;
  background: #fff;
  box-shadow: 0 22px 58px rgba(15, 35, 58, 0.22);
}

.lp-notification-panel[hidden],
.lp-notification-tabs[hidden] {
  display: none !important;
}

.lp-notification-header {
  min-height: 76px;
  padding: 16px 18px 13px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #e7edf4;
}

.lp-notification-header > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.lp-notification-header strong {
  color: #0f2742;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.lp-notification-identity {
  overflow: hidden;
  color: #718197;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lp-notification-mark-all {
  padding: 4px 0;
  border: 0;
  color: #2166d1;
  background: transparent;
  font: 700 11px/1.2 Inter, system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.lp-notification-tabs {
  padding: 8px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border-bottom: 1px solid #e7edf4;
  background: #f7f9fc;
}

.lp-notification-tabs > button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #607086;
  background: transparent;
  font: 750 11px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}

.lp-notification-tabs > button.is-active {
  border-color: #d9e4f5;
  color: #1f5fc0;
  background: #fff;
  box-shadow: 0 2px 7px rgba(15, 35, 58, 0.06);
}

.lp-action-count {
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: #2563eb;
  font-size: 9px;
}

.lp-notification-list {
  max-height: 430px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lp-notification-item {
  width: 100%;
  padding: 14px 17px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 11px;
  border: 0;
  border-bottom: 1px solid #edf1f6;
  color: inherit;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.lp-notification-item:hover {
  background: #f7faff;
}

.lp-notification-item.is-unread {
  background: #f3f7ff;
}

.lp-notification-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: transparent;
}

.lp-notification-item.is-unread .lp-notification-dot {
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.lp-notification-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.lp-notification-copy strong {
  color: #102a47;
  font-size: 12.5px;
  line-height: 1.3;
}

.lp-notification-copy > span {
  color: #53677e;
  font-size: 11.5px;
  line-height: 1.45;
}

.lp-notification-copy small {
  color: #8492a4;
  font-size: 10px;
  font-weight: 650;
}

.lp-notification-empty {
  min-height: 190px;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #617288;
  text-align: center;
}

.lp-notification-empty strong {
  color: #17304d;
  font-size: 13px;
}

.lp-notification-empty span {
  max-width: 280px;
  font-size: 11.5px;
  line-height: 1.5;
}

.lp-notification-empty a {
  margin-top: 4px;
  color: #1f62c9;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.lp-notification-footer {
  min-height: 48px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #e7edf4;
  color: #1f62c9;
  background: #fbfcfe;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.lp-notification-toast {
  position: fixed;
  top: 84px;
  right: 22px;
  z-index: 140;
  width: min(350px, calc(100vw - 28px));
  padding: 15px 17px;
  display: grid;
  gap: 5px;
  border: 1px solid #cadcf6;
  border-radius: 13px;
  color: #17304d;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 35, 58, 0.24);
  text-align: left;
  cursor: pointer;
  animation: lp-notification-in 180ms ease-out;
}

.lp-notification-toast strong {
  font-size: 12.5px;
}

.lp-notification-toast span {
  color: #5b6d82;
  font-size: 11.5px;
  line-height: 1.4;
}

@keyframes lp-notification-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .lp-notification-panel {
    position: fixed;
    top: 70px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100vh - 82px);
  }

  .lp-notification-list {
    max-height: calc(100vh - 300px);
  }

  .lp-notification-toast {
    top: 76px;
    right: 10px;
  }
}


/* Account-level interface preferences from Settings. */
body.lp-density-compact .vehicle-table th,
body.lp-density-compact .vehicle-table td,
body.lp-density-compact .data-table th,
body.lp-density-compact .data-table td {
  padding-top: 7px !important;
  padding-bottom: 7px !important;
}
body.lp-density-compact .panel,
body.lp-density-compact .card {
  --lp-control-height: 36px;
}
body.lp-reduce-motion *,
body.lp-reduce-motion *::before,
body.lp-reduce-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
