/* Lớp giao diện dễ đọc cho toàn bộ phân hệ công nợ. */
:root {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #202b38;
  background: #f5f7fa;
  font-synthesis: none;
  --ui-blue: #0869da;
  --ui-blue-dark: #0757b3;
  --ui-text: #202b38;
  --ui-muted: #526273;
  --ui-border: #dce3eb;
}

body, .workspace { background: #f5f7fa; }
button, input, select, textarea { font-family: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--ui-blue);
  outline-offset: 2px;
}

.sidebar { background: #fff; border-right-color: var(--ui-border); }
.brand strong { font-size: 18px; color: var(--ui-text); }
.brand small, .sidebar-status, .logout-button { font-size: 12px; color: var(--ui-muted); }
.brand-mark { background: var(--ui-blue); }
.nav-label { font-size: 11px; color: #617186; }
.nav-item { min-height: 46px; font-size: 14px; font-weight: 500; color: #344357; }
.nav-item:hover { background: #eef5ff; color: var(--ui-blue-dark); }
.nav-item.active { background: #e7f1ff; color: #0757b3; font-weight: 700; }
.nav-count { background: var(--ui-blue); color: #fff; }

.topbar { background: #fff; border-bottom-color: var(--ui-border); }
.topbar-left, .topbar-right { font-size: 13px; color: var(--ui-muted); }
.topbar-label { font-size: 11px; color: #617186; }
#topbar-current { color: var(--ui-text); }
main { padding-top: 26px; }
.eyebrow { font-size: 11px; color: #617186; }
.page-heading h1, #view-customers .page-heading h1 {
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -.025em;
  color: #152536;
}
.page-heading p { font-size: 14px; line-height: 1.5; color: var(--ui-muted); }

.panel, .metric-card { background: #fff; border-color: var(--ui-border); box-shadow: none; }
.panel-heading h2, .qr-form-panel h2, .connection-heading h2,
.overview-section-heading h2 { color: var(--ui-text); }
.panel-heading h2, .qr-form-panel h2 { font-size: 18px; }
.panel-heading p, .qr-form-panel > p, .connection-heading p,
.connection-group > p, .connection-provider-fields > p,
.connection-webhook-box > p, .test-hook-section > p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ui-muted);
}

.primary-button { background: var(--ui-blue); font-size: 13px; font-weight: 650; }
.primary-button:hover { background: var(--ui-blue-dark); }
.secondary-button, .icon-button, .pagination button {
  border-color: #cbd5e1;
  color: #164b86;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
}
.secondary-button:hover, .icon-button:hover, .pagination button:hover:not(:disabled) {
  background: #eef5ff;
}
.link-button, .attention-link { color: var(--ui-blue-dark); font-size: 13px; }

.metric-label { font-size: 14px; color: var(--ui-muted); }
.metric-value { color: #152536; font-weight: 700; }
.metric-hint, .recent-sub, .recent-money small,
.attention-item span { font-size: 12px; color: var(--ui-muted); }
.recent-title, .recent-money strong, .attention-item strong { font-size: 14px; color: var(--ui-text); }
.recent-row, .attention-item { border-top-color: #e6ebf1; }
.empty-state { font-size: 14px; color: var(--ui-muted); }
.notice strong { font-size: 14px; }
.notice p, .toolbar-count { font-size: 13px; line-height: 1.5; }

.search-wrap input, .table-toolbar select, .settings-form input,
.settings-form select, .qr-form-panel input, .password-wrap input,
.detail-form input, .detail-form textarea, .customer-messenger-field input {
  border-color: #cbd5e1;
  color: var(--ui-text);
  background: #fff;
  font-size: 14px;
}
.search-wrap input::placeholder, .settings-form input::placeholder,
.qr-form-panel input::placeholder, .password-wrap input::placeholder {
  color: #718096;
  opacity: 1;
}
.search-wrap input:focus, .settings-form input:focus,
.settings-form select:focus, .qr-form-panel input:focus,
.password-wrap input:focus { border-color: var(--ui-blue); box-shadow: 0 0 0 3px #0869da18; }
.settings-form label, .qr-form-panel label, .login-card label,
#pay2s-form .connection-field > label { font-size: 13px; font-weight: 650; color: #25364a; }
.settings-form small, .settings-note, .connection-field > small,
#pay2s-form .connection-field > small,
#pay2s-form .connection-group > p,
#pay2s-form .connection-provider-fields > p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ui-muted);
}
#pay2s-form input, #pay2s-form select { font-size: 14px; }
.settings-result, .connection-feedback, #pay2s-form .connection-feedback,
.sync-error, .customer-sync-notice { font-size: 13px; line-height: 1.5; }
.connection-state { font-size: 12px; }
.connection-group h3, .connection-provider-fields h3,
.connection-webhook-box h3, #pay2s-form .connection-group h3,
#pay2s-form .connection-provider-fields h3,
#pay2s-form .connection-webhook-box h3 { font-size: 16px; }
.automation-step, .test-hook-section summary,
.test-transaction, .webhook-log-row { font-size: 14px; }
.automation-step strong { color: #25364a; }
.settings-switch strong { font-size: 14px; }
.settings-switch small { font-size: 12px; color: var(--ui-muted); }

.table-panel th, .customer-head, .customer-head button {
  background: #eaf2fd;
  color: #243c5a;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
}
.table-panel td, .customer-row, .customer-row > .customer-code,
.customer-row .customer-name strong,
.customer-row > .customer-debt, .customer-row > .customer-invoiced,
.customer-row > .customer-revenue {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ui-text);
}
.table-panel .cell-primary { font-size: 14px; color: var(--ui-text); }
.table-panel .cell-secondary, .customer-row .customer-summary-meta {
  font-size: 12px;
  color: var(--ui-muted);
}
.status-chip, .table-panel .status-chip { font-size: 12px; }
.table-panel .numeric, .customer-row > .customer-debt,
.customer-row > .customer-invoiced, .customer-row > .customer-revenue,
.customer-totals { font-variant-numeric: tabular-nums; }
.customer-row { min-height: 58px; border-bottom-color: #e6ebf1; }
.customer-row:hover, .table-panel tbody tr:hover { background: #f5f9ff; }
.customer-totals { background: #f8fbff; font-size: 13px; }
.customer-totals > strong:nth-child(n+4) { font-size: 14px; }
.customer-toolbar-actions .secondary-button, .customer-actions .secondary-button {
  font-size: 13px;
  min-height: 36px;
}
.customer-messenger-status small, .customer-messenger-state { font-size: 13px; }
.pagination-bar, .page-size select, .page-number,
.page-range, .page-total, .table-footer { font-size: 13px; }

.detail-header h2 { color: var(--ui-text); }
.detail-section h3, .detail-form h3 { font-size: 12px; color: var(--ui-muted); }
.detail-data span, .detail-note-entry, .detail-form p { font-size: 13px; }
.detail-data strong, .detail-payment { font-size: 14px; }
.toast { font-size: 13px; background: #203750; }

.qr-form-panel .transfer-prefix-form {
  margin-top: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ui-border);
}
.transfer-prefix-controls { display: flex; align-items: center; gap: 8px; }
.transfer-prefix-controls input { flex: 1; min-width: 0; }
.transfer-prefix-controls .secondary-button { min-height: 45px; }
.transfer-prefix-form small {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  color: var(--ui-muted);
}
.qr-form-panel #qr-form { margin-top: 20px; }

/* Kết nối: ưu tiên mật độ thông tin, giữ chi tiết trạng thái khi cần xem. */
#view-connections .eyebrow { display: none; }
#view-connections .page-heading { margin-bottom: 14px; }
#view-connections .page-heading h1 { font-size: 25px; }
#view-connections .page-heading p { margin-top: 3px; }
#view-connections .panel { border-radius: 10px; }
#view-connections .connection-grid { gap: 12px; }
#view-connections .automation-panel { padding: 15px 20px; margin-bottom: 12px; }
#view-connections .automation-panel .connection-heading { margin-bottom: 0; }
#view-connections .connection-checklist { margin-top: 5px; }
#view-connections .connection-checklist summary {
  width: max-content;
  color: #0757b3;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
#view-connections .automation-steps {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 14px;
  margin-top: 10px;
}
#view-connections .connection-panel { padding: 18px 22px; }
#view-connections .connection-heading { margin-bottom: 12px; }
#view-connections .connection-heading p { margin-top: 2px; }
#view-connections .connection-step-number {
  width: 24px;
  height: 24px;
  margin-right: 8px;
}
#view-connections .settings-form { gap: 6px; }
#view-connections .connection-fields { gap: 9px 16px; }
#view-connections .settings-form .connection-field > label { margin: 0 0 4px; }
#view-connections .settings-form input,
#view-connections .settings-form select { height: 38px; }
#view-connections .connection-field > small { margin-top: 3px; }
#view-connections .settings-actions { margin-top: 8px; }
#view-connections .primary-button,
#view-connections .secondary-button { min-height: 36px; padding: 8px 12px; }
#view-connections .connection-group,
#view-connections .connection-provider-fields,
#view-connections .connection-webhook-box { padding-top: 13px; margin-top: 4px; }
#view-connections .connection-footer { padding-top: 12px; margin-top: 4px; }
#view-connections .settings-form .settings-switch { padding: 10px 12px; }
#view-connections .connection-state { padding: 5px 8px; }

@media (max-width: 1180px) {
  #view-connections .automation-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-connections .connection-fields-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  #view-connections .automation-steps,
  #view-connections .connection-fields-three { grid-template-columns: minmax(0, 1fr); }
  #view-connections .automation-panel,
  #view-connections .connection-panel { padding: 16px; }
  #view-connections .connection-heading { margin-bottom: 10px; }
}

@media (max-width: 900px) {
  .customer-row { min-height: 0; }
}
@media (max-width: 720px) {
  main { padding: 22px 17px 48px; }
  .page-heading h1, #view-customers .page-heading h1 { font-size: 24px; }
  .nav-item { font-size: 13px; }
  .topbar-left, .topbar-right { font-size: 12px; }
  .table-panel td, .customer-row { font-size: 14px; }
}
