:root {
  color-scheme: light;
  --ui-ink: #172b3a;
  --ui-muted: #667987;
  --ui-line: #dce5eb;
  --ui-surface: #ffffff;
  --ui-canvas: #f5f8fa;
  --ui-primary: #126b7a;
  --ui-primary-dark: #0c5360;
  --ui-shadow: 0 12px 28px rgba(28, 53, 68, .07);
  --ui-radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh !important;
  margin: 0 !important;
  padding: clamp(12px, 1.5vw, 24px) !important;
  color: var(--ui-ink) !important;
  background: linear-gradient(135deg, #f3f7fb 0%, #f5faf8 100%) fixed !important;
  font-family: "Plus Jakarta Sans", Roboto, system-ui, sans-serif !important;
  -webkit-font-smoothing: antialiased;
}

#qlpk-hub, .clinic-admin-app, .clinic-phieukham-app, .clinic-trash-app, .container,
.booking-clinic-wrapper, .clinic-edit-app, .pk-form-root-container,
.login-page, .users-app {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}
#qlpk-hub, .booking-clinic-wrapper, .clinic-edit-app { padding: 0 !important; }
.pk-form-root-container { padding: clamp(16px, 2.4vw, 36px) !important; }

.app-header, .workflow-card, .qlpk-sub-stats, .card-box, .card, .stat-card,
.booking-card, .form-container, .form-card, .login-card, .users-card,
.control-bar, .table-wrap, .section-card, .pk-form-root-container {
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  box-shadow: var(--ui-shadow) !important;
}
.app-header {
  color: #fff !important;
  background: linear-gradient(115deg, #183b4a, #126b7a) !important;
  padding: clamp(18px, 2vw, 30px) !important;
  margin-bottom: 18px !important;
}
.app-header h1 { color: #fff !important; letter-spacing: -.02em; }
.app-header p { color: #d6e6e9 !important; }
.qlpk-main-title h1 { color: #173d4b !important; }
.qlpk-main-title h2 { color: #387381 !important; }
.qlpk-main-title {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:clamp(16px,3vw,34px);
  width:fit-content;
  max-width:100%;
  margin:0 auto 26px !important;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent !important;
  box-shadow:none !important;
  animation:ui-enter .36s both;
}
.qlpk-main-logo { display:block; width:clamp(145px,19vw,225px); height:auto; object-fit:contain; flex:0 0 auto; }
.qlpk-main-title-copy { text-align:left; }
.qlpk-main-title-copy h2 { margin:0 0 7px !important; font-size:clamp(13px,1.5vw,17px) !important; letter-spacing:.11em; }
.qlpk-main-title-copy h1 { margin:0 !important; font-size:clamp(20px,2.8vw,32px) !important; line-height:1.2; }
.qlpk-sub-stats, .workflow-card, .card-box, .card, .stat-card,
.booking-card, .form-container, .form-card, .login-card,
.users-card, .control-bar, .pk-form-root-container {
  background: var(--ui-surface) !important;
}
.workflow-card, .card-box, .card, .stat-card, .booking-card, .form-container,
.form-card, .login-card, .users-card, .section-card {
  padding: clamp(16px, 2vw, 28px) !important;
}
.booking-clinic-wrapper .booking-card { padding: clamp(18px, 3vw, 40px) !important; }

button, [role="button"], .btn-ui, .action-btn, .page-nav a,
.btn-submit, .btn-auth-users, .btn-auth-logout, .btn-save,
.btn-print, .btn-list, .btn-home, .btn-add, .btn-add-manual {
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease !important;
}
button, .btn-ui, .action-btn, .btn-submit, .btn-save, .btn-print,
.btn-list, .btn-home, .btn-add, .btn-add-manual { border-radius: 9px !important; }
button:hover, [role="button"]:hover, .btn-ui:hover, .action-btn:hover,
.page-nav a:hover, .btn-submit:hover, .btn-auth-users:hover, .btn-auth-logout:hover,
.btn-save:hover, .btn-print:hover, .btn-list:hover, .btn-home:hover,
.btn-add:hover, .btn-add-manual:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(16, 56, 72, .14);
}
button:active, .btn-ui:active, .action-btn:active { transform: translateY(0) scale(.985); }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  border-color: #cbd8df !important;
  border-radius: 9px !important;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease !important;
}
input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: #318b99 !important;
  box-shadow: 0 0 0 3px rgba(49, 139, 153, .16) !important;
}
label { color: #425967; }

table { border-color: var(--ui-line); }
table th { letter-spacing: .035em; }
table tbody tr { transition: background-color .16s ease; }
table tbody tr:hover td { background-color: #f3f8f9 !important; }
.table-wrap, .table-wrapper { overflow-x: auto !important; }
.alert-banner, .alert-banner-err, .alert, .booking-alert, .alert-success, .alert-error { border-radius: 10px !important; }

.workflow-card, .stat-card, .sub-stat-item, .booking-card, .form-container,
.form-card, .card-box, .card, .users-card, .table-wrap {
  animation: ui-enter .36s both;
}
.qlpk-workflow-grid .workflow-card:nth-child(2), .stats-grid .stat-card:nth-child(2) { animation-delay: .04s; }
.qlpk-workflow-grid .workflow-card:nth-child(3), .stats-grid .stat-card:nth-child(3) { animation-delay: .08s; }
.qlpk-workflow-grid .workflow-card:nth-child(4), .stats-grid .stat-card:nth-child(4) { animation-delay: .12s; }
.workflow-card, .stat-card, .card, .booking-card, .form-container, .form-card, .card-box, .users-card {
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease !important;
}
.workflow-card:hover, .stat-card:hover, .card:hover, .booking-card:hover, .form-container:hover,
.form-card:hover, .card-box:hover, .users-card:hover {
  border-color: #c3d8dc !important;
  box-shadow: 0 16px 34px rgba(28, 53, 68, .11) !important;
}

/* Interface uses clear text labels in place of decorative icon glyphs. */
.wf-icon, .wf-arrow, .wf-header > span, .fa, [class^="fa-"], [class*=" fa-"],
.icon-only-decorative { display: none !important; }
.wf-item { gap: 0 !important; }

@keyframes ui-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  body { padding: 12px !important; }
  .app-header { align-items: flex-start !important; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 640px) {
  body { padding: 8px !important; }
  .stats-grid, .qlpk-sub-stats { grid-template-columns: 1fr !important; }
  .app-header { border-radius: 12px !important; }
  .header-actions { width: 100%; }
  .header-actions > * { flex: 1 1 auto; }
  .toolbar, .control-bar { align-items: stretch !important; }
  .qlpk-main-title { width:100%; flex-direction:column; gap:8px; padding:0; text-align:center; }
  .qlpk-main-logo { width:min(210px,58vw); }
  .qlpk-main-title-copy { text-align:center; }
}

/* Center action buttons consistently across the main workflow pages. */
.app-header { flex-wrap:wrap !important; }
.app-header .header-actions { width:100%; justify-content:center !important; }
.pk-form-root-container .actions {
  display:flex !important;
  width:100% !important;
  max-width:none !important;
  align-self:stretch !important;
  justify-content:center !important;
  align-items:center !important;
  margin-left:auto !important;
  margin-right:auto !important;
  flex-wrap:wrap !important;
}
.clinic-admin-app .action-cell { justify-content:center !important; align-items:center !important; flex-wrap:wrap !important; gap:5px !important; min-width:0 !important; }
.clinic-admin-app .action-cell .action-btn { width:auto !important; min-width:0 !important; height:28px !important; padding:0 8px !important; border-radius:7px !important; font-size:10px !important; line-height:1 !important; white-space:nowrap; }
.clinic-admin-app table.table-data th:last-child, .clinic-admin-app table.table-data td:last-child { min-width:235px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Account administration page */
.account-admin-page { max-width: 1600px !important; margin: 0 auto !important; }
.account-admin-page .header-box { padding: clamp(18px, 2.3vw, 30px) !important; border: 1px solid #244957; border-radius: 16px !important; background: linear-gradient(115deg, #183b4a, #126b7a) !important; box-shadow: 0 14px 30px rgba(20,58,72,.14) !important; }
.account-admin-page .header-box h1 { font-size: clamp(19px, 2vw, 25px); }
.account-admin-page .header-box p { max-width: 700px; line-height: 1.6; }
.account-admin-page .btn-back { padding: 10px 15px; border-radius: 9px; transition: background .18s ease, transform .18s ease; }
.account-admin-page .btn-back:hover { transform: translateY(-2px); }
.account-admin-grid { grid-template-columns: minmax(290px, 350px) minmax(0, 1fr) !important; gap: 20px !important; align-items: start; }
.account-admin-page .card { min-width: 0; border-radius: 15px !important; }
.account-admin-page .card h2 { color: #173d4b; font-size: 16px; line-height: 1.45; }
.account-admin-page .form-group { margin-bottom: 17px; }
.account-admin-page .form-group label { color: #355463; font-size: 11px; letter-spacing: .035em; }
.account-admin-page .input-text, .account-admin-page .select-custom { min-height: 42px; background-color: #fbfdfe; }
.account-admin-page .btn-submit { min-height: 44px; background: #126b7a; }
.account-admin-page .btn-submit:hover { background: #0c5360; }
.account-admin-page .account-list-card > div { overflow-x: auto; border: 1px solid #e4ecef; border-radius: 11px; }
.account-admin-page table { min-width: 650px; font-size: 13px; }
.account-admin-page th { padding: 13px 12px; background: #f1f7f8; color: #355463; }
.account-admin-page td { padding: 13px 12px; }
.account-admin-page .action-btns { gap: 7px; flex-wrap: wrap; }
.account-admin-page .btn-act { min-height: 32px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 7px; transition: transform .16s ease, box-shadow .16s ease; }
.account-admin-page .btn-act:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(24,59,74,.12); }
.account-admin-page .modal-content { border: 1px solid #dce5eb; border-radius: 16px; }
@media (max-width: 850px) { .account-admin-grid { grid-template-columns: minmax(0, 1fr) !important; } }
@media (max-width: 600px) { .account-admin-page .header-box { align-items:flex-start; flex-direction:column; gap:15px; } .account-admin-page .btn-back { width:100%; text-align:center; } .account-admin-page .card { padding:17px !important; } }

/* Shared responsive rules for the application pages */
@media (max-width: 900px) {
  .app-header { align-items:flex-start !important; gap:14px !important; }
  .app-header > div:first-child { flex:1 1 100%; min-width:0; }
  .app-header .header-actions { display:flex !important; flex:1 1 100%; flex-wrap:wrap; justify-content:center !important; gap:8px; }
  .app-header .header-actions > * { flex:1 1 150px; }
  .app-header .header-actions .btn-ui { width:100%; }
  .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  .form-grid, .grid-2, .row-grid, .sign-grid, .grid-master { grid-template-columns:minmax(0,1fr) !important; }
  .booking-row { display:grid !important; grid-template-columns:minmax(0,1fr) !important; }
  .booking-row > *, .grid-2 > *, .row-grid > *, .sign-grid > * { min-width:0; }
  .monthly-head, .monthly-head-left, .monthly-head-right { flex-wrap:wrap; }
  .clinic-admin-app .bulk-actions-bar, .clinic-trash-app .bulk-actions-bar { align-items:flex-start; }
}

@media (max-width: 640px) {
  html, body { width:100%; min-width:0; }
  body { padding:8px !important; overflow-x:hidden; }
  #qlpk-hub, .clinic-admin-app, .clinic-phieukham-app, .clinic-trash-app,
  .booking-clinic-wrapper, .clinic-edit-app, .container, .pk-form-root-container {
    width:100% !important; max-width:100% !important; min-width:0 !important; margin-left:auto !important; margin-right:auto !important;
  }
  .app-header { padding:16px !important; border-radius:13px !important; }
  .app-header h1 { font-size:clamp(18px,5vw,23px) !important; line-height:1.3; }
  .app-header p { font-size:12px !important; }
  .app-header .header-actions { display:grid !important; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
  .app-header .header-actions > * { min-width:0; }
  .app-header .header-actions > *:first-child:last-child { grid-column:1 / -1; }
  .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:8px !important; }
  .stat-card { min-width:0; padding:12px !important; }
  .stat-card .value { overflow-wrap:anywhere; font-size:clamp(17px,5vw,23px); }
  .workflow-card, .booking-card, .form-container, .form-card, .section-card, .card-box, .card,
  .users-card, .control-bar, .table-wrap { min-width:0; }
  .control-bar { flex-wrap:wrap; gap:9px !important; padding:12px !important; }
  .control-bar > form { display:flex !important; flex-wrap:wrap; width:100%; gap:8px !important; }
  .control-bar > form > * { min-width:0; max-width:100%; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { max-width:100%; min-width:0; font-size:16px !important; }
  .form-group, .mb-3 { min-width:0; }
  .form-group input, .form-group select, .form-group textarea, .input-custom, .select-custom { width:100%; }
  .form-group.full, .form-row-full, .full-width { grid-column:1 / -1; }
  .table-wrap, .table-wrapper, .table-responsive, .account-list-card > div { width:100%; max-width:100%; overflow-x:auto !important; -webkit-overflow-scrolling:touch; }
  table { max-width:none; }
  .table-wrap table, .table-wrapper table, .table-responsive table { min-width:720px; }
  .table-data th, .table-data td { white-space:nowrap; }
  .clinic-admin-app .action-cell { justify-content:flex-start !important; }
  .modal, .modal-overlay, .service-modal-overlay { padding:8px !important; }
  .modal-content, .modal-box, .service-modal-box { width:100% !important; max-width:100% !important; max-height:92vh !important; padding:16px !important; overflow:auto; }
  .pagination-bar, .page-nav { flex-wrap:wrap; justify-content:center; gap:6px; }
  .pagination-bar > *, .page-nav > * { min-width:36px; }
  .btn-group { display:flex !important; flex-wrap:wrap; justify-content:center; gap:8px; }
  .btn-group > * { flex:1 1 140px; min-width:0; }
  .bulk-actions-bar { display:flex; flex-wrap:wrap; gap:8px; }
  .bulk-actions-bar > * { flex:1 1 130px; }
  .btn-bar, .pk-form-root-container .actions { display:flex !important; flex-wrap:wrap !important; justify-content:center !important; gap:8px !important; }
  .btn-bar > *, .pk-form-root-container .actions > * { flex:1 1 145px; min-width:0; }
  .pk-form-root-container { padding:14px !important; border-radius:12px !important; }
  .pk-form-root-container .form-grid { grid-template-columns:minmax(0,1fr) !important; }
  .pk-form-root-container .form-group.full-width { grid-column:1 / -1 !important; }
  .pk-form-root-container .payment-summary-layout { grid-template-columns:1fr !important; gap:12px !important; }
  .pk-form-root-container .payment-summary-layout .payment-qr-block { order:2; }
  .pk-form-root-container .payment-summary-content { width:100%; overflow-x:auto; }
  .pk-form-root-container .payment-summary-content .payment-summary-table { width:100% !important; }
  .pk-form-root-container .payment-summary-content .payment-summary-table .pay-label { white-space:normal; }
  .pk-form-root-container .payment-summary-content .payment-summary-table .pay-val { white-space:nowrap; }
  .pk-form-root-container .signature-section { gap:10px; margin-top:22px !important; }
  .pk-form-root-container .signature-box { width:50% !important; overflow-wrap:anywhere; }
  .pk-form-root-container .service-table { min-width:650px; }
  .calendar-grid { gap:3px !important; }
  .calendar-grid > * { min-width:0; }
  .booking-clinic-wrapper .booking-card { padding:16px !important; }
  .booking-header { align-items:flex-start !important; flex-direction:column; gap:8px; }
  .canvas-wrap, .canvas-wrap canvas { width:100% !important; max-width:100% !important; }
  .sign-grid { grid-template-columns:minmax(0,1fr) !important; }
  .login-shell { width:100% !important; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns:minmax(0,1fr) !important; }
  .app-header .header-actions { grid-template-columns:minmax(0,1fr); }
  .app-header .header-actions > * { grid-column:1 / -1; }
  .pk-form-root-container .signature-section { flex-direction:column; }
  .pk-form-root-container .signature-box { width:100% !important; }
}

/* Final layout refinements: readable forms, colored summaries and phone-safe tables. */
.qlpk-sub-stats .sub-stat-item {
  color: #111827 !important;
  border: 1px solid #dce5eb !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: none !important;
}
.qlpk-sub-stats .sub-stat-item:nth-child(2) {
  border-color: #dce5eb !important;
  background: #fff !important;
  box-shadow: none !important;
}
.qlpk-sub-stats .sub-stat-item:nth-child(3) {
  border-color: #dce5eb !important;
  background: #fff !important;
  box-shadow: none !important;
}
.qlpk-sub-stats .sub-title, .qlpk-sub-stats .sub-desc,
.qlpk-sub-stats .sub-val { color: #111827 !important; }
.qlpk-sub-stats .sub-pill-badge { color:#111827 !important; background:#f8fafc !important; border-color:#dce5eb !important; }

/* Keep form pages comfortable to use without stretching their input panels across the screen. */
.booking-clinic-wrapper { width: min(100%, 980px) !important; margin: 24px auto !important; }
.booking-clinic-wrapper .booking-card { padding: clamp(20px, 3vw, 36px) !important; }
.clinic-edit-app { width: min(100%, 1120px) !important; margin: 24px auto !important; }
.clinic-edit-app .form-container { max-width: 100% !important; }
.pk-form-root-container { width: min(100%, 1180px) !important; max-width: 1180px !important; margin: 20px auto !important; }
.finance-create-page { width: min(100%, 980px) !important; max-width: 980px !important; margin: 24px auto !important; }
.pk-form-root-container .form-group { display:grid !important; grid-template-columns:100px minmax(0,1fr); gap:10px !important; }
.pk-form-root-container .form-group label { width:100px; text-align:left; color:#111827 !important; }
.pk-form-root-container .payment-summary-layout { justify-content:flex-end !important; }
.pk-form-root-container .payment-summary-content { width:min(100%, 520px) !important; margin-left:auto !important; }

/* Keep only the direct record actions together at the end of the form. */
.pk-form-root-container .actions {
  display:grid !important;
  width:min(100%, 820px) !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  align-items:center !important;
  gap:10px !important;
  margin-left:auto !important;
  margin-right:auto !important;
}
.pk-form-root-container .actions > .action-row {
  display:contents !important;
}
.pk-form-root-container .actions .btn-save,
.pk-form-root-container .actions .btn-print,
.pk-form-root-container .actions .btn-cancel {
  width:100% !important;
  min-width:0 !important;
  min-height:44px !important;
  padding:8px 12px !important;
  font-size:12px !important;
  line-height:1.25 !important;
}
.pk-form-root-container .actions .btn-cancel { box-shadow:none !important; }
.pk-form-root-container.view-only .actions { grid-template-columns:minmax(0,260px) !important; justify-content:center !important; }
@media (max-width:640px) {
  .pk-form-root-container .actions { grid-template-columns:minmax(0,1fr) !important; gap:8px !important; }
}

/* Add restrained color to management lists only. */
.clinic-admin-app .table-data thead th,
.clinic-phieukham-app .table-data thead th,
.container .table-data thead th { background:#eaf3f8 !important; color:#123b50 !important; }
.clinic-admin-app .table-data tbody tr:nth-child(even) td,
.clinic-phieukham-app .table-data tbody tr:nth-child(even) td,
.container .table-data tbody tr:nth-child(even) td { background:#f4f9fc; }
.clinic-admin-app .table-data tbody tr:hover td,
.clinic-phieukham-app .table-data tbody tr:hover td,
.container .table-data tbody tr:hover td { background:#e7f3f8 !important; }

/* Appointment controls remain on one line; phone users can scroll the table horizontally. */
.clinic-admin-app .action-cell { flex-wrap:nowrap !important; white-space:nowrap !important; gap:4px !important; min-width:max-content !important; }
.clinic-admin-app .action-btn { width:34px !important; min-width:34px !important; height:28px !important; padding:0 4px !important; font-size:10px !important; }
.clinic-admin-app .action-btn svg { display:block; width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.sr-only { position:absolute !important; width:1px !important; height:1px !important; padding:0 !important; margin:-1px !important; overflow:hidden !important; clip:rect(0,0,0,0) !important; white-space:nowrap !important; border:0 !important; }
.clinic-admin-app .act-print { background:#e0f2fe !important; color:#0369a1 !important; border:1px solid #bae6fd !important; }
.clinic-admin-app table.table-data th:last-child, .clinic-admin-app table.table-data td:last-child { min-width:270px !important; }
.clinic-admin-app .appointment-note-cell { min-width:220px; max-width:340px; white-space:normal !important; line-height:1.45; color:#243746 !important; }

/* Replace muted gray utility text with legible dark text while retaining semantic status colors. */
.qlpk-sub-stats .sub-desc, .booking-header p,
.detail-label, .form-group label, .account-admin-page .form-group label,
.table-data td[style*="64748b"], .table-data td[style*="94a3b8"],
.wf-info span, .muted, .text-muted { color:#111827 !important; }
.app-header p { color:#e8f4f7 !important; }
input::placeholder, textarea::placeholder { color:#111827 !important; opacity:.72; }
[style*="#64748b"], [style*="#94a3b8"], [style*="#475569"] { color:#111827 !important; }

@media (max-width: 640px) {
  .booking-clinic-wrapper, .clinic-edit-app, .pk-form-root-container, .finance-create-page {
    width:100% !important; max-width:100% !important; margin:8px auto !important;
  }
  .pk-form-root-container .form-group { grid-template-columns:1fr !important; gap:5px !important; }
  .pk-form-root-container .form-group label { width:auto !important; }
  .clinic-admin-app .action-cell { justify-content:flex-start !important; }
  .clinic-admin-app .action-btn { width:34px !important; min-width:34px !important; }
}

/* Medical-record summary cards: soft full-card color grouped by metric. */
.clinic-phieukham-app .stats-grid .stat-card {
  border-radius:13px !important;
  box-shadow:0 7px 18px rgba(29,65,82,.07) !important;
  transition:transform .18s ease, box-shadow .18s ease !important;
}
.clinic-phieukham-app .stats-grid .stat-card:hover {
  transform:translateY(-3px);
  box-shadow:0 12px 24px rgba(29,65,82,.12) !important;
}
.clinic-phieukham-app .stats-grid .stat-card.blue:nth-child(1) { background:linear-gradient(135deg,#e0f2fe,#f4fbff) !important; border-color:#bae6fd !important; }
.clinic-phieukham-app .stats-grid .stat-card.blue:nth-child(2) { background:linear-gradient(135deg,#dbeafe,#f5f8ff) !important; border-color:#bfdbfe !important; }
.clinic-phieukham-app .stats-grid .stat-card.green { background:linear-gradient(135deg,#dcfce7,#f3fff7) !important; border-color:#bbf7d0 !important; }
.clinic-phieukham-app .stats-grid .stat-card.cash { background:linear-gradient(135deg,#fef3c7,#fffdf5) !important; border-color:#fde68a !important; }
.clinic-phieukham-app .stats-grid .stat-card.transfer { background:linear-gradient(135deg,#e0e7ff,#f7f8ff) !important; border-color:#c7d2fe !important; }
.clinic-phieukham-app .stats-grid .stat-card.red { background:linear-gradient(135deg,#fee2e2,#fff7f7) !important; border-color:#fecaca !important; }
.clinic-phieukham-app .stats-grid .stat-card .label { color:#263b4b !important; }

/* Finance overview metrics get matching soft color fills. */
.container .stats-grid .stat-card.red { background:linear-gradient(135deg,#fee2e2,#fff8f8) !important; border-color:#fecaca !important; }
.container .stats-grid .stat-card.cash { background:linear-gradient(135deg,#dcfce7,#f6fff9) !important; border-color:#bbf7d0 !important; }
.container .stats-grid .stat-card.bank { background:linear-gradient(135deg,#dbeafe,#f7faff) !important; border-color:#bfdbfe !important; }
.container .stats-grid .stat-card.amber { background:linear-gradient(135deg,#fef3c7,#fffdf6) !important; border-color:#fde68a !important; }
.container .stats-grid .stat-card:not(.red):not(.cash):not(.bank):not(.amber) { background:linear-gradient(135deg,#e0f2fe,#f8fcff) !important; border-color:#bae6fd !important; }
.container .stats-grid .stat-card { border-radius:13px !important; box-shadow:0 7px 18px rgba(29,65,82,.07) !important; }
.container .stats-grid .stat-card .label { color:#263b4b !important; }

/* Homepage: refined spacing and surfaces while keeping the logo area unframed. */
#qlpk-hub { padding-bottom:clamp(24px,5vh,64px) !important; }
#qlpk-hub .qlpk-main-title { margin-top:clamp(12px,3vh,36px) !important; margin-bottom:30px !important; }
#qlpk-hub .qlpk-main-title h1 { letter-spacing:.015em !important; text-wrap:balance; }
#qlpk-hub .qlpk-main-title h2 { letter-spacing:.13em !important; }
#qlpk-hub .qlpk-toggle-bar { margin-bottom:clamp(24px,4vh,38px) !important; }
#qlpk-hub .qlpk-segmented-switch.three-tabs { border-color:#d3e1e8 !important; box-shadow:0 10px 26px rgba(23,61,75,.1) !important; }
#qlpk-hub .qlpk-panel-title, #qlpk-hub .qlpk-section-header { margin-bottom:14px !important; }
#qlpk-hub .qlpk-sub-stats { padding:clamp(18px,2vw,26px) !important; gap:clamp(12px,2vw,22px) !important; }
#qlpk-hub .sub-stat-item { padding:4px 12px !important; }
#qlpk-hub .qlpk-workflow-grid { gap:18px !important; }
#qlpk-hub .workflow-card { border-color:#dce7ed !important; background:rgba(255,255,255,.94) !important; }
#qlpk-hub .wf-header { color:#173d4b !important; border-bottom-color:#dce7ed !important; }
#qlpk-hub .wf-item { border-color:#dbe6ed !important; background:#f7fafc !important; transition:background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease !important; }
#qlpk-hub .wf-item:hover { background:#edf6fb !important; border-color:#a9cfdf !important; transform:translateY(-2px); box-shadow:0 8px 18px rgba(24,74,99,.1); }
#qlpk-hub .qlpk-sub-stats .sub-stat-item {
  min-height:132px; padding:17px 18px !important; border:1px solid #d7e6ee !important;
  border-top:4px solid #0284c7 !important; border-radius:13px !important;
  background:linear-gradient(145deg,#eaf6fc,#fff 78%) !important;
  box-shadow:0 6px 16px rgba(27,76,98,.07) !important;
}
#qlpk-hub .qlpk-sub-stats .sub-stat-item:nth-child(2) { border-top-color:#059669 !important; background:linear-gradient(145deg,#eaf9f1,#fff 78%) !important; }
#qlpk-hub .qlpk-sub-stats .sub-stat-item:nth-child(3) { border-top-color:#d97706 !important; background:linear-gradient(145deg,#fff5e8,#fff 78%) !important; }
#qlpk-hub .qlpk-sub-stats .sub-title { color:#173d4b !important; }
#qlpk-hub .qlpk-sub-stats .sub-val { color:#0369a1 !important; }
#qlpk-hub .qlpk-sub-stats .sub-stat-item:nth-child(2) .sub-val { color:#047857 !important; }
#qlpk-hub .qlpk-sub-stats .sub-stat-item:nth-child(3) .sub-val { color:#b45309 !important; }
#qlpk-hub .qlpk-sub-stats .sub-desc { color:#334155 !important; }
#qlpk-hub .qlpk-sub-stats .sub-stat-item:not(:last-child) { border-right:1px solid #d7e6ee !important; }
@media (max-width:640px) {
  #qlpk-hub .qlpk-main-title { margin:10px auto 22px !important; }
  #qlpk-hub .qlpk-main-logo { width:min(190px,56vw) !important; }
  #qlpk-hub .qlpk-sub-stats { padding:14px !important; }
  #qlpk-hub .sub-stat-item { padding:8px 4px !important; }
}

/* Soft color wash on the dashboard background; keep content cards crisp and unframed. */
body.home-dashboard-body {
  background:
    radial-gradient(ellipse at 8% 12%, rgba(56,189,248,.14), transparent 32%),
    radial-gradient(ellipse at 92% 18%, rgba(16,185,129,.11), transparent 30%),
    radial-gradient(ellipse at 78% 88%, rgba(251,146,60,.08), transparent 28%),
    linear-gradient(135deg,#f2f7fb 0%,#f5faf8 55%,#f8f7f3 100%) fixed !important;
}
#qlpk-hub .auth-bar { animation:ui-enter .32s both; }
#qlpk-hub .qlpk-toggle-bar { animation:ui-enter .42s .04s both; }
#qlpk-hub .qlpk-sub-stats .sub-stat-item { animation:ui-enter .38s both; }
#qlpk-hub .qlpk-sub-stats .sub-stat-item:nth-child(2) { animation-delay:.06s; }
#qlpk-hub .qlpk-sub-stats .sub-stat-item:nth-child(3) { animation-delay:.12s; }
#qlpk-hub .workflow-card:nth-child(1) { animation:ui-enter .38s .04s both; }
#qlpk-hub .workflow-card:nth-child(2) { animation:ui-enter .38s .1s both; }

/* Shared interaction polish across application pages. */
.app-header, .control-bar, .table-wrap, .calendar-card, .calendar-panel {
  animation:ui-enter .34s both;
}
.wf-item, .filter-pills a, .page-nav a, .stat-badge, .status-badge,
.badge-status, .source-badge { transition:transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease !important; }
.filter-pills a:hover, .page-nav a:hover { transform:translateY(-1px); box-shadow:0 4px 10px rgba(24,74,99,.1); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline:3px solid rgba(2,132,199,.28) !important; outline-offset:2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:.01ms !important; animation-iteration-count:1 !important;
    scroll-behavior:auto !important; transition-duration:.01ms !important;
  }
}

/* At-home medical records use the clinic's orange identity; in-clinic records stay blue. */
.home-records-page .app-header {
  background:linear-gradient(115deg,#a84c16,#d97735) !important;
  border-color:#d97735 !important;
}
.home-records-page .btn-brand {
  background:#c96b2c !important;
  border-color:#b45309 !important;
}
.home-records-page .btn-brand:hover {
  background:#b45309 !important;
}
.home-records-page .stats-grid .stat-card {
  box-shadow:inset 0 3px 0 rgba(234,88,12,.18),0 8px 20px rgba(154,52,18,.06) !important;
}
.home-records-page .stats-grid .stat-card.blue:nth-child(1),
.home-records-page .stats-grid .stat-card.blue:nth-child(2) {
  background:linear-gradient(135deg,#fff4e8,#fffdf9) !important;
  border-color:#f5d4b7 !important;
}
.home-records-page .stats-grid .stat-card.green { background:linear-gradient(135deg,#dcfce7,#f5fff8) !important; border-color:#bbf7d0 !important; }
.home-records-page .stats-grid .stat-card.cash { background:linear-gradient(135deg,#fef3c7,#fffdf5) !important; border-color:#fde68a !important; }
.home-records-page .stats-grid .stat-card.transfer { background:linear-gradient(135deg,#fff4e8,#fffdf9) !important; border-color:#f5d4b7 !important; }
.home-records-page .stats-grid .stat-card.red { background:linear-gradient(135deg,#fee2e2,#fff7f7) !important; border-color:#fecaca !important; }
.home-records-page .table-data thead th { background:#fff6ed !important; color:#9a4d1d !important; border-bottom-color:#f5d4b7 !important; }
.home-records-page .table-data tbody tr:nth-child(even) td { background:#fffaf5 !important; }
.home-records-page .table-data tbody tr:hover td { background:#fff2e3 !important; }
.home-records-page .page-nav .active { background:#c96b2c !important; border-color:#c96b2c !important; }
.home-records-page .act-print { background:#fff9f2 !important; color:#a64b10 !important; border-color:#efc49f !important; }
.home-records-page .code-badge { color:#a64b10 !important; background:#fff9f2 !important; border-color:#f0d4bd !important; }

/* Finance/expense management uses green to distinguish it from clinic blue and home-visit orange. */
.finance-index-page .app-header {
  background:linear-gradient(115deg,#23643e,#3d9360) !important;
  border-color:#3d9360 !important;
}
.finance-index-page .btn-brand,
.finance-index-page .btn-purple {
  background:#198754 !important;
  border-color:#167548 !important;
  color:#fff !important;
}
.finance-index-page .btn-brand:hover,
.finance-index-page .btn-purple:hover { background:#146c43 !important; }
.finance-index-page .stats-grid .stat-card {
  background:linear-gradient(135deg,#f1faf4,#fff) !important;
  border-color:#c8e6d2 !important;
  box-shadow:inset 0 3px 0 rgba(61,147,96,.14),0 8px 20px rgba(35,100,62,.05) !important;
}
.finance-index-page .stats-grid .stat-card .value { color:#28794c !important; }
.finance-index-page .table-data thead th {
  background:#eaf5ee !important;
  color:#286344 !important;
  border-bottom-color:#c8e6d2 !important;
}
.finance-index-page .table-data tbody tr:nth-child(even) td { background:#f7fbf8 !important; }
.finance-index-page .table-data tbody tr:hover td { background:#edf7f0 !important; }
.finance-index-page .code-badge { color:#28794c !important; background:#f1faf4 !important; border-color:#c8e6d2 !important; }

/* Keep the softer orange identity consistent across at-home appointment and record tools. */
.home-appointments-page .app-header {
  background:linear-gradient(115deg,#a84c16,#d97735) !important;
  border-color:#d97735 !important;
}
.home-appointments-page .btn-brand,
.home-appointment-form .booking-btn-submit,
.home-appointment-form .btn-primary {
  background:#c96b2c !important;
  border-color:#b45309 !important;
}
.home-appointments-page .btn-brand:hover,
.home-appointment-form .booking-btn-submit:hover,
.home-appointment-form .btn-primary:hover { background:#b45309 !important; }
.home-appointments-page .table-data thead th { background:#fff6ed !important; color:#9a4d1d !important; border-bottom-color:#f5d4b7 !important; }
.home-appointments-page .table-data tbody tr:nth-child(even) td { background:#fffaf5 !important; }
.home-appointments-page .table-data tbody tr:hover td { background:#fff2e3 !important; }
.home-appointments-page .filter-pills a.active { background:#d98245 !important; border-color:#d98245 !important; color:#fff !important; }
.home-appointments-page .cal-cell.selected { background:#fff4e8 !important; border-color:#d98245 !important; box-shadow:0 0 0 1px #d98245 !important; }
.home-appointment-form input:focus,
.home-appointment-form textarea:focus,
.home-appointment-form select:focus { border-color:#d97735 !important; box-shadow:0 0 0 3px rgba(217,119,53,.12) !important; }
.home-appointment-form .booking-header h1 { color:#a6531f !important; }
.pk-form-root-container.home-mode .header { border-bottom-color:#d49a70 !important; }
.pk-form-root-container.home-mode .clinic-info p:first-child strong,
.pk-form-root-container.home-mode .clinic-info h3,
.pk-form-root-container.home-mode .title { color:#a6531f !important; }
.pk-form-root-container.home-mode .section-header,
.pk-form-root-container.home-mode .btn-add,
.pk-form-root-container.home-mode .btn-save { background:linear-gradient(135deg,#d98245,#c96b2c) !important; }
.pk-form-root-container.home-mode .gender-radio-group input[type="radio"] { accent-color:#d97735 !important; }
.pk-form-root-container.home-mode table.service-table th { color:#9a4d1d !important; background-color:#fff8f1 !important; border-bottom-color:#f1d5bd !important; }
.pk-form-root-container.home-mode .unit-price-input,
.pk-form-root-container.home-mode #totalCost,
.pk-form-root-container.home-mode .service-table td[style*="color"] { color:#a6531f !important; }
.pk-form-root-container.home-mode .service-item-card.checked { background:#fff8f1 !important; border-color:#e7b990 !important; }

/* Soften the green identity throughout expense entry, list, and print controls. */
.finance-create-page .btn-submit,
.finance-print-page .btn-print { background:#198754 !important; }
.finance-create-page .btn-submit:hover,
.finance-print-page .btn-print:hover { background:#146c43 !important; }
.finance-create-page .sign-card-title { color:#28794c !important; }
.finance-create-page .input-text:focus,
.finance-create-page .select-custom:focus,
.finance-create-page .textarea-custom:focus { border-color:#70b98e !important; box-shadow:0 0 0 3px rgba(61,147,96,.12) !important; }

/* Dashboard accents for the at-home and expense panels use lighter fills and borders. */
#tab-home:checked ~ .qlpk-toggle-glider { background:linear-gradient(135deg,#e98a4c,#c96b2c) !important; }
.tn-border { border-left-color:#e0a174 !important; }
.tn-border h3 { color:#a6531f !important; }
.tn-sec { border-left-color:#e0a174 !important; }
#panel-home .qlpk-sub-stats { border-color:#f0d8c5 !important; }
#panel-home .wf-item:hover { background:linear-gradient(135deg,#fff9f3,#fff1e4) !important; border-color:#e7b990 !important; box-shadow:0 8px 18px rgba(180,83,9,.09) !important; }
#panel-home .wf-item:hover .wf-icon { border-color:#e7b990 !important; }
#panel-home .wf-item:hover .wf-info strong { color:#a6531f !important; }
#panel-home .wf-item:hover .wf-arrow { color:#c96b2c !important; }
#tab-expense:checked ~ .qlpk-toggle-glider { background:linear-gradient(135deg,#53a878,#34875b) !important; }
.exp-border { border-left-color:#9bc8aa !important; }
.exp-border h3 { color:#28794c !important; }
.exp-sec { border-left-color:#9bc8aa !important; }
#panel-expense .qlpk-sub-stats { border-color:#cfe5d5 !important; }
#panel-expense .wf-item:hover { background:linear-gradient(135deg,#f8fcf9,#edf7f0) !important; border-color:#b8d8c2 !important; box-shadow:0 8px 18px rgba(35,100,62,.08) !important; }
#panel-expense .wf-item:hover .wf-icon { border-color:#b8d8c2 !important; }
#panel-expense .wf-item:hover .wf-info strong,
#panel-expense .wf-item:hover .wf-arrow { color:#28794c !important; }

/* Use consistent black section headings across all three dashboard tabs. */
.qlpk-panel-title h3,
.qlpk-section-header h3 { color:#000 !important; }

/* Final responsive pass: keep the dashboard controls and forms usable on narrow phones. */
#qlpk-hub { width:min(100%, 1240px) !important; margin-inline:auto !important; padding-inline:clamp(12px, 3vw, 24px) !important; }
#qlpk-hub .qlpk-toggle-bar { min-width:0; }
#qlpk-hub .qlpk-segmented-switch.three-tabs { min-width:0; }
#qlpk-hub .qlpk-segmented-switch label { min-width:0; overflow-wrap:anywhere; }
#qlpk-hub .qlpk-workflow-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
#qlpk-hub .workflow-card { min-width:0; }
#qlpk-hub .wf-item, #qlpk-hub .wf-info { min-width:0; }
#qlpk-hub .wf-info strong, #qlpk-hub .wf-info span { overflow-wrap:anywhere; }

@media (max-width: 760px) {
  #qlpk-hub .qlpk-workflow-grid { grid-template-columns:minmax(0, 1fr) !important; }
  #qlpk-hub .workflow-card[style*="grid-column"] { grid-column:1 / -1 !important; }
  #qlpk-hub .qlpk-sub-stats { grid-template-columns:minmax(0, 1fr) !important; }
  #qlpk-hub .qlpk-sub-stats .sub-stat-item { min-height:0; }
  #qlpk-hub .qlpk-sub-stats .sub-stat-item:not(:last-child) { border-right:0 !important; border-bottom:1px solid #d7e6ee !important; padding-bottom:16px !important; }
}

@media (max-width: 480px) {
  body { padding: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)) !important; }
  #qlpk-hub { padding-inline:4px !important; margin-top:6px !important; }
  #qlpk-hub .auth-bar { gap:7px; }
  #qlpk-hub .auth-identity { min-width:0; flex-wrap:wrap; }
  #qlpk-hub .auth-user { overflow-wrap:anywhere; }
  #qlpk-hub .btn-auth-users, #qlpk-hub .btn-auth-logout { min-height:44px; }
  #qlpk-hub .qlpk-main-title { gap:5px; }
  #qlpk-hub .qlpk-main-logo { width:min(150px, 42vw) !important; }
  #qlpk-hub .qlpk-main-title-copy h2 { font-size:11px !important; }
  #qlpk-hub .qlpk-main-title-copy h1 { font-size:clamp(17px, 5.2vw, 22px) !important; }
  #qlpk-hub .qlpk-segmented-switch label { font-size:clamp(9px, 2.7vw, 11px) !important; line-height:1.25; padding-inline:2px !important; }
  #qlpk-hub .qlpk-panel-title h3, #qlpk-hub .qlpk-section-header h3 { font-size:14px; line-height:1.4; }
  #qlpk-hub .workflow-card { padding:13px !important; }
  #qlpk-hub .wf-item { min-height:54px; padding:12px 10px !important; }
  #qlpk-hub .wf-info strong { font-size:12px; line-height:1.4; }
  #qlpk-hub .wf-info span { font-size:11px; line-height:1.45; }
  .pk-form-root-container, .booking-clinic-wrapper .booking-card, .card, .form-card { padding:14px !important; }
  .app-header .header-actions > *, .btn-group > *, .btn-bar > *, .pk-form-root-container .actions > * { min-height:44px; }
  .table-wrap, .table-wrapper, .table-responsive, .portal-table-wrap { overscroll-behavior-inline:contain; scrollbar-width:thin; }
}
