:root {
  --amber: #f59e0b;
  --ink: #101316;
  --muted: #f3f5f6;
  --border: #dfe3e6;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--muted);
  font-family: Inter, system-ui, sans-serif;
  color: #171a1d;
}
.skip-link {
  position: absolute;
  top: -60px;
}
.skip-link:focus {
  top: 1rem;
}
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-brand {
  background: linear-gradient(145deg, #080a0c, #252b31);
  color: #fff;
  display: flex;
  align-items: end;
  padding: 6vw;
}
.login-brand h1 {
  font-size: clamp(3rem, 6vw, 6rem);
  line-height: 0.9;
  text-transform: uppercase;
}
.login-form {
  display: grid;
  place-items: center;
  padding: 2rem;
}
.login-form form {
  width: min(420px, 100%);
}
.btn-amber {
  background: var(--amber);
  border-color: var(--amber);
  color: #111 !important;
  font-weight: 700;
}
.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  width: 260px;
  height: 100vh;
  background: var(--ink);
  color: #bcc3c9;
  padding: 1.5rem;
  overflow: auto;
}
.sidebar h2 {
  color: #fff;
}
.sidebar a {
  color: #bcc3c9;
  text-decoration: none;
  display: flex;
  gap: 0.7rem;
  padding: 0.7rem;
  border-radius: 0.35rem;
}
.sidebar a:hover,
.sidebar a.active {
  background: #292f35;
  color: #fff;
}
.sidebar a.active {
  border-left: 3px solid var(--amber);
}
.admin-main {
  grid-column: 2;
  padding: 2rem;
  max-width: 1600px;
  width: 100%;
}
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}
.metric {
  background: #fff;
  border: 1px solid var(--border);
  padding: 1.25rem;
  height: 100%;
}
.metric span {
  font-size: 2rem;
  font-weight: 800;
  display: block;
}
.panel {
  background: #fff;
  border: 1px solid var(--border);
  padding: 1.25rem;
}
.table-responsive {
  min-height: 200px;
}
.status {
  font-size: 0.75rem;
  border-radius: 2rem;
  background: #e7eaec;
  padding: 0.25rem 0.55rem;
}
.form-section {
  background: #fff;
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.mobile-toggle {
  display: none;
}
.admin-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: #111;
  color: #fff;
  border-left: 4px solid var(--amber);
  padding: 1rem;
  z-index: 2000;
}
@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-brand {
    display: none;
  }
  .admin-shell {
    display: block;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: 0.2s;
    z-index: 1000;
  }
  .sidebar.open {
    transform: none;
  }
  .admin-main {
    padding: 1rem;
  }
  .mobile-toggle {
    display: inline-flex;
  }
  .admin-top h1 {
    font-size: 1.6rem;
  }
  .table td:nth-child(n + 4),
  .table th:nth-child(n + 4) {
    display: none;
  }
}

/* Module 15: shared admin business-software shell */
:root {
  --admin-radius: 0.6rem;
  --admin-shadow: 0 8px 24px rgb(16 19 22 / 8%);
  --admin-focus: 0 0 0 0.22rem rgb(245 158 11 / 30%);
}
html,
body {
  max-width: 100%;
  overflow-x: clip;
}
button,
input,
select,
textarea {
  font: inherit;
}
.btn {
  min-height: 2.65rem;
  min-width: 2.65rem;
  padding: 0.55rem 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-weight: 700;
  border-radius: 0.4rem;
}
.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
a:focus-visible,
button:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--admin-focus);
  border-color: #ad6500;
}
.form-control,
.form-select {
  min-height: 2.75rem;
  border-color: #b9c1c7;
}
.form-label {
  color: #343a40;
  font-weight: 700;
}
.required-marker {
  color: #b42318;
  font-weight: 800;
}

.required-label::after {
  color: #b42318;
  content: " *";
  font-weight: 800;
}
.panel,
.form-section,
.metric {
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
}
.panel + .panel {
  margin-top: 1rem;
}
.admin-shell {
  grid-template-columns: 272px minmax(0, 1fr);
}
.sidebar {
  width: 272px;
  padding: 1.25rem 1rem;
  scrollbar-width: thin;
  z-index: 1040;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.sidebar nav {
  display: grid;
  gap: 0.15rem;
  padding-bottom: 2rem;
}
.sidebar nav a {
  min-height: 2.65rem;
  align-items: center;
}
.sidebar nav a i {
  width: 1.1rem;
  text-align: center;
}
.mobile-sidebar-close,
.sidebar-backdrop {
  display: none;
}
.admin-main {
  max-width: none;
  min-width: 0;
  padding: clamp(1rem, 2vw, 2rem);
}
.admin-top {
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 1rem;
  background: rgb(243 245 246 / 94%);
  backdrop-filter: blur(12px);
  padding: 0.75rem 0;
  margin-bottom: 0.75rem;
}
.admin-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.admin-title h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  overflow-wrap: anywhere;
}
.admin-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.45rem;
  color: #697178;
  font-size: 0.76rem;
}
.admin-breadcrumbs i {
  font-style: normal;
}
.admin-breadcrumbs a {
  color: #4d565d;
  text-underline-offset: 0.18em;
}
.admin-top-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}
.admin-global-search {
  display: flex;
  width: min(25rem, 30vw);
}
.admin-global-search .form-control {
  min-width: 0;
  border-radius: 0.4rem 0 0 0.4rem;
}
.admin-global-search .btn {
  border-radius: 0 0.4rem 0.4rem 0;
}
.notification-menu,
.user-menu {
  position: relative;
}
.notification-menu summary,
.user-menu summary {
  list-style: none;
  position: relative;
}
.notification-menu summary::-webkit-details-marker,
.user-menu summary::-webkit-details-marker {
  display: none;
}
.notification-count {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.25rem;
  height: 1.25rem;
  display: grid;
  place-items: center;
  padding: 0 0.25rem;
  border-radius: 2rem;
  background: #b42318;
  color: #fff;
  font-size: 0.68rem;
}
.top-menu-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(23rem, calc(100vw - 2rem));
  max-height: min(70vh, 30rem);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--admin-radius);
  box-shadow: 0 18px 50px rgb(0 0 0 / 18%);
  padding: 0.8rem;
  z-index: 50;
}
.top-menu-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.top-menu-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.top-menu-panel li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid #edf0f2;
}
.top-menu-panel time,
.top-menu-panel small {
  color: #697178;
  font-size: 0.72rem;
}
.user-menu .top-menu-panel {
  width: 14rem;
  display: grid;
  gap: 0.5rem;
}
.user-menu .top-menu-panel a,
.user-menu .top-menu-panel button {
  border: 0;
  background: transparent;
  color: #212529;
  padding: 0.55rem;
  text-align: left;
  text-decoration: none;
}
.user-menu .top-menu-panel a:hover,
.user-menu .top-menu-panel button:hover {
  background: #f2f4f5;
}
.admin-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0 1.25rem;
}
.admin-loading {
  position: fixed;
  top: 0;
  left: 272px;
  right: 0;
  z-index: 2000;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem;
  background: #111;
  color: #fff;
  border-bottom: 3px solid var(--amber);
}
.admin-toast {
  width: min(24rem, calc(100vw - 2rem));
  border-radius: 0.4rem;
  box-shadow: 0 14px 40px rgb(0 0 0 / 20%);
}
.form-section-nav {
  position: sticky;
  top: 5.5rem;
  z-index: 15;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.6rem;
  margin-bottom: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
  scrollbar-width: thin;
}
.form-section-nav a {
  flex: 0 0 auto;
  color: #343a40;
  border-radius: 2rem;
  padding: 0.4rem 0.7rem;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
}
.form-section-nav a:hover {
  background: #fff1c7;
}
form[data-dirty='true'] .sticky-actions::before {
  content: 'Unsaved changes';
  color: #8a4d00;
  font-size: 0.8rem;
  font-weight: 800;
  align-self: center;
}
.admin-error-summary {
  border-left: 4px solid #b42318;
  background: #fff0f0;
  padding: 1rem;
  margin-bottom: 1rem;
}
.table-responsive {
  border: 1px solid var(--border);
  border-radius: var(--admin-radius);
  background: #fff;
}
.table {
  margin-bottom: 0;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #20252a;
  color: #fff;
  border: 0;
  white-space: nowrap;
}
.table td,
.table th {
  padding: 0.75rem;
  vertical-align: middle;
}
.inventory-pagination,
.sale-pagination {
  padding-top: 1rem;
}
.admin-dialog,
.content-preview {
  max-height: min(90dvh, 54rem);
  overflow-y: auto;
  border-radius: var(--admin-radius);
}

@media (max-width: 1100px) {
  .admin-global-search {
    width: 14rem;
  }
  .user-menu summary span {
    display: none;
  }
}
@media (max-width: 900px) {
  .sidebar {
    width: min(82vw, 300px);
    box-shadow: 18px 0 50px rgb(0 0 0 / 30%);
  }
  .mobile-sidebar-close {
    display: block;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1030;
    display: block;
    visibility: hidden;
    opacity: 0;
    border: 0;
    background: rgb(0 0 0 / 52%);
    transition: opacity 160ms ease;
  }
  .admin-shell.nav-open .sidebar-backdrop {
    visibility: visible;
    opacity: 1;
  }
  .admin-main {
    padding: 0.75rem;
  }
  .admin-loading {
    left: 0;
  }
  .admin-top {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .admin-title {
    flex: 1 1 auto;
  }
  .admin-top-tools {
    flex: 1 1 100%;
  }
  .admin-global-search {
    flex: 1;
    width: auto;
  }
  .admin-quick-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .admin-quick-actions .btn {
    flex: 0 0 auto;
  }
  .form-section-nav {
    top: 8.5rem;
  }
}
@media (min-width: 641px) and (max-width: 900px) {
  table.admin-responsive-table th,
  table.admin-responsive-table td {
    display: table-cell !important;
  }

  .table-responsive {
    overflow-x: auto;
  }
}

@media (max-width: 640px) {
  .admin-main {
    padding: 0.5rem;
  }
  .admin-top {
    margin-inline: -0.5rem;
    padding-inline: 0.5rem;
  }
  .notification-menu .top-menu-panel,
  .user-menu .top-menu-panel {
    position: fixed;
    top: 8.5rem;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
  }
  .panel,
  .form-section {
    padding: 0.9rem;
  }
  .inventory-toolbar,
  .vehicle-editor-head,
  .media-toolbar {
    align-items: stretch;
  }
  .inventory-toolbar > *,
  .vehicle-editor-head > *,
  .media-toolbar > * {
    width: 100%;
  }
  .sticky-actions {
    margin-inline: -0.9rem;
    padding: 0.75rem;
    flex-wrap: wrap;
  }
  .sticky-actions .btn,
  .sticky-actions a {
    flex: 1 1 auto;
  }
  .table-responsive {
    border: 0;
    overflow: visible;
  }
  table.admin-responsive-table,
  table.admin-responsive-table tbody {
    display: block;
    width: 100%;
  }
  table.admin-responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  table.admin-responsive-table tbody tr {
    display: grid;
    gap: 0;
    margin-bottom: 0.8rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    overflow: hidden;
  }
  table.admin-responsive-table tbody td,
  table.inventory-table tbody td,
  table.vehicle-table tbody td {
    display: grid !important;
    grid-template-columns: minmax(7rem, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    min-width: 0;
    border: 0;
    border-bottom: 1px solid #edf0f2;
    padding: 0.65rem 0.75rem;
    overflow-wrap: anywhere;
  }
  table.admin-responsive-table tbody td::before {
    content: attr(data-label);
    color: #687178;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
  }
  table.admin-responsive-table tbody td:last-child {
    border-bottom: 0;
  }
  table.admin-responsive-table tbody td:last-child .btn {
    width: 100%;
  }
  .inventory-pagination,
  .inventory-toolbar,
  .inventory-bulk {
    display: grid;
    grid-template-columns: 1fr;
  }
  .inventory-pagination .btn,
  .inventory-toolbar .btn,
  .inventory-bulk .btn,
  .inventory-bulk .form-select {
    width: 100%;
  }
  .vehicle-media-grid,
  .media-grid {
    grid-template-columns: 1fr;
  }
  .analytics-row {
    grid-template-columns: 5rem minmax(0, 1fr) 2rem;
  }
}
@media (max-width: 380px) {
  .admin-global-search input {
    font-size: 0.85rem;
  }
  .admin-title h1 {
    font-size: 1.35rem;
  }
  .admin-top-tools {
    gap: 0.3rem;
  }
  .notification-menu summary,
  .user-menu summary,
  .mobile-toggle {
    padding-inline: 0.65rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition: none !important;
  }
}

/* Module 16: consistent WCAG 2.2 keyboard focus and motion behavior. */
:focus-visible {
  outline: 3px solid #0b67c2;
  outline-offset: 3px;
}
.sidebar :focus-visible { outline-color: #ffd166; }
[tabindex="-1"]:focus { outline: none; }
.skip-link:focus {
  position: fixed;
  inset: 0.75rem auto auto 0.75rem;
  z-index: 2000;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.vehicle-tabs,
.vehicle-editor-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: center;
}
.vehicle-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 230px;
}
.vehicle-cell img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  background: #e4e7e9;
}
.vehicle-cell small {
  display: block;
  color: #697178;
}
.purpose-choice {
  background: #fff;
  padding: 2rem;
}
.purpose-card {
  display: block;
  height: 100%;
  padding: 2rem;
  border: 2px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.purpose-card:hover,
.purpose-card:focus {
  border-color: var(--amber);
  box-shadow: 0 12px 30px #0001;
}
.purpose-card i {
  font-size: 2.5rem;
  color: #b36b00;
}
.purpose-pill {
  display: inline-block;
  background: #fff2ce;
  border: 1px solid #d49514;
  border-radius: 2rem;
  padding: 0.3rem 0.7rem;
  font-weight: 700;
}
.vehicle-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.vehicle-media-item {
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.75rem;
  cursor: grab;
}
.vehicle-media-item img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  margin-bottom: 0.5rem;
}
.vehicle-media-item label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.45rem;
}
.media-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  background: #f1f3f4;
  padding: 1rem;
}
.media-library button {
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.5rem;
  text-align: left;
}
.media-library img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.admin-dialog {
  width: min(620px, calc(100% - 2rem));
  border: 0;
  padding: 1.5rem;
  box-shadow: 0 25px 80px #0008;
}
.admin-dialog::backdrop {
  background: #000b;
}
.progress {
  height: 1.4rem;
}

.inventory-toolbar,
.inventory-bulk,
.inventory-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.inventory-bulk {
  justify-content: flex-start;
  padding: 0.75rem;
  background: #f6f7f8;
}
.inventory-bulk .form-select {
  width: auto;
  min-width: 180px;
}
.column-picker {
  position: relative;
}
.column-picker summary {
  list-style: none;
}
.column-menu {
  position: absolute;
  z-index: 20;
  right: 0;
  width: 220px;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px #0002;
}
.column-menu label {
  display: block;
  padding: 0.25rem;
}
.inventory-thumb {
  display: block;
  width: 64px;
  height: 48px;
  object-fit: cover;
  background: #e4e7e9;
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 1rem;
  background: #fffd;
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.media-toolbar {
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.media-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}
.media-list .media-asset {
  display: grid;
  grid-template-columns: 140px 1fr;
}
.media-asset {
  border: 1px solid var(--border);
  background: #fff;
}
.media-preview {
  border: 0;
  padding: 0;
  width: 100%;
  background: #e9ecef;
}
.media-preview img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.media-summary {
  padding: 0.75rem;
  overflow-wrap: anywhere;
}
.media-summary small {
  display: block;
  color: #697178;
}
.media-dialog-image {
  width: 100%;
  max-height: 55vh;
  object-fit: contain;
  background: #e9ecef;
  margin-bottom: 1rem;
}
@media (max-width: 900px) {
  .inventory-panel {
    padding: 0.75rem;
  }
  .inventory-table td,
  .inventory-table th {
    display: none;
  }
  .inventory-table td:first-child,
  .inventory-table th:first-child,
  table.inventory-table [data-column='image'],
  table.inventory-table [data-column='name'],
  table.inventory-table [data-column='stock'],
  .inventory-table td:last-child,
  .inventory-table th:last-child {
    display: table-cell;
  }
  .inventory-bulk .form-select,
  .inventory-bulk button {
    width: 100%;
  }
}
.content-preview {
  width: min(760px, 90vw);
  max-height: 85vh;
  border: 0;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 20px 70px #0005;
}
.content-preview::backdrop {
  background: #111a;
}
.content-preview div {
  line-height: 1.7;
}
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.analytics-chart {
  min-height: 250px;
}
.analytics-bars {
  display: grid;
  gap: 0.65rem;
}
.analytics-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 3fr 42px;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.82rem;
}
.analytics-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analytics-row > div {
  height: 0.7rem;
  background: #edf0f2;
  border-radius: 1rem;
  overflow: hidden;
}
.analytics-row i {
  display: block;
  height: 100%;
  background: var(--amber);
  border-radius: 1rem;
}
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.activity-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.8rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.activity-list li span {
  grid-column: 1;
}
.activity-list time {
  grid-column: 2;
  grid-row: 1/3;
  color: #697178;
  font-size: 0.75rem;
}
.dashboard-range {
  position: sticky;
  top: 0;
  z-index: 10;
}
@media (max-width: 900px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  .analytics-row {
    grid-template-columns: 90px 1fr 35px;
  }
  .dashboard-range {
    position: static;
  }
  .activity-list time {
    grid-column: 1;
    grid-row: auto;
  }
}
