/* ── Theme ─────────────────────────────────────────────────────────────────
   Deep teal-green primary (a nod to the flag's green), warm red accent, calm neutrals. */

:root {
    --dc-primary: #0f766e;
    --dc-primary-600: #0d9488;
    --dc-primary-50: #ecfdf8;
    --dc-primary-100: #ccfbef;
    --dc-accent: #dc2626;
    --dc-ink: #13232b;
    --dc-muted: #5b6b73;
    --dc-border: #e3e9ec;
    --dc-surface: #ffffff;
    --dc-bg: #f4f7f8;
    --dc-nav-h: 56px;

    --bs-primary: var(--dc-primary);
    --bs-primary-rgb: 15, 118, 110;
    --bs-link-color: var(--dc-primary);
    --bs-link-color-rgb: 15, 118, 110;
    --bs-link-hover-color: #115e59;
    --bs-body-color: var(--dc-ink);
    --bs-body-font-family: 'Inter', 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body.lang-bn { --bs-body-font-family: 'Hind Siliguri', 'Inter', system-ui, sans-serif; }

.btn-primary {
    --bs-btn-bg: var(--dc-primary); --bs-btn-border-color: var(--dc-primary);
    --bs-btn-hover-bg: #115e59; --bs-btn-hover-border-color: #115e59;
    --bs-btn-active-bg: #134e4a; --bs-btn-active-border-color: #134e4a;
    --bs-btn-disabled-bg: var(--dc-primary); --bs-btn-disabled-border-color: var(--dc-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--dc-primary); --bs-btn-border-color: var(--dc-primary);
    --bs-btn-hover-bg: var(--dc-primary); --bs-btn-hover-border-color: var(--dc-primary);
    --bs-btn-active-bg: #115e59; --bs-btn-active-border-color: #115e59;
}
.text-primary { color: var(--dc-primary) !important; }
.bg-primary { background-color: var(--dc-primary) !important; }
.border-primary { border-color: var(--dc-primary) !important; }
.bg-primary-subtle { background-color: var(--dc-primary-50) !important; }
.text-primary-emphasis { color: #115e59 !important; }
.form-control:focus, .form-select:focus {
    border-color: var(--dc-primary-600);
    box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .15);
}
.form-check-input:checked { background-color: var(--dc-primary); border-color: var(--dc-primary); }
.nav-pills .nav-link.active { background-color: var(--dc-primary); }
.page-link { color: var(--dc-primary); }
.active > .page-link, .page-link.active { background-color: var(--dc-primary); border-color: var(--dc-primary); }

/* ── Layout ──────────────────────────────────────────────────────────────── */

body {
    padding-top: var(--dc-nav-h);
    background-color: var(--dc-bg);
}

.min-w-0 { min-width: 0; }

.app-navbar {
    background: linear-gradient(90deg, #0f766e 0%, #115e59 100%);
    height: var(--dc-nav-h);
    box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.brand-mark {
    width: 30px; height: 30px; border-radius: 9px;
    background: rgba(255,255,255,.16);
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-nav {
    color: #fff; border: 1px solid rgba(255,255,255,.28); background: transparent;
}
.btn-nav:hover, .btn-nav:focus, .btn-nav.active, .btn-nav.show {
    color: #0f3d3a; background: #fff; border-color: #fff;
}
.chamber-switch { max-width: 46vw; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

#sidebar {
    width: 236px;
    background: var(--dc-surface);
    border-right: 1px solid var(--dc-border);
    height: calc(100vh - var(--dc-nav-h));
    position: sticky; top: var(--dc-nav-h);
    overflow-y: auto; overflow-x: hidden;
    transition: width .2s ease, transform .2s ease;
    flex-shrink: 0;
}
#sidebar.collapsed { width: 64px; }
#sidebar.collapsed .nav-link span,
#sidebar.collapsed .sidebar-section-label { display: none; }

#sidebar .nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; margin: 1px 8px;
    color: #3f4f57; border-radius: 8px; font-size: .9rem;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
#sidebar .nav-link i { font-size: 1.05rem; width: 20px; flex-shrink: 0; }
#sidebar .nav-link:hover { background: var(--dc-primary-50); color: var(--dc-primary); }
#sidebar .nav-link.active { background: var(--dc-primary-50); color: var(--dc-primary); font-weight: 600; }

.sidebar-section-label {
    font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    color: #94a3ab; padding: 14px 22px 4px; list-style: none;
}
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    #sidebar {
        position: fixed; left: 0; top: var(--dc-nav-h); z-index: 1040;
        transform: translateX(-100%);
        box-shadow: 0 10px 30px rgba(0,0,0,.15);
    }
    #sidebar.open { transform: translateX(0); }
    #sidebar.collapsed { width: 236px; }
    .sidebar-backdrop.show {
        display: block; position: fixed; inset: var(--dc-nav-h) 0 0 0;
        background: rgba(15, 30, 35, .35); z-index: 1035;
    }
}

#content { min-height: calc(100vh - var(--dc-nav-h)); }

/* ── Page header & cards ─────────────────────────────────────────────────── */

.page-header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-header h1, .page-header h2, .page-header h4 { margin: 0; font-weight: 700; }
.page-header .subtitle { color: var(--dc-muted); font-size: .9rem; }

.card { border-radius: 12px; border-color: var(--dc-border); }
.card-header { background: var(--dc-surface); border-bottom-color: var(--dc-border); }

/* ── Avatars ─────────────────────────────────────────────────────────────── */

.avatar-circle {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700; text-transform: uppercase; flex-shrink: 0;
}
.avatar-circle-lg {
    width: 72px; height: 72px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 700; text-transform: uppercase;
}

/* ── Search dropdown ─────────────────────────────────────────────────────── */

.search-dropdown {
    background: #fff; border: 1px solid var(--dc-border); border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12); z-index: 1050;
    min-width: min(340px, 90vw); max-height: 400px; overflow-y: auto;
}

/* ── Stat cards ──────────────────────────────────────────────────────────── */

.stat-card {
    border-radius: 12px; padding: 18px; background: var(--dc-surface);
    border: 1px solid var(--dc-border); height: 100%;
}
.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--dc-ink); font-variant-numeric: tabular-nums; }
.stat-card .stat-label { font-size: .78rem; color: var(--dc-muted); text-transform: uppercase; letter-spacing: .5px; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Serial queue ────────────────────────────────────────────────────────── */

.serial-token {
    width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums;
    background: var(--dc-primary-50); color: var(--dc-primary);
}
.serial-row { border: 1px solid var(--dc-border); border-radius: 12px; background: #fff; padding: 10px 12px; }
.serial-row.status-InChair { border-color: var(--dc-primary); box-shadow: 0 0 0 2px var(--dc-primary-100); }
.serial-row.status-InChair .serial-token { background: var(--dc-primary); color: #fff; }
.serial-row.status-Arrived .serial-token { background: #fef3c7; color: #92400e; }
.serial-row.status-Done { opacity: .6; }
.serial-row.status-Done .serial-token { background: #e5e7eb; color: #4b5563; }
.serial-row.status-Cancelled, .serial-row.status-NoShow { opacity: .45; }
.now-serving {
    background: linear-gradient(135deg, #0f766e, #115e59); color: #fff; border-radius: 16px;
}
.now-serving .big { font-size: 3rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }

/* ── Tooth chart (FDI) ───────────────────────────────────────────────────── */

.fdi-chart { overflow-x: auto; padding: 8px 4px; }
.fdi-arch { display: flex; justify-content: center; gap: 10px; min-width: max-content; }
.fdi-quadrant { display: grid; grid-auto-flow: column; gap: 4px; }
.fdi-quadrant.q-right { border-right: 2px solid #9fb3ba; padding-right: 10px; }
.fdi-midline { height: 2px; background: #9fb3ba; margin: 6px auto; max-width: 760px; }

.tooth-cell {
    width: 40px; height: 40px;
    border: 1.5px solid #d5dde1; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 600; cursor: pointer; transition: all .15s; background: #fafcfc;
}
.tooth-cell.primary-tooth { width: 34px; height: 34px; border-style: dashed; }
.tooth-cell:hover { border-color: var(--dc-primary); background: var(--dc-primary-50); }
.tooth-cell.healthy { background: #fafcfc; }
.tooth-cell.decayed { background: #fff3cd; border-color: #f0b400; }
.tooth-cell.filled { background: #cff4fc; border-color: #0dcaf0; }
.tooth-cell.missing, .tooth-cell.extracted { background: #f8d7da; border-color: #dc3545; text-decoration: line-through; }
.tooth-cell.crown { background: #d1e7dd; border-color: #198754; }
.tooth-cell.root-canal, .tooth-cell.rootcanal { background: #e2d9f3; border-color: #6f42c1; }
.tooth-cell.impacted { background: #ffe5d0; border-color: #fd7e14; }

/* ── Calendar ────────────────────────────────────────────────────────────── */

.calendar-event {
    padding: 3px 8px; border-radius: 6px; font-size: .78rem; margin-bottom: 2px;
    cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table th {
    font-size: .74rem; text-transform: uppercase; letter-spacing: .5px;
    color: var(--dc-muted); font-weight: 600;
}
.table-responsive { -webkit-overflow-scrolling: touch; }

/* ── Messages ────────────────────────────────────────────────────────────── */

.message-bubble { max-width: 75%; border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.message-bubble.inbound  { background: #eef2f3; margin-right: auto; border-bottom-left-radius: 2px; }
.message-bubble.outbound { background: var(--dc-primary); color: #fff; margin-left: auto; border-bottom-right-radius: 2px; }

/* ── Imaging ─────────────────────────────────────────────────────────────── */

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.image-card { border: 1px solid var(--dc-border); border-radius: 8px; overflow: hidden; cursor: pointer; transition: box-shadow .15s; }
.image-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.image-card img { width: 100%; height: 120px; object-fit: cover; }
.image-card-body { padding: 8px; font-size: .75rem; }

/* ── Utilities ───────────────────────────────────────────────────────────── */

.bg-pink-subtle { background-color: #fce4ec; }
.text-pink-emphasis { color: #880e4f; }
.bkash { color: #e2136e; }
.nagad { color: #f7941d; }
.rocket { color: #8c3494; }

@media (max-width: 575.98px) {
    .stat-card .stat-value { font-size: 1.3rem; }
    .btn-mobile-block { width: 100%; }
}
