@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+KR:wght@400;500;600;700&display=swap");

:root {
  --bg: #bebebe;
  --surface: #f9fbfd;
  --surface-strong: #ffffff;
  --line: rgba(89, 73, 55, 0.22);
  --ink: #161411;
  --muted: rgba(95, 86, 80, 0.74);
  --accent: #f18f01;
  --accent-soft: rgba(241, 143, 1, 0.13);
  --panel-shadow: 0 16px 28px rgba(82, 60, 46, 0.12);
  --green: #18794e;
  --amber: #9a6509;
  --red: #b33a3a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Malgun Gothic", "IBM Plex Sans KR", "Segoe UI", sans-serif;
  color: var(--ink);
}

body {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.22), transparent 24%),
    linear-gradient(180deg, #c2c2c2 0%, #b6b6b6 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.24;
}

.payment-page {
  min-height: 100vh;
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.page-header,
.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  box-shadow: var(--panel-shadow);
}

.page-header {
  position: relative;
  overflow: hidden;
  padding: 24px 16px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.page-header::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  height: 1px;
  background: rgba(241, 143, 1, 0.34);
}

.page-header h1,
.section-head h2 {
  margin: 0;
}

.page-header h1 {
  position: relative;
  z-index: 1;
  color: var(--accent);
  font-family: "IBM Plex Sans KR", "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.02;
}

.home-link,
button,
select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-strong);
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-weight: 800;
  padding: 8px 12px;
  font-size: 14px;
}

.home-link {
  position: relative;
  z-index: 1;
  border-color: rgba(241, 143, 1, 0.32);
  color: var(--accent);
  box-shadow: none;
}

.home-link:hover {
  background: var(--accent);
  color: #fffaf1;
  border-color: var(--accent);
}

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffaf1;
}

.card {
  padding: 12px;
  display: grid;
  gap: 10px;
}

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

.payment-title-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.payment-title-line h2 {
  margin: 0;
}

.payment-latest-update {
  color: #d93025;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.payment-search-form {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.payment-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.payment-db-refresh-warning {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(179, 58, 58, 0.28);
  background: rgba(255, 244, 242, 0.94);
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.payment-db-refresh-warning[hidden],
.payment-db-refresh-warning:empty {
  display: none !important;
}

.print-button {
  border-color: rgba(241, 143, 1, 0.32);
  color: var(--accent);
  background: #fff;
}

.print-button:hover {
  background: var(--accent);
  color: #fffaf1;
  border-color: var(--accent);
}

.payment-print-area {
  display: none;
}

.payment-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.payment-field span {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
}

.payment-field span {
  min-width: 1.2em;
  text-align: left;
  color: var(--ink);
}

.payment-field input {
  width: 88px;
  min-height: 40px;
  border: 1px solid rgba(109, 96, 86, 0.16);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.99);
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.payment-customer-search {
  display: grid;
  grid-template-columns: auto minmax(260px, 420px);
  align-items: center;
  gap: 8px;
  position: relative;
}

.payment-customer-search-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.payment-customer-search-box {
  position: relative;
}

.payment-customer-search-box input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(109, 96, 86, 0.18);
  border-radius: 0;
  background: #fff;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.payment-customer-search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(360px, 54vh);
  overflow: auto;
  border: 1px solid rgba(89, 73, 55, 0.26);
  background: #fff;
  box-shadow: 0 14px 28px rgba(82, 60, 46, 0.18);
}

.payment-customer-search-empty,
.payment-customer-search-option {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid rgba(24, 34, 48, 0.08);
  background: #fff;
  text-align: left;
}

.payment-customer-search-option {
  display: grid;
  gap: 3px;
  cursor: pointer;
}

.payment-customer-search-option:hover,
.payment-customer-search-option:focus {
  outline: 0;
  background: var(--accent-soft);
}

.payment-search-name {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.payment-search-meta,
.payment-customer-search-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.payment-search-tag {
  display: inline-flex;
  margin-left: 4px;
  padding: 1px 4px;
  border: 1px solid rgba(179, 58, 58, 0.22);
  color: var(--red);
  font-size: 10px;
  font-weight: 900;
}

.status-box {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(109, 96, 86, 0.16);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-box.is-error {
  color: var(--red);
}

.status-box[hidden] {
  display: none;
}

.status-box.is-success {
  color: var(--green);
}

.payment-view-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-segment {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(109, 96, 86, 0.16);
  background: rgba(255, 255, 255, 0.72);
}

.payment-segment-button {
  min-height: 34px;
  padding: 7px 12px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.payment-segment-button:hover,
.payment-segment-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffaf1;
}

.payment-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.payment-summary-card {
  border: 1px solid rgba(109, 96, 86, 0.16);
  background: rgba(255, 255, 255, 0.88);
  padding: 10px;
}

.payment-summary-card.is-total {
  border-color: rgba(241, 143, 1, 0.38);
  background: rgba(255, 255, 255, 0.96);
}

.payment-summary-card h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.payment-summary-card dl {
  margin: 0;
  display: grid;
  gap: 6px;
}

.payment-summary-card dl div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.payment-summary-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.payment-summary-card dd {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.table-wrap {
  max-height: calc(100vh - 250px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(109, 96, 86, 0.16);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.99);
}

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

.payment-table.has-ledger :is(th, td):nth-child(1) { width: 16%; }
.payment-table.has-ledger :is(th, td):nth-child(2) { width: 6%; text-align: center; }
.payment-table.has-ledger :is(th, td):nth-child(3),
.payment-table.has-ledger :is(th, td):nth-child(4),
.payment-table.has-ledger :is(th, td):nth-child(5),
.payment-table.has-ledger :is(th, td):nth-child(6) { width: 10%; text-align: center; }
.payment-table.has-ledger :is(th, td):nth-child(7),
.payment-table.has-ledger :is(th, td):nth-child(8) { width: 8%; text-align: center; }
.payment-table.has-ledger :is(th, td):nth-child(9) { width: 22%; }
.payment-table.has-ledger td:nth-child(6) .pill { border-color: transparent; }

.ledger-status-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 34px;
  padding: 6px;
  border: 1px solid #dadfe5;
  border-radius: 6px;
  background: #f7f8fa;
  color: #7d4850;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.ledger-status-button.is-printed { color: #226c48; background: #edf8f0; }
.ledger-card-label { color: #365b9e; font-size: 11px; white-space: nowrap; }
.payment-ledger-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-sizing: border-box;
  padding: 22px;
  border: 1px solid #e1e5e9;
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
}
.payment-ledger-dialog::backdrop { background: rgba(20, 30, 45, .4); }
.ledger-period, .ledger-help { font-size: 13px; color: var(--muted); line-height: 1.6; }
.ledger-card-choice { display: flex; align-items: center; gap: 8px; margin-top: 20px; font-weight: 800; }
.ledger-status-choices { display: grid; gap: 14px; margin: 20px 0; padding: 16px 12px; border: 1px solid #e1e5e9; border-radius: 8px; }
.ledger-status-choices legend { font-weight: 800; font-size: 14px; padding: 0 5px; }
.ledger-status-choices label { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.ledger-error { color: var(--red); font-size: 13px; }

.payment-table th,
.payment-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(24, 34, 48, 0.08);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.payment-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  box-shadow: 0 1px 0 rgba(24, 34, 48, 0.12);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.payment-header-note {
  display: inline-block;
  margin-top: 2px;
  color: var(--red);
  font-size: 10px;
  line-height: 1.2;
}

.payment-table td.is-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.collect-amount-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  line-height: 1.12;
}

.collect-amount-button:hover .collect-amount-value {
  text-decoration: underline;
}

.collect-amount-value {
  display: block;
  white-space: nowrap;
}

.collect-badge {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  padding: 2px 4px;
  border-radius: 3px;
  background: #d93025;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.payment-table th:nth-child(1),
.payment-table td:nth-child(1) {
  width: 16%;
}

.payment-table thead th {
  text-align: center;
  vertical-align: middle;
}

.payment-table th:nth-child(2),
.payment-table td:nth-child(2) {
  width: 11%;
  text-align: center;
}

.payment-table th:nth-child(3),
.payment-table td:nth-child(3) {
  width: 11%;
  text-align: center;
}

.payment-table th:nth-child(4),
.payment-table td:nth-child(4) {
  width: 11%;
  text-align: center;
}

.payment-table th:nth-child(5),
.payment-table td:nth-child(5) {
  width: 11%;
  text-align: center;
}

.payment-table th:nth-child(6),
.payment-table td:nth-child(6) {
  width: 9%;
  text-align: center;
}

.payment-table th:nth-child(7),
.payment-table td:nth-child(7) {
  width: 8%;
  text-align: center;
}

.payment-table th:nth-child(8),
.payment-table td:nth-child(8) {
  width: 23%;
}

.payment-table tr.is-completed {
  background: #fff;
}

.payment-table tr.is-attention {
  background: #fff;
}

.payment-table tr.is-search-focused {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: #fff5dc;
}

.payment-table tr.is-search-focused td {
  box-shadow: inset 0 1px 0 rgba(241, 143, 1, 0.36), inset 0 -1px 0 rgba(241, 143, 1, 0.36);
}

.payment-table tr.is-excluded-row {
  background: rgba(109, 96, 86, 0.06);
  color: rgba(22, 20, 17, 0.58);
}

.payment-table tr.is-excluded-row.is-search-focused {
  background: #fff5dc;
}

.payment-table tr.is-excluded-row .customer-name,
.payment-table tr.is-excluded-row .collect-amount-button {
  color: rgba(22, 20, 17, 0.62);
}

.company-group-row td {
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  border-bottom: 1px solid rgba(180, 96, 0, 0.38);
}

.customer-name {
  display: block;
  font-weight: 900;
  line-height: 1.22;
  max-width: 100%;
  overflow: hidden;
}

.customer-name-split {
  display: grid;
  gap: 2px;
}

.customer-name-region {
  color: var(--muted);
  font-size: 0.92em;
}

.customer-name-pharmacy,
.customer-name-single {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

.customer-name-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.customer-name-button:hover {
  color: var(--accent);
  text-decoration: underline;
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 0;
  padding: 4px 8px;
  border: 1px solid rgba(109, 96, 86, 0.14);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  white-space: normal;
  max-width: 100%;
}

.pill.is-muted {
  background: #fff;
  color: var(--muted);
}

.pill.is-warning {
  background: #fff;
  color: var(--amber);
}

.pill.is-excluded {
  border-color: transparent;
  background: rgba(109, 96, 86, 0.12);
  color: var(--muted);
}

.payment-table td:nth-child(5) .pill {
  border-color: transparent;
}

.payment-methods {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.card-chip {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 2px 5px;
  background: #666;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.card-chip.is-shinhan {
  background: #173b78;
}

.card-chip.is-lotte {
  background: #111;
}

.card-chip.is-bc {
  background: #c8252c;
}

.card-chip.is-kb {
  background: #ffd22e;
  color: #1f1a00;
}

.kb-card-toggle {
  appearance: none;
  position: relative;
  min-height: 20px;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 2px 5px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.kb-card-toggle.is-weekend-marked {
  box-shadow: inset 0 0 0 2px #d93025;
}

.kb-weekend-badge {
  position: absolute;
  top: -11px;
  right: -13px;
  padding: 2px 4px;
  background: #d93025;
  color: #fff;
  border: 1px solid #a91f17;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.payment-available-day-input {
  appearance: auto;
  width: 100%;
  min-width: 62px;
  min-height: 34px;
  border: 1px solid rgba(109, 96, 86, 0.2);
  background: #fff;
  color: var(--ink);
  padding: 5px 4px;
  text-align: center;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.payment-available-day-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: #fff8e8;
}

.payment-available-day-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.card-chip.is-samsung {
  background: #1f66d1;
}

.card-chip.is-etc {
  background: #e76aa4;
}

.card-chip.is-deposit {
  background: #1f8a4c;
}

.card-chip.is-hana {
  background: #4f4f4f;
}

.card-chip.is-hyundai {
  background: #f18f01;
}

.card-chip.is-default {
  background: #6b625a;
}

.installment-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 6px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  animation: installmentPulse 1.15s steps(2, end) infinite;
}

@keyframes installmentPulse {
  0%,
  100% {
    background: #ffe046;
    color: #1f1a00;
  }

  50% {
    background: var(--red);
    color: #fff;
  }
}

.payment-current {
  display: inline-grid;
  justify-items: center;
  max-width: 100%;
  color: var(--ink);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.18;
}

.payment-current-label,
.payment-current-amount,
.payment-current-date {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

.payment-current-label {
  color: var(--ink);
}

.payment-current-date {
  color: var(--muted);
  font-size: 0.86em;
}

.payment-mismatch {
  color: var(--red);
}

.payment-mismatch .payment-current-date {
  color: var(--red);
}

.visit-staff-select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid rgba(109, 96, 86, 0.16);
  background: #fff;
  color: var(--ink);
  padding: 6px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.visit-staff-select.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.note-select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border-radius: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.99);
}

.wholesale-term-select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border-radius: 0;
  border: 1px solid rgba(241, 143, 1, 0.28);
  background: #fffaf2;
  color: var(--ink);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 900;
}

.payment-note-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.payment-note-tools .note-select {
  width: 100%;
}

.payment-excluded-note,
.payment-note-placeholder {
  min-width: 0;
}

.payment-excluded-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.payment-note-placeholder {
  display: block;
  min-height: 1px;
}

.payment-exclude-button {
  min-height: 32px;
  padding: 6px 8px;
  border-color: rgba(179, 58, 58, 0.24);
  color: var(--red);
  background: #fff;
  font-size: 12px;
}

.payment-exclude-button.is-restore {
  border-color: rgba(24, 121, 78, 0.25);
  color: var(--green);
}

.empty-cell {
  height: 120px;
  text-align: center !important;
  color: var(--muted);
  font-weight: 800;
}

.has-payment-modal {
  overflow: hidden;
}

.payment-modal[hidden] {
  display: none;
}

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

.payment-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 20, 17, 0.46);
}

.payment-modal-panel {
  position: relative;
  width: min(100%, 520px);
  border: 1px solid rgba(89, 73, 55, 0.26);
  background: #fff;
  box-shadow: 0 24px 52px rgba(22, 20, 17, 0.24);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.payment-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  border-bottom: 1px solid rgba(109, 96, 86, 0.14);
  padding-bottom: 10px;
}

.payment-modal-head h2,
.payment-modal-head p {
  margin: 0;
}

.payment-modal-head h2 {
  color: var(--accent);
  font-size: 20px;
  line-height: 1.2;
}

.payment-modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal-icon-button {
  min-width: 62px;
  padding: 7px 10px;
  color: var(--muted);
}

.collect-choice-list {
  display: grid;
  gap: 8px;
}

.collect-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(109, 96, 86, 0.18);
  background: #fff;
  padding: 10px;
  cursor: pointer;
}

.collect-choice:hover,
.collect-choice.is-selected {
  border-color: rgba(241, 143, 1, 0.7);
  background: rgba(241, 143, 1, 0.08);
}

.collect-choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.choice-main {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.choice-title {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.choice-main strong {
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.choice-tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 5px;
  background: #d93025;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.collect-custom-field {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 8px;
}

.collect-custom-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.collect-custom-field input,
.collect-custom-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(109, 96, 86, 0.18);
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  text-align: right;
  font: inherit;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.collect-custom-field select {
  text-align: left;
}

.collect-custom-field input:disabled,
.collect-custom-field select:disabled {
  background: rgba(109, 96, 86, 0.06);
  color: rgba(95, 86, 80, 0.48);
  cursor: not-allowed;
}

.payment-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 900px) {
  .payment-page {
    padding: 8px;
    max-width: 100%;
    font-size: 16px;
  }

  .payment-title-line h2 {
    font-size: 19px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .payment-toolbar-actions,
  .payment-search-form {
    gap: 6px;
    max-width: 100%;
  }

  .payment-field {
    gap: 3px;
  }

  .payment-field input {
    width: 78px;
    padding: 7px 5px;
    font-size: 16px;
  }

  #paymentMonth {
    width: 48px;
  }

  .payment-field span,
  .payment-customer-search-label,
  .payment-summary-card dt {
    font-size: 14px;
  }

  .payment-toolbar-actions button,
  .payment-segment-button,
  .payment-customer-search input {
    font-size: 16px;
  }

  .payment-summary-card h3 {
    font-size: 16px;
  }

  .payment-summary-card dd {
    font-size: 18px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .payment-toolbar-actions {
    justify-content: flex-start;
  }

  .payment-view-controls,
  .payment-segment {
    width: 100%;
  }

  .payment-segment-button {
    flex: 1 1 auto;
  }

  .payment-customer-search {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .payment-customer-search-box {
    width: 100%;
  }

  .payment-customer-search-results {
    max-height: 50vh;
  }

  .payment-summary-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-height: calc(100vh - 310px);
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: auto;
  }

  .card {
    padding: 8px;
  }

  .payment-table {
    width: 840px;
    min-width: 840px;
  }

  .payment-table th,
  .payment-table td {
    padding: 8px 4px;
    font-size: 15px;
    line-height: 1.35;
  }

  .payment-table th:nth-child(1),
  .payment-table td:nth-child(1) {
    width: 130px;
  }

  .payment-table th:nth-child(2),
  .payment-table td:nth-child(2) {
    width: 120px;
  }

  .payment-table th:nth-child(3),
  .payment-table td:nth-child(3) {
    width: 110px;
  }

  .payment-table th:nth-child(4),
  .payment-table td:nth-child(4) {
    width: 85px;
  }

  .payment-table th:nth-child(5),
  .payment-table td:nth-child(5) {
    width: 95px;
  }

  .payment-table th:nth-child(6),
  .payment-table td:nth-child(6) {
    width: 85px;
  }

  .payment-table th:nth-child(7),
  .payment-table td:nth-child(7) {
    width: 80px;
  }

  .payment-table th:nth-child(8),
  .payment-table td:nth-child(8) {
    width: 135px;
  }

  .customer-name {
    font-size: 15px;
    line-height: 1.3;
  }

  .customer-name-pharmacy,
  .customer-name-single {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .customer-name-split {
    gap: 1px;
  }

  .collect-amount-button {
    width: 100%;
    gap: 2px;
  }

  .collect-amount-value {
    font-size: 16px;
  }

  .collect-badge {
    min-height: 14px;
    padding: 2px 3px;
    font-size: 11px;
  }

  .pill,
  .payment-mismatch,
  .visit-staff-select,
  .note-select,
  .wholesale-term-select,
  .payment-available-day-input {
    font-size: 15px;
    min-width: 0;
    max-width: 100%;
  }

  .card-chip,
  .kb-card-toggle,
  .payment-exclude-button {
    font-size: 13px;
  }

  .payment-current {
    width: 100%;
    font-size: 15px;
  }

  .payment-current-date {
    margin-top: 1px;
    font-size: 13px;
  }

  .payment-modal {
    align-items: end;
    padding: 10px;
  }

  .choice-main {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .collect-custom-field {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  html,
  body {
    min-height: auto;
    background: #fff !important;
    color: #000;
  }

  body::before,
  .payment-page,
  .payment-modal {
    display: none !important;
  }

  .payment-print-area {
    display: block;
    font-family: "Malgun Gothic", "Segoe UI", sans-serif;
    color: #000;
  }

  .print-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 12px;
    margin: 0 0 8px;
  }

  .print-head h1 {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
  }

  .print-head p {
    margin: 0;
    font-size: 10px;
    font-weight: 700;
  }

  .print-payment-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 10px;
  }

  .print-payment-table th,
  .print-payment-table td {
    border: 1px solid #333;
    padding: 4px 5px;
    vertical-align: middle;
    line-height: 1.25;
  }

  .print-payment-table th {
    background: #eee;
    text-align: center;
    font-weight: 800;
  }

  .print-payment-table tr {
    break-inside: avoid;
  }

  .print-payment-table .print-name {
    width: 23%;
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .print-payment-table .print-amount {
    width: 10%;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  .print-payment-table .is-empty {
    background: #fff;
  }
}
