:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #dfe4ea;
  --accent: #111827;
  --accent-2: #27364d;
  --danger: #a11a1a;
  --success: #116b3a;
  --soft: #f8fafc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", sans-serif;
}

button, input { font: inherit; }

button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
}

button:disabled { opacity: .55; cursor: wait; }

.primary {
  background: var(--accent);
  color: white;
}

.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 32px 0 60px;
}

.hidden { display: none !important; }

.login-card {
  width: min(440px, 100%);
  margin: 8vh auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

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

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; }
h2 { margin-bottom: 6px; }

.stack { display: grid; gap: 15px; }

label {
  display: grid;
  gap: 7px;
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
  font-size: 16px;
}

input:focus, button:focus-visible {
  outline: 3px solid rgba(17, 24, 39, .15);
  outline-offset: 2px;
}

.message {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

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

.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  font-weight: 800;
}

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

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.kpi, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.kpi { padding: 18px; }
.kpi span { display: block; color: var(--muted); font-size: 13px; }
.kpi strong { display: block; margin-top: 5px; font-size: 26px; }

.panel {
  padding: 20px;
  margin-top: 16px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}

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

.file-box {
  padding: 16px;
  background: var(--soft);
  border: 1px dashed #bdc7d4;
  border-radius: 14px;
}

.file-title { font-weight: 800; }

.file-box input {
  margin-top: 12px;
  min-height: unset;
  border: 0;
  padding: 0;
  background: transparent;
}

.progress {
  margin-top: 14px;
  border-radius: 12px;
  padding: 13px;
  background: #eef5ff;
  color: #25446b;
}

.result {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  background: #111827;
  color: #f8fafc;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
}

.search { width: min(360px, 100%); }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

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

th, td {
  text-align: left;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

tbody tr:last-child td { border-bottom: 0; }

.empty {
  padding: 22px !important;
  color: var(--muted);
  text-align: center;
}

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

.history-item {
  display: grid;
  grid-template-columns: 1.3fr .8fr .8fr .8fr;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.history-item small { color: var(--muted); }

@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 1120px); padding-top: 18px; }
  .topbar, .panel-heading { display: grid; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
  .history-item { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
  .top-actions, .actions { display: grid; grid-template-columns: 1fr; }
  .top-actions button, .actions button { width: 100%; }
}


.customer-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: end;
}

.customer-address {
  grid-column: span 3;
}

.customer-actions {
  display: flex;
  align-items: end;
}

.customer-actions button {
  width: 100%;
}

.customer-list-heading {
  margin-top: 26px;
}

.customer-list-heading h3 {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .customer-form {
    grid-template-columns: 1fr 1fr;
  }
  .customer-address {
    grid-column: span 1;
  }
}

@media (max-width: 560px) {
  .customer-form {
    grid-template-columns: 1fr;
  }
}


select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

select {
  min-height: 46px;
}

textarea {
  resize: vertical;
}

select:focus, textarea:focus {
  outline: 3px solid rgba(17, 24, 39, .15);
  outline-offset: 2px;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
  align-items: start;
}

.order-main {
  min-width: 0;
}

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

.order-header-grid {
  grid-template-columns: 1.6fr 1fr 1fr;
}

.order-notes {
  margin-top: 12px;
}

.product-picker {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
}

.product-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.product-picker-head h3,
.draft-section h3,
.recent-orders h3 {
  margin-bottom: 4px;
}

.product-search-grid {
  grid-template-columns: 1.5fr .75fr .75fr;
}

.product-matches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.product-match {
  min-height: 60px;
  text-align: left;
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 12px;
}

.product-match strong,
.product-match small {
  display: block;
}

.product-match small {
  margin-top: 3px;
  color: var(--muted);
}

.selected-product {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selected-product strong {
  display: block;
  margin-top: 3px;
}

.link-button {
  min-height: 36px;
  padding: 6px 8px;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(95px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.size-card {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--line);
}

.size-card span {
  font-weight: 800;
  text-align: center;
}

.size-card small {
  color: var(--muted);
  text-align: center;
}

.size-card input {
  min-height: 42px;
  text-align: center;
}

.empty-inline {
  grid-column: 1 / -1;
  color: var(--muted);
  margin: 8px 0;
}

.draft-section {
  margin-top: 20px;
}

.compact-heading {
  margin-bottom: 8px;
}

.draft-items {
  display: grid;
  gap: 10px;
}

.draft-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.draft-item h4 {
  margin: 0 0 4px;
}

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

.draft-size-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.draft-size-pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 12px;
}

.remove-draft-item {
  min-height: 36px;
  padding: 7px 9px;
  background: white;
  border: 1px solid var(--line);
  color: var(--danger);
}

.order-summary {
  position: sticky;
  top: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: var(--soft);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.summary-total {
  border-bottom: 0;
  padding-bottom: 16px;
}

.summary-total strong {
  font-size: 20px;
}

.full-button {
  width: 100%;
  margin-top: 8px;
}

.recent-orders {
  margin-top: 28px;
}

@media (max-width: 930px) {
  .order-layout {
    grid-template-columns: 1fr;
  }

  .order-summary {
    position: static;
  }

  .size-grid {
    grid-template-columns: repeat(4, minmax(90px, 1fr));
  }
}

@media (max-width: 720px) {
  .order-header-grid,
  .product-search-grid {
    grid-template-columns: 1fr;
  }

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

  .size-grid {
    grid-template-columns: repeat(3, minmax(80px, 1fr));
  }
}

@media (max-width: 430px) {
  .size-grid {
    grid-template-columns: repeat(2, minmax(80px, 1fr));
  }

  .draft-item {
    grid-template-columns: 1fr;
  }
}


.approvals-section {
  margin-top: 30px;
}

.approvals-list {
  display: grid;
  gap: 14px;
}

.approval-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: white;
}

.approval-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.approval-top h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.approval-badge {
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff7df;
  color: #815d08;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.approval-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.approval-stat {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--soft);
}

.approval-stat small {
  display: block;
  color: var(--muted);
  margin-bottom: 3px;
}

.approval-items {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.approval-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.approval-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.approval-item-head strong {
  display: block;
}

.approval-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.approval-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  gap: 8px;
  align-items: end;
  margin-top: 15px;
}

.approval-actions label {
  min-width: 0;
}

.approval-reason {
  margin-top: 10px;
}

.approval-message {
  margin-top: 10px;
  min-height: 18px;
  font-size: 14px;
}

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

  .approval-actions {
    grid-template-columns: 1fr 1fr;
  }

  .approval-actions label {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .approval-top {
    display: grid;
  }

  .approval-summary,
  .approval-actions {
    grid-template-columns: 1fr;
  }

  .approval-actions label {
    grid-column: auto;
  }
}
