:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #dfe4ea;
  --brand: #c91f2f;
  --brand-dark: #971522;
  --accent: #0f766e;
  --warn: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(560px, 680px) minmax(360px, 1fr);
}

.auth-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 36px;
  overflow: auto;
  min-width: 0;
}

.auth-cover {
  padding: 48px;
  display: flex;
  align-items: flex-end;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.72), rgba(15, 118, 110, 0.58)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
  color: white;
  min-width: 0;
}

.cover-copy {
  max-width: 660px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}

.tab {
  height: 42px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  cursor: pointer;
}

.tab.active {
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}

.form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  padding: 7px 12px;
  background: var(--brand);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(0.96);
}

.button.secondary:hover {
  background: #253044;
}

.button.ghost:hover {
  border-color: #b8c1ce;
  background: #f8fafc;
}

.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.icon-only {
  width: 38px;
  min-width: 38px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
}

.button.secondary {
  background: #111827;
}

.button.ghost {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.button.danger {
  background: var(--brand);
}

.button.ghost-danger {
  color: var(--brand-dark);
  background: white;
  border: 1px solid #fecdd3;
}

.is-hidden {
  display: none !important;
}

.message {
  display: none;
  padding: 12px;
  border-radius: 8px;
  background: #eef6f5;
  color: var(--accent);
  border: 1px solid #b7ddda;
}

.message.error {
  background: #fff1f2;
  color: var(--brand-dark);
  border-color: #fecdd3;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #111827;
  color: white;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.nav {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.logout-button {
  width: 100%;
  min-height: 46px;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.logout-button span:first-child {
  font-size: 22px;
  line-height: 1;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-heading {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 9px 11px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.nav-chevron {
  transform: rotate(0deg);
  transition: transform 0.15s ease;
  opacity: 0.72;
}

.nav-group.open .nav-chevron {
  transform: rotate(90deg);
}

.nav-items {
  display: none;
  gap: 4px;
  padding-left: 8px;
}

.nav-group.open .nav-items {
  display: grid;
}

.nav-items button {
  text-align: left;
  color: white;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 14px;
  cursor: pointer;
}

.nav-items button.active,
.nav-items button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.content {
  padding: 28px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.offer-group-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.category-checks {
  max-height: 260px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.category-checks label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

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

.download-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.download-card img,
.pdf-preview,
.pdf-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--brand);
  font-weight: 900;
  font-size: 28px;
}

.pdf-preview {
  display: block;
  overflow: hidden;
}

.cart-layout,
.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}

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

.cart-product-cell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.cart-product-cell img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.quantity-stepper {
  display: inline-grid;
  grid-template-columns: 34px 58px 34px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.quantity-stepper button,
.quantity-stepper input {
  border: 0;
  border-right: 1px solid var(--line);
  min-height: 40px;
  text-align: center;
  background: white;
}

.quantity-stepper button:last-child {
  border-right: 0;
}

.line-total,
.summary-total span,
.checkout-order .summary-line span {
  color: var(--brand);
}

.cart-summary,
.checkout-order {
  border-width: 2px;
}

.summary-line,
.summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.summary-total {
  border-bottom: 0;
  font-size: 20px;
}

.summary-section {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.summary-options {
  display: grid;
  gap: 8px;
}

.summary-options label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-confirm {
  width: 100%;
  margin-top: 18px;
  min-height: 44px;
  text-transform: uppercase;
}

.checkout-lines {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.checkout-lines div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.payment-box {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.settings-rows {
  display: grid;
  gap: 10px;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 1fr) 38px;
  gap: 10px;
  align-items: center;
}

.orders-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.order-detail-modal {
  max-width: 1080px;
}

.order-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.order-detail-grid section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

.checkout-notice {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #f4c7cb;
  border-radius: 7px;
  background: #fff5f6;
  color: #8a1420;
  line-height: 1.5;
}

.price-class-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.price-class-box p {
  margin: 5px 0 0;
}

.class-price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.danger-zone {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff7f8;
}

.danger-zone p {
  margin: 4px 0 0;
}

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

.row-actions.no-wrap {
  flex-wrap: nowrap;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.link-button:hover {
  color: var(--brand);
}

.import-map {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.import-map-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.import-map-head h3 {
  margin: 0;
}

.import-map-head p {
  margin: 5px 0 0;
}

.import-map-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 360px);
  gap: 18px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

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

.import-map-row span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.toolbar input {
  max-width: 360px;
  width: 100%;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 800;
}

.status.pending {
  background: #fff7ed;
  color: var(--warn);
}

.status.approved {
  background: #ecfdf5;
  color: #047857;
}

.status.rejected {
  background: #fff1f2;
  color: var(--brand-dark);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.metric {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 10px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.dashboard-tile {
  min-height: 104px;
  display: grid;
  place-items: center;
  gap: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}

.dashboard-tile:hover {
  border-color: var(--brand);
}

.tile-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid #c7ced8;
  border-radius: 50%;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.empty-state {
  max-width: 720px;
}

.empty-state h2,
.panel h2 {
  margin-top: 0;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.54);
}

.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.product-modal {
  width: min(1080px, 100%);
}

.product-detail-modal {
  width: min(1120px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  cursor: pointer;
}

.product-thumb {
  width: 52px;
  height: 52px;
  object-fit: contain;
  float: left;
  margin-right: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.compact-thumb {
  float: none;
  display: block;
  margin: 0;
}

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

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

.wishlist-table .product-thumb {
  width: 58px;
  height: 58px;
}

.qty-input {
  width: 84px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
}

.image-preview-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.image-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-preview-grid img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.product-detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 28px;
  align-items: start;
}

.product-detail-main-image {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.product-detail-image-frame {
  position: relative;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 36px;
  height: 46px;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.gallery-prev {
  left: 10px;
}

.gallery-next {
  right: 10px;
}

.gallery-thumb {
  width: 74px;
  height: 74px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  cursor: pointer;
}

.gallery-thumb.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(201, 31, 47, 0.12);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-detail-price {
  margin: 0 0 18px;
  color: var(--brand);
  font-size: 24px;
  font-weight: 800;
}

.product-description {
  margin: 18px 0;
  color: var(--muted);
  line-height: 1.55;
}

.product-description p {
  margin: 0 0 10px;
}

.product-detail-empty {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

.pending-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.pending-screen .panel {
  max-width: 560px;
}

@media (max-width: 1200px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    border-right: 0;
  }

  .auth-cover {
    display: none;
  }
}

@media (max-width: 900px) {
  .auth-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    border-right: 0;
  }

  .auth-cover {
    min-height: 280px;
    align-items: center;
  }

  .sidebar {
    position: static;
  }

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

  .danger-zone {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .download-grid,
  .cart-layout,
  .checkout-layout {
    grid-template-columns: 1fr;
  }
}
