/* Doctor workspace (front.layouts.doctor-layout) */
body.doctor-panel { background: var(--tint); }
.dp-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.dp-sidebar { width: 256px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.dp-brand { padding: 4px 8px 18px; }
.dp-nav { flex: 1; }
.dp-nav-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #9aa7b3; padding: 16px 10px 6px; }
.dp-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #33475b; font-weight: 600; font-size: .94rem; }
.dp-link i { width: 18px; text-align: center; color: #8595a3; }
.dp-link:hover { background: var(--tint); color: var(--brand-dark); }
.dp-link.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.dp-link.is-active i { color: var(--brand); }
.dp-link.is-soon { color: #8595a3; }
.dp-link .badge-soon { margin-left: auto; }
.dp-site-link { border-top: 1px solid var(--line); border-radius: 0; margin-top: 12px; padding-top: 14px; }

/* Main */
.dp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dp-topbar { display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.dp-title { font-size: 1.25rem; font-weight: 800; margin: 0; margin-right: auto; }
.dp-toggle { display: none; }
.dp-user { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px; font-weight: 600; color: var(--ink); }
.dp-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 13px; }
.dp-content { padding: 28px; max-width: 1200px; width: 100%; }
.dp-greeting { font-size: 1.05rem; color: var(--muted); margin-bottom: 16px; }
.dropdown-item i { width: 18px; margin-right: 6px; color: #8595a3; }

/* Cards */
.dp-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.dp-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.dp-empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.dp-empty > i { font-size: 28px; color: #b8c3cc; display: block; margin-bottom: 10px; }
.dp-card.dp-empty { padding: 48px 24px; }
.dp-soon { max-width: 640px; margin: 24px auto; }
.dp-soon-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; font-size: 26px; margin-bottom: 12px; }

/* Stats */
.dp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.dp-stat { display: flex; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.dp-stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.dp-stat.is-soon .dp-stat-icon { background: #f1f4f7; color: #9aa7b3; }
.dp-stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.dp-stat-value { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.dp-stat-soon { font-size: .82rem; font-weight: 600; color: #9aa7b3; }

/* Actions + completeness */
.dp-action { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font-weight: 600; margin-bottom: 8px; }
.dp-action > i:first-child { color: #e0a100; }
.dp-action:hover { border-color: var(--brand); color: var(--brand-dark); }
.dp-ring { --p: 0; width: 86px; height: 86px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) calc(var(--p) * 1%), #e8eef3 0); }
.dp-ring span { width: 66px; height: 66px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; }
.check-list-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.check-list-grid li { padding: 4px 0; font-size: .9rem; color: var(--muted); }
.check-list-grid li i.fa-circle { font-size: 8px; margin-top: 7px; color: #c9d3db; }

/* Profile + chambers */
.dp-photo { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; }
.dp-photo-empty { display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 48px; }
.dp-chamber { background: #fff; }
.dp-chamber.is-inactive { opacity: .7; }
.day-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.day-picker .btn-check:checked + .btn { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Mobile */
@media (max-width: 991.98px) {
    .dp-sidebar { position: fixed; left: 0; top: 0; z-index: 1050; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
    body.dp-open .dp-sidebar { transform: none; }
    .dp-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 31, 46, .4); z-index: 1040; }
    body.dp-open .dp-backdrop { display: block; }
    .dp-toggle { display: inline-flex; }
    .dp-topbar { padding: 12px 16px; }
    .dp-content { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) { .dp-sidebar { transition: none; } }

/* Feed */
.text-accent { color: var(--accent); }
.composer-input { border: 0; resize: vertical; padding: 4px 0; box-shadow: none !important; font-size: 1rem; }
.feed-tabs { display: inline-flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.feed-tab { border: 0; background: none; padding: 6px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: .92rem; }
.feed-tab.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.feed-post.is-hidden { border-style: dashed; }
.feed-author { font-weight: 700; color: var(--ink); }
.feed-author:hover { color: var(--brand); }
.feed-body { white-space: normal; word-wrap: break-word; line-height: 1.6; }
.feed-tag { color: var(--brand); font-weight: 600; }
.feed-media { display: grid; gap: 6px; margin-top: 12px; border-radius: 12px; overflow: hidden; }
.feed-media img { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--tint); }
.feed-media-1 { grid-template-columns: 1fr; }
.feed-media-1 img { max-height: 460px; object-fit: contain; }
.feed-media-2, .feed-media-4 { grid-template-columns: 1fr 1fr; }
.feed-media-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.feed-media-3 a:first-child { grid-row: span 2; }
.feed-media-2 img, .feed-media-3 img, .feed-media-4 img { aspect-ratio: 4 / 3; }
.feed-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 8px; }
.feed-react { border: 0; background: none; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .88rem; }
.feed-react:hover:not(:disabled) { background: var(--tint); color: var(--brand-dark); }
.feed-react.is-active { color: var(--brand); background: var(--brand-soft); }
.feed-react:disabled { opacity: .55; }
.feed-count { font-size: .85rem; color: var(--muted); padding-right: 6px; }
.feed-comments { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
.feed-comment { display: flex; gap: 10px; margin-bottom: 10px; }
.feed-comment.is-reply { margin-top: 8px; }
.feed-comment.is-hidden .feed-comment-bubble { opacity: .6; }
.feed-comment-bubble { background: var(--tint); border-radius: 12px; padding: 8px 12px; }
.feed-replies { margin-top: 4px; padding-left: 4px; }
.feed-comment-form { display: flex; gap: 8px; margin-top: 8px; }
.dp-avatar-sm { width: 30px; height: 30px; font-size: 11px; flex-shrink: 0; }
.feed-counts { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.feed-counts strong { display: block; font-size: 1.3rem; }
.feed-counts span { font-size: 12px; color: var(--muted); }

/* Feed: post extras */
.feed-post { transition: box-shadow .2s; }
.feed-post.is-new, .feed-post.is-focused { box-shadow: 0 0 0 2px var(--brand-soft), 0 6px 20px rgba(15, 31, 46, .06); }
.feed-body.is-clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.feed-link { color: var(--brand); text-decoration: underline; word-break: break-all; }
.feed-media a { display: block; cursor: zoom-in; overflow: hidden; }
.feed-media a img { transition: transform .25s; }
.feed-media a:hover img { transform: scale(1.03); }
.feed-stats { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .85rem; color: var(--muted); min-height: 22px; }
.feed-stats-link { color: var(--muted); font-size: .85rem; text-decoration: none; }
.feed-stats-link:hover { color: var(--brand); }
.feed-summary { display: inline-flex; align-items: center; gap: 6px; }
.feed-summary-icons { display: inline-flex; }
.feed-summary-icons i { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; border: 2px solid #fff; margin-left: -4px; }
.feed-summary-icons i:first-child { margin-left: 0; }
.feed-summary-icons .is-like { background: var(--brand); }
.feed-summary-icons .is-insightful { background: #e0a100; }
.feed-summary-icons .is-support { background: #e5566b; }
.feed-actions .feed-react { flex: 0 0 auto; }
.feed-react.is-pop i { animation: feed-pop .35s ease; }
@keyframes feed-pop { 50% { transform: scale(1.45); } }
.feed-skeleton .sk-avatar { display: block; width: 42px; height: 42px; border-radius: 50%; margin: 0; }
.feed-skeleton .sk-line { display: block; margin-bottom: 10px; }
.feed-comment-input { position: relative; }
.feed-comment-input .form-control { padding-right: 34px; }
.feed-emoji-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 2px 6px; }
.feed-emoji-btn:hover { color: var(--brand); }
.feed-emoji-btn.is-top { top: 6px; transform: none; }

/* Feed: a shared post inside a share, and the "share to your feed" box */
.feed-shared { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; background: #fff; }
.feed-shared .feed-media { margin-top: 8px; }
.feed-shared.is-gone { color: var(--muted); background: var(--tint); font-size: .9rem; }
.feed-body.is-short { -webkit-line-clamp: 3; font-size: .9rem; }
.feed-stats-shares { white-space: nowrap; }
.feed-stats-shares:empty { display: none; }
.feed-share-feed { padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.feed-share-feed textarea { padding-right: 34px; resize: vertical; }
.feed-share-feed .feed-shared { background: var(--tint); margin-top: 8px; }
.is-flagged, .front .form-control.is-flagged { border-color: #e5566b !important; }
.feed-language-warning { margin-top: 6px; font-size: .82rem; color: #b42318; background: #fef3f2; border-radius: 8px; padding: 6px 10px; }

/* Feed: composer previews */
.composer-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.composer-preview { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--tint); }
.composer-preview img { width: 100%; height: 100%; object-fit: cover; }
.composer-preview button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(15, 31, 46, .7); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; }

/* Feed: emoji picker */
.emoji-picker { position: absolute; z-index: 1080; width: 290px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 31, 46, .16); padding: 8px; }
.emoji-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 6px; }
.emoji-tabs button { border: 0; background: none; border-radius: 8px; padding: 4px 8px; font-size: 1.1rem; }
.emoji-tabs button.is-active { background: var(--brand-soft); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 180px; overflow-y: auto; }
.emoji-grid button { border: 0; background: none; border-radius: 6px; font-size: 1.25rem; padding: 3px 0; line-height: 1.3; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: var(--tint); }

/* Feed: sidebar */
@media (min-width: 1200px) { .feed-side { position: sticky; top: 16px; align-self: flex-start; } }
.feed-suggest { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.feed-suggest:last-of-type { border-bottom: 0; }
.feed-suggest-reason { display: inline-block; font-size: 11px; color: var(--brand-dark); background: var(--brand-soft); border-radius: 20px; padding: 1px 8px; margin-top: 2px; }
.feed-followed { font-size: .8rem; color: var(--brand); font-weight: 600; white-space: nowrap; }
.feed-popular { display: block; padding: 8px 10px; margin: 0 -10px; border-radius: 10px; color: var(--ink); font-size: .9rem; }
.feed-popular:hover { background: var(--tint); color: var(--ink); }

/* Feed: share dialog */
.feed-share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.feed-share { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: .78rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.feed-share i { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--muted); font-size: 1rem; }
.feed-share:hover { border-color: var(--brand); color: var(--ink); }
.feed-share.is-whatsapp i { background: #25d366; }
.feed-share.is-facebook i { background: #1877f2; }
.feed-share.is-linkedin i { background: #0a66c2; }
.feed-share.is-x i { background: #000; }
.feed-share.is-email i { background: #6b7a89; }
#shareDevice i { background: var(--brand); }

/* Feed: image viewer */
body.feed-viewer-open { overflow: hidden; }
.feed-viewer { position: fixed; inset: 0; z-index: 1090; background: rgba(8, 14, 20, .97); backdrop-filter: blur(6px); display: flex; flex-direction: column; }
.feed-viewer[hidden] { display: none; }
.feed-viewer-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; color: #dfe6ec; font-size: .9rem; }
.feed-viewer-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.feed-viewer-btn:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.feed-viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0 64px; }
.feed-viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; transition: transform .25s; user-select: none; }
.feed-viewer.is-zoomed .feed-viewer-stage img { transform: scale(2.2); cursor: zoom-out; }
.feed-viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.1rem; z-index: 2; }
.feed-viewer-nav:hover { background: rgba(255, 255, 255, .25); }
.feed-viewer-nav[hidden] { display: none; }
.feed-viewer-nav.is-prev { left: 12px; }
.feed-viewer-nav.is-next { right: 12px; }
.feed-viewer-thumbs { display: flex; justify-content: center; gap: 6px; padding: 10px; }
.feed-viewer-thumbs:empty { display: none; }
.feed-viewer-thumbs button { width: 56px; height: 56px; border: 2px solid transparent; border-radius: 8px; padding: 0; overflow: hidden; background: none; opacity: .55; }
.feed-viewer-thumbs button.is-active { border-color: #fff; opacity: 1; }
.feed-viewer-thumbs img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 575.98px) {
    .feed-viewer-stage { padding: 0 8px; }
    .feed-viewer-nav { width: 40px; height: 40px; }
    .feed-actions .feed-react span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .feed-media a img, .feed-viewer-stage img, .feed-post { transition: none; }
    .feed-react.is-pop i { animation: none; }
}

/* Badges + bell */
.dp-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #d64545; color: #fff; font-size: 11px; font-weight: 700; margin-left: auto; }
.dp-bell { position: relative; color: var(--muted); font-size: 18px; padding: 6px; }
.dp-bell .dp-badge { position: absolute; top: -2px; right: -6px; margin: 0; }
/* Appointment desk: day figures, queue, filters, payment */
.ap-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ap-daynav { display: inline-flex; align-items: center; gap: 4px; }
.ap-daynav .form-control { width: 160px; }
.ap-chambers { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.ap-chamber { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: .92rem; padding: 8px 14px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px; }
.ap-chamber:hover { color: var(--brand); }
.ap-chamber.is-active { background: #0a2342; color: #fff; }
.ap-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ap-stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.ap-stat > i { width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.ap-stat strong { display: block; font-size: 1.15rem; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.ap-stat span { font-size: 12px; color: var(--muted); }
.ap-stat.is-warn > i { background: #fff4d6; color: #8a6100; }
.ap-queue { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; margin-bottom: 16px; }
.ap-serving { display: grid; gap: 12px; }
.ap-serving-card { padding: 18px 20px; border-radius: 16px; color: #fff; background: radial-gradient(420px 200px at 100% 0%, rgba(20, 163, 139, .4), transparent 65%), #0a2342; }
.ap-serving-card.is-empty { background: #fff; color: var(--muted); border: 1px dashed #c9d5df; }
.ap-serving-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.ap-serving-main { display: flex; align-items: center; gap: 16px; margin: 8px 0 14px; }
.ap-serving-card.is-empty .ap-serving-main { margin-bottom: 0; }
.ap-token-lg { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; border-radius: 10px; }
.btn-accent:hover { background: #0f8a75; border-color: #0f8a75; color: #fff; }
.ap-next { padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.ap-next-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-next-item { padding: 6px 12px; border-radius: 10px; background: var(--tint); border: 1px solid var(--line); font-size: .9rem; }
.ap-next-item b { font-weight: 800; }
.ap-next-item.is-first { background: var(--accent-soft); border-color: #bfe9df; }
.ap-filters { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ap-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-chip { border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; }
.ap-chip span { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: #eef2f5; font-size: 11px; }
.ap-chip.is-active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.ap-chip.is-active span { background: #fff; }
.ap-search { position: relative; }
.ap-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9aa7b3; font-size: 12px; }
.ap-search .form-control { padding-left: 30px; width: 290px; max-width: 100%; }
.ap-token { display: inline-grid; place-items: center; min-width: 42px; padding: 4px 8px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; }
.ap-table tr.is-serving td { background: #f3fbf9; }
.ap-table tr.is-serving .ap-token { background: var(--accent); color: #fff; }
.ap-table tr.is-closed td { opacity: .55; }
.ap-table .dropdown-item { font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.badge-status.pay-paid { background: var(--accent-soft); color: #0b6b5b; }
.badge-status.pay-partial { background: #fff4d6; color: #8a6100; }
.badge-status.pay-unpaid { background: #fdecec; color: #9b1c1c; }
.ap-money { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.ap-money div { padding: 8px 10px; border-radius: 10px; background: var(--tint); text-align: center; }
.ap-money dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ap-money dd { margin: 0; font-weight: 800; font-size: .95rem; white-space: nowrap; }
.ap-money .is-due { background: #fff4d6; }
.ap-bill summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--brand); }
@media (max-width: 1599.98px) { .ap-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .ap-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ap-queue { grid-template-columns: 1fr; } .ap-money { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ap-search .form-control { width: 100%; } }
/* Patients: filter bar and server-side DataTable */
.pt-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pt-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--tint); border-radius: var(--radius) var(--radius) 0 0; }
.pt-filter .form-label { margin-bottom: 4px; font-weight: 600; color: var(--muted); }
.pt-filter-wide { grid-column: span 2; }
.pt-filter .ap-search .form-control { width: 100%; }
.pt-filter-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; min-height: 31px; }
.pt-table-wrap { overflow-x: auto; position: relative; }
.pt-table { min-width: 760px; margin: 0 !important; border-collapse: collapse !important; }
.pt-table thead th { white-space: nowrap; border-bottom: 1px solid var(--line) !important; background: #fff; cursor: default; }
.pt-table thead th.sorting, .pt-table thead th.sorting_asc, .pt-table thead th.sorting_desc { cursor: pointer; }
.pt-table thead th.sorting_asc, .pt-table thead th.sorting_desc { color: var(--brand); }
.pt-table tbody tr { cursor: pointer; }
.pt-table tbody tr:hover td { background: var(--tint); }
.pt-table td { border-bottom: 1px solid var(--line); }
.pt-patient { display: flex; align-items: center; gap: 12px; color: var(--ink); min-width: 0; }
.pt-patient:hover strong { color: var(--brand); }
.pt-avatar { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 13px; }
.pt-count { display: inline-grid; place-items: center; min-width: 28px; padding: 2px 8px; border-radius: 999px; background: #eef2f5; font-weight: 700; font-size: 13px; }
.pt-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; font-size: .88rem; color: var(--muted); }
.pt-foot-info { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pt-foot .dataTables_info { padding: 0 !important; }
.pt-foot .dataTables_length label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.pt-foot .dataTables_length select { width: auto; display: inline-block; }
.pt-foot .pagination { margin: 0; gap: 4px; }
.pt-foot .page-link { border-radius: 8px !important; border-color: var(--line); color: var(--ink); font-size: .88rem; }
.pt-foot .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.pt-table-wrap .dataTables_processing { position: absolute; inset: 44px 0 auto 0; margin: 0 auto; width: max-content; padding: 6px 14px; border-radius: 999px; background: #0a2342; color: #fff; font-size: .85rem; z-index: 2; box-shadow: var(--shadow); }
.pt-table-wrap .dataTables_processing > div { display: none; }
@media (max-width: 767.98px) { .pt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pt-filter-wide { grid-column: span 1; } }
/* Finance (cashbook) and practice settings */
.fn-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.fn-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.fn-side div { padding: 10px 14px; border: 1px dashed #c9d5df; border-radius: 12px; font-size: .9rem; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.fn-side strong { color: var(--ink); }
.fn-amount.is-income { color: #0b6b5b; }
.fn-amount.is-expense { color: #9b1c1c; }
.fn-row.is-voided td { opacity: .5; text-decoration: line-through; }
.fn-row.is-voided td:last-child { text-decoration: none; }
.fn-cat { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.fn-cat:last-child { border-bottom: 0; }
.fn-cat .progress { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: #eef2f5; }
.fn-cat .progress-bar { border-radius: 99px; }
.fn-recurring { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fn-recurring:last-of-type { border-bottom: 0; }
.fn-recurring.is-paused { opacity: .6; }
.fn-category { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fn-category-form { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; flex-wrap: wrap; min-width: 0; }
.fn-category-form .form-control { flex: 1 1 140px; min-width: 0; border-color: transparent; background: transparent; font-weight: 600; padding-left: 6px; }
.fn-category-form .form-control:hover, .fn-category-form .form-control:focus { border-color: var(--line); background: #fff; }
.fn-category-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.fn-category-add .form-control { flex: 1 1 160px; }
.st-display { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.st-display.is-inactive { opacity: .6; }
.st-group { margin-bottom: 20px; }
.st-check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.st-check .form-check-input { margin-top: 3px; flex-shrink: 0; }
@media (max-width: 991.98px) { .fn-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Partners (doctor side) and the partner portal */
.partner-login { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--tint); }
.partner-count { text-align: center; min-width: 64px; }
.partner-count strong { display: block; font-size: 1.25rem; font-weight: 800; line-height: 1.1; }
.partner-count span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
body.partner-portal { background: var(--tint); }
.pp-bar { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); padding: 12px 0; }
.pp-main { padding: 28px 0 64px; }
.pp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.pp-stats .pf-stat { background: #fff; }
.pp-table th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--tint); white-space: nowrap; }
.pp-table th, .pp-table td { padding: 12px 16px; }
.pp-table tr:last-child td { border-bottom: 0; }
.profile-block.p-0 { overflow: hidden; }
.pf-tabs.pp-tabs { top: 0; position: static; border-top: 0; border-bottom: 1px solid var(--line); }
.pf-tabs.pp-tabs a { display: inline-flex; align-items: center; gap: 8px; }
.pp-stats:has(.is-main) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Partner wallet (doctor side and portal) */
.wl-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.wl-stats .pf-stat, .pp-stats .pf-stat { background: #fff; }
.pf-stat.is-main { background: #0a2342 !important; border-color: #0a2342; color: #fff; }
.pf-stat.is-main span { color: rgba(255, 255, 255, .75); }
a.pf-stat.is-main:hover { color: #fff; border-color: var(--accent); }
.wl-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.wl-totals strong { display: block; font-size: 1.15rem; font-weight: 800; }
.wl-totals span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.wl-request { padding: 14px; border: 1px solid #f0d48a; border-radius: 12px; background: #fffdf5; }
.wl-request + .wl-request { margin-top: 10px; }
.wl-request-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.badge-status.wl-commission, .badge-status.po-paid { background: var(--accent-soft); color: #0b6b5b; }
.badge-status.wl-payout { background: #e6f1f8; color: var(--brand); }
.badge-status.wl-adjustment, .badge-status.po-requested { background: #fff4d6; color: #8a6100; }
.badge-status.po-rejected { background: #fdecec; color: #9b1c1c; }
@media (max-width: 767.98px) { .wl-stats, .wl-totals, .pp-stats:has(.is-main) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Live updates (realtime.js) */
.dp-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1080; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.dp-toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px; box-shadow: var(--shadow); color: var(--ink); font-size: .92rem; animation: dp-toast-in .2s ease; }
.dp-toast:hover { color: var(--ink); border-color: var(--brand); }
.dp-toast > i { color: var(--brand); font-size: 18px; }
.dp-toast.is-success { border-left-color: var(--accent); }
.dp-toast.is-success > i { color: var(--accent); }
.dp-toast.is-error { border-left-color: #d64545; }
.dp-toast.is-error > i { color: #d64545; }
.dp-toast-close { border: 0; background: none; color: var(--muted); padding: 2px 6px; font-size: 18px; line-height: 1; }
@keyframes dp-toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .dp-toast { animation: none; } }

/* Messages */
.chat { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 160px); min-height: 480px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-conversations { flex: 1; overflow-y: auto; }
.chat-item { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: none; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-item:hover { background: var(--tint); }
.chat-item.is-active { background: var(--brand-soft); }
.chat-item.is-unread strong { color: var(--ink); }
.chat-item .dp-badge { margin-left: 0; }
.chat-thread { display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; background: var(--tint); display: flex; flex-direction: column; gap: 6px; }
.chat-msg { max-width: 75%; align-self: flex-start; }
.chat-msg.is-mine { align-self: flex-end; text-align: right; }
.chat-bubble { display: inline-block; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px; word-wrap: break-word; max-width: 100%; }
.chat-msg.is-mine .chat-bubble { background: var(--brand); color: #fff; border-color: var(--brand); border-radius: 14px 14px 4px 14px; }
.chat-msg.is-mine .chat-bubble a { color: #fff; }
.chat-msg.is-hidden .chat-bubble { opacity: .6; }
.chat-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chat-report { border: 0; background: none; color: #9aa7b3; padding: 0 4px; font-size: 11px; }
.chat-report:hover { color: #d64545; }
.chat-seen { margin-left: 4px; color: var(--brand); font-weight: 600; }
.chat-image { max-width: 260px; max-height: 260px; border-radius: 10px; display: block; margin-bottom: 4px; }
.chat-file-link { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.chat-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--line); }
.chat-composer textarea { resize: none; max-height: 140px; }
.chat-file { display: inline-block; margin-bottom: 4px; color: var(--brand-dark); }
.chat-blocked { padding: 14px; border-top: 1px solid var(--line); text-align: center; }
@media (max-width: 991.98px) {
    .chat { grid-template-columns: 1fr; height: calc(100vh - 130px); }
    .chat .chat-thread { display: none; }
    .chat.is-open .chat-thread { display: flex; }
    .chat.is-open .chat-list { display: none; }
}

/* Notifications */
.notif { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--tint); color: var(--ink); }
.notif.is-unread { background: #f4fafd; font-weight: 600; }
.notif .dp-avatar i { font-size: 14px; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }

/* Billing */
.badge-status { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #eef2f5; color: #5b6b7a; vertical-align: middle; }
.badge-status.s-active, .badge-status.s-inv-paid, .badge-status.s-pay-confirmed { background: var(--accent-soft); color: #0b6b5b; }
.badge-status.s-grace, .badge-status.s-pending_payment, .badge-status.s-inv-open, .badge-status.s-pay-pending { background: #fff4d6; color: #8a6100; }
.badge-status.s-past_due, .badge-status.s-pay-rejected { background: #fdecec; color: #9b1c1c; }
.method-card { height: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--tint); }
.pay-card { border-left: 6px solid #e0a100; }
.invoice-page { background: var(--tint); }
.invoice-actions { max-width: 820px; margin: 24px auto 0; display: flex; justify-content: space-between; padding: 0 16px; }
.invoice-sheet { max-width: 820px; margin: 16px auto 48px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 40px; }
.invoice-table th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
@media print {
    .invoice-actions { display: none; }
    .invoice-page { background: #fff; }
    .invoice-sheet { border: 0; margin: 0; padding: 0; max-width: none; }
}

/* Practice: appointments, patients, prescriptions */
.usage-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #eef6fa; color: var(--brand); }
.practice-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: #5b6b7a; font-weight: 700; padding: 10px 12px; }
.practice-table td { padding: 10px 12px; vertical-align: middle; }
.practice-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.practice-row:last-child { border-bottom: 0; }
a.practice-row:hover { background: #f7fafc; }
.badge-status.s-appt-confirmed, .badge-status.s-appt-checked_in { background: #e6f1f8; color: var(--brand); }
.badge-status.s-appt-in_consultation, .badge-status.s-appt-pending, .badge-status.s-rx-draft { background: #fff4d6; color: #8a6100; }
.badge-status.s-appt-completed, .badge-status.s-rx-finalized { background: var(--accent-soft); color: #0b6b5b; }
.badge-status.s-appt-cancelled_patient, .badge-status.s-appt-cancelled_doctor, .badge-status.s-appt-no_show { background: #fdecec; color: #9b1c1c; }
.rx-symbol { font-family: Georgia, serif; color: var(--brand); font-size: 1.2em; }
.rx-medicines { display: flex; flex-direction: column; gap: 8px; }
.rx-med { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 6px; align-items: center; }
.rx-med > * { min-width: 0; }
@media (max-width: 991.98px) { .rx-med { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-bottom: 8px; border-bottom: 1px dashed var(--line); } .rx-med .rx-med-name { grid-column: 1 / -1; } .rx-med [data-med-remove] { justify-self: end; } }
@media (min-width: 1200px) { .rx-actions { position: sticky; top: 84px; } }
