: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;
}
.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;
}
.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; }
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;
}
.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; }

@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; }
}
