:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17151f;
  background: #f5f4f9;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 8px; color: #6d4ce8; font-size: 12px; font-weight: 900; letter-spacing: 1.3px; }
.eyebrow.light { color: #cfc8ff; }
.logo { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 22px; background: #fff; color: #6547d7; font-size: 34px; font-weight: 900; box-shadow: 0 14px 34px #24185933; }
.logo.small { width: 42px; height: 42px; border-radius: 14px; background: #6d4ce8; color: #fff; font-size: 21px; box-shadow: none; }
.button { min-height: 44px; padding: 0 17px; border: 0; border-radius: 13px; font-weight: 800; }
.button:disabled { cursor: wait; opacity: .55; }
.primary { width: 100%; color: #fff; background: #6d4ce8; }
.secondary { color: #5536c7; background: #eeeaff; }
.ghost { color: #56515f; background: #f0eef4; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: 9vw; color: #fff; background: radial-gradient(circle at 15% 20%, #7662c9 0, transparent 30%), #241859; }
.login-brand h1 { max-width: 650px; margin: 26px 0 14px; font-size: clamp(38px, 5vw, 72px); line-height: .98; letter-spacing: -3px; }
.login-brand p:last-child { max-width: 540px; color: #cec8e7; line-height: 1.7; }
.login-card { width: min(430px, calc(100% - 48px)); margin: auto; padding: 34px; border: 1px solid #e4e1eb; border-radius: 26px; background: #fff; box-shadow: 0 22px 60px #31236114; }
.login-card h2 { margin: 0 0 28px; font-size: 29px; }
label { display: block; margin: 15px 0 7px; font-size: 13px; font-weight: 800; }
input, textarea, select { width: 100%; padding: 14px; border: 1px solid #dcd8e4; border-radius: 13px; background: #f8f7fa; outline: none; }
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus { border-color: #6d4ce8; box-shadow: 0 0 0 3px #6d4ce81a; }
.error { min-height: 22px; color: #b3403b; font-size: 13px; }
.security-note { color: #77717f; font-size: 12px; line-height: 1.5; text-align: center; }

.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 4vw; border-bottom: 1px solid #e2dfe8; background: #fff; }
.brand-row, .admin-user { display: flex; align-items: center; gap: 12px; }
.brand-row span { display: block; margin-top: 2px; color: #88828f; font-size: 11px; }
.admin-user span { color: #716b78; font-size: 13px; }
.page { width: min(1220px, calc(100% - 40px)); margin: 42px auto; }
.section-tabs { display: flex; gap: 8px; margin: -18px 0 28px; padding: 6px; max-width: 100%; overflow-x: auto; border: 1px solid #e2dfe8; border-radius: 15px; background: #fff; }
.section-tab { white-space: nowrap; }
.section-tab { min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; color: #716b78; background: transparent; font-weight: 800; }
.section-tab.active { color: #fff; background: #6d4ce8; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-head h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); letter-spacing: -1.8px; }
.page-head p:last-child { color: #746e7b; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 28px 0; }
.overview-stats { grid-template-columns: repeat(3, 1fr); }
.compact { width: auto; }
.catalog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.catalog-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border: 1px solid #e2dfe8; border-radius: 18px; background: #fff; }
.catalog-card h3, .catalog-card p { margin: 0; }
.catalog-card p, .catalog-card small { color: #77717f; }
.catalog-title { display: flex; align-items: center; gap: 12px; }
.catalog-emoji { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: #f3f0ff; font-size: 24px; }
.catalog-card dl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 12px 0; border-block: 1px solid #eeeaf2; }
.catalog-card dt { color: #817b88; font-size: 11px; }
.catalog-card dd { margin: 4px 0 0; font-weight: 800; }
.form-box { margin: 24px 0; padding: 20px; border: 1px solid #e2dfe8; border-radius: 18px; background: #fff; }
.form-box h3 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1.3fr 1fr auto auto; gap: 10px; align-items: center; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.check { display: flex; align-items: center; gap: 8px; margin: 0; }
.check input { width: auto; }
.reward-form fieldset { margin: 16px 0; border: 1px solid #e2dfe8; border-radius: 14px; }
.checkbox-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 0; }
.report-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.redemption-toolbar { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr auto auto; gap: 10px; align-items: end; margin: 24px 0 8px; padding: 18px; border: 1px solid #e2dfe8; border-radius: 18px; background: #fff; }
.redemption-toolbar label { margin: 0; color: #77717f; }
.redemption-toolbar select, .redemption-toolbar input { margin-top: 7px; padding: 11px; }
.redemptions-list { display: grid; gap: 10px; }
.redemption-row { display: grid; grid-template-columns: 90px minmax(220px, 1.3fr) minmax(180px, 1fr) minmax(150px, .7fr); gap: 16px; align-items: center; padding: 16px 18px; border: 1px solid #e2dfe8; border-radius: 16px; background: #fff; }
.redemption-row strong, .redemption-row small { display: block; }
.redemption-row small { margin-top: 4px; color: #817b88; font-size: 11px; }
.redemption-row span:last-child { text-align: right; }
.section-subhead { margin: 34px 0 14px; }
.section-subhead h2 { margin: 0; }
.health-grid, .audit-list { display: grid; gap: 10px; }
.health-card { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px; border: 1px solid #e2dfe8; border-left-width: 5px; border-radius: 16px; background: #fff; }
.health-card h3, .health-card p { margin: 0; }
.health-card p { margin-top: 5px; color: #77717f; font-size: 12px; }
.health-card > strong { min-width: 55px; font-size: 28px; text-align: right; }
.health-state { display: inline-block; margin-bottom: 8px; padding: 4px 8px; border-radius: 8px; font-size: 10px; font-weight: 900; }
.health-card.pass { border-left-color: #24855c; }
.health-card.pass .health-state { color: #18794e; background: #e7f8ef; }
.health-card.warning { border-left-color: #d29221; }
.health-card.warning .health-state { color: #8a5b00; background: #fff1d7; }
.health-card.critical { border-left-color: #c64b45; }
.health-card.critical .health-state { color: #a13d37; background: #fff0ef; }
.audit-row { display: grid; grid-template-columns: 1fr minmax(220px, .7fr); gap: 16px; padding: 15px 18px; border: 1px solid #e2dfe8; border-radius: 14px; background: #fff; }
.audit-row strong, .audit-row small { display: block; }
.audit-row small { margin-top: 4px; color: #817b88; font-size: 11px; }
.audit-row span:last-child { text-align: right; }
.stats article { padding: 21px; border: 1px solid #e2dfe8; border-radius: 19px; background: #fff; }
.stats span, .stats small { display: block; color: #807a87; font-size: 12px; font-weight: 700; }
.stats strong { display: inline-block; margin: 9px 5px 2px 0; color: #241859; font-size: 32px; }
.filters { display: flex; gap: 8px; margin: 24px 0 15px; overflow-x: auto; }
.filter { padding: 10px 15px; border: 0; border-radius: 12px; color: #716b78; background: #ebe9ef; font-weight: 800; white-space: nowrap; }
.filter.active { color: #fff; background: #6d4ce8; }
.message { min-height: 22px; color: #746e7b; font-size: 13px; }
.orders-list { display: grid; gap: 12px; }
.order-card { display: grid; grid-template-columns: minmax(210px, 1.4fr) repeat(3, minmax(110px, .7fr)) auto; align-items: center; gap: 16px; padding: 18px; border: 1px solid #e2dfe8; border-radius: 18px; background: #fff; }
.customer strong, .customer span { display: block; }
.customer span, .detail span { margin-top: 4px; color: #817b88; font-size: 12px; }
.detail strong { display: block; font-size: 14px; }
.amount { color: #5d3bd4; font-size: 20px !important; }
.status { display: inline-block; width: fit-content; padding: 6px 9px; border-radius: 10px; font-size: 11px; font-weight: 900; }
.status.pending { color: #8a5b00; background: #fff1d7; }
.status.draft { color: #5536c7; background: #eeeaff; }
.status.approved { color: #18794e; background: #e7f8ef; }
.status.ready, .status.used { color: #18794e; background: #e7f8ef; }
.status.rejected { color: #a13d37; background: #fff0ef; }
.status.cancelled, .status.expired { color: #716b78; background: #ebe9ef; }
.actions { display: flex; gap: 7px; justify-content: flex-end; flex-wrap: wrap; }
.actions button { min-height: 38px; padding: 0 12px; border: 0; border-radius: 11px; font-size: 12px; font-weight: 900; }
.view-slip { color: #5536c7; background: #eeeaff; }
.approve { color: #fff; background: #24855c; }
.reject { color: #a13d37; background: #fff0ef; }
.empty { padding: 60px 20px; border: 1px dashed #d9d5df; border-radius: 20px; color: #7a7480; text-align: center; background: #fff; }
.customer-tools { margin-top: 28px; }
.customer-tools input { max-width: 560px; background: #fff; }
.customer-layout { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(500px, 1.3fr); gap: 16px; align-items: start; }
.customers-list { display: grid; gap: 9px; max-height: 680px; overflow-y: auto; }
.customer-row { display: flex; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid #e2dfe8; border-radius: 16px; color: inherit; background: #fff; text-align: left; }
.customer-row:hover, .customer-row.active { border-color: #6d4ce8; box-shadow: 0 0 0 2px #6d4ce817; }
.customer-row span:last-child { text-align: right; }
.customer-row strong, .customer-row small { display: block; }
.customer-row small { margin-top: 4px; color: #817b88; }
.customer-detail { min-height: 300px; padding: 24px; border: 1px solid #e2dfe8; border-radius: 20px; background: #fff; }
.empty-detail { display: grid; place-items: center; color: #7a7480; }
.customer-detail-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.customer-detail-head h2 { margin: 0; }
.customer-detail-head p:last-child { color: #77717f; }
.wallet-summary { display: flex; gap: 10px; }
.wallet-summary span { min-width: 130px; padding: 14px; border-radius: 14px; background: #f5f3ff; }
.wallet-summary small, .wallet-summary strong { display: block; }
.wallet-summary small { color: #77717f; }
.wallet-summary strong { margin-top: 5px; color: #3b258d; }
.adjustment { margin: 22px 0; padding: 18px; border-radius: 16px; background: #f7f5ff; }
.adjustment h3, .adjustment p { margin-top: 0; }
.adjustment p { color: #77717f; font-size: 13px; }
.adjustment-grid { display: grid; grid-template-columns: .55fr 1fr auto; gap: 9px; }
.adjustment-grid .primary { width: auto; }
.ledger-title { margin-top: 26px; }
.ledger-list { display: grid; gap: 8px; }
.ledger-row { display: grid; grid-template-columns: 55px 1fr auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid #ebe8ef; border-radius: 13px; }
.ledger-row span:last-child { text-align: right; }
.ledger-row strong, .ledger-row small { display: block; }
.ledger-row small { margin-top: 3px; color: #817b88; font-size: 11px; }
.ledger-direction { display: grid; place-items: center; min-height: 38px; border-radius: 10px; font-weight: 900; }
.ledger-direction.credit, .ledger-direction.unlock { color: #18794e; background: #e7f8ef; }
.ledger-direction.debit, .ledger-direction.lock { color: #a13d37; background: #fff0ef; }

dialog { width: min(620px, calc(100% - 28px)); padding: 20px; border: 0; border-radius: 22px; box-shadow: 0 28px 90px #18112166; }
dialog::backdrop { background: #17122599; backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-head h2 { margin: 0 0 15px; }
.icon-button { width: 40px; height: 40px; border: 0; border-radius: 12px; font-size: 25px; }
#slip-image { width: 100%; max-height: 68vh; object-fit: contain; border-radius: 15px; background: #eee; }

@media (max-width: 850px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .order-card { grid-template-columns: 1fr 1fr; }
  .customer, .actions { grid-column: 1 / -1; }
  .actions { justify-content: flex-start; }
  .customer-layout { grid-template-columns: 1fr; }
  .catalog-grid, .overview-stats { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .redemption-toolbar { grid-template-columns: 1fr 1fr 1fr; }
  .redemption-row { grid-template-columns: 90px 1fr 1fr; }
  .redemption-row span:last-child { grid-column: 2 / -1; }
  .audit-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .admin-user span { display: none; }
  .page { width: min(100% - 24px, 1220px); margin-top: 26px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .order-card { grid-template-columns: 1fr; }
  .customer, .actions { grid-column: auto; }
  .customer-detail-head, .wallet-summary { flex-direction: column; }
  .wallet-summary { width: 100%; }
  .wallet-summary span { width: 100%; }
  .adjustment-grid { grid-template-columns: 1fr; }
  .catalog-grid, .overview-stats, .form-grid, .form-grid.two, .checkbox-list { grid-template-columns: 1fr; }
  .redemption-toolbar, .redemption-row { grid-template-columns: 1fr; }
  .redemption-row span:last-child { grid-column: auto; text-align: left; }
  .health-card { align-items: flex-start; }
  .audit-row { grid-template-columns: 1fr; }
  .audit-row span:last-child { text-align: left; }
  .ledger-row { grid-template-columns: 44px 1fr; }
  .ledger-row span:last-child { grid-column: 2; text-align: left; }
}
