:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d8dee8;
  --primary: #176b87;
  --primary-dark: #0f4f64;
  --deep: #12395b;
  --gold: #d99021;
  --danger: #b42318;
  --ok: #107c41;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
.customer-page { background: #f4f1eb; }
.customer-wrap {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 14px 14px 42px;
}
.brand-head {
  padding: 10px 4px 8px;
  color: var(--deep);
}
.brand-head h1 {
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.15;
  margin-bottom: 2px;
}
.brand-head p { margin: 3px 0 0; color: #52616f; }
.brand-kicker {
  color: var(--gold) !important;
  font-weight: 700;
}
.query-card, .result-card {
  background: #fff;
  border: 1px solid #e4e8ee;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(18, 57, 91, .08);
}
.primary-cta {
  min-height: 50px;
  background: var(--gold);
  color: #fff;
  font-weight: 700;
}
.primary-cta:hover { background: #bd7815; }
.customer-page input {
  min-height: 50px;
  font-size: 16px;
}
.status-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.status-hero h2 {
  margin: 0 0 4px;
  color: var(--deep);
  overflow-wrap: anywhere;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.status-yellow, .status-orange { background: #fff4cc; color: #8a5a00; }
.status-green { background: #ddf5e7; color: #0f6b3d; }
.status-red { background: #fde2df; color: #a31f15; }
.status-blue { background: #e0efff; color: #155b9a; }
.status-gray { background: #edf0f3; color: #5a6673; }
.status-purple { background: #ece7ff; color: #5541a3; }
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}
.steps span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  background: #fafbfc;
}
.steps .done {
  border-color: #9cc7a9;
  color: #0f6b3d;
  background: #edf8f1;
}
.steps .done::before { content: "✓ "; font-weight: 800; }
.steps .current {
  border-color: #f3bd72;
  color: #9a5b0c;
  background: #fff7e8;
  font-weight: 700;
}
.service-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.service-btn, .link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 8px 13px;
  background: var(--deep);
  color: #fff;
  text-decoration: none;
  border: 0;
}
.recommend-area {
  margin-top: 18px;
}
.recommend-area h2 {
  color: var(--deep);
}
.recommend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.recommend-card {
  background: #fff;
  border: 1px solid #e4e8ee;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 6px 18px rgba(18, 57, 91, .06);
}
.recommend-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--deep);
}
.recommend-card p {
  margin: 0 0 10px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
a { color: var(--primary); }
.wrap {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.admin-workspace { width: min(100%, 1440px); }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 750;
}
h2 {
  margin: 0 0 12px;
  font-size: 18px;
}
.muted { color: var(--muted); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.stack { display: grid; gap: 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: #344054;
}
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}
textarea { min-height: 76px; resize: vertical; }
button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { background: var(--primary-dark); }
button.secondary {
  background: #eef2f6;
  color: var(--text);
}
button.customer-secondary {
  background: #eef2f6;
  color: var(--text);
}
button.danger { background: var(--danger); }
button:disabled { opacity: .55; cursor: not-allowed; }
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.message {
  min-height: 24px;
  color: var(--muted);
}
.message.error { color: var(--danger); }
.message.ok { color: var(--ok); }
.result {
  display: none;
  margin-top: 16px;
}
.result.active { display: block; }
.kv {
  display: grid;
  gap: 10px;
}
.kv div {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef1f5;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.legacy-detail { display: none !important; }
.mini-copy {
  min-height: 28px;
  padding: 3px 8px;
  margin-left: 8px;
  width: auto;
  border-radius: 6px;
  background: #eef2f6;
  color: var(--text);
}
.remark-row {
  margin-top: 4px;
  padding: 10px 12px !important;
  border: 1px solid #e4e8ee !important;
  border-radius: 8px;
  background: #f8fbfd;
}
.info-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid #d6e4ef;
  border-radius: 8px;
  background: #f8fbfd;
  color: #344054;
  overflow-wrap: anywhere;
}
.voucher-area {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #d6e4ef;
  border-radius: 10px;
  background: #f8fbfd;
  display: grid;
  gap: 8px;
}

.customer-fulfillment { margin: 18px 0; }
.customer-fulfillment h2 { margin: 0 0 10px; font-size: 17px; }
.customer-fulfillment-list { display: grid; gap: 10px; }
.customer-fulfillment-card { padding: 13px; border: 1px solid #dce4ec; border-radius: 10px; background: #f8fbfd; }
.customer-fulfillment-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.customer-fulfillment-card p { margin: 7px 0 0; }
.customer-item-voucher { margin-top: 9px; }
.voucher-area h2 {
  margin: 0;
  color: var(--deep);
}
.voucher-area p {
  margin: 0;
  overflow-wrap: anywhere;
}
.toolbar {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.filter-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}
.filter-toolbar label { min-width: 0; }
.action-toolbar { align-items: center; }
.action-toolbar button { min-height: 40px; }
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}
.metric strong {
  display: block;
  font-size: 20px;
  color: var(--deep);
}
.metric.clickable { cursor: pointer; }
.metric.clickable:hover { border-color: var(--primary); }
.metric small { display: block; color: var(--muted); margin-top: 4px; }
.risk-high { border-color: #f4b8b0; background: #fff7f5; }
.risk-warn { border-color: #f3bd72; background: #fffaf0; }
.risk-high-text { color: var(--danger); font-weight: 700; }
.risk-warn-text { color: #9a5b0c; font-weight: 700; }
.batch-bar {
  border: 1px solid #d6e4ef;
  border-radius: 8px;
  padding: 8px;
  background: #f8fbfd;
  margin-bottom: 10px;
}
.pager {
  justify-content: flex-end;
  margin-top: 10px;
}
.mini-list {
  display: grid;
  gap: 6px;
}
.mini-list div {
  border-bottom: 1px solid #eef1f5;
  padding: 6px 0;
  overflow-wrap: anywhere;
}
.toolbar label { min-width: 160px; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.table-wrap table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: #fff;
}
table.compact {
  min-width: 760px;
}
table.compact th, table.compact td {
  padding: 8px;
  font-size: 13px;
}
.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}
.pill.ok { color: var(--ok); border-color: #b7dfc7; }
.pill.error { color: var(--danger); border-color: #f4b8b0; }
button.pill { min-height: 30px; cursor: pointer; }
button.pill:hover, button.pill.active { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
th, td {
  border-bottom: 1px solid #edf0f4;
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  overflow-wrap: anywhere;
}
th {
  background: #f9fafb;
  color: #344054;
  font-weight: 700;
}
.hidden { display: none !important; }
[hidden] { display: none !important; }
.mt-14 { margin-top: 14px; }
.login {
  min-height: 100vh;
  display: grid;
  align-items: center;
}
.login .panel { width: min(100%, 420px); margin: 0 auto; }
.modal-open { overflow: hidden; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}
.modal.active { display: block; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 31, 45, .46);
}
.modal-card {
  position: relative;
  width: min(92vw, 430px);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  margin: 22px auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e4e8ee;
  box-shadow: 0 18px 48px rgba(15, 31, 45, .22);
  padding: 18px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.icon-close {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}
.service-modal-card { display: grid; gap: 14px; }
.voucher-modal-card { display: grid; gap: 14px; width: min(94vw, 760px); }
.voucher-stage {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  overflow: hidden;
  position: relative;
}
.voucher-stage img {
  display: block;
  max-width: 100%;
  max-height: min(68vh, 760px);
  height: auto;
  object-fit: contain;
  background: #fff;
}
.voucher-stage iframe {
  width: 100%;
  height: min(70vh, 760px);
  border: 0;
  background: #fff;
}
.voucher-watermark {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
  color: rgba(18, 57, 91, .72);
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.voucher-actions {
  justify-content: center;
}
.voucher-actions .pill {
  min-width: 58px;
  text-align: center;
}
.voucher-dropzone {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 132px;
  padding: 18px;
  border: 2px dashed #9bb7c7;
  border-radius: 10px;
  background: #f8fbfd;
  color: var(--deep);
  text-align: center;
  cursor: pointer;
  outline: none;
}
.voucher-dropzone span,
.voucher-dropzone small {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.voucher-dropzone.drag-over,
.voucher-dropzone:focus {
  border-color: var(--gold);
  background: #fff8ec;
  box-shadow: 0 0 0 3px rgba(217, 144, 33, .14);
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--deep);
  font-weight: 700;
}
.inline-check input {
  width: auto;
  min-height: auto;
}
.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.voucher-upload-preview {
  display: grid;
  gap: 8px;
}
.voucher-preview-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.voucher-preview-media {
  display: grid;
  place-items: center;
  width: 64px;
  height: 52px;
  border-radius: 6px;
  background: #eef2f6;
  color: var(--deep);
  font-weight: 800;
}
.voucher-preview-media img {
  max-width: 64px;
  max-height: 52px;
  object-fit: contain;
  border-radius: 6px;
}
.voucher-preview-meta {
  color: #344054;
  overflow-wrap: anywhere;
}
.intake-batch-fields { grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr); }
.intake-remark { grid-column: 1 / -1; }
.intake-upload-head,
.intake-queue-head { margin-bottom: 0; }
.intake-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.intake-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.intake-preview-card,
.intake-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 9px;
}
.intake-card[data-status="duplicate"] { border-color: #f3bd72; background: #fffaf0; }
.intake-card[data-status="manually_matched"] { border-color: #8fc4d6; background: #f5fbfd; }
.intake-card[data-status="confirmed"] { border-color: #9cc7a9; background: #f5fbf7; }
.intake-card[data-status="rejected"] { opacity: .75; }
.intake-preview-image,
.intake-card-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border: 1px solid #e5e9ef;
  border-radius: 8px;
  background: #f8fafc;
}
.intake-card-image {
  height: 168px;
  aspect-ratio: auto;
}
.intake-card-meta {
  display: grid;
  gap: 3px;
  color: #344054;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.intake-card-meta strong { color: var(--deep); }
.intake-card .actions button,
.intake-card .actions .link-btn { min-height: 34px; padding: 6px 9px; font-size: 13px; }
.intake-dialog {
  width: min(96vw, 1180px);
  max-height: 92vh;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  overflow-y: auto;
}
.intake-dialog::backdrop { background: rgba(15, 31, 45, .52); }
.intake-confirm-dialog { width: min(94vw, 920px); }
.intake-compare-layout {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(380px, 1.4fr);
  gap: 18px;
  align-items: start;
}
.intake-dialog-image {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.intake-order-results {
  display: grid;
  gap: 7px;
  max-height: 320px;
  overflow-y: auto;
}
.intake-order-option {
  width: 100%;
  text-align: left;
  background: #f6f8fb;
  color: var(--text);
  border: 1px solid var(--line);
  white-space: normal;
}
.intake-order-option:hover,
.intake-order-option.selected { background: #e8f4f8; border-color: var(--primary); }
.intake-order-option small { display: block; color: var(--muted); margin-top: 3px; }

@media (max-width: 1180px) {
  .intake-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .intake-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intake-card-image { height: 150px; }
}

@media (max-width: 540px) {
  .intake-card-grid { grid-template-columns: 1fr; }
  .intake-card-image { height: 180px; }
}

@media (max-width: 760px) {
  .intake-compare-layout,
  .intake-batch-fields { grid-template-columns: 1fr; }
  .intake-remark { grid-column: auto; }
}
.mini-action {
  min-height: 34px;
  padding: 6px 10px;
}
.service-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.service-block strong { overflow-wrap: anywhere; }
.service-qr {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}
.service-qr img {
  width: min(72vw, 240px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.service-extra {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.privacy-note {
  margin: 16px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.bottom-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: none;
  gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(18, 57, 91, .08);
}
.bottom-action-bar:not(.hidden) { display: none; }

/* ERP admin workspace */
.erp-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  background: #f2f5f9;
}
.erp-shell.hidden { display: none; }
.erp-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 216px;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  color: #dbe7f3;
  background: #102a43;
  border-right: 1px solid #183b59;
}
.erp-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.erp-brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #1d7898;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .08em;
}
.erp-brand strong, .erp-brand small { display: block; }
.erp-brand small { margin-top: 2px; color: #91a7ba; font-size: 11px; }
.erp-nav { display: grid; gap: 5px; }
.erp-nav-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  color: #c5d3df;
  background: transparent;
  text-align: left;
  font-weight: 600;
}
.erp-nav-item:hover, .erp-nav-item.active { color: #fff; background: #1b405e; }
.erp-nav-item.active { box-shadow: inset 3px 0 #51b7d7; }
.erp-nav-item small { color: #87a0b5; font-size: 10px; font-weight: 500; }
.erp-sidebar-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid #284963; color: #9eb2c3; font-size: 12px; overflow-wrap: anywhere; }
.erp-frame { grid-column: 2; min-width: 0; }
.erp-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 18px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid #dfe6ee;
  backdrop-filter: blur(10px);
}
.erp-topbar h1 { margin: 0; font-size: 18px; color: #102a43; }
.erp-topbar p { margin: 1px 0 0; color: #6b7d8d; font-size: 11px; }
.erp-content { width: 100%; max-width: 1704px; margin: 0 auto; padding: 10px 14px 24px; }
.erp-module { min-width: 0; }
.erp-module.active { display: block; }
.erp-commandbar {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.erp-commandbar > p { margin: 0; font-size: 11px; }
.erp-commandbar .actions { gap: 6px; }
.erp-commandbar button, .erp-popover > summary { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.erp-orders-commandbar { justify-content: flex-end; }
.import-workspace { margin-top: 0; }
.excel-import-panel { border-color: #cbdbe8; }
.excel-import-settings { grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(130px, 1fr)); }
.excel-sheet-mappings { display: grid; gap: 10px; }
.excel-sheet-map-card { border: 1px solid #dce4ec; background: #f8fafc; padding: 10px; }
.excel-sheet-map-card.needs-attention { border-color: #d97706; background: #fffbeb; }
.excel-sheet-map-card.ignored-empty { color: #64748b; background: #f1f5f9; border-color: #e2e8f0; font-size: 12px; }
.excel-sheet-map-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.excel-sheet-map-fields { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 7px; }
.excel-sheet-map-fields label { font-size: 11px; }
.excel-preview-table { min-width: 1320px; }
.excel-preview-table-wrap { max-height: 480px; }
.excel-action-create, .excel-action-add_item { color: var(--ok); font-weight: 700; }
.excel-action-update { color: #1d4ed8; font-weight: 700; }
.excel-action-no_change { color: var(--muted); }
.excel-action-needs_confirmation, .error-text { color: var(--danger); font-weight: 700; }
.excel-action-skipped { color: var(--muted); font-weight: 700; }
.excel-preview-needs-confirmation { background: #fff1f0; box-shadow: inset 4px 0 0 var(--danger); }
.excel-preview-needs-confirmation td { border-bottom-color: #f8c7c2; }
.excel-import-attention { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid #efaaa2; background: #fff1f0; color: #8f1d16; }
.excel-import-attention p { margin: 0; font-weight: 700; }
.excel-resolution-dialog { width: min(96vw, 900px); max-height: 92vh; padding: 20px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); overflow-y: auto; }
.excel-resolution-dialog::backdrop { background: rgba(15, 31, 45, .52); }
.excel-resolution-section { padding: 12px; border: 1px solid #dce4ec; background: #f8fafc; }
.excel-resolution-section h3 { margin: 0 0 4px; }
.excel-resolution-problems { padding: 10px 12px; border-left: 4px solid var(--danger); background: #fff1f0; color: #8f1d16; font-weight: 700; }
.excel-resolution-list { display: grid; gap: 8px; }
.excel-resolution-list label { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 9px; padding: 8px 10px; border: 1px solid #dce4ec; background: #fff; }
.excel-resolution-list input[type="checkbox"] { width: auto; margin-top: 3px; }
.excel-manual-travelers { display: grid; gap: 8px; }
.excel-manual-traveler-row { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(110px, .6fr) minmax(240px, 1.4fr) auto; gap: 8px; align-items: end; }
.excel-resolution-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.excel-diff-item { display: grid; grid-template-columns: 130px 1fr 1fr; gap: 10px; border-bottom: 1px solid #e5e7eb; padding: 9px 0; }
.compact-action { min-height: 26px; padding: 3px 7px; font-size: 11px; }
.erp-group-candidates { margin-top: 10px; padding-top: 9px; border-top: 1px solid #dce4ec; }
.erp-group-candidate-row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 11px; border-bottom: 1px dashed #e5e7eb; }
.erp-matched-order-block + .erp-matched-order-block { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #dce4ec; }
.intake-order-option { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 8px; cursor: pointer; }
.intake-order-option > span { display: grid; gap: 2px; }
.erp-popover { position: relative; }
.erp-popover > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 7px;
  background: #eef2f6;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.erp-popover > summary::-webkit-details-marker { display: none; }
.erp-popover > summary::after { content: '▾'; color: #6b7d8d; font-size: 10px; }
.erp-popover[open] > summary { color: #0f5e79; background: #e6f3f8; }
.erp-popover-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 24;
  min-width: 230px;
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid #d4dde6;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(16, 42, 67, .16);
}
.erp-popover-menu button { width: 100%; justify-content: flex-start; text-align: left; }
.module-heading, .erp-pane-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.module-heading h2, .erp-pane-heading h3 { margin: 0; color: #102a43; }
.module-heading p, .erp-pane-heading small { margin: 3px 0 0; color: #718096; }
.erp-quick-filters {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  margin-bottom: 6px;
  padding: 3px;
  border: 1px solid #dce4ec;
  border-radius: 8px;
  background: #fff;
}
.erp-quick-filters button { flex: 0 0 auto; min-height: 28px; padding: 4px 9px; color: #526579; background: transparent; font-size: 11px; }
.erp-quick-filters button:hover, .erp-quick-filters button.active { color: #0f5e79; background: #e6f3f8; }
.erp-module > .filter-toolbar {
  grid-template-columns: minmax(280px, 1.8fr) minmax(138px, .75fr) minmax(120px, .65fr) minmax(140px, .75fr) auto auto;
  align-items: end;
  gap: 6px;
  margin-bottom: 5px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #dce4ec;
  border-radius: 8px;
}
.erp-module > .filter-toolbar label { gap: 3px; font-size: 11px; color: #66788a; }
.erp-module > .filter-toolbar input, .erp-module > .filter-toolbar select { min-height: 30px; padding: 4px 7px; font-size: 12px; }
.erp-primary-filters > button, .erp-primary-filters > .erp-popover > summary { min-height: 30px; }
.erp-more-filter-grid { width: min(430px, calc(100vw - 32px)); grid-template-columns: 1fr 1fr; }
.erp-more-filter-grid label { min-width: 0; }
.erp-order-table-wrap { max-height: calc(100vh - 228px); min-height: 420px; border: 1px solid #dce4ec; border-radius: 0; }
.erp-order-table { width: 100%; min-width: 1040px; table-layout: fixed; font-size: 11px; }
.erp-order-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 6px 5px;
  color: #526579;
  background: #edf2f7;
  white-space: nowrap;
}
.erp-order-table td { height: 31px; max-width: 170px; padding: 4px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom-color: #edf1f5; }
.erp-order-table th:nth-child(1) { width: 34px; }
.erp-order-table th:nth-child(2) { width: 150px; }
.erp-order-table th:nth-child(3) { width: 76px; }
.erp-order-table th:nth-child(4) { width: 155px; }
.erp-order-table th:nth-child(5) { width: 155px; }
.erp-order-table th:nth-child(6) { width: 180px; }
.erp-order-table th:nth-child(7) { width: 235px; }
.erp-order-table th:nth-child(8) { width: 130px; }
.erp-order-table th:nth-child(9) { width: 120px; }
.erp-order-table tbody tr { cursor: default; }
.erp-order-table tbody tr:hover { background: #f2f8fb; }
.erp-order-table th:last-child, .erp-order-table td:last-child { position: sticky; right: 0; z-index: 3; background: #fff; box-shadow: -5px 0 8px rgba(16, 42, 67, .06); }
.erp-order-table th:last-child { z-index: 5; background: #edf2f7; }
.erp-order-table tbody tr:hover td:last-child { background: #f2f8fb; }
.erp-order-actions { display: flex; align-items: center; gap: 4px; }
.erp-order-actions button { min-height: 24px; padding: 3px 5px; font-size: 10px; }
.erp-row-more { position: relative; }
.erp-row-more summary { min-height: 24px; padding: 4px 6px; border: 1px solid #cbd8e3; border-radius: 5px; color: #36566f; cursor: pointer; list-style: none; }
.erp-row-more summary::-webkit-details-marker { display: none; }
.erp-row-more-menu { position: absolute; z-index: 20; top: calc(100% + 4px); right: 0; display: grid; width: 124px; gap: 4px; padding: 7px; border: 1px solid #cbd8e3; border-radius: 7px; background: #fff; box-shadow: 0 10px 24px rgba(16, 42, 67, .16); }
.erp-row-more-menu button { width: 100%; }
.erp-entity-label { display: inline-flex; width: max-content; padding: 1px 5px; border-radius: 999px; color: #17627e; background: #e7f3f7; font-size: 9px; font-weight: 700; }
.erp-master-label { margin: 0 4px 0 1px; color: #4e5968; background: #edf1f5; }
.erp-search-matches { display: flex; gap: 3px; margin: 2px 0 0 19px; overflow: hidden; }
.erp-search-matches span { padding: 1px 4px; border-radius: 3px; color: #855a08; background: #fff4d6; font-size: 9px; }
.erp-order-table tbody tr.date-filter-match > td { background: #f2fbf7; }
.erp-order-table tbody tr.date-filter-match > td:last-child { background: #f2fbf7; }
.erp-expand-order { min-width: 22px; min-height: 22px; margin-right: 5px; padding: 1px 3px; color: #176f8a; background: transparent; border: 0; }
.erp-fulfillment-expanded-row td { height: auto; padding: 8px 12px 10px 42px; background: #f7fafc; white-space: normal; }
.erp-fulfillment-expanded-row td:last-child { position: static; box-shadow: none; }
.erp-fulfillment-expanded-list { display: grid; gap: 5px; }
.erp-fulfillment-expanded-item { display: grid; grid-template-columns: auto minmax(100px, 1.1fr) 135px 90px minmax(125px, 1fr) auto auto; align-items: center; gap: 8px; padding: 7px 9px; border-left: 3px solid #63a8bd; background: #fff; }
.erp-fulfillment-expanded-item.date-match { border-left-color: #2d9a67; background: #f0fbf5; box-shadow: inset 0 0 0 1px #bce4cf; }
.erp-date-quick-filters > span { align-self: center; margin-right: 3px; color: #66788a; font-size: 11px; font-weight: 700; }
.erp-priority-panel { margin-top: 18px; }
.erp-priority-list { display: grid; gap: 6px; }
.erp-priority-task { display: grid; grid-template-columns: 38px minmax(130px, .8fr) minmax(230px, 1.6fr) minmax(120px, .7fr); align-items: center; gap: 10px; min-height: 42px; padding: 8px 12px; color: #25384a; text-align: left; background: #fff; border: 1px solid #dce4ec; }
.erp-priority-task:hover { border-color: #75a9bc; background: #f4fafc; }
.erp-priority-rank { width: max-content; padding: 2px 5px; border-radius: 4px; color: #8a4f0b; background: #ffefd6; font-size: 10px; font-weight: 800; }
.erp-priority-task.priority-1 { border-left: 4px solid #c93a42; }
.erp-priority-task.priority-1 .erp-priority-rank { color: #991f27; background: #ffe3e5; }
.erp-priority-task.historical { color: #647483; background: #f7f9fb; border-color: #d9e0e6; }
.erp-priority-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.erp-priority-dialog { width: min(1100px, calc(100vw - 28px)); max-height: min(820px, calc(100vh - 28px)); }
.erp-priority-dialog .erp-priority-list { min-height: 180px; max-height: 570px; overflow: auto; }
.erp-order-timeline { display: grid; gap: 0; }
.erp-timeline-entry { display: grid; grid-template-columns: 16px 1fr; gap: 8px; min-height: 55px; }
.erp-timeline-marker { position: relative; width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: #3289a4; }
.erp-timeline-marker::after { content: ''; position: absolute; top: 10px; bottom: -42px; left: 4px; width: 1px; background: #d6e2e8; }
.erp-timeline-entry:last-child .erp-timeline-marker::after { display: none; }
.erp-timeline-entry strong, .erp-timeline-entry small { display: block; }
.erp-timeline-entry small { margin-top: 2px; color: #728394; }
.erp-timeline-entry p { margin: 3px 0 10px; color: #53687a; font-size: 12px; }
.erp-quick-workflow-dialog { width: min(460px, calc(100vw - 28px)); }
.erp-status-cell, .erp-workflow-cell { font-weight: 650; color: #164e63; }
.erp-develop-card {
  max-width: 760px;
  padding: 28px;
  border: 1px solid #dce4ec;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(16, 42, 67, .05);
}
.erp-develop-card h2 { margin-top: 8px; }
.erp-eyebrow { color: #17718e; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.erp-intake-upload { padding: 0; }
.erp-intake-upload .voucher-dropzone { min-height: 140px; }
.erp-upload-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.erp-upload-mode-switch button { min-height: 38px; }
.erp-upload-mode-switch button.active { color: #fff; background: #176f8a; border-color: #176f8a; }
.erp-upload-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 70;
  width: min(800px, 94vw);
  padding: 0 20px 28px;
  overflow-y: auto;
  background: #f7f9fc;
  border-left: 1px solid #d4dde6;
  box-shadow: -18px 0 42px rgba(16, 42, 67, .18);
}
.erp-upload-drawer.hidden { display: none; }
.erp-upload-open { overflow: hidden; }
.erp-upload-drawer .intake-preview-grid { max-height: 42vh; overflow-y: auto; }
.folder-picker-panel { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border: 1px dashed #9eb8ca; border-radius: 9px; background: #f3f8fb; }
.folder-picker-panel p { margin: 4px 0 0; color: #6b7d8d; font-size: 12px; }
.folder-picker-button { flex: 0 0 auto; cursor: pointer; }
.folder-import-preview { display: grid; gap: 9px; max-height: 44vh; overflow-y: auto; padding-right: 3px; }
.folder-preview-summary { position: sticky; top: 0; z-index: 2; display: grid; gap: 7px; padding: 11px; border: 1px solid #cfdbe5; border-radius: 8px; background: #fff; }
.folder-preview-groups { display: grid; gap: 6px; }
.folder-preview-group { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding: 9px 11px; border: 1px solid #dde5ec; border-radius: 7px; background: #fff; }
.folder-preview-group strong { overflow-wrap: anywhere; }
.folder-preview-group small { grid-column: 1 / -1; color: #738294; }
.folder-ignored-files { padding: 8px 10px; border: 1px solid #ead9b5; border-radius: 7px; background: #fffaf0; font-size: 12px; }
.folder-ignored-files p { margin: 7px 0 0; color: #7c6240; overflow-wrap: anywhere; }
.folder-upload-progress { display: grid; gap: 8px; padding: 12px; border: 1px solid #b9d3df; border-radius: 8px; background: #f3f9fb; }
.folder-upload-progress progress { width: 100%; height: 12px; }
.folder-progress-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; color: #576b7d; font-size: 12px; }
.erp-voucher-grid { display: grid; grid-template-columns: 232px minmax(430px, 1fr) 350px; gap: 10px; height: calc(100vh - 112px); min-height: 600px; }
.erp-voucher-grid > .panel { min-width: 0; padding: 12px; overflow: hidden; }
.erp-voucher-batches, .erp-voucher-queue, .erp-voucher-inspector { display: flex; flex-direction: column; }
.erp-batch-list { display: grid; gap: 7px; overflow-y: auto; }
.erp-batch-card {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 10px;
  color: #273b4d;
  background: #f7f9fb;
  border: 1px solid #dce4ec;
  text-align: left;
  white-space: normal;
}
.erp-batch-card:hover, .erp-batch-card.active { border-color: #56a5bd; background: #eaf6f9; }
.erp-batch-card small, .erp-batch-card span { color: #718096; font-size: 11px; }
.erp-voucher-queue .erp-pane-heading { align-items: center; }
.erp-voucher-queue select { max-width: 170px; min-height: 32px; padding: 5px 7px; font-size: 11px; }
.erp-intake-queue { min-height: 0; overflow-y: auto; padding-right: 3px; }
.erp-intake-group { margin-bottom: 9px; padding: 7px; border: 1px solid #d9e3eb; border-radius: 8px; background: #f8fafc; }
.erp-intake-group.active { border-color: #5a9fb5; background: #f0f8fa; box-shadow: 0 0 0 2px rgba(34, 132, 161, .09); }
.erp-intake-group-heading { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 32px; padding: 4px 5px 8px; color: #27475f; background: transparent; text-align: left; white-space: normal; }
.erp-intake-group-heading span:last-child { color: #718096; font-size: 10px; font-weight: 600; }
.erp-group-toggle { color: #3c7d92; font-size: 10px; }
.erp-intake-group-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 7px; }
.erp-intake-queue .intake-card { padding: 7px; cursor: pointer; }
.erp-intake-queue .intake-card:hover, .erp-intake-queue .intake-card.selected { border-color: #2284a1; box-shadow: 0 0 0 2px rgba(34, 132, 161, .13); }
.erp-intake-queue .intake-card-image { height: 116px; }
.erp-intake-queue .intake-card-meta { font-size: 11px; }
.erp-voucher-inspector { gap: 8px; overflow-y: auto !important; }
.erp-inspector-image { width: 100%; height: 250px; object-fit: contain; border: 1px solid #dbe4ec; border-radius: 7px; background: #f4f7f9; }
.erp-inspector-section { padding: 10px; border: 1px solid #dfe6ed; border-radius: 8px; background: #fff; }
.erp-inspector-section h4 { margin: 0 0 8px; color: #183d59; font-size: 12px; }
.erp-inspector-meta { font-size: 12px; }
.erp-inspector-meta p { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 7px; margin: 5px 0; overflow-wrap: anywhere; }
.erp-inspector-meta p strong { color: #627487; font-weight: 600; }
.erp-inspector-future { color: #7a8996; background: #f7f9fb; }
.erp-inspector-future p { margin: 0; font-size: 11px; }
.erp-inspector-actions { align-items: stretch; }
.erp-inspector-actions > * { flex: 1 1 100%; }
.erp-empty-state { padding: 24px 14px; color: #718096; text-align: center; }
.erp-empty-state p { margin-bottom: 0; font-size: 12px; }
.erp-inspector-empty { flex: 1; display: grid; place-content: center; min-height: 360px; }
.erp-order-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 70;
  width: min(760px, 88vw);
  padding: 0 20px 28px;
  overflow-y: auto;
  background: #f7f9fc;
  border-left: 1px solid #d4dde6;
  box-shadow: -18px 0 42px rgba(16, 42, 67, .18);
}
.erp-order-drawer.hidden { display: none; }
.erp-drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(16, 42, 67, .28); }
.erp-drawer-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -20px 14px; padding: 14px 20px; background: rgba(255, 255, 255, .97); border-bottom: 1px solid #dce4ec; }
.erp-drawer-head h2 { margin: 2px 0 0; }
.erp-drawer-summary, .erp-drawer-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.erp-drawer-tabs { position: sticky; top: 76px; z-index: 2; padding: 8px; background: #eef3f7; border-radius: 7px; }
.erp-drawer-tabs a { padding: 4px 7px; text-decoration: none; font-size: 12px; }
.erp-drawer-section { margin-bottom: 12px; padding: 15px; border: 1px solid #dce4ec; border-radius: 9px; background: #fff; }
.erp-drawer-section h3 { margin: 0 0 12px; color: #173f5f; }
.erp-fulfillment-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.erp-fulfillment-card { display: grid; gap: 4px; min-height: 94px; padding: 10px; color: #173f5f; text-align: left; background: #f7fafc; border: 1px solid #dce4ec; }
.erp-fulfillment-card.active { border-color: #17718e; box-shadow: 0 0 0 2px rgba(23, 113, 142, .12); }
.erp-fulfillment-card span, .erp-fulfillment-card small { font-size: 11px; }
.erp-item-detail { padding-top: 12px; border-top: 1px solid #dce4ec; }
.erp-item-detail .mini-list > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid #edf1f5; }
.erp-drawer-open { overflow: hidden; }

@media (min-width: 1700px) {
  .erp-intake-group-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1280px) {
  .erp-module > .filter-toolbar { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .erp-voucher-grid { grid-template-columns: 190px minmax(380px, 1fr) 285px; }
  .erp-intake-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .excel-import-settings, .excel-sheet-map-fields { grid-template-columns: 1fr; }
  .excel-manual-traveler-row { grid-template-columns: 1fr; }
  .erp-shell { grid-template-columns: 184px minmax(0, 1fr); }
  .erp-sidebar { width: 184px; padding-inline: 10px; }
  .erp-frame { grid-column: 2; }
  .erp-voucher-grid { grid-template-columns: 170px minmax(330px, 1fr); height: auto; }
  .erp-voucher-inspector { grid-column: 1 / -1; min-height: 320px; }
}

@media (max-width: 720px) {
  .erp-shell { display: block; padding-bottom: 62px; }
  .erp-sidebar { inset: auto 0 0 0; width: 100%; height: 62px; padding: 6px; border: 0; border-top: 1px solid #284963; }
  .erp-brand, .erp-sidebar-foot { display: none; }
  .erp-nav { display: flex; gap: 3px; overflow-x: auto; }
  .erp-nav-item { flex: 0 0 68px; min-height: 48px; justify-content: center; padding: 4px; font-size: 10px; text-align: center; }
  .erp-nav-item small { display: none; }
  .erp-frame { min-width: 0; }
  .erp-topbar { padding: 9px 12px; }
  .erp-content { padding: 12px; }
  .module-heading { flex-direction: column; }
  .erp-module > .filter-toolbar { grid-template-columns: 1fr 1fr; }
  .erp-voucher-grid { display: block; height: auto; }
  .erp-voucher-grid > .panel { margin-bottom: 10px; max-height: none; }
  .erp-intake-queue { max-height: 520px; }
  .erp-intake-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .erp-order-drawer { width: 100vw; padding-inline: 12px; }
  .erp-drawer-head { margin-inline: -12px; padding-inline: 12px; }
}

@media (max-width: 720px) {
  .wrap { padding: 20px 12px 32px; }
  h1 { font-size: 24px; }
  .panel { padding: 15px; }
  .grid { grid-template-columns: 1fr; }
  .kv div { grid-template-columns: 88px 1fr; }
  button { width: 100%; }
  .actions button, .toolbar button { width: auto; }
  .status-hero { align-items: flex-start; flex-direction: column; }
  .steps { grid-template-columns: 1fr; }
  .recommend-grid {
    display: grid;
    grid-template-columns: 1fr;
    overflow-x: visible;
  }
  .recommend-card {
    min-width: 0;
  }
  .customer-wrap {
    overflow-x: hidden;
    padding-top: 12px;
    padding-bottom: 106px;
  }
  .query-card, .result-card { padding: 15px; border-radius: 12px; }
  .bottom-action-bar:not(.hidden) { display: grid; grid-template-columns: 1fr 1fr; }
  .bottom-action-bar button { width: 100%; }
  .bottom-action-bar button.hidden { display: none !important; }
  .bottom-action-bar:has(button.hidden) { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .filter-toolbar { grid-template-columns: 1fr; }
  .filter-toolbar label { width: 100%; }
  .action-toolbar button { width: 100%; }
  .modal-card {
    width: calc(100vw - 24px);
    margin: 12px auto;
  }
  .service-block button { width: 100%; }
  .voucher-preview-item {
    grid-template-columns: 52px minmax(0, 1fr);
  }
  .voucher-preview-item button {
    grid-column: 1 / -1;
  }
  .voucher-preview-media {
    width: 52px;
    height: 46px;
  }
  .voucher-preview-media img {
    max-width: 52px;
    max-height: 46px;
  }
  .voucher-modal-card { width: calc(100vw - 18px); }
  .voucher-stage { min-height: 180px; }
  .voucher-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .voucher-actions .pill { justify-self: center; }
}
