:root {
  --ink: #17231d;
  --ink-soft: #34453b;
  --muted: #748178;
  --paper: #f1eee6;
  --paper-deep: #e6e4d9;
  --card: #fffdf7;
  --line: #d8ddd2;
  --line-strong: #bec8bb;
  --leaf: #648670;
  --leaf-deep: #486654;
  --sun: #f4cd64;
  --coral: #e97756;
  --coral-deep: #c85f43;
  --blue: #8fb6b1;
  --white: #fffefa;
  --shadow: 0 18px 45px rgba(31, 45, 36, 0.1);
  --shadow-small: 0 7px 20px rgba(31, 45, 36, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 10px;
  --mono: 'DM Mono', 'Cascadia Code', Consolas, monospace;
  --sans: 'Manrope', 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(244, 205, 100, 0.22), transparent 25rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.36), transparent 42%),
    var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: '';
  opacity: 0.24;
  background-image: linear-gradient(rgba(79, 103, 87, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(79, 103, 87, 0.05) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(233, 119, 86, 0.42);
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(100%, 1440px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 46px 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 96px;
  border-bottom: 1px solid rgba(92, 111, 98, 0.22);
}

.brand-lockup,
.topbar-actions,
.mode-control,
.storage-status,
.section-heading-row,
.section-heading-actions,
.form-section-heading,
.upload-block-heading,
.drawer-actions,
.modal-actions {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 13px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  overflow: hidden;
  place-items: center;
  border-radius: 13px 13px 13px 4px;
  background: var(--ink);
  transform: rotate(-7deg);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  width: 17px;
  height: 3px;
  content: '';
  background: var(--sun);
  border-radius: 9px;
}

.brand-mark::before {
  top: 11px;
  left: 8px;
  transform: rotate(-40deg);
}

.brand-mark::after {
  right: 7px;
  bottom: 11px;
  transform: rotate(-40deg);
}

.brand-mark-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  background: var(--coral);
  border-radius: 50%;
}

.brand-mark-line {
  position: absolute;
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, 0.64);
  transform: rotate(44deg);
}

.eyebrow {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.brand-name {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
}

.topbar-actions {
  gap: 17px;
}

.mode-control {
  gap: 7px;
}

.mode-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.mode-switch {
  display: flex;
  padding: 3px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.mode-button {
  min-width: 42px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  background: transparent;
  border: 0;
  border-radius: 999px;
}

.mode-button.is-active {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 2px 9px rgba(35, 52, 42, 0.09);
}

.storage-status {
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--leaf);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(100, 134, 112, 0.13);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 43px;
  padding: 0 17px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--white);
  background: var(--ink);
  box-shadow: 0 7px 16px rgba(23, 35, 29, 0.16);
}

.button-primary:hover {
  background: var(--leaf-deep);
  box-shadow: 0 10px 24px rgba(23, 35, 29, 0.2);
}

.button-secondary {
  color: var(--ink);
  background: var(--sun);
  box-shadow: 0 8px 17px rgba(176, 133, 33, 0.18);
}

.button-ghost {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line);
}

.button-ghost:hover {
  background: rgba(255, 255, 255, 0.6);
}

.button-plus {
  font-size: 18px;
  font-weight: 400;
  line-height: 0;
}

.archive-section {
  padding: 31px 0 50px;
}

.section-heading-row {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading-row h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.07em;
}

.section-heading-actions {
  gap: 14px;
}

.merchant-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-action-button {
  min-height: 36px;
  padding: 0 13px;
  font-size: 11px;
}

.section-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.search-field,
.select-field {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background 180ms ease, border 180ms ease, box-shadow 180ms ease;
}

.search-field {
  flex: 1;
  max-width: 460px;
}

.search-field:focus-within,
.select-field:focus-within {
  background: var(--white);
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(100, 134, 112, 0.1);
}

.search-field input,
.select-field select {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  font-size: 12px;
  background: transparent;
  border: 0;
  outline: 0;
}

.search-field input {
  padding: 0 17px 0 42px;
}

.search-icon {
  position: absolute;
  left: 17px;
  color: var(--leaf-deep);
  font-size: 22px;
  line-height: 1;
  transform: translateY(-1px) rotate(-17deg);
}

.select-field {
  width: 174px;
}

.select-field select {
  padding: 0 31px 0 16px;
  appearance: none;
  cursor: pointer;
}

.select-field::after {
  position: absolute;
  right: 15px;
  width: 6px;
  height: 6px;
  content: '';
  border-right: 1px solid var(--ink-soft);
  border-bottom: 1px solid var(--ink-soft);
  pointer-events: none;
  transform: rotate(45deg) translateY(-2px);
}

.compact-select {
  width: 152px;
}

.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.vehicle-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid rgba(190, 200, 187, 0.78);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-small);
  transition: transform 220ms ease, box-shadow 220ms ease, border 220ms ease;
}

.vehicle-card:hover {
  border-color: rgba(100, 134, 112, 0.66);
  box-shadow: var(--shadow);
  transform: translateY(-5px);
}

.card-image-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.card-image {
  display: block;
  width: 100%;
  aspect-ratio: 1.45;
  object-fit: cover;
  background: linear-gradient(145deg, #dce5d9, #b6c9bc);
  transition: transform 500ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.vehicle-card:hover .card-image {
  transform: scale(1.04);
}

.image-placeholder {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1.45;
  overflow: hidden;
  place-items: center;
  color: var(--leaf-deep);
  background:
    linear-gradient(135deg, transparent 47%, rgba(100, 134, 112, 0.2) 48%, rgba(100, 134, 112, 0.2) 51%, transparent 52%),
    linear-gradient(40deg, transparent 46%, rgba(233, 119, 86, 0.18) 47%, rgba(233, 119, 86, 0.18) 49%, transparent 50%),
    #dae4d7;
}

.image-placeholder::after {
  position: absolute;
  right: 15%;
  bottom: 17%;
  width: 70%;
  height: 2px;
  content: '';
  background: rgba(72, 102, 84, 0.45);
  box-shadow: 0 -13px 0 rgba(72, 102, 84, 0.16), 0 13px 0 rgba(72, 102, 84, 0.16);
  transform: rotate(-8deg);
}

.placeholder-label {
  position: relative;
  z-index: 1;
  padding: 6px 8px;
  color: var(--leaf-deep);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid rgba(72, 102, 84, 0.22);
  border-radius: 4px;
}

.card-image-label {
  position: absolute;
  top: 15px;
  left: 15px;
  padding: 5px 8px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  background: rgba(255, 253, 247, 0.86);
  border-radius: 5px;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px 18px 16px;
}

.card-meta,
.card-footer,
.card-footer-actions,
.config-card-heading,
.config-result,
.detail-meta-line,
.detail-heading-row,
.detail-config-title,
.detail-stats,
.detail-actions {
  display: flex;
  align-items: center;
}

.card-meta,
.card-footer,
.detail-meta-line,
.detail-heading-row {
  justify-content: space-between;
}

.card-meta {
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vehicle-number {
  color: var(--coral-deep);
}

.card-body h3 {
  margin: 8px 0 3px;
  overflow: hidden;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-dimensions {
  min-height: 18px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-spec-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0 14px;
  padding: 11px 0 0;
  border-top: 1px solid var(--line);
}

.card-spec-strip div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.card-spec-strip span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.card-spec-strip strong {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-footer {
  gap: 10px;
  margin-top: auto;
  padding-top: 3px;
}

.card-footer > span {
  color: var(--leaf-deep);
  font-size: 11px;
  font-weight: 800;
}

.card-footer-actions {
  gap: 4px;
}

.small-action {
  min-height: 28px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.small-action:hover {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
}

.small-action.delete-action:hover {
  color: var(--coral-deep);
  background: #fff1eb;
  border-color: #f2c3b4;
}

.empty-state {
  max-width: 520px;
  margin: 30px auto 45px;
  padding: 54px 28px 58px;
  text-align: center;
  background: rgba(255, 253, 247, 0.55);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

.empty-signal {
  margin-bottom: 20px;
  color: var(--coral);
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 500;
}

.empty-state h3 {
  margin: 7px 0 8px;
  font-size: 24px;
  letter-spacing: -0.06em;
}

.empty-state p:not(.eyebrow) {
  max-width: 325px;
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 19px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--line);
}

.overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(20, 34, 27, 0.36);
  backdrop-filter: blur(6px);
}

.drawer {
  width: min(640px, 100%);
  height: 100%;
  overflow: auto;
  background: var(--paper);
  box-shadow: -20px 0 60px rgba(21, 37, 29, 0.2);
  animation: slide-in 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 34px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2,
.small-modal h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.08em;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted);
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--white);
}

.drawer-form {
  padding: 0 34px 38px;
}

.form-section {
  padding: 27px 0 30px;
  border-bottom: 1px solid var(--line);
}

.form-section-heading {
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 16px;
}

.form-section-heading > div {
  display: flex;
  align-items: baseline;
  gap: 11px;
}

.section-index {
  color: var(--coral-deep);
  font-family: var(--mono);
  font-size: 10px;
}

.form-section h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.05em;
}

.required-hint,
.section-hint {
  color: var(--muted);
  font-size: 10px;
}

.field-grid {
  display: grid;
  gap: 13px;
}

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

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.field b {
  color: var(--coral-deep);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 43px;
  padding: 0 12px;
  color: var(--ink);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  transition: border 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.field textarea {
  min-height: 74px;
  padding: 11px 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  background: var(--white);
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(100, 134, 112, 0.1);
}

.inline-link-button {
  align-self: end;
  min-height: 43px;
  padding: 0 10px;
  color: var(--leaf-deep);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  background: transparent;
  border: 0;
}

.inline-link-button:hover,
.text-button:hover {
  color: var(--coral-deep);
}

.text-button {
  padding: 6px 0;
  color: var(--leaf-deep);
  font-size: 11px;
  font-weight: 800;
  background: transparent;
  border: 0;
}

.section-help {
  max-width: 490px;
  margin: -2px 0 15px 22px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.config-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-empty-note {
  padding: 18px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  background: rgba(255, 255, 255, 0.38);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}

.config-row {
  padding: 14px;
  background: rgba(255, 253, 247, 0.68);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.config-card-heading {
  justify-content: space-between;
  margin-bottom: 12px;
}

.config-card-heading strong {
  color: var(--leaf-deep);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.remove-config-button {
  padding: 3px 5px;
  color: var(--muted);
  font-size: 10px;
  background: transparent;
  border: 0;
}

.remove-config-button:hover {
  color: var(--coral-deep);
}

.config-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.config-field-grid .field {
  gap: 5px;
}

.config-field-grid .field > span {
  font-size: 9px;
}

.config-field-grid .field input {
  min-height: 37px;
  padding: 0 9px;
  font-size: 11px;
}

.config-row-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.config-result {
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}

.config-result span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.config-result strong {
  color: var(--coral-deep);
  font-family: var(--mono);
  font-size: 15px;
}

.upload-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.upload-block-heading {
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  background: rgba(216, 221, 210, 0.7);
  border-radius: 4px;
}

.pill-accent {
  color: var(--coral-deep);
  background: #fde3d8;
}

.upload-dropzone {
  display: flex;
  min-height: 140px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 15px;
  color: var(--ink-soft);
  text-align: center;
  background: rgba(255, 255, 255, 0.42);
  border: 1px dashed var(--leaf);
  border-radius: 12px;
  cursor: pointer;
  transition: background 160ms ease, border 160ms ease, transform 160ms ease;
}

.upload-dropzone:hover {
  background: rgba(255, 255, 255, 0.76);
  border-color: var(--coral);
  transform: translateY(-2px);
}

.upload-dropzone-muted {
  border-color: var(--line-strong);
}

.upload-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.upload-plus {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--leaf-deep);
  font-size: 21px;
  font-weight: 300;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.upload-dropzone strong {
  font-size: 11px;
}

.upload-dropzone small {
  max-width: 150px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.image-preview-area {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 17px;
}

.image-preview-group h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.image-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.image-thumb.is-cover {
  border: 2px solid var(--coral);
}

.image-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-thumb-overlay {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.image-thumb-button {
  max-width: 76%;
  overflow: hidden;
  padding: 4px 6px;
  color: var(--white);
  font-size: 8px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(23, 35, 29, 0.78);
  border: 0;
  border-radius: 4px;
}

.image-thumb-delete {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--white);
  font-size: 13px;
  background: rgba(200, 95, 67, 0.9);
  border: 0;
  border-radius: 4px;
}

.image-cover-marker {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 3px 5px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 7px;
  background: var(--sun);
  border-radius: 3px;
}

.pending-image {
  border-style: dashed;
}

.pending-image .image-thumb-button {
  color: var(--ink);
  background: rgba(244, 205, 100, 0.9);
}

.drawer-actions {
  justify-content: flex-end;
  gap: 10px;
  padding-top: 26px;
}

.button-save {
  min-width: 160px;
}

.detail-modal {
  width: min(100% - 34px, 1040px);
  max-height: min(90vh, 840px);
  margin: auto;
  overflow: auto;
  background: var(--paper);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(17, 30, 23, 0.3);
  animation: rise-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.detail-content {
  padding: 30px;
}

.detail-heading-row {
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 25px;
}

.detail-title-wrap h2 {
  margin: 7px 0 5px;
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -0.09em;
  line-height: 0.98;
}

.detail-title-wrap p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.detail-actions {
  gap: 8px;
}

.detail-close {
  margin-left: 3px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  gap: 23px;
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-content: start;
}

.detail-gallery-item {
  position: relative;
  overflow: hidden;
  background: var(--paper-deep);
  border-radius: 10px;
}

.detail-gallery-item:first-child {
  grid-column: span 3;
  aspect-ratio: 1.26;
}

.detail-gallery-item:not(:first-child) {
  aspect-ratio: 1;
}

.detail-gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-gallery-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 6px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 8px;
  background: rgba(255, 253, 247, 0.85);
  border-radius: 4px;
}

.detail-gallery-empty {
  display: grid;
  min-height: 290px;
  place-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  background: #dce5d9;
  border-radius: 13px;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.detail-meta-line {
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.merchant-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.merchant-detail strong {
  font-size: 13px;
}

.merchant-detail span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.detail-stats {
  gap: 9px;
}

.detail-stat {
  display: flex;
  min-width: 70px;
  flex-direction: column;
  gap: 3px;
  padding-left: 10px;
  border-left: 2px solid var(--sun);
}

.detail-stat strong {
  font-family: var(--mono);
  font-size: 16px;
}

.detail-stat span {
  color: var(--muted);
  font-size: 9px;
}

.detail-configs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-config-title {
  justify-content: space-between;
  margin-bottom: 1px;
}

.detail-config-title h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.04em;
}

.detail-config-title span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.detail-config-card {
  padding: 14px;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.detail-config-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-config-card-top strong {
  color: var(--leaf-deep);
  font-family: var(--mono);
  font-size: 10px;
}

.detail-price {
  color: var(--coral-deep);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
}

.detail-config-specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.detail-config-specs div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-config-specs span {
  color: var(--muted);
  font-size: 9px;
}

.detail-config-specs strong {
  font-family: var(--mono);
  font-size: 11px;
}

.detail-config-result {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 12px;
  padding-top: 11px;
  color: var(--coral-deep);
  border-top: 1px dashed var(--line-strong);
}

.detail-config-result strong {
  font-family: var(--mono);
  font-size: 20px;
}

.detail-config-result span {
  color: var(--muted);
  font-size: 10px;
}

.detail-no-config {
  padding: 16px;
  color: var(--muted);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}

.small-modal {
  width: min(100% - 34px, 470px);
  max-height: min(90vh, 720px);
  margin: auto;
  overflow: auto;
  background: var(--paper);
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(17, 30, 23, 0.3);
  animation: rise-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.compact-header {
  padding: 27px 30px 19px;
}

.merchant-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 30px 27px;
}

.modal-intro {
  margin: -2px 0 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.form-error {
  min-height: 16px;
  margin: -6px 0 0;
  color: var(--coral-deep);
  font-size: 11px;
}

.modal-actions {
  justify-content: flex-end;
  gap: 9px;
  padding-top: 5px;
}

.merchant-directory {
  padding: 0 30px 30px;
}

.merchant-directory:empty {
  display: none;
}

.directory-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 9px;
  padding-top: 17px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  border-top: 1px solid var(--line);
}

.directory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(216, 221, 210, 0.7);
}

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

.directory-row-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.directory-row-info strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-row-info span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-row-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
}

.toast {
  position: fixed;
  z-index: 40;
  right: 25px;
  bottom: 25px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 13px 17px;
  color: var(--white);
  font-size: 12px;
  line-height: 1.5;
  background: var(--ink);
  border-left: 4px solid var(--sun);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.noscript-message {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  color: var(--ink);
  text-align: center;
  background: var(--paper);
}

@keyframes slide-in {
  from { transform: translateX(40px); opacity: 0.5; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes rise-in {
  from { transform: translateY(16px) scale(0.985); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@media (max-width: 1100px) {
  .app-shell {
    padding-right: 30px;
    padding-left: 30px;
  }

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

@media (max-width: 780px) {
  .app-shell {
    padding: 0 16px 26px;
  }

  .topbar {
    min-height: 70px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .storage-status,
  .mode-label {
    display: none;
  }

  .button {
    min-height: 39px;
    padding: 0 13px;
  }

  .archive-section {
    padding: 24px 0 42px;
  }

  .section-heading-row {
    margin-bottom: 15px;
  }

  .filter-bar {
    gap: 8px;
    margin-bottom: 15px;
  }

  .vehicle-grid {
    gap: 14px;
  }

  .card-body {
    padding: 15px 16px;
  }

  .card-spec-strip {
    margin-top: 14px;
    margin-bottom: 12px;
  }

  .section-heading-row {
    align-items: flex-end;
  }

  .filter-bar {
    flex-wrap: wrap;
  }

  .search-field {
    flex-basis: 100%;
    max-width: none;
  }

  .select-field,
  .compact-select {
    flex: 1;
    width: auto;
  }

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

@media (max-width: 560px) {
  .app-shell {
    padding-right: 15px;
    padding-left: 15px;
  }

  .topbar {
    min-height: 0;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .brand-name {
    font-size: 18px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .topbar-actions .button {
    max-width: none;
    flex: 1;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mode-button {
    min-width: 43px;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 10px;
  }

  .vehicle-grid {
    grid-template-columns: 1fr;
  }

  .section-heading-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .section-note {
    margin-top: 0;
  }

  .section-heading-actions {
    width: 100%;
    justify-content: space-between;
  }

  .site-footer {
    flex-direction: column;
    gap: 7px;
  }

  .drawer-header,
  .drawer-form {
    padding-right: 21px;
    padding-left: 21px;
  }

  .two-columns,
  .upload-columns {
    grid-template-columns: 1fr;
  }

  .inline-link-button {
    min-height: auto;
    padding: 0;
  }

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

  .config-field-grid .field:last-child {
    grid-column: span 2;
  }

  .detail-content {
    padding: 22px 17px 26px;
  }

  .detail-heading-row {
    flex-direction: column;
  }

  .detail-actions {
    width: 100%;
  }

  .detail-actions .button {
    flex: 1;
  }

  .detail-stats {
    align-self: stretch;
    justify-content: space-between;
  }
}

@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;
  }
}
