.admin-body {
  min-height: 100vh;
  background: #f4f2ec;
}

.admin-app {
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

.login-card {
  display: grid;
  gap: 28px;
  width: min(440px, calc(100% - 36px));
  margin: 8vh auto;
  padding: 34px;
  background: var(--porcelain);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card h1,
.admin-topbar h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 52px);
}

.login-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.65;
}

.login-card form,
.product-form,
.settings-card form,
.checkout-panel {
  display: grid;
  gap: 14px;
}

.login-card label,
.product-form label,
.settings-card label,
.checkout-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.login-card input,
.product-form input,
.product-form select,
.product-form textarea,
.settings-card input,
.checkout-panel input,
.checkout-panel textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--deep);
  background: var(--porcelain);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.login-card button,
.card-head button,
.product-form button,
.logout-button,
.danger-button,
.checkout-submit {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--deep);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 760;
}

.login-card button,
.card-head button,
.product-form button[type="submit"],
.checkout-submit {
  color: var(--porcelain);
  background: var(--deep);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--coral);
}

.dashboard {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  height: 100vh;
  padding: 22px;
  background: var(--deep);
  color: var(--porcelain);
}

.admin-sidebar .brand-mark {
  background: var(--porcelain);
  color: var(--deep);
}

.admin-sidebar nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.admin-sidebar nav button,
.logout-button {
  width: 100%;
  min-height: 42px;
  color: rgba(255, 255, 255, 0.74);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.admin-sidebar nav button.is-active,
.admin-sidebar nav button:hover {
  color: var(--porcelain);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.logout-button {
  text-align: center;
}

.admin-main {
  padding: 28px clamp(18px, 4vw, 48px) 48px;
}

.admin-topbar,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.admin-panel {
  display: none;
}

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

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

.metric-card,
.admin-card {
  background: var(--porcelain);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(42, 51, 48, 0.07);
}

.metric-card {
  padding: 20px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.admin-card {
  padding: 22px;
}

.admin-card h2 {
  font-size: 24px;
}

.product-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 18px;
  margin-bottom: 20px;
  background: #f8f4ed;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.wide-field,
.form-actions {
  grid-column: 1 / -1;
}

.image-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px auto;
  gap: 14px;
  align-items: end;
  padding: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.image-preview {
  display: grid;
  width: 120px;
  height: 96px;
  place-items: center;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  background: var(--porcelain);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.image-preview img,
.product-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumb-image {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.no-image {
  color: var(--muted);
}

.form-actions {
  display: flex;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

td {
  color: var(--deep);
  font-size: 14px;
}

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

.row-actions button,
.status-select {
  min-height: 32px;
  padding: 6px 10px;
  background: #eef4f1;
  border: 1px solid #d7e4dd;
  border-radius: 999px;
  cursor: pointer;
}

.danger-button,
.row-actions .delete-button {
  color: var(--coral);
  background: #fff6f2;
  border-color: #f0d3ca;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  background: #f8f4ed;
  border-radius: 8px;
}

.checkout-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.checkout-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.checkout-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 41, 39, 0.36);
}

.checkout-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 0 22px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

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

  .admin-sidebar nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metrics-grid,
  .admin-grid,
  .product-form,
  .image-field {
    grid-template-columns: 1fr;
  }

  .admin-topbar,
  .card-head {
    align-items: start;
    flex-direction: column;
  }
}
