/* Cross-app feedback only: toast notifications. */
.count-badge{background:var(--primary);color:#fff;min-width:18px;text-align:center;font-variant-numeric:tabular-nums;border-radius:10px}

.toast-stack{position:fixed;bottom:calc(78px + env(safe-area-inset-bottom,0px));right:12px;left:12px;z-index:2000;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none}
@media(min-width:760px){.toast-stack{left:auto;right:18px;max-width:380px;align-items:flex-end}}
.toast{pointer-events:auto;display:flex;align-items:center;gap:8px;background:#0f172a;color:#f8fafc;border:1px solid rgba(255,255,255,.14);border-radius:12px;padding:10px 14px;font-size:11px;font-weight:700;box-shadow:0 12px 30px rgba(2,6,23,.4);opacity:0;transform:translateY(14px) scale(.97);transition:opacity .28s ease,transform .28s ease;max-width:100%}
.toast.show{opacity:1;transform:translateY(0) scale(1)}
.toast-success{border-color:rgba(16,185,129,.5);background:linear-gradient(180deg,#065f46,#064e3b)}
.toast-error{border-color:rgba(248,113,113,.5);background:linear-gradient(180deg,#991b1b,#7f1d1d)}
.toast-info{border-color:rgba(56,189,248,.5);background:linear-gradient(180deg,#0c4a6e,#075985)}
.toast-icon{font-size:15px;line-height:1}
.toast-text{line-height:1.5}

/* CSS ownership refactor checkpoint. */

/* Feature components — history and preview. */
.history-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin:6px 0 10px}
.stat-cell{background:#f8fafc;border:1px solid #e2e8f0;border-radius:9px;padding:8px 6px;text-align:center;display:flex;flex-direction:column;gap:3px}
.stat-cell .stat-label{font-size:8.5px;color:#64748b;font-weight:700}
.stat-cell strong{font-size:12px;color:var(--primary);font-variant-numeric:tabular-nums}
.stat-balance{background:#fef2f2;border-color:#fecaca}.stat-balance strong{color:#b91c1c}
.history-search{margin-bottom:10px;text-align:right;font-size:11px;padding:8px 10px}
.history-entry-main{min-width:0;text-align:right;flex:1}.history-entry-main small{display:block;margin-top:2px}.history-recno{color:#64748b;font-size:9px;font-weight:600}
@media(max-width:600px){.history-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}
.preview-modal-box{width:min(560px,94vw)!important;max-height:92vh;display:flex;flex-direction:column}
.preview-note{font-size:10px!important}.preview-stage{margin:8px 0;overflow:auto;background:#e2e8f0;border-radius:10px;padding:10px;display:flex;justify-content:center;max-height:64vh}
.preview-stage img{max-width:100%;height:auto;box-shadow:0 6px 24px rgba(15,23,42,.25);border-radius:4px;background:#fff}
.preview-loading{color:#475569;font-size:11px;padding:30px 10px}.preview-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.preview-actions .tool-btn{min-height:48px!important}
@media(max-width:600px){.preview-actions{grid-template-columns:1fr}}

/* Feature components — patient presentation. */
.patient-field{display:flex;flex-direction:column;gap:4px;min-width:0}
.patient-field>span{font-size:10px;font-weight:800;color:#073b63;line-height:1.2}
.patient-field .live-input{width:100%;box-sizing:border-box}
.history-search{width:100%;max-width:100%;box-sizing:border-box;min-height:38px;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.patient-list-actions button{appearance:none;border:1px solid #073b63;background:#073b63;color:#fff;border-radius:8px;padding:7px 12px;font:inherit;font-size:10px;font-weight:800;cursor:pointer;box-shadow:0 2px 7px rgba(7,59,99,.16);transition:.16s ease}
.patient-list-actions button:hover{background:#0f766e;border-color:#0f766e;transform:translateY(-1px)}
.patient-list-actions button:focus-visible{outline:2px solid #14b8a6;outline-offset:2px}
#receiptCurrencyBadge{display:inline-flex;align-items:center;justify-content:center;min-width:28px;padding:2px 6px;border-radius:999px;background:#e0f2fe;color:#073b63;border:1px solid #bae6fd;font-size:8px;font-weight:900;line-height:1;direction:ltr;unicode-bidi:isolate}
@media(max-width:600px){.patient-field>span{font-size:9px}.patient-list-actions{width:100%}.patient-list-actions button{width:100%;min-height:34px}}

.sync-badge{font-size:8px;background:#e2e8f0;color:#475569;border-radius:999px;padding:2px 8px;margin-inline-start:6px;vertical-align:middle}

.sync-auto-row{display:flex;align-items:center;gap:7px;font-size:10px;font-weight:700;color:#475569;margin:8px 0 2px}.sync-auto-row input{width:16px;height:16px}

.sync-status{margin-top:8px;font-size:9.5px;line-height:1.55;border-radius:7px;padding:7px 9px;border:1px solid #e2e8f0;background:#f8fafc;color:#475569}
.sync-status.sync-ok{background:#ecfdf5;border-color:#a7f3d0;color:#065f46}
.sync-status.sync-warn{background:#fffbeb;border-color:#fde68a;color:#92400e}
.sync-status.sync-error{background:#fef2f2;border-color:#fecaca;color:#b91c1c}
.sync-status.sync-busy{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
html[data-night="on"] .sync-badge{background:#1e293b;color:#cbd5e1}
html[data-night="on"] .sync-status{background:#111c33;border-color:#1e293b;color:#cbd5e1}


/* ===== AQSA7 Phase 2 / Task 2.6 — History / Receipts Ledger ===== */
.history-ledger-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin:2px 0 10px}
.history-ledger-head h3{margin:2px 0 3px;color:var(--color-text);font-size:15px}
.history-ledger-head p{margin:0;color:var(--color-text-muted);font-size:8.5px;line-height:1.5}
.history-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin:6px 0 10px}
.stat-cell{background:var(--color-surface);border:1px solid var(--color-border);border-radius:9px;padding:8px 6px;text-align:center;display:flex;flex-direction:column;gap:3px}
.stat-cell .stat-label{font-size:8.5px;color:var(--color-text-muted);font-weight:700}
.stat-cell strong{font-size:12px;color:var(--color-primary);font-variant-numeric:tabular-nums}
.stat-balance{background:#fff7ed;border-color:#fed7aa}.stat-balance strong{color:var(--color-warning)}
.history-ledger-tools{display:grid;grid-template-columns:minmax(0,1fr) 190px;gap:7px;margin-bottom:10px}
.history-search-wrap{min-width:0;position:relative;display:flex;align-items:center}
.history-search-wrap>span{position:absolute;inset-inline-start:10px;z-index:1}
.history-search{width:100%;max-width:100%;box-sizing:border-box;min-height:44px!important;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0!important;padding-inline-start:32px!important;font-size:11px}
.history-ledger-table-wrap{display:flex;flex-direction:column;gap:0;min-width:0}.history-ledger-table{display:flex;flex-direction:column;gap:5px;max-height:420px;overflow:auto}
.history-ledger-head-row,.history-ledger-row{display:grid;grid-template-columns:1fr 1.35fr 1.5fr .85fr .85fr .85fr .7fr 1.35fr;gap:6px;align-items:center}
.history-ledger-head-row{position:sticky;top:0;z-index:1;padding:7px 8px;background:#f1f5f9;border:1px solid var(--color-border);border-radius:7px;color:var(--color-text-muted);font-size:7.5px;font-weight:900}
.history-ledger-row{padding:8px;border:1px solid var(--color-border);border-radius:9px;background:var(--color-white);min-height:54px}
.history-ledger-row>div{min-width:0}
.history-ledger-row strong{display:block;color:var(--color-text);font-size:9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-ledger-row small{display:block;margin-top:2px;color:var(--color-text-muted);font-size:7.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-service-cell{color:var(--color-text-muted);font-size:7.5px;line-height:1.45;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-money{font-variant-numeric:tabular-nums;text-align:center}
.history-money span{display:block;color:var(--color-text);font-size:8.5px;font-weight:900}
.history-money small{font-size:6.5px}
.history-status-cell{text-align:center}
.history-status{display:inline-block;padding:4px 6px;border-radius:999px;font-size:7px;font-weight:900;white-space:nowrap}
.history-status-paid{background:#ecfdf5;color:#047857}.history-status-due{background:#fff7ed;color:#c2410c}
.history-list-actions{display:flex;gap:4px;justify-content:flex-end;flex-wrap:wrap}
.history-action{min-height:44px;padding:5px 7px;border:1px solid var(--color-border);border-radius:8px;background:var(--color-surface);color:var(--color-text);font:inherit;font-size:8px;font-weight:900;cursor:pointer}
.history-action:hover{border-color:var(--color-primary)}
.history-open{color:var(--color-primary)}.history-delete{color:var(--color-danger)}
.history-ledger-empty{padding:28px 12px;text-align:center;border:1px dashed var(--color-border);border-radius:10px;background:var(--color-surface);color:var(--color-text-muted);display:flex;flex-direction:column;gap:5px;font-size:9px}
.history-ledger-empty strong{color:var(--color-text);font-size:10px}
.history-footer{display:flex;gap:7px;justify-content:flex-end;margin-top:9px}
@media(max-width:900px){
 .history-ledger-head-row{display:none}
 .history-ledger-row{grid-template-columns:1.1fr 1.5fr .9fr .9fr;gap:7px;padding:9px}
 .history-service-cell{grid-column:1/-1;padding-top:2px;border-top:1px solid #f1f5f9}
 .history-money{text-align:start}.history-status-cell{text-align:start}
 .history-list-actions{grid-column:4;grid-row:2 / span 3;align-items:stretch;flex-direction:column}
 .history-action{width:100%}
}
@media(max-width:600px){
 .history-ledger-head{align-items:center}.history-ledger-tools{grid-template-columns:1fr}
 .history-ledger-row{grid-template-columns:1fr 1fr}.history-service-cell{grid-column:1/-1}
 .history-money{text-align:start}.history-status-cell{text-align:start}
 .history-list-actions{grid-column:2;grid-row:auto;flex-direction:row;align-items:center}
 .history-action{flex:1}.history-footer{display:grid;grid-template-columns:1fr}
 .history-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
}
html[data-night="on"] .history-ledger-head-row{background:#0f172a;border-color:#1e293b}
html[data-night="on"] .history-ledger-row,html[data-night="on"] .history-ledger-empty{background:#111c33;border-color:#1e293b}
html[data-night="on"] .history-service-cell{border-color:#1e293b}

/* Phase 2 — Settings dashboard foundation */
.settings-overview{display:flex;flex-direction:column;gap:12px;padding:16px;border:1px solid var(--color-border);border-radius:16px;background:var(--color-surface);margin-bottom:12px}.settings-overview h3{margin:4px 0 4px;font-size:18px;color:var(--color-text)}.settings-overview p{margin:0;color:var(--color-text-muted);font-size:12px;line-height:1.7}.settings-overview-chips{display:flex;flex-wrap:wrap;gap:6px}.settings-overview-chips span{display:inline-flex;align-items:center;min-height:32px;padding:0 10px;border:1px solid var(--color-border);border-radius:999px;background:var(--color-white);color:var(--color-text-muted);font-size:11px}.settings-drawer .setting-card{border:1px solid var(--color-border);border-radius:16px;background:var(--color-white);box-shadow:0 1px 2px rgba(15,23,42,.04)}.settings-drawer .setting-card h4{font-size:14px}.settings-drawer .setting-help{line-height:1.7}.settings-drawer button,.settings-drawer select{min-height:44px !important;box-sizing:border-box}.settings-drawer input:not([type="file"]){min-height:44px}.settings-drawer .grid-btns{gap:8px}@media (min-width:760px){.settings-overview{padding:18px 20px}.settings-drawer .drawer-body{padding-top:16px}.settings-drawer .setting-card{padding:16px}}
