:root {
  --app-safe-top: env(safe-area-inset-top, 0px);
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-safe-left: env(safe-area-inset-left, 0px);
  --app-safe-right: env(safe-area-inset-right, 0px);
  --app-viewport-height: 100vh;
}

@supports (height: 100dvh) {
  :root {
    --app-viewport-height: 100dvh;
  }
}

@supports (-webkit-touch-callout: none) {
  :root {
    --app-viewport-height: -webkit-fill-available;
  }
}

.admin-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #f8fafc;
  margin: 0;
  color: #0f172a;
  min-height: 100vh;
  min-height: var(--app-viewport-height);
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(1rem + var(--app-safe-top));
  padding-bottom: calc(1rem + var(--app-safe-bottom));
  padding-left: calc(1rem + var(--app-safe-left));
  padding-right: calc(1rem + var(--app-safe-right));
}

.image-modal.hidden {
  display: none;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.image-modal-panel {
  position: relative;
  width: min(720px, 90vw);
}

.image-modal-content {
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 70px -40px rgba(15, 23, 42, 0.65);
  padding: 1.5rem;
}

.image-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
}

.image-modal-message {
  margin: 0.35rem 0 0;
  color: #475569;
  font-size: 0.9rem;
}

.image-modal-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Overview dashboard */
.stat-card {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1.25rem;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 15px 40px -28px rgba(15, 23, 42, 0.4);
}
.stat-card--accent {
  background: linear-gradient(135deg, #111827, #1f2937);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.08);
}
.stat-card .stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: inherit;
  opacity: 0.7;
}
.stat-card .stat-value {
  margin-top: 0.35rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: inherit;
}
.stat-card .stat-sub {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: inherit;
  opacity: 0.65;
}

.sales-chart {
  border: 1px dashed rgba(148, 163, 184, 0.45);
  border-radius: 1rem;
  padding: 1rem 4.5rem 1rem 1rem;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
}
.chart-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.5rem 0 0.25rem;
}
.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  box-shadow: 0 10px 22px -16px rgba(15, 23, 42, 0.15);
}
.view-btn {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.6);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  transition: all 0.12s ease;
}
.view-btn.view-btn--active {
  background: linear-gradient(135deg, #f97316, #fb923c);
  border-color: rgba(249, 115, 22, 0.25);
  color: #0f172a;
  box-shadow: 0 10px 22px -14px rgba(249, 115, 22, 0.45);
}
.view-btn:hover {
  transform: translateY(-1px);
}
.view-meta {
  margin-left: 0.4rem;
  color: #475569;
  font-weight: 700;
  font-size: 0.9rem;
}
.week-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.75rem;
}
.week-select {
  padding: 0.35rem 0.6rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: #ffffff;
  font-weight: 600;
  color: #0f172a;
  min-width: 160px;
  box-shadow: 0 10px 20px -16px rgba(15, 23, 42, 0.25);
}
.sales-legend {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.35rem 0.4rem 0.6rem;
  font-size: 0.9rem;
  color: #475569;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  border: none;
  background: transparent;
  padding: 0.1rem 0.35rem;
  border-radius: 0.5rem;
  cursor: pointer;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}
.legend-dot-current {
  background: linear-gradient(135deg, #f97316, #ea580c);
  box-shadow: 0 8px 18px -12px rgba(234, 88, 12, 0.6);
}
.legend-dot-previous {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 8px 18px -12px rgba(22, 163, 74, 0.45);
}
.sales-line-graph {
  position: relative;
  height: 260px;
}
.sales-line-svg {
  width: 100%;
  height: 100%;
}
.sales-ref-line-svg {
  stroke: rgba(34, 197, 94, 0.6);
  stroke-width: 0.6;
  stroke-dasharray: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.sales-ref-line-svg.is-visible {
  opacity: 1;
}
.sales-axis {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 0.8rem;
  color: #64748b;
}
.sales-axis-y {
  left: 0;
  width: 100%;
}
.sales-axis-x {
  top: auto;
  bottom: 0;
  width: 100%;
  height: 32px;
}
.sales-axis-tick {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  overflow: visible;
}
.sales-axis-tick::before {
  content: '';
  display: block;
  background: rgba(100, 116, 139, 0.35);
}
.sales-axis-tick-y {
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0;
  position: absolute;
}
.sales-axis-tick-y::before {
  flex: 1 1 auto;
  height: 1px;
}
.sales-axis-tick-y span {
  position: absolute;
  right: -56px;
  background: #f8fafc;
  padding: 0.15rem 0.5rem;
  border-radius: 0.4rem;
  box-shadow: 0 8px 20px -14px rgba(15, 23, 42, 0.3);
  margin: 0;
}
.sales-axis-tick-x {
  bottom: 0;
  flex-direction: column;
  transform: translateX(-50%);
}
.sales-axis-tick-x::before {
  width: 1px;
  height: 6px;
}
.sales-axis-tick-x span {
  margin-top: 4px;
  background: #fff;
  padding: 0.15rem 0.4rem;
  border-radius: 0.4rem;
  box-shadow: 0 8px 20px -14px rgba(15, 23, 42, 0.3);
}
.sales-line-area {
  fill: rgba(249, 115, 22, 0.1);
}
.sales-line-path {
  fill: none;
  stroke: #ea580c;
  stroke-width: 0.9;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0px 3px 7px rgba(234, 88, 12, 0.18));
}
.sales-line-area.is-muted,
.sales-line-path.is-muted,
.sales-line-point.is-muted,
.sales-line-points.is-muted {
  opacity: 0.28;
}
.sales-line-area.is-highlight,
.sales-line-path.is-highlight,
.sales-line-point.is-highlight,
.sales-line-points.is-highlight {
  opacity: 1;
}
.sales-line-path.is-highlight {
  stroke-width: 2.6;
}
.sales-ref-line-svg {
  stroke: rgba(34, 197, 94, 0.8);
  stroke-width: 1;
  opacity: 0;
  transition: opacity 0.2s ease, stroke-width 0.12s ease;
  vector-effect: non-scaling-stroke;
}
.sales-ref-line-svg.is-visible {
  opacity: 1;
}
.sales-ref-line-svg.is-highlight {
  stroke-width: 2;
}
.sales-ref-line-svg.is-muted {
  opacity: 0.25;
}
.sales-line-points {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sales-line-point {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  border: 2px solid #ffffff;
  box-shadow: 0 10px 22px -12px rgba(15, 23, 42, 0.35);
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
}
.sales-line-point--mini {
  width: 9px;
  height: 9px;
  box-shadow: 0 8px 16px -12px rgba(15, 23, 42, 0.35);
}
.sales-line-point--blue {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border-color: #e0f2fe;
}
.sales-line-point:focus {
  outline: 2px solid #0f172a;
  outline-offset: 2px;
}
.sales-line-point.is-muted {
  opacity: 0.35;
}
.sales-line-point.is-highlight {
  opacity: 1;
}
.sales-line-tooltip {
  position: absolute;
  transform: translate(-50%, -140%);
  background: #0f172a;
  color: #f8fafc;
  padding: 0.45rem 0.65rem;
  border-radius: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 16px 40px -22px rgba(15, 23, 42, 0.6);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.sales-line-tooltip.is-visible {
  opacity: 1;
}
.sales-chart-empty {
  text-align: center;
  padding: 1.25rem;
  color: #475569;
  font-weight: 600;
}
.sales-chart-hint {
  margin-top: 0.85rem;
  color: #475569;
  font-size: 0.9rem;
}

.admin-section {
  margin-top: 1.75rem;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1.25rem;
  box-shadow: 0 16px 45px -32px rgba(15, 23, 42, 0.45);
  padding: 1.35rem 1.25rem 1.25rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-header p {
  margin: 0.15rem 0 0;
  color: #475569;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  color: #0f172a;
  font-weight: 600;
  font-size: 0.85rem;
}

.badge--status {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.badge-success {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

.badge-muted {
  background: rgba(148, 163, 184, 0.28);
  color: #475569;
}

.badge-danger {
  background: rgba(248, 113, 113, 0.2);
  color: #b91c1c;
}

.lead-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.lead-tab {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #f8fafc;
  color: #0f172a;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.lead-tab--active {
  background: linear-gradient(135deg, #f97316, #fbbf24);
  color: #0f172a;
  border-color: rgba(249, 115, 22, 0.2);
  box-shadow: 0 10px 30px -18px rgba(249, 115, 22, 0.6);
}

.lead-filters {
  margin-bottom: 1.8rem;
  padding: 1rem 1.35rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 20px 45px -36px rgba(15, 23, 42, 0.35);
}

.lead-filter-row {
  margin-top: 0;
  grid-template-columns: minmax(220px, 1.2fr) minmax(110px, 0.55fr) minmax(240px, 1.2fr) minmax(200px, 1fr);
}

.lead-filter-row--owner {
  grid-template-columns: minmax(220px, 1.2fr) minmax(110px, 0.55fr) minmax(240px, 1.2fr) minmax(200px, 1fr) minmax(200px, 1fr);
}

@media (max-width: 1100px) {
  .lead-filter-row,
  .lead-filter-row--owner {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.lead-filters .form-label {
  margin-top: 0;
}

.lead-filters .form-input {
  min-height: 2.6rem;
  font-size: 0.9rem;
  padding: 0.45rem 0.75rem;
  background: rgba(255, 255, 255, 0.96);
}

.lead-filter-stock .form-input {
  width: 100%;
}

.lead-status-col {
  min-width: 140px;
}

.lead-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.lead-card {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 10px 30px -25px rgba(15, 23, 42, 0.4);
}

.lead-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.lead-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.lead-card-subtitle {
  margin: 0.2rem 0 0;
  color: #475569;
  font-size: 0.9rem;
}

.lead-card dl {
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.lead-card dt {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.lead-card dd {
  margin: 0;
  font-weight: 600;
}

.lead-card--form {
  margin-top: 1rem;
}

.lead-detail-header {
  align-items: flex-start;
}

.lead-detail-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  width: 100%;
}

.lead-detail-badges {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.lead-notes-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lead-note {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.8rem;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  position: relative;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.lead-note-grid {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.75rem;
  align-items: flex-start;
}

[data-contact-card].contact-card-editing [data-contact-edit-toggle] {
  display: none !important;
}

.lead-note-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #475569;
}

.lead-note-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #e2e8f0;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.lead-note-body {
  min-width: 0;
}

.lead-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.lead-note--truncated {
  cursor: pointer;
}

.lead-note--truncated .lead-note-text {
  cursor: pointer;
}

.lead-note--truncated::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, #f8fafc 95%);
  pointer-events: none;
}

.lead-note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 0.25rem;
}

.lead-note-author {
  font-weight: 700;
  color: #0f172a;
}

.lead-note-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #0f172a;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-note-modal-text {
  margin: 0;
  white-space: pre-wrap;
  color: #0f172a;
  line-height: 1.55;
}

.note-modal-panel {
  width: min(90vw, 640px);
}
.lead-table-shell {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1.25rem;
  box-shadow: 0 18px 45px -32px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}

.lead-table thead th {
  background: #f1f5f9;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: normal;
  line-height: 1.2;
}

.lead-table th,
.lead-table td {
  padding: 0.8rem 0.9rem;
}

.lead-row:hover {
  background: rgba(248, 250, 252, 0.85);
}

.lead-table td,
.lead-table th {
  vertical-align: middle;
}

.lead-action-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lead-action-form.hidden {
  display: none !important;
}

.lead-action-form--stack {
  flex-direction: column;
  gap: 0.35rem;
}

.lead-action-form--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.appointment-inline .form-input--compact {
  min-width: 160px;
}

.lead-action-form .form-input--compact {
  padding: 0.35rem 0.55rem;
}

.lead-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lead-action-buttons--stack {
  flex-direction: column;
  align-items: stretch;
}

.lead-action-buttons--inline {
  flex-direction: row;
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: min(700px, 95vw);
  background: #fff;
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 20px 55px -30px rgba(15, 23, 42, 0.55);
  padding: 1.5rem;
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #0f172a;
}

.modal-body {
  margin-top: 0.5rem;
}

.auth-container,
.admin-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3.5rem;
}

.admin-site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: calc(1.4rem + var(--app-safe-top)) 1.5rem 0.4rem;
}

.admin-site-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.65rem 1.4rem;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 18px 45px -40px rgba(15, 23, 42, 0.4);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: #0f172a;
  font-weight: 700;
  font-size: 1.1rem;
  pointer-events: none;
}

.admin-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316, #facc15);
  box-shadow: 0 12px 25px -16px rgba(249, 115, 22, 0.65);
}

.admin-brand-name {
  letter-spacing: -0.01em;
}

.admin-site-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-left: auto;
}

.admin-site-link {
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-site-link:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

.admin-site-link[aria-current="page"] {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.admin-site-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-left: 0;
}

.auth-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 1.5rem;
  padding: 2.5rem;
  box-shadow: 0 30px 60px -35px rgba(15, 23, 42, 0.6);
  position: relative;
  overflow: hidden;
}

.auth-title {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
}

.auth-subtitle {
  margin: 0 0 1.5rem;
  color: #475569;
}

.auth-heading {
  margin-bottom: 1rem;
}

.login-form {
  gap: 1.2rem;
}

.auth-footnote {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: #64748b;
}

.auth-container {
  min-height: 100vh;
  min-height: var(--app-viewport-height);
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
}

.form-grid.form-wide {
  gap: 1.75rem;
}

.form-row {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 0.25rem;
}

.vin-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.vin-input-row .form-input {
  flex: 1;
  min-width: 220px;
}

.description-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.description-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.description-actions .field-hint {
  margin-top: 0;
}

.text-error {
  color: #dc2626;
}

.field-hint {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #94a3b8;
}

.address-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.autocomplete {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  background: #ffffff;
  border-radius: 0.9rem;
  box-shadow: 0 18px 46px -22px rgba(15, 23, 42, 0.35), 0 6px 18px -12px rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
  max-height: 16rem;
  overflow-y: auto;
}

.autocomplete-dropdown.hidden {
  display: none;
}

.autocomplete-option {
  width: 100%;
  padding: 0.65rem 0.95rem;
  text-align: left;
  background: transparent;
  border: none;
  font-size: 0.85rem;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.autocomplete-option:hover,
.autocomplete-option:focus-visible {
  background: rgba(15, 23, 42, 0.05);
  color: #0f172a;
  outline: none;
}

.autocomplete-option.empty {
  cursor: default;
  color: #94a3b8;
}

.input-with-prefix {
  display: flex;
  align-items: stretch;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.input-with-prefix .form-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
  min-width: 0;
}

.input-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
  background: rgba(226, 232, 240, 0.35);
  border-right: 1px solid rgba(148, 163, 184, 0.25);
}

.business-hours-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.business-hours-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.business-hours-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.business-hours-input {
  font-size: 0.9rem;
}

.default-photo-preview {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.default-photo-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.default-photo-frame {
  position: relative;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 4/3;
  border-radius: 1rem;
  background: rgba(226, 232, 240, 0.35);
  border: 1px dashed rgba(148, 163, 184, 0.5);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.default-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.85rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.default-photo-frame--error {
  border-style: solid;
  border-color: rgba(248, 113, 113, 0.6);
}

.default-photo-empty {
  font-size: 0.8rem;
  color: #94a3b8;
  text-align: center;
  padding: 0 0.5rem;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  align-items: center;
  margin-top: 0.5rem;
}

.inventory-status-row {
  padding: 0.6rem 0.75rem;
  border-radius: 1rem;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.9);
}

.inventory-status-row .form-checkbox {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.5rem 0.7rem;
  border-radius: 0.85rem;
  box-shadow: 0 12px 24px -24px rgba(15, 23, 42, 0.35);
}

.inventory-status-row .form-checkbox input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #f97316;
}

.sold-date-slot {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.92);
  min-width: 230px;
  transition: opacity 0.15s ease;
}

.sold-date-slot.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sold-date-slot .form-input {
  width: 100%;
  max-width: 240px;
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
}

.sold-date-slot .form-label {
  margin-top: 0;
}

.sold-date-slot .text-xs {
  margin: 0;
}

.checkbox-row .form-checkbox {
  margin: 0;
}

.feature-limit-note {
  font-size: 0.8rem;
  color: #b91c1c;
  font-weight: 500;
  display: block;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.form-input,
.form-input:focus {
  width: 100%;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.55);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.form-input:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
}

.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: #0f172a;
  font-weight: 500;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-actions-right {
  justify-content: flex-end;
}

.tag-input {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.96);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-size: 0.85rem;
}

.tag-remove {
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}

.tag-remove:hover {
  color: #dc2626;
}

.tag-editor {
  border: none;
  outline: none;
  font-size: 0.9rem;
  color: #0f172a;
  background: transparent;
  width: 100%;
}

.tag-editor:disabled {
  opacity: 0.6;
}

.tag-hint {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
}

.image-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.image-btn {
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.94);
  color: #475569;
  border-radius: 9999px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.45rem 1.2rem;
  font-weight: 600;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.image-btn:hover,
.image-btn:focus-visible {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.12);
  color: #c2410c;
  outline: none;
  transform: translateY(-1px);
}

.image-btn-danger {
  border-color: rgba(220, 38, 38, 0.45);
  color: #b91c1c;
}

.image-btn-danger:hover,
.image-btn-danger:focus-visible {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  color: #7f1d1d;
}

.image-empty {
  margin: 0 0 0.5rem;
}

.image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  list-style: none;
  padding: 0;
}

.image-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: min(100%, 200px);
  padding: 0.85rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 38px -34px rgba(15, 23, 42, 0.45);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: move;
}

.image-item::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid transparent;
  pointer-events: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.image-item--removed {
  border-style: dashed;
  border-color: rgba(220, 38, 38, 0.45);
  opacity: 0.55;
}

.image-item--hidden {
  display: none !important;
}

.image-item--dragging {
  opacity: 0.6;
  cursor: move;
}

.image-item--dragover {
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.image-item--selected::before {
  border-color: rgba(249, 115, 22, 0.65);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.22);
}

.image-item--selected::before {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.image-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0.85rem;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.image-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.image-select-badge {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.12);
  color: rgba(15, 23, 42, 0.65);
  font-size: 0.75rem;
  font-weight: 700;
  transform: scale(0.8);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.image-item--selected .image-select-badge {
  background: #f97316;
  color: #fff;
  transform: scale(1);
}

.image-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}

.image-status {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
}

.image-item--removed .image-status {
  color: #dc2626;
}

.image-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
}

.image-reorder {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.image-reorder .image-move {
  width: 2.35rem;
  padding: 0.35rem 0;
}

.image-move {
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.96);
  color: #475569;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.image-move:hover,
.image-move:focus-visible {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.08);
  color: #c2410c;
  outline: none;
}

.image-remove-checkbox {
  display: none;
}

.drivetrain-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.drivetrain-pill {
  display: inline-flex;
  cursor: pointer;
  font-size: 0.85rem;
}

.drivetrain-pill input {
  display: none;
}

.drivetrain-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.drivetrain-pill input:checked + span {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  color: #c2410c;
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.2);
}

.drivetrain-pill span:hover {
  border-color: #f97316;
}

.admin-loader {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.admin-loader[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.admin-loader-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(225, 232, 240, 0.35);
  border-top-color: #f97316;
  box-shadow: 0 12px 30px -18px rgba(15, 23, 42, 0.6);
  animation: adminSpin 0.8s linear infinite;
}

.admin-loader-message {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #e2e8f0;
  text-shadow: 0 0 12px rgba(15, 23, 42, 0.45);
}

@keyframes adminSpin {
  to {
    transform: rotate(360deg);
  }
}

.btn-primary,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #f97316, #facc15);
  color: #0f172a;
  box-shadow: 0 16px 30px -18px rgba(249, 115, 22, 0.65);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px -20px rgba(249, 115, 22, 0.75);
}

.btn-ghost {
  background: rgba(15, 23, 42, 0.05);
  color: #0f172a;
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.1);
}

.admin-site-actions .btn-ghost {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #0f172a;
  padding: 0.45rem 1rem;
}

.admin-site-actions .btn-ghost:hover {
  background: rgba(248, 250, 252, 0.95);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.18);
}

.btn-success {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  padding: 0.25rem 0.625rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}

.btn-success:hover {
  background: rgba(22, 163, 74, 0.18);
}

.btn-success:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2.25rem 1.75rem 0;
  color: #f8fafc;
}

.admin-header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.header-subtitle {
  margin: 0.3rem 0 0;
  color: rgba(248, 250, 252, 0.7);
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-container {
  position: relative;
  background: #ffffff;
  border-radius: 2.4rem 2.4rem 0 0;
  margin-top: 1.75rem;
  min-height: calc(100vh - 180px);
  min-height: calc(var(--app-viewport-height) - 180px);
  box-shadow: 0 -32px 90px -50px rgba(15, 23, 42, 0.4);
  padding: 2.4rem 2.2rem 3.2rem;
  overflow: hidden;
}

.admin-page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
}

.inventory-filters {
  margin-bottom: 1.8rem;
  padding: 1rem 1.35rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 20px 45px -36px rgba(15, 23, 42, 0.35);
}

.inventory-filter-grid {
  display: grid;
  gap: 1rem 1.35rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.inventory-filter-field .form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}

.inventory-filter-field .form-input {
  min-height: 2.6rem;
  font-size: 0.9rem;
  padding: 0.45rem 0.75rem;
}

.inventory-filter-field select.form-input {
  cursor: pointer;
}

.inventory-filter-field.multi-filter {
  position: relative;
}

.inventory-filter-field.multi-filter .form-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
}

.multi-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-trigger {
  position: relative;
}

.multi-trigger::after {
  content: '';
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid #475569;
  border-bottom: 2px solid #475569;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.multi-trigger[aria-expanded="true"]::after {
  transform: rotate(-135deg);
}

.multi-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.28);
  border-color: rgba(249, 115, 22, 0.55);
}

.multi-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.multi-panel {
  position: absolute;
  top: calc(100% - 0.01rem);
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 26px 60px -32px rgba(15, 23, 42, 0.45);
  padding: 0.6rem;
  z-index: 30;
}

.multi-panel.hidden {
  display: none;
}

.multi-search {
  margin-bottom: 0.45rem;
  position: relative;
}

.multi-search-input {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(248, 250, 252, 0.92);
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.multi-search-input:focus {
  outline: none;
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
}

.multi-options {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0.2rem;
}

.multi-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #0f172a;
}

.multi-option input {
  accent-color: #f97316;
}

.multi-actions {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}

.multi-actions button {
  flex: 1;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.95);
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.multi-actions button:hover {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.4);
  color: #d97706;
}

.multi-empty {
  font-size: 0.8rem;
  color: #94a3b8;
  text-align: center;
  padding: 0.5rem 0.25rem;
}

.admin-page-heading h1 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  color: #0f172a;
}

.admin-page-heading p {
  margin: 0.45rem 0 0;
  color: #475569;
  font-size: 0.95rem;
}

.admin-page-heading--stack {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1.25rem;
}

.table-scroll {
  overflow-x: auto;
  border-radius: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  margin-top: 1.8rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 45px -32px rgba(15, 23, 42, 0.45);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.table-label {
  display: none;
}

.admin-table th,
.admin-table td {
  padding: 0.65rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  font-size: 0.8rem;
  word-break: break-word;
  line-height: 1.3;
}

.admin-table th {
  white-space: nowrap;
}

.admin-table td {
  white-space: normal;
}

.admin-table thead {
  background: rgba(226, 232, 240, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  color: #475569;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.sort-button span:last-child {
  text-transform: inherit;
  letter-spacing: inherit;
  font-weight: inherit;
  white-space: nowrap;
}

.sort-button:hover {
  color: #0f172a;
}

.sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
}

th.sorted-asc .sort-indicator::before {
  content: '▲';
  font-size: 0.6rem;
  color: #0f172a;
}

th.sorted-desc .sort-indicator::before {
  content: '▼';
  font-size: 0.6rem;
  color: #0f172a;
}

.admin-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.05);
}
.admin-table tbody tr.table-row-link {
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.admin-table tbody tr.table-row-link:focus-within,
.admin-table tbody tr.table-row-link:focus {
  outline: none;
  box-shadow: none;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.table-actions form {
  margin: 0;
}

.admin-table-actions-head {
  width: 140px;
  text-align: right;
}

/* removed fixed width for updated column */

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.25rem 0.25rem;
}
.table-pagination.hidden {
  display: none;
}
.table-pagination.is-empty {
  display: none;
}
.pagination-info {
  color: #475569;
  font-weight: 600;
}
.pagination-actions {
  display: flex;
  gap: 0.5rem;
}
.pagination-page {
  min-width: 36px;
  text-align: center;
}
.pagination-page--active {
  background: #0f172a;
  color: #f8fafc;
  border-color: #0f172a;
  cursor: default;
}
.analytics-chart {
  margin-top: 1rem;
  background: #ffffff;
  border: 1px dashed rgba(148, 163, 184, 0.4);
  border-radius: 1rem;
  padding: 1rem;
}
.analytics-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.analytics-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.analytics-bar-label {
  font-weight: 700;
  color: #0f172a;
}
.analytics-bar-track {
  width: 100%;
  background: #f1f5f9;
  border-radius: 0.75rem;
  height: 24px;
  overflow: hidden;
}
.analytics-bar-fill {
  height: 100%;
  border-radius: 0.75rem;
  background: linear-gradient(90deg, #38bdf8, #0ea5e9);
  display: flex;
  align-items: center;
  padding-left: 0.6rem;
  color: #0b1622;
  font-weight: 700;
}
.analytics-bar-value {
  color: #0f172a;
  font-size: 0.9rem;
}
.analytics-line-chart {
  margin-top: 0.75rem;
  background: #fff;
  border: 1px dashed rgba(148, 163, 184, 0.4);
  border-radius: 1rem;
  padding: 0.75rem;
}
.lead-line-svg {
  width: 100%;
  height: 260px;
}
.lead-line-path {
  fill: none;
  stroke: #0ea5e9;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lead-line-dot {
  fill: #0ea5e9;
}
.lead-line-label {
  font-size: 3px;
  fill: #0f172a;
  text-anchor: middle;
}
.lead-line-legend {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  color: #0f172a;
}
.chart-card {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 1.1rem;
  padding: 1rem 1.2rem 0.8rem;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.4);
}
.chart-card--line {
  padding-right: 4.2rem;
  padding-bottom: 1.25rem;
}
.chart-canvas--analytics {
  position: relative;
  min-height: 240px;
}
.chart-card--line .chart-canvas--analytics {
  min-height: 260px;
}
.chart-card--line .chart-svg {
  height: 100%;
}
.chart-svg {
  width: 100%;
  height: 220px;
  display: block;
}
.chart-grid line {
  stroke: rgba(148, 163, 184, 0.22);
  stroke-width: 0.3;
  stroke-dasharray: 1.4 3;
}
.chart-area {
  fill: rgba(249, 115, 22, 0.08);
}
.chart-line {
  stroke: #f97316;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-card--line .chart-line {
  stroke-width: 0.9;
}
.chart-dot {
  fill: #f97316;
  stroke: #fff;
  stroke-width: 0.2;
}
.chart-xlabels text {
  font-size: 2.6px;
  fill: #475569;
  text-anchor: middle;
}
.chart-ylabels text {
  font-size: 2.4px;
  fill: #94a3b8;
  text-anchor: end;
  dominant-baseline: middle;
}
.chart-label {
  font-size: 2.6px;
  fill: #0f172a;
  text-anchor: middle;
  font-weight: 700;
}
.chart-legend {
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  color: #0f172a;
  font-weight: 700;
}
.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  background: #f1f5f9;
  border-radius: 999px;
  font-weight: 700;
}
.chart-legend-meta {
  color: #64748b;
  font-weight: 600;
}
.chart-card--line .sales-axis-tick-y span {
  right: -48px;
  background: #ffffff;
}
.chart-card--line .sales-axis-tick-x span {
  background: #ffffff;
}
.chart-card--line .sales-line-tooltip {
  font-size: 0.85rem;
}
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chart-bars--tight {
  gap: 0.75rem;
}
.chart-bar {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.chart-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.chart-bar-label {
  font-weight: 700;
  color: #0f172a;
}
.chart-bar-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: #0f172a;
}
.chart-bar-share {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
}
.chart-bar-track {
  width: 100%;
  background: #f1f5f9;
  border-radius: 0.85rem;
  height: 24px;
  overflow: hidden;
  position: relative;
}
.chart-bar-fill {
  height: 100%;
  border-radius: 0.85rem;
  background: linear-gradient(90deg, #38bdf8, #0ea5e9);
  display: flex;
  align-items: center;
  padding-left: 0.6rem;
  color: #0b1622;
  font-weight: 800;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.chart-bar-fill--amber {
  background: linear-gradient(90deg, #f97316, #ea580c);
  color: #fffdfb;
}
.chart-bar-fill--amber .chart-bar-value {
  color: #ffffff;
}
.chart-bar-value {
  color: #0f172a;
  font-size: 0.9rem;
}
.chart-empty {
  color: #475569;
  font-weight: 600;
  padding: 1rem 0.25rem;
}
.chart-line--blue {
  stroke: #0ea5e9;
}
.chart-dot--blue {
  fill: #0ea5e9;
}
.chart-label--blue {
  fill: #0ea5e9;
}
.legend-dot-blue {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 8px 18px -12px rgba(14, 165, 233, 0.6);
}
.movement-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #0f172a;
  font-weight: 700;
  z-index: 2;
}
.movement-overlay.hidden {
  display: none;
}
.btn-ghost.disabled {
  pointer-events: none;
  opacity: 0.45;
}

@media (max-width: 960px) {
  .table-scroll {
    border-radius: 1.1rem;
    overflow: visible;
  }

  .admin-table,
  .admin-table thead,
  .admin-table tbody,
  .admin-table th,
  .admin-table td,
  .admin-table tr {
    display: block;
    width: 100%;
  }

  .admin-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
  }

  .admin-table tbody tr {
    border: 1px solid rgba(148, 163, 184, 0.5);
    padding: 1.1rem 1.25rem 0.4rem;
    margin-bottom: 0.85rem;
    border-radius: 1rem;
    background: rgba(248, 250, 252, 0.85);
    box-shadow: 0 12px 25px -22px rgba(15, 23, 42, 0.7);
  }

  .admin-table th,
  .admin-table td {
    padding: 0.4rem 0;
    border: none;
    font-size: 0.85rem;
    text-align: left;
    white-space: normal;
  }

  .admin-table td {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    justify-content: space-between;
  }

  .admin-table td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    flex: 0 0 44%;
    max-width: 8rem;
  }

.admin-table td[data-label="Actions"] {
  padding-top: 0.8rem;
  flex-direction: column;
  gap: 0.35rem;
}

  .table-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .admin-table-actions-head {
    width: auto;
  }

  .table-actions .btn-ghost,
  .table-actions .btn-danger,
  .table-actions form,
  .table-actions form button {
    width: 100%;
  }
  .table-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    flex: 0 0 44%;
    max-width: 8rem;
  }

  .admin-table td.table-updated {
    justify-content: flex-start;
    gap: 0.75rem;
  }

  .admin-table td.table-updated::before {
    display: none;
  }

  .admin-table td.table-updated .table-updated-value {
    flex: 1 1 auto;
    margin-left: auto;
    display: block;
    text-align: right;
    white-space: normal;
    min-width: fit-content;
  }
}

code {
  background: rgba(15, 23, 42, 0.08);
  padding: 0.2rem 0.4rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  color: #0f172a;
}

.alert {
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.alert-info {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.form-section {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 1.2rem;
  padding: 1.2rem 1.1rem 1.35rem;
  background: rgba(255, 255, 255, 0.94);
  display: grid;
  gap: 1rem;
  box-shadow: 0 18px 36px -32px rgba(15, 23, 42, 0.25);
}

.form-section h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #0f172a;
}

.form-section .form-row {
  margin-top: 0.5rem;
}

.form-section .form-label {
  margin-top: 0;
}

.advanced-card {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.85);
}

.advanced-card summary {
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
  list-style: none;
  position: relative;
}

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

.advanced-card summary::after {
  content: '▾';
  position: absolute;
  right: 0;
  color: #475569;
  transition: transform 0.2s ease;
}

.advanced-card[open] summary::after {
  transform: rotate(180deg);
}

.advanced-card .form-label {
  margin-top: 1rem;
}

.advanced-hint,
.section-hint {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0.5rem 0 1rem;
}

.media-section {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 1.2rem;
  padding: 1.25rem 1.1rem;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  gap: 0.75rem;
}

 .media-section h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #0f172a;
}

@media (max-width: 900px) {
  .admin-site-shell {
    flex-direction: column;
    align-items: flex-start;
  }
  .admin-site-nav {
    order: 3;
    margin-left: 0;
  }
  .admin-site-actions {
    margin-left: 0;
    order: 2;
  }
  .admin-page-heading {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .admin-container {
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.75rem 1.5rem 2.2rem;
  }

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

/* Admin nav dropdown */
.admin-nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.admin-nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-nav-caret {
  width: 0.65rem;
  height: 0.65rem;
  opacity: 0.6;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.admin-nav-dropdown:hover .admin-nav-caret,
.admin-nav-dropdown:focus-within .admin-nav-caret {
  opacity: 0.9;
  transform: rotate(180deg);
}

.admin-nav-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: -0.25rem;
  min-width: 180px;
  padding: 0.45rem;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.85rem;
  box-shadow: 0 18px 35px -28px rgba(15, 23, 42, 0.55);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 60;
}

.admin-nav-dropdown:hover .admin-nav-menu,
.admin-nav-dropdown:focus-within .admin-nav-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.admin-nav-sub-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav-sub-link:hover,
.admin-nav-sub-link:focus-visible {
  background: rgba(148, 163, 184, 0.15);
  color: #0f172a;
  outline: none;
}

.admin-nav-sub-link.is-active {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.08);
}

.admin-mobile-sub-link {
  margin-left: 1.25rem;
  font-size: 0.85rem;
  color: #64748b;
}

.admin-mobile-sub-link:hover,
.admin-mobile-sub-link:focus-visible {
  color: #0f172a;
}
.lead-filter-status .multi-label {
  font-size: 0.8rem;
}

.lead-filter-status .multi-option span {
  font-size: 0.7rem;
}

.btn-icon-delete {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  color: #dc2626;
}

.btn-icon-delete:hover {
  background-color: #fee2e2;
  color: #b91c1c;
}

.btn-icon-delete:active {
  background-color: #fecaca;
}

.btn-icon-restore {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  color: #16a34a;
}

.btn-icon-restore:hover {
  background-color: #dcfce7;
  color: #15803d;
}

.btn-icon-restore:active {
  background-color: #bbf7d0;
}
