.admin-page {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
  background: #eef3f1;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(90deg, rgba(8, 28, 23, 0.82), rgba(8, 28, 23, 0.48)),
    url("https://images.unsplash.com/photo-1609521263047-f8f205293f24?auto=format&fit=crop&w=1800&q=80") center / cover;
}

.login-screen.is-hidden {
  display: none;
}

.login-box {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-box h1 {
  color: var(--ink);
  font-size: 34px;
}

.login-box p {
  margin: 6px 0 0;
  color: #35443c;
  font-weight: 700;
}

.login-box input,
.admin-filters input,
.admin-filters select {
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #9eb3a8;
  border-radius: 8px;
}

.login-box input::placeholder,
.admin-filters input::placeholder,
.car-editor input::placeholder,
.car-editor textarea::placeholder,
.user-editor input::placeholder {
  color: #4d5d55;
  opacity: 1;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: grid;
  align-content: start;
  gap: 26px;
  height: 100vh;
  padding: 22px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-tab,
.back-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: #09221d;
  font-weight: 800;
  text-align: left;
  background: #f3f8f5;
  border: 1px solid #c4d8cf;
  border-radius: 8px;
  cursor: pointer;
}

.admin-tab:hover,
.back-link:hover {
  color: #fff;
  background: #0b5f3c;
  border-color: #0b5f3c;
}

.admin-tab.is-active {
  color: #fff;
  background: #0b5f3c;
  border-color: #0b5f3c;
  box-shadow: inset 4px 0 0 #d6a742;
}

.admin-tab.is-hidden {
  display: none;
}

.back-link {
  color: #09221d;
  background: #e8f3ef;
  border-color: #9ebdab;
}

.admin-main {
  min-width: 0;
  padding: 32px clamp(18px, 4vw, 48px);
}

.admin-toolbar {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.admin-toolbar h1 {
  color: var(--ink);
  font-size: clamp(32px, 5vw, 52px);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar-actions .secondary-action {
  color: #09221d;
  background: #ffffff;
  border: 1px solid #b8cec6;
  box-shadow: 0 8px 18px rgba(9, 34, 29, 0.08);
}

.toolbar-actions .secondary-action:hover {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.sync-state {
  padding: 10px 12px;
  color: #236348;
  font-weight: 800;
  background: #e4f6ed;
  border-radius: 8px;
}

.sync-state.is-error {
  color: #9f2f24;
  background: #fff0ed;
}

.admin-page .reset-button,
.admin-page .load-more {
  color: #09221d;
  background: #ffffff;
  border: 1px solid #8fb5a4;
  box-shadow: 0 6px 14px rgba(9, 34, 29, 0.06);
}

.admin-page .reset-button:hover,
.admin-page .load-more:hover {
  color: #fff;
  background: #0b5f3c;
  border-color: #0b5f3c;
}

.admin-page .form-message {
  color: #0b5f3c;
  font-weight: 900;
}

.admin-section {
  display: none;
}

.admin-section.is-active {
  display: grid;
  gap: 18px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-stats article,
.admin-card,
.admin-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(9, 34, 29, 0.06);
}

.admin-stats article {
  display: grid;
  gap: 7px;
  padding: 18px;
}

.admin-stats small,
.admin-card p,
.mini-car small,
.port-list small {
  color: #35443c;
  font-weight: 700;
}

.admin-stats strong {
  color: var(--ink);
  font-size: 34px;
}

.admin-grid {
  display: grid;
  gap: 18px;
}

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

.admin-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.admin-card h2 {
  color: var(--ink);
  font-size: 24px;
}

.admin-card p {
  line-height: 1.75;
}

.password-form,
.settings-editor,
.slide-editor {
  display: grid;
  gap: 12px;
}

.password-form label,
.settings-editor label,
.slide-editor label {
  display: grid;
  gap: 7px;
  color: #24352e;
  font-size: 13px;
  font-weight: 800;
}

.password-form input,
.settings-editor input,
.slide-editor input,
.slide-editor textarea {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid #9eb3a8;
  border-radius: 8px;
}

.check-list,
.pill-cloud,
.port-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-list span,
.pill-cloud span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 9px 11px;
  color: var(--ink);
  font-weight: 800;
  background: var(--soft);
  border-radius: 8px;
}

.pill-cloud button {
  min-height: 24px;
  padding: 0 7px;
  color: #7d2017;
  font-size: 12px;
  font-weight: 900;
  background: #ffe3dd;
  border: 1px solid #d77b6d;
  border-radius: 999px;
  cursor: pointer;
}

.dict-group {
  align-items: flex-start;
  flex-direction: column;
}

.check-list.muted span {
  color: #24352e;
  background: #eef5f1;
  border: 1px solid #b8cec6;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px 180px auto;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.car-editor,
.user-editor,
.port-editor {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.car-editor h2,
.car-editor .wide-field,
.car-editor .form-actions,
.user-editor h2,
.user-editor .wide-field,
.port-editor .wide-field {
  grid-column: 1 / -1;
}

.car-editor label,
.user-editor label,
.port-editor label {
  display: grid;
  gap: 7px;
  color: #24352e;
  font-size: 13px;
  font-weight: 800;
}

.car-editor .checkbox-field {
  align-content: center;
  grid-template-columns: auto 1fr;
  min-height: 42px;
  padding: 10px 12px;
  color: #09221d;
  background: #eef8f2;
  border: 1px solid #9eb3a8;
  border-radius: 8px;
}

.car-editor .checkbox-field input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.car-editor input,
.car-editor select,
.car-editor textarea,
.user-editor input,
.user-editor select,
.port-editor input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #9eb3a8;
  border-radius: 8px;
}

.login-box input:focus,
.admin-filters input:focus,
.admin-filters select:focus,
.password-form input:focus,
.settings-editor input:focus,
.slide-editor input:focus,
.slide-editor textarea:focus,
.car-editor input:focus,
.car-editor select:focus,
.car-editor textarea:focus,
.user-editor input:focus,
.user-editor select:focus,
.port-editor input:focus {
  outline: 3px solid rgba(12, 124, 74, 0.22);
  border-color: #0c7c4a;
}

.slide-editor .wide-field {
  grid-column: 1 / -1;
}

.slide-list {
  display: grid;
  gap: 10px;
}

.slide-list-item {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: #f8fbf6;
  border: 1px solid #c4d8cf;
  border-radius: 8px;
}

.slide-list-item img {
  width: 108px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: #d7e1dc;
}

.slide-list-item strong,
.slide-list-item small {
  display: block;
}

.slide-list-item small {
  color: #35443c;
}

.inline-admin-form,
.port-editor {
  display: grid;
  gap: 10px;
}

.inline-admin-form {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto;
}

.inline-admin-form input {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #9eb3a8;
  border-radius: 8px;
}

.inline-admin-form input:focus {
  outline: 3px solid rgba(12, 124, 74, 0.22);
  border-color: #0c7c4a;
}

.image-upload-field input {
  padding: 8px;
  color: #09221d;
  background: #eef8f2;
  border-color: #8fb5a4;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.image-preview-grid p {
  grid-column: 1 / -1;
  margin: 0;
  color: #35443c;
  font-weight: 700;
}

.image-preview-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf6;
}

.image-preview-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.image-preview-item button,
.image-preview-item span {
  position: absolute;
  right: 6px;
  min-height: 24px;
  padding: 0 7px;
  border: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.image-preview-item button {
  top: 6px;
  color: #fff;
  background: rgba(159, 47, 36, 0.9);
  cursor: pointer;
}

.image-preview-item span {
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  color: #083a2a;
  background: rgba(255, 255, 255, 0.9);
}

.form-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.admin-table th {
  color: #09221d;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  background: #eef5f1;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.mini-car {
  display: flex;
  gap: 12px;
  align-items: center;
}

.mini-car img {
  width: 82px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  background: #d7e1e8;
}

.mini-car strong,
.mini-car small {
  display: block;
}

.current-user {
  display: inline-flex;
  margin-left: 8px;
  padding: 3px 7px;
  color: #236348;
  font-size: 11px;
  font-weight: 800;
  background: #e4f6ed;
  border-radius: 999px;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  color: #09221d;
  font-weight: 800;
  background: #dff0e8;
  border: 1px solid #8fb5a4;
  border-radius: 8px;
  cursor: pointer;
}

.small-button:hover {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.danger-button {
  color: #7d2017;
  background: #ffe3dd;
  border-color: #d77b6d;
}

.danger-button:hover {
  color: #fff;
  background: #9f2f24;
  border-color: #9f2f24;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: #236348;
  font-weight: 800;
  background: #e4f6ed;
  border-radius: 8px;
}

.status-pill.is-draft {
  color: #8b5e00;
  background: #fff4d6;
}

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

.port-list div {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: var(--soft);
  border-radius: 8px;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(520px, 100%);
  padding: 24px;
  overflow-y: auto;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(9, 34, 29, 0.18);
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.detail-drawer.is-open {
  transform: translateX(0);
}

.drawer-close {
  position: sticky;
  top: 0;
  float: right;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.drawer-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  margin-bottom: 16px;
  border-radius: 8px;
}

.drawer-price {
  margin: 12px 0;
  color: var(--brand);
  font-size: 30px;
  font-weight: 900;
}

.drawer-price span {
  color: #35443c;
  font-size: 13px;
}

.drawer-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.drawer-specs div {
  padding: 10px;
  background: var(--soft);
  border-radius: 8px;
}

.drawer-specs small {
  display: block;
  color: #35443c;
  font-weight: 800;
}

.drawer-loading {
  color: #35443c;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .admin-stats,
  .admin-grid.two,
  .admin-filters,
  .car-editor,
  .user-editor,
  .port-editor,
  .inline-admin-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .admin-page {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .admin-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .admin-stats,
  .admin-grid.two,
  .admin-filters,
  .car-editor,
  .user-editor,
  .port-editor,
  .inline-admin-form,
  .image-preview-grid,
  .port-list,
  .drawer-specs {
    grid-template-columns: 1fr;
  }
}
