:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d6dfeb;
  --text: #0f172a;
  --muted: #5b6a80;
  --primary: #0b6fa4;
  --primary-strong: #0a5f8b;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef4fb 0%, var(--bg) 280px, var(--bg) 100%);
}

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

.shell {
  width: min(1360px, 96vw);
  margin: 18px auto 28px;
  display: grid;
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0;
  color: #316891;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.hero h1 {
  margin: 8px 0 4px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.08;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  align-items: center;
}

.auth-grid {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.auth-card {
  padding: 16px;
  width: min(560px, 100%);
}

.auth-card h2 {
  margin: 0 0 12px;
}

.auth-switch-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
  border-color: #60a5fa;
}

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

.approval-banner {
  padding: 14px 16px;
  color: #0c4a6e;
  border-color: #bae6fd;
  background: #f0f9ff;
  font-weight: 600;
}

.price-access-panel {
  padding: 14px;
  border-color: #c7dbe9;
  background: #f8fbff;
}

.panel-head-stack {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.panel-head-stack h2 {
  margin: 0;
}

.filters {
  padding: 14px;
}

.filters-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.filters-head h2,
.products-head h2 {
  margin: 0;
}

.status-copy {
  color: var(--muted);
  font-size: 13px;
}

.filters-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 0.8fr auto auto;
  gap: 10px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 3.8fr);
  gap: 14px;
  align-items: start;
}

.cart-panel {
  padding: 14px;
  position: sticky;
  top: 12px;
}

.cart-panel h2 {
  margin: 0 0 10px;
}

.cart-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.cart-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.cart-item-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: baseline;
}

.cart-item-name {
  font-weight: 600;
}

.cart-item-meta {
  color: var(--muted);
  font-size: 12px;
}

.cart-total {
  margin-top: 10px;
  border: 1px solid #c8d7f4;
  border-radius: 10px;
  background: #f3f7ff;
  padding: 10px;
  font-weight: 700;
}

.cart-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.products-panel {
  padding: 14px;
  min-width: 0;
}

.products-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

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

.table th,
.table td {
  border-bottom: 1px solid #e5edf7;
  text-align: left;
  padding: 8px 10px;
  vertical-align: middle;
  font-size: 13px;
}

.table th {
  color: #334155;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #f8fbff;
}

.thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #dbe4ef;
  background: #f8fafc;
}

.price-locked {
  color: #64748b;
  font-weight: 600;
}

.pager {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 600;
}

.btn.primary {
  background: linear-gradient(120deg, var(--primary) 0%, #1d87bf 100%);
  color: #fff;
}

.btn.primary:hover {
  background: linear-gradient(120deg, var(--primary-strong) 0%, #0e76a7 100%);
}

.btn.secondary {
  border-color: #7ab6d9;
  color: #0a5f8b;
  background: #f0f9ff;
}

.btn.ghost {
  border-color: #c7d5e6;
  color: #334155;
  background: #fff;
}

.btn.danger {
  border-color: #f5c2bf;
  color: #8c1d18;
  background: #fff5f4;
}

.btn.link {
  border: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.btn.link:hover {
  color: var(--primary-strong);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.orders-panel {
  padding: 14px;
}

.orders-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.orders-head h2 {
  margin: 0;
}

.orders-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-draft {
  color: #374151;
  background: #f3f4f6;
  border-color: #d1d5db;
}

.status-pending_review,
.status-pending_customer_confirm {
  color: #854d0e;
  background: #fffbeb;
  border-color: #fcd34d;
}

.status-approved {
  color: #065f46;
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.status-rejected,
.status-cancelled {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fca5a5;
}

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

.row-actions .btn {
  padding: 6px 10px;
}

.order-total-copy {
  margin: 8px 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #c8d7f4;
  background: #f3f7ff;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1120px, 94vw);
  max-height: min(86vh, 920px);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.modal-head h3 {
  margin: 0;
}

.order-items-table {
  min-width: 760px;
}

.order-items-table .qty-input {
  width: 88px;
}

.order-edit-tools {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) 120px repeat(6, auto);
  gap: 8px;
  align-items: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  max-width: min(420px, 90vw);
  z-index: 20;
}

.toast.error {
  background: var(--danger);
}

.hidden {
  display: none !important;
}

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

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

  .hero {
    flex-direction: column;
  }

  .cart-panel {
    position: static;
  }

  .orders-tools {
    width: 100%;
    flex-wrap: wrap;
  }

  .modal-card {
    width: min(96vw, 1120px);
    max-height: 92vh;
  }

  .order-edit-tools {
    grid-template-columns: 1fr 1fr;
  }
}
