:root {
    --bg: #f4f7fb;
    --card: rgba(255,255,255,0.75);
    --line: rgba(148,163,184,0.18);
    --text: #0f172a;
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-2: #7c3aed;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --surface: rgba(255,255,255,0.8);
    --surface-2: rgba(255,255,255,0.68);
    --surface-3: rgba(255,255,255,0.58);
    --surface-strong: rgba(255,255,255,0.92);
    --shadow: 0 10px 35px rgba(15, 23, 42, 0.06);
    --input-text: #0f172a;
}

html[data-theme="dark"] {
    --bg: #07111f;
    --card: rgba(8,18,34,0.78);
    --line: rgba(148,163,184,0.14);
    --text: #e5eefb;
    --muted: #95a7c2;
    --surface: rgba(10,23,42,0.76);
    --surface-2: rgba(10,23,42,0.68);
    --surface-3: rgba(10,23,42,0.58);
    --surface-strong: rgba(9,20,37,0.92);
    --shadow: 0 18px 40px rgba(2, 6, 23, 0.35);
    --input-text: #e5eefb;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Cairo', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(79,70,229,0.18), transparent 26%),
        radial-gradient(circle at top right, rgba(14,165,233,0.12), transparent 24%),
        linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
}

html[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(79,70,229,0.16), transparent 28%),
        radial-gradient(circle at top right, rgba(14,165,233,0.14), transparent 24%),
        linear-gradient(180deg, #0a1222 0%, var(--bg) 100%);
}

a { text-decoration: none; }

.auth-body {
    min-height: 100vh;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-shell {
    width: min(1180px, 100%);
    margin: 1.25rem auto;
    display: grid;
    grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 0.85fr);
    gap: 1.5rem;
    align-items: stretch;
}

.auth-side,
.auth-content {
    min-width: 0;
}

.auth-side {
    padding: 2rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background:
        radial-gradient(circle at top left, rgba(79,70,229,0.16), transparent 34%),
        radial-gradient(circle at bottom right, rgba(14,165,233,0.16), transparent 32%),
        rgba(255,255,255,0.72);
}

.auth-side:before {
    content: "";
    position: absolute;
    inset: auto -40px -60px auto;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(79,70,229,0.18), rgba(14,165,233,0.12));
    filter: blur(8px);
}

.auth-side > * {
    position: relative;
    z-index: 1;
}

.auth-side h1 {
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.25;
    max-width: 12ch;
}

.feature-stack {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 1.5rem;
}

.feature-line {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(255,255,255,0.62);
    border: 1px solid rgba(148,163,184,0.18);
    font-weight: 700;
    color: #334155;
}

.feature-line i {
    color: var(--success);
}

.auth-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-card {
    padding: 2rem;
    border-radius: 30px;
}

.auth-card-wide {
    padding: 2rem;
}

.auth-card-head {
    margin-bottom: 1.25rem;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.8rem;
    margin-bottom: 0.8rem;
    border-radius: 999px;
    background: rgba(79,70,229,0.08);
    color: var(--primary);
    border: 1px solid rgba(79,70,229,0.12);
    font-size: 0.85rem;
    font-weight: 800;
}

.auth-helper-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.auth-helper-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(148,163,184,0.18);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.input-icon-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    inset-inline-start: 1rem;
    color: #94a3b8;
    pointer-events: none;
}

.input-icon-wrap .form-control,
.input-icon-wrap .form-select {
    padding-inline-start: 2.8rem;
}

.auth-submit {
    margin-top: 0.25rem;
    min-height: 52px;
}

.demo-box {
    padding: 1rem 1.1rem;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(79,70,229,0.06), rgba(14,165,233,0.08));
    border: 1px solid rgba(148,163,184,0.18);
}

.demo-box-title {
    font-weight: 800;
    margin-bottom: 0.85rem;
}

.demo-box-grid {
    display: grid;
    gap: 0.7rem;
}

.demo-box-grid div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.8rem;
    border-radius: 16px;
    background: rgba(255,255,255,0.7);
}

.demo-box-grid span {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.demo-box-grid strong {
    color: var(--text);
}

.auth-footer-link {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

@media (max-width: 980px) {
    .auth-body {
        padding: 1rem;
        align-items: stretch;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        margin: 0 auto;
    }

    .auth-side,
    .auth-card,
    .auth-card-wide {
        padding: 1.5rem;
    }

    .auth-side h1 {
        max-width: none;
        font-size: 2rem;
    }
}

.app-shell {
    display: grid;
    grid-template-columns: 290px 1fr;
    min-height: 100vh;
    gap: 1.25rem;
    padding: 1.25rem;
}

.glass-card {
    background: var(--card);
    border: 1px solid var(--line);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 35px rgba(15, 23, 42, 0.06);
    border-radius: 28px;
}

.glass-subtle {
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--line);
    border-radius: 22px;
}

.sidebar {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.5rem;
}

.brand-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 12px 28px rgba(79,70,229,0.24);
}

.brand-title { font-size: 1.1rem; font-weight: 800; }
.brand-subtitle { color: var(--muted); font-size: 0.9rem; }

.side-nav { gap: 0.4rem; }
.side-nav .nav-link {
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    font-weight: 600;
}
.side-nav .nav-link:hover,
.side-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(79,70,229,0.12), rgba(14,165,233,0.08));
    color: var(--primary);
}

.side-nav .nav-count-badge {
    margin-inline-start: auto;
    min-width: 24px;
    height: 24px;
    padding: 0 0.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #f97316);
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 22px rgba(239, 68, 68, 0.2);
    font-size: 0.76rem;
    font-weight: 900;
    line-height: 1;
}

.side-nav .nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.side-nav .nav-group-title {
    cursor: default;
    margin-bottom: 0;
}

.side-nav .nav-submenu {
    padding-inline-start: 1rem;
    margin-inline-start: 1rem;
    border-inline-start: 2px solid rgba(79,70,229,0.12);
    margin-top: 0.15rem;
}

.side-nav .nav-submenu.show,
.side-nav .nav-submenu.collapsing {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.side-nav .nav-group-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    justify-content: space-between;
    text-align: inherit;
}

.side-nav .nav-group-label {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.side-nav .nav-group-caret {
    transition: transform 0.2s ease;
}

.side-nav .nav-group-toggle[aria-expanded="true"] .nav-group-caret {
    transform: rotate(180deg);
}

.side-nav .nav-sublink {
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
    color: var(--muted);
    margin-inline-start: 0.2rem;
    border-radius: 14px;
}

html[dir="rtl"] .side-nav .nav-submenu {
    padding-inline-start: 0;
    padding-inline-end: 1rem;
    margin-inline-start: 0;
    margin-inline-end: 1rem;
    border-inline-start: 0;
    border-inline-end: 2px solid rgba(79,70,229,0.12);
}

html[dir="rtl"] .side-nav .nav-sublink {
    padding-right: 1rem;
    margin-inline-start: 0;
    margin-inline-end: 0.2rem;
}

.sidebar-order-list {
    display: grid;
    gap: 0.75rem;
}

.sidebar-order-item {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(82, 104, 140, 0.16);
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.74);
}

.sidebar-order-handle,
.sidebar-order-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.8rem;
}

.sidebar-order-handle {
    color: var(--muted);
    background: rgba(82, 104, 140, 0.08);
}

.sidebar-order-icon {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.sidebar-order-label {
    font-weight: 800;
    color: var(--text);
}

.sidebar-order-actions {
    display: flex;
    gap: 0.4rem;
}

.sidebar-footer {
    padding: 1rem;
}

.sidebar-user-context {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.9rem;
    padding: 0.8rem;
    border: 1px solid rgba(79, 70, 229, 0.12);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(79,70,229,0.08), rgba(14,165,233,0.06));
}

.sidebar-user-context i {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.08);
    flex: 0 0 auto;
}

.sidebar-user-context span,
.sidebar-user-context small {
    display: block;
    line-height: 1.25;
}

.sidebar-user-context span {
    color: var(--heading);
    font-weight: 800;
}

.sidebar-user-context small {
    color: var(--muted);
    font-weight: 750;
    margin-top: 0.12rem;
}

.sidebar-user-context small:first-child {
    color: #4f46e5;
    font-size: 0.72rem;
    margin-top: 0;
}

.availability-week-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.85rem;
}

.availability-day-card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 22px;
    padding: 1rem;
    background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(240,253,250,0.66));
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.04);
}

.availability-day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.availability-doctor-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.availability-doctor-row {
    display: grid;
    grid-template-columns: minmax(72px, 0.8fr) minmax(140px, 1.3fr) repeat(4, minmax(74px, 1fr));
    gap: 0.45rem;
    align-items: center;
    padding: 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    background: rgba(255,255,255,0.72);
}

.availability-block-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid rgba(20,184,166,0.16);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(240,253,250,0.72), rgba(255,255,255,0.86));
}

.availability-default-holidays {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid rgba(239, 68, 68, 0.16);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.75), rgba(255, 255, 255, 0.9));
}

.availability-block-notes {
    grid-column: span 2;
}

.availability-doctor-required .form-label::after {
    content: " *";
    color: #ef4444;
}

@media (max-width: 1200px) {
    .availability-default-holidays {
        align-items: stretch;
        flex-direction: column;
    }

    .availability-doctor-row,
    .availability-block-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .availability-doctor-row > .fw-bold,
    .availability-block-notes {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .clinic-settings-switch-row {
        align-items: flex-start;
        flex-direction: column;
    }


    .availability-doctor-row,
    .availability-block-form {
        grid-template-columns: 1fr;
    }

    .availability-block-notes {
        grid-column: auto;
    }
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.topbar {
    padding: 1.1rem 1.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.page-title { font-size: 1.6rem; font-weight: 800; }
.page-subtitle { color: var(--muted); margin-top: 0.25rem; }

.clinic-title {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--heading);
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.2;
    padding: 0.2rem 0.1rem;
    white-space: nowrap;
}

.clinic-title i {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.09);
    font-size: 0.95rem;
}

.header-alert-button {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--muted);
    text-decoration: none;
    background: rgba(255,255,255,0.86);
    border: 1px solid var(--line);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.header-alert-button:hover,
.header-alert-button:focus {
    color: var(--primary);
    transform: translateY(-1px);
    border-color: rgba(79, 70, 229, 0.28);
    box-shadow: 0 16px 32px rgba(79, 70, 229, 0.14);
}

.header-alert-button.has-alerts {
    color: #dc2626;
    background: linear-gradient(135deg, rgba(254, 226, 226, 0.96), rgba(255, 247, 237, 0.86));
    border-color: rgba(248, 113, 113, 0.38);
}

.header-alert-button > i {
    font-size: 1.15rem;
}

.header-alert-button > span {
    position: absolute;
    top: -7px;
    inset-inline-start: -7px;
    min-width: 22px;
    height: 22px;
    padding: 0 0.34rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: #64748b;
    border: 2px solid #fff;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
}

.header-alert-button.has-alerts > span {
    background: #ef4444;
}

.search-pill, .user-pill, .search-form {
    background: rgba(255,255,255,0.8);
    border: 1px solid var(--line);
    padding: 0.8rem 1rem;
    border-radius: 999px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 600;
}

.search-form {
    min-width: 280px;
    margin: 0;
}

.search-form-icon {
    color: var(--muted);
    flex-shrink: 0;
}

.search-form-submit {
    border: 0;
    padding: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    cursor: pointer;
}

.search-form-input {
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    width: 100%;
    min-width: 0;
    font-weight: 600;
}

.search-form-input::placeholder {
    color: var(--muted);
}

.pagination-shell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.pagination-summary {
    color: var(--muted);
    font-weight: 600;
}

.pagination-modern {
    gap: 0.45rem;
}

.pagination-modern .page-link {
    border: 1px solid rgba(148,163,184,0.24);
    background: rgba(255,255,255,0.82);
    color: var(--text);
    border-radius: 12px;
    min-width: 44px;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(15,23,42,0.04);
}

.pagination-modern .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border-color: transparent;
    color: #fff;
}

.pagination-modern .page-item.disabled .page-link {
    background: rgba(241,245,249,0.72);
    color: #94a3b8;
}

.content-area { display: flex; flex-direction: column; gap: 1rem; }

.hero-banner {
    padding: 1.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(79,70,229,0.95), rgba(14,165,233,0.9));
    color: #fff;
}

.badge-soft {
    display: inline-flex;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.18);
    font-weight: 600;
}

.hero-title { font-size: 2rem; font-weight: 800; max-width: 620px; }
.hero-text { max-width: 650px; color: rgba(255,255,255,0.88); margin-bottom: 0; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.btn-dashboard-add-patient {
    --bs-btn-color: #fff;
    --bs-btn-bg: #f97316;
    --bs-btn-border-color: rgba(255,255,255,0.48);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #ea580c;
    --bs-btn-hover-border-color: rgba(255,255,255,0.72);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #c2410c;
    --bs-btn-active-border-color: rgba(255,255,255,0.72);
    background: linear-gradient(135deg, #f97316, #f59e0b);
    border: 1px solid var(--bs-btn-border-color);
    color: #fff;
    font-weight: 850;
    box-shadow: 0 18px 36px rgba(249,115,22,0.28);
}

.btn-dashboard-add-patient:hover,
.btn-dashboard-add-patient:focus {
    background: linear-gradient(135deg, #ea580c, #f97316);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 22px 42px rgba(249,115,22,0.36);
}

.dashboard-quick-actions .btn-dashboard-add-patient {
    border-color: rgba(249,115,22,0.34);
}

.dashboard-quick-actions {
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(240,253,250,0.78));
}

.dashboard-quick-actions > div:first-child {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.dashboard-quick-actions strong {
    font-weight: 800;
    color: var(--text);
}

.badge-soft-muted {
    background: rgba(20,184,166,0.12);
    border-color: rgba(20,184,166,0.18);
    color: #0f766e;
}

.section-card, .form-card {
    padding: 1.4rem;
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.section-head h3 { margin: 0; font-size: 1.15rem; font-weight: 800; }

.clinic-settings-stack {
    display: grid;
    gap: 1rem;
}

.clinic-settings-segment {
    padding: 1.15rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.08), transparent 34%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.76));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 14px 30px rgba(15, 23, 42, 0.045);
}

.clinic-settings-segment-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.9rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.clinic-settings-segment-compact .clinic-settings-segment-head {
    align-items: center;
    padding-bottom: 0;
    border-bottom: 0;
}

.clinic-settings-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
}

.clinic-settings-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    color: #0f766e;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.18), rgba(14, 165, 164, 0.08));
    border: 1px solid rgba(20, 184, 166, 0.18);
}

.clinic-settings-icon-warning {
    color: #b45309;
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.22), rgba(254, 243, 199, 0.7));
    border-color: rgba(251, 146, 60, 0.22);
}

.clinic-settings-icon-success {
    color: #15803d;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(220, 252, 231, 0.75));
    border-color: rgba(34, 197, 94, 0.22);
}

.clinic-settings-icon-muted {
    color: #4f46e5;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(238, 242, 255, 0.84));
    border-color: rgba(99, 102, 241, 0.2);
}

.clinic-settings-segment h3,
.clinic-settings-segment .form-label.fw-bold {
    margin: 0;
    color: var(--text);
    font-size: 1.02rem;
    font-weight: 800;
}

.clinic-settings-segment p {
    margin: 0.22rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.clinic-settings-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.clinic-settings-toggle-card {
    min-width: min(100%, 360px);
    padding: 0.85rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
}

.clinic-settings-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
}

.clinic-settings-switch-row .form-check {
    min-width: max-content;
}

.clinic-settings-note {
    margin-top: 1rem;
    border-radius: 18px;
    border-color: rgba(6, 182, 212, 0.2);
}

.clinic-settings-token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin-top: 0.75rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.clinic-settings-token-list code {
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    background: rgba(236, 253, 245, 0.8);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.16);
}

@media (max-width: 768px) {
    .clinic-settings-segment-head,
    .clinic-settings-segment-compact .clinic-settings-segment-head {
        flex-direction: column;
        align-items: stretch;
    }

    .clinic-settings-actions {
        justify-content: flex-start;
    }
}

.grid-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1rem;
    margin-bottom: 0.35rem;
}

.grid-export-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 1rem;
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.12);
}

.grid-export-cell {
    min-width: 56px;
    text-align: left !important;
}

.grid-export-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.grid-export-header .grid-export-icon {
    flex: 0 0 auto;
}

.grid-header-actions + .table-responsive {
    margin-top: 0.35rem !important;
}

.online-booking-request-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.online-booking-request-summary > div {
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(238, 252, 250, 0.72));
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
}

.online-booking-request-summary span,
.online-booking-request-summary strong {
    display: block;
}

.online-booking-request-summary span {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 6px;
}

.online-booking-request-summary strong {
    color: var(--text);
    font-weight: 900;
}

@media (max-width: 1100px) {
    .online-booking-request-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .online-booking-request-summary {
        grid-template-columns: 1fr;
    }
}

.section-mini-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.section-mini-head h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 850;
    color: var(--text);
}

.treatment-tabs {
    border-bottom: 0;
    gap: 0.15rem;
    padding-inline: 1rem;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

.treatment-tabs .nav-link {
    position: relative;
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    padding: 0.85rem 1.15rem;
    color: var(--muted);
    font-weight: 800;
    background: rgba(255,255,255,0.42);
}

.treatment-tabs .nav-link:hover {
    color: var(--primary);
    background: rgba(255,255,255,0.75);
    border-color: rgba(99,102,241,0.16);
}

.treatment-tabs .nav-link.active {
    color: var(--primary);
    background: rgba(255,255,255,0.96);
    border-color: rgba(99,102,241,0.28);
    box-shadow: 0 -10px 24px rgba(79,70,229,0.08);
}

.treatment-tabs .nav-link.active::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: -1px;
    height: 2px;
    background: rgba(255,255,255,0.96);
}

.treatment-tabs .badge {
    color: var(--primary) !important;
    background: rgba(79,70,229,0.1) !important;
}

.treatment-tab-content {
    margin-top: 0;
    padding: 0;
    background: transparent;
    position: relative;
    z-index: 1;
}

.treatment-editor-tab-content {
    margin-top: -1rem;
    padding: 0 1rem 1rem;
    border: 1px solid rgba(99,102,241,0.22);
    border-radius: 0 0 24px 24px;
    background: rgba(255,255,255,0.46);
    box-shadow: 0 18px 36px rgba(15,23,42,0.06);
}

.treatment-editor-tab-content > .tab-pane > .section-card,
.treatment-editor-tab-content > .tab-pane > .glass-card,
.treatment-editor-tab-content > .tab-pane .dental-profile-shell {
    border: 0;
    box-shadow: none;
}

.treatment-tab-content > .tab-pane > .section-card,
.treatment-tab-content > .tab-pane > .glass-card,
.treatment-tab-content > .tab-pane .dental-profile-shell {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-color: var(--line);
}

.treatment-editor-tab-content > .tab-pane > .section-card,
.treatment-editor-tab-content > .tab-pane > .glass-card,
.treatment-editor-tab-content > .tab-pane .dental-profile-shell {
    border-color: transparent;
}

.treatment-tab-content > .tab-pane > .section-card,
.treatment-tab-content > .tab-pane > .dental-profile-shell {
    padding-top: 0;
}

.treatment-tab-content .section-head {
    min-height: 0;
    padding-top: 0.75rem;
}

.treatment-tab-content > .tab-pane > .section-card > .row:first-child,
.treatment-tab-content > .tab-pane > .section-card > .row:first-child > [class*="col-"] {
    margin-top: 0;
    padding-top: 0;
}

.treatment-tab-content #treatment-lab-pane .row.g-4:first-child,
.treatment-tab-content #lab-pane .row.g-4:first-child {
    --bs-gutter-y: 0;
}

.treatment-lab-tab-grid {
    gap: 1.5rem;
}

.treatment-lab-tab-grid > [class*="col-"] {
    flex: 1 1 420px;
    padding-top: 0;
}

.stat-card {
    padding: 0.9rem 1rem;
    min-height: 104px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.45rem;
}
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: #fff;
}
.stat-icon.purple { background: linear-gradient(135deg, #7c3aed, #4f46e5); }
.stat-icon.blue { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #be123c); }
.stat-icon.teal { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.stat-label {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.25;
}
.stat-value {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.05;
}

.inventory-alert-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.9rem;
}

.inventory-alert-stats .stat-card {
    min-height: 86px;
    padding: 0.78rem 0.9rem;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 0.7rem;
    row-gap: 0.15rem;
}

.inventory-alert-stats .stat-icon {
    grid-row: span 2;
    width: 36px;
    height: 36px;
}

.inventory-alert-stats span {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.25;
}

.inventory-alert-stats strong {
    color: var(--heading);
    font-size: 1.38rem;
    font-weight: 900;
    line-height: 1;
}

.document-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
    margin-top: 1rem;
}

.document-summary-card {
    min-height: 88px;
    padding: 0.85rem 1rem;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 0.85rem;
    row-gap: 0.15rem;
}

.document-summary-card .stat-icon {
    grid-row: span 2;
    width: 40px;
    height: 40px;
}

.document-summary-card span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.25;
}

.document-summary-card strong {
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 900;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.document-viewer-shell {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: stretch;
}

.document-wide-toolbar {
    display: none;
}

.document-wide-title {
    min-width: 0;
}

.document-wide-title strong,
.document-wide-title span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-wide-title strong {
    color: #fff;
    font-weight: 900;
}

.document-wide-title span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.85rem;
    font-weight: 800;
}

.document-viewer-sidebar,
.document-viewer-main {
    min-height: 72vh;
}

.document-viewer-shell.document-viewer-wide {
    position: fixed;
    inset: 0;
    z-index: 9999;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.85rem;
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0.9rem;
    background: radial-gradient(circle at 12% 12%, rgba(45, 212, 191, 0.2), transparent 26%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
    overflow: hidden;
}

.document-viewer-shell.document-viewer-wide .document-viewer-sidebar {
    display: none;
}

.document-viewer-shell.document-viewer-wide .document-wide-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
    padding: 0.3rem 0.2rem;
}

.document-viewer-shell.document-viewer-wide .document-viewer-main {
    min-height: 0;
    height: 100%;
    padding: 0.35rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.document-viewer-shell.document-viewer-wide .document-preview-frame {
    height: 100%;
    min-height: 0;
    border-radius: 20px;
}

.document-viewer-shell.document-viewer-wide .document-preview-empty {
    min-height: 100%;
}

body:has(.document-viewer-shell.document-viewer-wide) {
    overflow: hidden;
}

body.document-viewer-wide-active {
    overflow: hidden;
}

.document-file-icon {
    width: 62px;
    height: 62px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
    margin-bottom: 1rem;
    color: #0f766e;
    background: linear-gradient(135deg, rgba(204, 251, 241, 0.95), rgba(219, 234, 254, 0.75));
    box-shadow: 0 18px 36px rgba(15, 118, 110, 0.16);
}

.document-file-icon i {
    font-size: 1.65rem;
}

.document-viewer-sidebar h3 {
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.document-meta-list {
    display: grid;
    gap: 0.55rem;
    margin: 0;
}

.document-meta-list dt {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 800;
}

.document-meta-list dd {
    margin: -0.35rem 0 0;
    color: #0f172a;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.document-related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.2rem;
}

.document-notes {
    margin-top: 1.2rem;
    padding: 0.9rem;
    border-radius: 18px;
    background: rgba(241, 245, 249, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.document-notes p {
    margin: 0.35rem 0 0;
    color: #475569;
    line-height: 1.8;
}

.document-viewer-main {
    padding: 0.8rem;
    overflow: hidden;
}

.document-preview-frame {
    width: 100%;
    height: 72vh;
    min-height: 540px;
    border: 0;
    border-radius: 24px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.document-preview-frame.image-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.document-preview-frame.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 18px;
}

.document-preview-empty {
    min-height: 540px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    border-radius: 24px;
    border: 1px dashed rgba(100, 116, 139, 0.32);
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.96), rgba(236, 253, 245, 0.52));
}

.document-preview-empty i {
    font-size: 3rem;
    color: #0f766e;
}

html[data-theme="dark"] .document-file-icon {
    color: #99f6e4;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.22), rgba(59, 130, 246, 0.18));
}

html[data-theme="dark"] .document-meta-list dd,
html[data-theme="dark"] .document-viewer-sidebar h3 {
    color: #e2e8f0;
}

html[data-theme="dark"] .document-notes,
html[data-theme="dark"] .document-preview-empty {
    background: rgba(15, 23, 42, 0.48);
    border-color: rgba(148, 163, 184, 0.24);
}

html[data-theme="dark"] .document-preview-frame {
    background: #0f172a;
}

@media (max-width: 992px) {
    .document-viewer-shell {
        grid-template-columns: 1fr;
    }

    .document-viewer-sidebar,
    .document-viewer-main {
        min-height: auto;
    }

    .document-preview-frame,
    .document-preview-empty {
        min-height: 420px;
        height: 62vh;
    }
}

.appointment-slots-card {
    background: linear-gradient(135deg, rgba(240,253,250,0.78), rgba(239,246,255,0.82));
    border: 1px solid rgba(20,184,166,0.18);
}

.appointment-selected-slot {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(148,163,184,0.2);
    color: var(--heading);
    font-weight: 700;
}

.treatment-plan-image-preview {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    background: rgba(248, 250, 252, 0.75);
}

.treatment-images-modal-dialog {
    max-width: min(980px, calc(100vw - 2rem));
}

.modal.treatment-images-modal-root {
    z-index: 1065;
}

.treatment-images-modal {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.treatment-images-modal .modal-header {
    align-items: flex-start;
    padding: 1.15rem 1.35rem 0.35rem;
}

.treatment-images-modal .modal-body {
    padding: 1rem 1.35rem 1.35rem;
}

.treatment-images-modal .modal-body > .row {
    justify-content: center;
}

.treatment-images-modal .modal-body > .row > [class*="col-"] {
    flex: 1 1 320px;
    width: auto;
    max-width: 560px;
}

.treatment-images-modal .glass-card {
    background: rgba(255, 255, 255, 0.82);
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.treatment-images-modal .btn-close {
    margin: 0;
}

.treatment-image-inline-preview {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,0.65);
}

.treatment-image-inline-preview img {
    width: 68px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid var(--line);
    background: rgba(248, 250, 252, 0.75);
}

.treatment-inline-file-icon {
    width: 68px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(238, 242, 255, 0.72);
    color: var(--primary);
    font-size: 1.35rem;
}

.treatment-attachment-card {
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.treatment-attachment-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.treatment-attachment-icon {
    color: var(--primary);
    font-size: 1.35rem;
}

.treatment-attachment-preview {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.72);
    border: 1px dashed rgba(148, 163, 184, 0.42);
    text-decoration: none;
}

.treatment-attachment-preview > span {
    width: 76px;
    height: 76px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 2.2rem;
}

.appointment-slot-group {
    padding: 0.85rem 0;
    border-top: 1px solid rgba(148,163,184,0.18);
}

.appointment-slot-group:first-child {
    border-top: 0;
    padding-top: 0;
}

.appointment-slot-group-title {
    font-weight: 800;
    color: var(--heading);
    margin-bottom: 0.6rem;
}

.appointment-slot-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-width: 100%;
    white-space: normal;
}

.appointment-slot-day-label {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: rgba(20,184,166,0.12);
    border: 1px solid rgba(20,184,166,0.22);
    color: #0f766e;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.4;
}

.appointment-slot-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #10b981, #0f766e);
    border-color: transparent;
    box-shadow: 0 12px 24px rgba(15,118,110,0.2);
}

.appointment-slot-btn.active .appointment-slot-day-label {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.38);
    color: #fff;
}

.dashboard-refresh-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(14,165,233,0.08);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.dashboard-refresh-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #0ea5e9;
}

.dashboard-refresh-indicator.is-refreshing .dashboard-refresh-dot {
    animation: refreshPulse 0.9s ease-in-out infinite;
}

@keyframes refreshPulse {
    0%, 100% { transform: scale(0.9); opacity: 0.5; }
    50% { transform: scale(1.35); opacity: 1; }
}

.dashboard-stats .stat-card {
    min-height: 88px;
    padding: 0.75rem 0.85rem;
    gap: 0.3rem;
}

.dashboard-stats .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.dashboard-stats .stat-label {
    font-size: 0.78rem;
}

.dashboard-stats .stat-value {
    font-size: 1.25rem;
}

.custom-table thead th {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-bottom: 1rem;
}

.sortable-header {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    text-decoration: none;
    border-radius: 999px;
    padding: 0.2rem 0.45rem;
    transition: color 0.18s ease, background 0.18s ease;
}

.sortable-header:hover,
.sortable-header.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.sortable-header i {
    font-size: 0.78rem;
}

.custom-table tbody tr {
    background: rgba(255,255,255,0.62);
    border: 1px solid rgba(148,163,184,0.14);
}
.custom-table tbody td {
    padding: 1rem 0.85rem;
    border-top: none;
}
.custom-table tbody tr + tr { margin-top: 0.7rem; }

.list-stack { display: flex; flex-direction: column; gap: 0.9rem; }
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255,255,255,0.65);
    border: 1px solid rgba(148,163,184,0.16);
    border-radius: 18px;
}

.list-item-link {
    color: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.list-item-link-shell {
    position: relative;
}

.list-item-link:hover,
.list-item-link:focus {
    color: inherit;
    transform: translateY(-2px);
    border-color: rgba(79,70,229,0.22);
    box-shadow: 0 16px 28px rgba(15,23,42,0.08);
    background: rgba(255,255,255,0.82);
}

.list-item-link-shell:hover,
.list-item-link-shell:focus-within {
    transform: translateY(-2px);
    border-color: rgba(79,70,229,0.22);
    box-shadow: 0 16px 28px rgba(15,23,42,0.08);
    background: rgba(255,255,255,0.82);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.42rem 0.82rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.84rem;
}
.status-pill.confirmed, .status-pill.done, .status-pill.paid { background: rgba(16,185,129,0.14); color: #047857; }
.status-pill.pending, .status-pill.planned, .status-pill.unpaid { background: rgba(245,158,11,0.14); color: #b45309; }
.status-pill.completed, .status-pill.partiallypaid, .status-pill.inprogress { background: rgba(14,165,233,0.14); color: #0369a1; }
.status-pill.cancelled, .status-pill.noshow { background: rgba(239,68,68,0.12); color: #b91c1c; }
.status-pill.draft { background: rgba(100,116,139,0.14); color: #475569; }
.status-pill.submitted { background: rgba(59,130,246,0.14); color: #1d4ed8; }
.status-pill.accepted { background: rgba(16,185,129,0.14); color: #047857; }
.status-pill.rejected, .status-pill.failed { background: rgba(239,68,68,0.12); color: #b91c1c; }

.form-control, .form-select {
    border-radius: 16px;
    min-height: 48px;
    border: 1px solid rgba(148,163,184,0.22);
    background: rgba(255,255,255,0.92);
}
textarea.form-control { min-height: 120px; }
.form-label { font-weight: 700; color: #334155; }
.form-label.required-field::after {
    content: " *";
    color: #dc2626;
    font-weight: 900;
}
.btn {
    border-radius: 14px;
    padding: 0.75rem 1rem;
    font-weight: 700;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border: none;
    box-shadow: 0 14px 28px rgba(79,70,229,0.24);
}

.detail-box {
    background: rgba(255,255,255,0.68);
    border: 1px solid rgba(148,163,184,0.16);
    border-radius: 20px;
    padding: 1rem;
    height: 100%;
}
.detail-label { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.4rem; }
.detail-value { font-weight: 700; }

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { order: 2; }
    .hero-banner, .dashboard-quick-actions, .topbar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 576px) {
    .stat-card {
        min-height: 96px;
        padding: 0.85rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
    }

    .stat-value {
        font-size: 1.35rem;
    }
}


html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] .brand-wrap, html[dir="rtl"] .side-nav .nav-link, html[dir="rtl"] .search-pill, html[dir="rtl"] .user-pill, html[dir="rtl"] .search-form, html[dir="rtl"] .clinic-title { flex-direction: row-reverse; }
html[dir="rtl"] .section-head { flex-direction: row-reverse; }
html[dir="rtl"] .topbar { flex-direction: row; }
html[dir="rtl"] .hero-actions { justify-content: flex-start; }
.form-control, .form-select, textarea { border-radius: 14px; padding: 0.8rem 1rem; border: 1px solid rgba(148,163,184,0.28); }
.form-control:focus, .form-select:focus, textarea:focus { box-shadow: 0 0 0 0.2rem rgba(79,70,229,0.12); border-color: rgba(79,70,229,0.4); }
.btn { border-radius: 14px; font-weight: 700; }
.detail-box { background: rgba(255,255,255,0.7); border: 1px solid rgba(148,163,184,0.16); border-radius: 18px; padding: 1rem 1.1rem; height: 100%; }
.detail-label { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.45rem; }
.detail-value { font-weight: 700; }
@media (max-width: 992px) { .app-shell { grid-template-columns: 1fr; } .topbar, .section-head { flex-direction: column; align-items: stretch; } .top-tools { width: 100%; justify-content: space-between; } .search-form { min-width: 100%; } }

.filter-panel .form-control,
.filter-panel .form-select,
.section-card .glass-card form[method="get"].row.align-items-end .form-control,
.section-card .glass-card form[method="get"].row.align-items-end .form-select {
    min-height: 38px;
    padding: 0.45rem 0.72rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

.filter-panel .form-label,
.section-card .glass-card form[method="get"].row.align-items-end .form-label {
    margin-bottom: 0.3rem;
    font-size: 0.86rem;
}

.filter-panel .btn,
.section-card .glass-card form[method="get"].row.align-items-end .btn {
    min-height: 38px;
    padding: 0.45rem 0.72rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

.report-filter-card {
    min-width: 460px;
    padding: 1rem;
    border-radius: 24px;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.18);
}
.empty-state {
    padding: 1.2rem;
    border-radius: 18px;
    background: rgba(255,255,255,0.58);
    border: 1px dashed rgba(148,163,184,0.35);
    color: var(--muted);
    text-align: center;
    font-weight: 600;
}
.locked-card {
    position: relative;
    overflow: hidden;
}
.locked-card:after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(245,158,11,0.08));
}
@media (max-width: 992px) {
    .report-filter-card { min-width: 100%; }
}

.chart-card {
    position: relative;
    height: 320px;
    min-height: 320px;
    padding: 1rem;
    border-radius: 22px;
    background: rgba(255,255,255,0.66);
    border: 1px solid rgba(148,163,184,0.16);
}
.chart-card.small-chart {
    height: 260px;
    min-height: 260px;
}
.chart-card canvas {
    width: 100% !important;
    height: 100% !important;
}
@media print {
    .chart-card {
        page-break-inside: avoid;
        break-inside: avoid;
        background: #fff !important;
        border: 1px solid #ddd !important;
    }
}

/* Interactive Dental Treatment Chart */
.dental-chart-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.88), rgba(248,250,252,0.7));
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 24px;
    padding: 1.25rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}

.teeth-chart-wrap {
    position: relative;
    overflow-x: auto;
    padding: 1rem;
    border-radius: 24px;
    background:
        radial-gradient(circle at 50% 28%, rgba(79,70,229,0.08), transparent 24%),
        radial-gradient(circle at 50% 74%, rgba(14,165,233,0.08), transparent 26%),
        rgba(255,255,255,0.58);
    border: 1px solid rgba(148,163,184,0.18);
}

.teeth-chart {
    min-width: 720px;
    width: 100%;
    max-height: 420px;
    display: block;
}

.jaw-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    background: rgba(79,70,229,0.08);
    color: var(--primary);
    border: 1px solid rgba(79,70,229,0.12);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 800;
}
.upper-label { margin-bottom: 0.5rem; }
.lower-label { margin-top: 0.5rem; }

.tooth-group { cursor: pointer; outline: none; }
.tooth-group.read-only { cursor: help; }
.tooth-shape {
    fill: #ffffff;
    stroke: rgba(71,85,105,0.58);
    stroke-width: 2;
    filter: url(#toothShadow);
    transition: fill 0.18s ease, stroke 0.18s ease, transform 0.18s ease;
    transform-box: fill-box;
    transform-origin: center;
}
.teeth-chart.overview .tooth-shape { filter: url(#toothShadowOverview); }
.tooth-number {
    text-anchor: middle;
    dominant-baseline: middle;
    fill: #334155;
    font-size: 15px;
    font-weight: 800;
    pointer-events: none;
}
.tooth-group:hover .tooth-shape,
.tooth-group:focus .tooth-shape {
    fill: #eef2ff;
    stroke: var(--primary);
    transform: translateY(-3px) scale(1.04);
}
.tooth-group.selected .tooth-shape {
    fill: #dbeafe;
    stroke: #2563eb;
    stroke-width: 4;
}
.tooth-group.planned .tooth-shape { fill: #eef2ff; stroke: #6366f1; }
.tooth-group.progress .tooth-shape { fill: #fef3c7; stroke: #f59e0b; }
.tooth-group.done .tooth-shape { fill: #dcfce7; stroke: #10b981; }
.tooth-group.cancelled .tooth-shape { fill: #fee2e2; stroke: #ef4444; }

.jaw-divider {
    stroke: rgba(148,163,184,0.45);
    stroke-dasharray: 7 7;
    stroke-width: 2;
}

.selected-tooth-badge,
.tooth-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(14,165,233,0.1);
    color: #0369a1;
    border: 1px solid rgba(14,165,233,0.16);
    font-weight: 800;
}

.teeth-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}
.teeth-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    display: inline-block;
    border: 2px solid rgba(15,23,42,0.12);
}
.legend-dot.selected { background: #dbeafe; border-color: #2563eb; }
.legend-dot.planned { background: #eef2ff; border-color: #6366f1; }
.legend-dot.progress { background: #fef3c7; border-color: #f59e0b; }
.legend-dot.done { background: #dcfce7; border-color: #10b981; }
.legend-dot.cancelled { background: #fee2e2; border-color: #ef4444; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    white-space: nowrap;
}

.auth-theme-wrap {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 1rem;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] .glass-card,
html[data-theme="dark"] .glass-subtle,
html[data-theme="dark"] .detail-box,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .dental-chart-card,
html[data-theme="dark"] .teeth-chart-wrap,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .report-filter-card,
html[data-theme="dark"] .custom-table tbody tr,
html[data-theme="dark"] .list-item,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .auth-side,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .section-card,
html[data-theme="dark"] .dashboard-quick-actions,
html[data-theme="dark"] .hero-banner {
    background: var(--surface);
    border-color: var(--line);
    box-shadow: 0 18px 40px var(--shadow);
}

html[data-theme="dark"] .glass-subtle,
html[data-theme="dark"] .detail-box,
html[data-theme="dark"] .feature-line,
html[data-theme="dark"] .demo-box-grid div,
html[data-theme="dark"] .auth-helper-pill,
html[data-theme="dark"] .search-form,
html[data-theme="dark"] .search-pill,
html[data-theme="dark"] .user-pill,
html[data-theme="dark"] .header-alert-button {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--text);
}

html[data-theme="dark"] .header-alert-button.has-alerts {
    color: #fca5a5;
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.42), rgba(67, 20, 7, 0.34));
    border-color: rgba(248, 113, 113, 0.32);
}

html[data-theme="dark"] .clinic-settings-segment {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.72));
    border-color: var(--line);
    box-shadow: 0 18px 40px var(--shadow);
}

html[data-theme="dark"] .clinic-settings-toggle-card {
    background: var(--surface-2);
    border-color: var(--line);
}

html[data-theme="dark"] .clinic-settings-switch-row {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .clinic-settings-token-list code {
    background: rgba(20, 83, 45, 0.35);
    color: #86efac;
    border-color: rgba(74, 222, 128, 0.2);
}

html[data-theme="dark"] .header-alert-button > span {
    border-color: var(--surface);
}

html[data-theme="dark"] .report-filter-card,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .teeth-chart-wrap,
html[data-theme="dark"] .dental-chart-card {
    background: var(--surface-2);
}

html[data-theme="dark"] .treatment-tabs {
    border-bottom-color: var(--line);
}

html[data-theme="dark"] .treatment-tabs .nav-link {
    color: var(--muted);
    background: rgba(30,41,59,0.42);
}

html[data-theme="dark"] .treatment-tabs .nav-link:hover {
    color: var(--text);
    background: rgba(30,41,59,0.78);
    border-color: rgba(148,163,184,0.18);
}

html[data-theme="dark"] .treatment-tabs .nav-link.active {
    color: #93c5fd;
    background: var(--surface);
    border-color: rgba(147,197,253,0.36);
}

html[data-theme="dark"] .treatment-tabs .nav-link.active::after {
    background: var(--surface);
}

html[data-theme="dark"] .treatment-editor-tab-content {
    background: rgba(15,23,42,0.5);
    border-color: rgba(147,197,253,0.3);
    box-shadow: 0 18px 40px var(--shadow);
}

html[data-theme="dark"] .treatment-tab-content > .tab-pane > .section-card,
html[data-theme="dark"] .treatment-tab-content > .tab-pane > .glass-card,
html[data-theme="dark"] .treatment-tab-content > .tab-pane .dental-profile-shell {
    border-color: var(--line);
}

html[data-theme="dark"] .brand-title,
html[data-theme="dark"] .page-title,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .detail-value,
html[data-theme="dark"] .fw-semibold,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .custom-table,
html[data-theme="dark"] .table,
html[data-theme="dark"] .tooth-number {
    color: var(--text);
}

html[data-theme="dark"] .text-secondary,
html[data-theme="dark"] .page-subtitle,
html[data-theme="dark"] .brand-subtitle,
html[data-theme="dark"] .detail-label,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .teeth-legend,
html[data-theme="dark"] .small.text-secondary {
    color: var(--muted) !important;
}

html[data-theme="dark"] .side-nav .nav-link,
html[data-theme="dark"] .nav-group-toggle,
html[data-theme="dark"] .nav-sublink,
html[data-theme="dark"] .feature-line,
html[data-theme="dark"] .search-form,
html[data-theme="dark"] .search-pill,
html[data-theme="dark"] .user-pill {
    color: var(--text);
}

html[data-theme="dark"] .clinic-title i {
    color: #93c5fd;
    background: rgba(147, 197, 253, 0.12);
}

html[data-theme="dark"] .side-nav .nav-link:hover,
html[data-theme="dark"] .side-nav .nav-link.active,
html[data-theme="dark"] .nav-group.active > .nav-group-toggle,
html[data-theme="dark"] .nav-group-toggle:hover,
html[data-theme="dark"] .nav-sublink:hover,
html[data-theme="dark"] .nav-sublink.active {
    background: rgba(79, 70, 229, 0.22);
    color: #eef2ff;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea {
    background: var(--surface-3);
    border-color: rgba(148,163,184,0.22);
    color: var(--input-text);
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] .search-form-input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #8ea4c7;
}

html[data-theme="dark"] .search-form-input,
html[data-theme="dark"] .search-form-icon {
    color: var(--text);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] textarea:focus {
    background: var(--surface-3);
    color: var(--input-text);
    border-color: rgba(96,165,250,0.45);
    box-shadow: 0 0 0 0.2rem rgba(59,130,246,0.18);
}

html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-primary {
    color: var(--text);
    border-color: rgba(148,163,184,0.3);
    background: transparent;
}

html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-primary:hover {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

html[data-theme="dark"] .pagination-modern .page-link {
    background: var(--surface-2);
    border-color: rgba(148,163,184,0.18);
    color: var(--text);
    box-shadow: none;
}

html[data-theme="dark"] .pagination-modern .page-item.disabled .page-link {
    background: rgba(30,41,59,0.72);
    color: #64748b;
}

html[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: transparent;
    color: var(--text);
    border-bottom-color: rgba(148,163,184,0.14);
}

html[data-theme="dark"] .custom-table tbody tr:hover,
html[data-theme="dark"] .list-item:hover {
    background: rgba(30, 41, 59, 0.92);
}

html[data-theme="dark"] .alert-success {
    color: #d1fae5;
    background: rgba(6, 95, 70, 0.34);
}

html[data-theme="dark"] .alert-danger {
    color: #fee2e2;
    background: rgba(127, 29, 29, 0.4);
}

.validation-summary-valid {
    display: none;
}

.field-validation-valid {
    display: none;
}

html[data-theme="dark"] .badge.bg-light,
html[data-theme="dark"] .selected-tooth-badge,
html[data-theme="dark"] .tooth-badge,
html[data-theme="dark"] .jaw-label {
    background: rgba(59,130,246,0.16) !important;
    color: #bfdbfe !important;
    border-color: rgba(96,165,250,0.22);
}

html[data-theme="dark"] .tooth-shape {
    fill: #cbd5e1;
    stroke: rgba(148,163,184,0.72);
}

html[data-theme="dark"] .tooth-group:hover .tooth-shape,
html[data-theme="dark"] .tooth-group:focus .tooth-shape {
    fill: #dbeafe;
}

html[data-theme="dark"] .jaw-divider {
    stroke: rgba(148,163,184,0.28);
}

.dental-profile-shell {
    overflow: hidden;
    position: relative;
    background:
        radial-gradient(circle at top left, rgba(59,130,246,0.10), transparent 26%),
        radial-gradient(circle at top right, rgba(16,185,129,0.10), transparent 22%),
        linear-gradient(180deg, var(--surface-strong), var(--surface));
}

.dental-profile-shell::before {
    content: "";
    position: absolute;
    inset: -120px auto auto -80px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.16), transparent 68%);
    pointer-events: none;
}

.chart-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.85rem;
    margin-bottom: 0.7rem;
    border-radius: 999px;
    background: rgba(59,130,246,0.10);
    color: #1d4ed8;
    border: 1px solid rgba(59,130,246,0.16);
    font-size: 0.83rem;
    font-weight: 800;
}

.chart-kicker.subtle {
    margin-bottom: 0.55rem;
    background: rgba(16,185,129,0.10);
    color: #0f766e;
    border-color: rgba(16,185,129,0.14);
}

.chart-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.chart-summary-card {
    position: relative;
    padding: 1rem 1.1rem;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.90), rgba(255,255,255,0.72));
    border: 1px solid var(--line);
    box-shadow: 0 14px 30px rgba(15,23,42,0.05);
    overflow: hidden;
}

.chart-summary-card::after {
    content: "";
    position: absolute;
    inset: auto -18px -18px auto;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(59,130,246,0.08);
}

.chart-summary-card i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.55rem;
    border-radius: 12px;
    background: rgba(59,130,246,0.10);
    color: #2563eb;
    font-size: 1rem;
}

.chart-summary-card.chart-summary-accent {
    background: linear-gradient(135deg, rgba(59,130,246,0.92), rgba(99,102,241,0.88));
    color: #fff;
}

.chart-summary-card.chart-summary-accent span,
.chart-summary-card.chart-summary-accent strong {
    color: #fff;
}

.chart-summary-card.chart-summary-accent i {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

.chart-summary-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.chart-summary-card strong {
    font-size: 1.15rem;
}

.dentition-switch {
    display: inline-flex;
    gap: 0.75rem;
    padding: 0.45rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.dentition-tab {
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 800;
}

.dentition-tab.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.dental-profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(320px, 0.75fr);
    gap: 1.25rem;
    align-items: start;
}

.clinical-type-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.clinical-type-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 92px;
    padding: 1rem;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.74));
    border: 1px solid rgba(148,163,184,0.24);
    box-shadow: 0 16px 36px rgba(15,23,42,0.05);
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.clinical-type-card:hover,
.clinical-type-card.active {
    transform: translateY(-2px);
    border-color: rgba(99,102,241,0.46);
    box-shadow: 0 24px 46px rgba(79,70,229,0.12);
}

.clinical-type-card.active {
    background: linear-gradient(135deg, rgba(238,242,255,0.96), rgba(236,253,245,0.88));
}

.clinical-type-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.clinical-type-icon {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    color: #4f46e5;
    background: rgba(99,102,241,0.11);
    flex: 0 0 auto;
}

.clinical-type-card strong,
.clinical-type-card small {
    display: block;
}

.clinical-type-card strong {
    color: var(--ink);
    font-weight: 900;
}

.clinical-type-card small {
    color: var(--muted);
    margin-top: 0.2rem;
    line-height: 1.5;
}

.dental-chart-workspace,
.chart-timeline-card {
    padding: 1.25rem;
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74));
    border: 1px solid var(--line);
    box-shadow: 0 24px 42px rgba(15,23,42,0.05);
}

.clinical-specialty-workspace {
    min-height: 560px;
}

.specialty-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.35rem;
    border-radius: 28px;
    border: 1px solid rgba(148,163,184,0.18);
    background:
        radial-gradient(circle at 12% 20%, rgba(16,185,129,0.18), transparent 32%),
        linear-gradient(135deg, rgba(255,255,255,0.94), rgba(240,253,250,0.84));
}

.specialty-hero-ortho {
    background:
        radial-gradient(circle at 12% 20%, rgba(99,102,241,0.20), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,0.94), rgba(238,242,255,0.86));
}

.specialty-hero-icon {
    width: 4.2rem;
    height: 4.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    box-shadow: 0 18px 34px rgba(20,184,166,0.22);
    font-size: 1.6rem;
    flex: 0 0 auto;
}

.specialty-hero-ortho .specialty-hero-icon {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 18px 34px rgba(99,102,241,0.22);
}

.specialty-hero h3 {
    margin: 0 0 0.35rem;
    font-weight: 900;
}

.specialty-hero p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.specialty-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.specialty-metric-card,
.aligner-progress-card {
    padding: 1.1rem;
    border-radius: 24px;
    border: 1px solid rgba(148,163,184,0.18);
    background: rgba(255,255,255,0.82);
    box-shadow: 0 16px 32px rgba(15,23,42,0.05);
}

.specialty-metric-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.specialty-metric-card strong {
    font-size: 1.25rem;
    font-weight: 900;
}

.aligner-progress-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.aligner-progress-ring {
    width: 7rem;
    height: 7rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #4338ca;
    font-size: 1.45rem;
    font-weight: 900;
    background:
        radial-gradient(circle, rgba(255,255,255,0.96) 54%, transparent 56%),
        conic-gradient(from 180deg, #4f46e5, #14b8a6, #4f46e5);
    box-shadow: 0 18px 36px rgba(79,70,229,0.16);
}

.aligner-progress-card h4 {
    font-weight: 900;
    margin-bottom: 0.35rem;
}

.aligner-progress-card p {
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.clinical-fields-panel {
    border: 1px solid rgba(148,163,184,0.18);
}

.perio-chart-shell {
    padding: 1rem;
    border: 1px solid rgba(20, 184, 166, 0.18);
    border-radius: 28px;
    background:
        radial-gradient(circle at 8% 0%, rgba(20, 184, 166, 0.12), transparent 30%),
        linear-gradient(180deg, rgba(255,255,255,0.9), rgba(240,253,250,0.72));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 18px 34px rgba(15,23,42,0.05);
}

.perio-chart-shell-wide {
    padding: 1.05rem;
}

.perio-chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.perio-chart-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.perio-chart-actions .btn {
    border-radius: 999px;
    font-weight: 900;
}

.perio-index-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.9rem;
}

.perio-index-card {
    position: relative;
    overflow: hidden;
    padding: 0.85rem 0.95rem;
    border: 1px solid rgba(148,163,184,0.16);
    border-radius: 20px;
    background: rgba(255,255,255,0.86);
    box-shadow: 0 12px 26px rgba(15,23,42,0.04);
}

.perio-index-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #14b8a6;
}

.perio-index-card.danger::before {
    background: #ef4444;
}

.perio-index-card.warning::before {
    background: #f59e0b;
}

.perio-index-card span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.perio-index-card strong {
    display: block;
    color: var(--ink);
    font-size: 1.3rem;
    font-weight: 950;
    line-height: 1.2;
}

.perio-index-card.danger strong {
    color: #dc2626;
}

.perio-index-card.warning strong {
    color: #b45309;
}

.perio-matrix-grid {
    display: grid;
    gap: 1rem;
    max-height: 760px;
    overflow: auto;
    padding: 0.1rem 0 0.25rem 0.25rem;
}

.perio-quadrant-card {
    overflow: hidden;
    border: 1px solid rgba(20, 184, 166, 0.16);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.045);
}

.perio-quadrant-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.82rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.09), rgba(14, 165, 233, 0.055));
}

.perio-quadrant-head strong,
.perio-quadrant-head span {
    display: block;
}

.perio-quadrant-head strong {
    color: var(--ink);
    font-weight: 950;
}

.perio-quadrant-head span,
.perio-quadrant-head small {
    color: var(--muted);
    font-weight: 800;
}

.perio-matrix-scroll {
    overflow-x: auto;
    padding-bottom: 0.35rem;
}

.perio-matrix-table {
    width: 100%;
    min-width: 1180px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.perio-matrix-table th,
.perio-matrix-table td {
    padding: 0.42rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    border-inline-start: 1px solid rgba(148, 163, 184, 0.10);
    text-align: center;
    vertical-align: middle;
}

.perio-matrix-table tbody tr:last-child th,
.perio-matrix-table tbody tr:last-child td {
    border-bottom: 0;
}

.perio-row-label {
    position: sticky;
    inset-inline-start: 0;
    z-index: 3;
    width: 4.6rem;
    min-width: 4.6rem;
    padding-inline: 0.35rem !important;
    color: #334155;
    background: rgba(248, 250, 252, 0.96);
    font-size: 0.72rem;
    font-weight: 950;
    text-align: right !important;
    box-shadow: -8px 0 16px rgba(15, 23, 42, 0.03);
}

.perio-matrix-table thead .perio-row-label {
    z-index: 5;
}

.perio-tooth-heading {
    min-width: 8.5rem;
    background: rgba(240, 253, 250, 0.72);
}

.perio-tooth-title {
    color: var(--ink);
    font-weight: 950;
    line-height: 1.1;
}

.perio-sites-row th,
.perio-sites-row td {
    background: rgba(248, 250, 252, 0.68);
}

.perio-site-strip,
.perio-cell-triplet,
.perio-cell-checks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem;
    align-items: center;
}

.perio-site-strip span {
    color: var(--muted);
    font-size: 0.67rem;
    font-weight: 950;
}

.perio-cell-triplet .form-control {
    min-width: 2.45rem;
    min-height: 32px;
    padding: 0.24rem 0.16rem;
    border-radius: 10px;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 950;
}

.perio-filled-value {
    border-color: rgba(20, 184, 166, 0.55) !important;
    color: #0f766e !important;
    background: #ecfdf5 !important;
    box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.18), 0 0 0 3px rgba(20, 184, 166, 0.08);
}

.perio-cell-checks label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    min-height: 28px;
    margin: 0;
    border: 1px solid rgba(239, 68, 68, 0.16);
    border-radius: 10px;
    color: #991b1b;
    background: rgba(254, 226, 226, 0.42);
    font-size: 0.68rem;
    font-weight: 950;
}

.perio-cell-checks label.perio-bleeding-checked {
    color: #991b1b;
    border-color: rgba(239, 68, 68, 0.42);
    background: #fee2e2;
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.12), 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.perio-mobility-input {
    min-width: 92px;
    border-radius: 12px;
    font-size: 0.76rem;
    font-weight: 850;
}

.perio-mobility-input.perio-mobility-marked {
    color: #3730a3;
    border-color: rgba(99, 102, 241, 0.45);
    background: #eef2ff;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.12), 0 0 0 3px rgba(99, 102, 241, 0.08);
}

[data-perio-tooth-cell].perio-tooth-skipped {
    opacity: 0.48;
    background: rgba(241, 245, 249, 0.76) !important;
}

.perio-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
    gap: 0.75rem;
    max-height: 760px;
    overflow: auto;
    padding: 0.15rem 0 0.25rem 0.25rem;
}

.perio-tooth-card {
    border: 1px solid rgba(148,163,184,0.17);
    border-radius: 22px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 14px 28px rgba(15,23,42,0.045);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.perio-tooth-card:focus-within,
.perio-tooth-card:hover {
    border-color: rgba(20,184,166,0.44);
    box-shadow: 0 18px 34px rgba(20,184,166,0.1);
}

.perio-tooth-card.perio-tooth-skipped {
    opacity: 0.54;
    filter: grayscale(0.18);
}

.perio-tooth-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.72rem 0.85rem;
    border-bottom: 1px solid rgba(148,163,184,0.13);
    border-radius: 22px 22px 0 0;
    background: linear-gradient(135deg, rgba(15,118,110,0.08), rgba(14,165,233,0.06));
}

.perio-tooth-head strong {
    font-size: 0.9rem;
    font-weight: 950;
}

.perio-skip-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
}

.perio-site-labels,
.perio-triplet,
.perio-bleeding-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    padding-inline: 0.72rem;
}

.perio-site-labels {
    margin-top: 0.65rem;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-align: center;
}

.perio-triplet {
    margin-top: 0.28rem;
}

.perio-triplet .form-control {
    min-height: 34px;
    padding: 0.32rem 0.2rem;
    border-radius: 12px;
    text-align: center;
    font-weight: 900;
}

.perio-bleeding-row {
    margin-top: 0.35rem;
}

.perio-bleeding-row label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 30px;
    margin: 0;
    border: 1px solid rgba(239,68,68,0.15);
    border-radius: 12px;
    color: #991b1b;
    background: rgba(254,226,226,0.42);
    font-size: 0.7rem;
    font-weight: 900;
}

.perio-mobility-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.72rem 0.78rem;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 900;
}

.perio-danger-value {
    border-color: #ef4444 !important;
    color: #991b1b !important;
    background: #fff1f2 !important;
}

.perio-warning-value {
    border-color: #f59e0b !important;
    color: #92400e !important;
    background: #fffbeb !important;
}

.dental-chart-sidebar .form-card {
    position: sticky;
    top: 1.25rem;
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,255,255,0.82));
    box-shadow: 0 24px 42px rgba(15,23,42,0.06);
}

.dental-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.legend-dot {
    width: 0.8rem;
    height: 0.8rem;
    display: inline-flex;
    border-radius: 999px;
    margin-inline-end: 0.35rem;
    border: 1px solid rgba(15,23,42,0.08);
}

.legend-dot.healthy { background: #ffffff; }
.legend-dot.caries { background: #ef4444; }
.legend-dot.filling { background: #3b82f6; }
.legend-dot.crown { background: #d4a017; }
.legend-dot.missing { background: #94a3b8; }
.legend-dot.implant { background: #10b981; }

.odontogram-board {
    display: grid;
    gap: 1.25rem;
}

.odontogram-jaw {
    padding: 1.05rem;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.78)),
        var(--surface-strong);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.jaw-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    font-weight: 800;
    margin-bottom: 0.85rem;
    color: var(--text);
}

.jaw-title span {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(15,23,42,0.05);
}

.odontogram-quadrants {
    display: grid;
    gap: 0.85rem;
}

.odontogram-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.odontogram-quadrant-label {
    flex: 0 0 92px;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.14);
    color: #335072;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
}

.odontogram-tooth-card {
    width: 78px;
    border: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.70), rgba(255,255,255,0.34));
    padding: 0.35rem;
    border-radius: 20px;
    border: 1px solid rgba(148,163,184,0.12);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.odontogram-tooth-card::before {
    content: none;
    position: absolute;
    z-index: 0;
    left: 50%;
    top: 0.58rem;
    width: 43px;
    height: 43px;
    transform: translateX(-50%);
    pointer-events: none;
    background:
        radial-gradient(circle at 34% 32%, rgba(255,255,255,0.98) 0 13%, transparent 14%),
        radial-gradient(circle at 66% 32%, rgba(255,255,255,0.96) 0 13%, transparent 14%),
        linear-gradient(150deg, #ffffff 0%, #f8fbff 46%, #e8edf5 100%);
    border: 1.8px solid rgba(100,116,139,0.34);
    box-shadow:
        inset 0 1px 4px rgba(255,255,255,0.95),
        inset 0 -8px 13px rgba(148,163,184,0.12),
        0 8px 14px rgba(15,23,42,0.10);
}

.odontogram-tooth-card::after {
    content: none;
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 0.88rem;
    width: 22px;
    height: 16px;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0.42;
    background:
        radial-gradient(circle at 50% 50%, rgba(100,116,139,0.32) 0 9%, transparent 10%),
        linear-gradient(90deg, transparent 46%, rgba(100,116,139,0.22) 47% 53%, transparent 54%),
        linear-gradient(0deg, transparent 46%, rgba(100,116,139,0.18) 47% 53%, transparent 54%);
    border-radius: 999px;
}

.odontogram-tooth-card[data-tooth$="1"]::before,
.odontogram-tooth-card[data-tooth$="2"]::before {
    width: 34px;
    height: 46px;
    border-radius: 16px 16px 10px 10px / 23px 23px 8px 8px;
    clip-path: polygon(16% 5%, 84% 5%, 92% 28%, 86% 88%, 67% 97%, 33% 97%, 14% 88%, 8% 28%);
}

.odontogram-tooth-card[data-tooth$="1"]::after,
.odontogram-tooth-card[data-tooth$="2"]::after {
    width: 22px;
    height: 18px;
    top: 1.02rem;
    background: linear-gradient(90deg, transparent 45%, rgba(100,116,139,0.16) 46% 54%, transparent 55%);
    border-radius: 0;
}

.odontogram-tooth-card[data-tooth$="3"]::before {
    width: 36px;
    height: 48px;
    border-radius: 20px 20px 15px 15px / 26px 26px 14px 14px;
    clip-path: polygon(18% 7%, 82% 7%, 92% 38%, 72% 84%, 50% 100%, 28% 84%, 8% 38%);
}

.odontogram-tooth-card[data-tooth$="3"]::after {
    width: 18px;
    height: 26px;
    top: 0.9rem;
    background: linear-gradient(180deg, rgba(100,116,139,0.18), transparent 76%);
    border-radius: 999px;
}

.odontogram-tooth-card[data-tooth$="4"]::before,
.odontogram-tooth-card[data-tooth$="5"]::before {
    width: 42px;
    height: 42px;
    border-radius: 42% 48% 44% 48%;
    clip-path: polygon(50% 5%, 82% 18%, 95% 50%, 80% 84%, 50% 96%, 20% 84%, 5% 50%, 18% 18%);
}

.odontogram-tooth-card[data-tooth$="4"]::after,
.odontogram-tooth-card[data-tooth$="5"]::after {
    width: 26px;
    height: 21px;
    top: 0.9rem;
    background:
        radial-gradient(circle at 32% 46%, rgba(100,116,139,0.30) 0 11%, transparent 12%),
        radial-gradient(circle at 68% 46%, rgba(100,116,139,0.26) 0 11%, transparent 12%),
        linear-gradient(90deg, transparent 47%, rgba(100,116,139,0.20) 48% 52%, transparent 53%);
    border-radius: 999px;
}

.odontogram-tooth-card[data-tooth$="6"]::before,
.odontogram-tooth-card[data-tooth$="7"]::before,
.odontogram-tooth-card[data-tooth$="8"]::before {
    width: 48px;
    height: 44px;
    border-radius: 18px 20px 16px 17px / 19px 18px 17px 18px;
    clip-path: polygon(25% 4%, 47% 10%, 68% 4%, 92% 23%, 96% 57%, 82% 88%, 54% 98%, 24% 90%, 5% 62%, 9% 24%);
    background:
        radial-gradient(circle at 30% 28%, #ffffff 0 12%, transparent 13%),
        radial-gradient(circle at 68% 28%, #ffffff 0 12%, transparent 13%),
        radial-gradient(circle at 36% 70%, rgba(255,255,255,0.95) 0 11%, transparent 12%),
        radial-gradient(circle at 70% 68%, rgba(255,255,255,0.92) 0 10%, transparent 11%),
        linear-gradient(150deg, #ffffff 0%, #f8fbff 46%, #e3eaf4 100%);
}

.odontogram-tooth-card[data-tooth$="6"]::after,
.odontogram-tooth-card[data-tooth$="7"]::after,
.odontogram-tooth-card[data-tooth$="8"]::after {
    width: 31px;
    height: 24px;
    top: 0.92rem;
    background:
        radial-gradient(circle at 29% 35%, rgba(100,116,139,0.32) 0 9%, transparent 10%),
        radial-gradient(circle at 70% 35%, rgba(100,116,139,0.28) 0 9%, transparent 10%),
        radial-gradient(circle at 48% 68%, rgba(100,116,139,0.24) 0 8%, transparent 9%),
        linear-gradient(135deg, transparent 45%, rgba(100,116,139,0.20) 46% 54%, transparent 55%),
        linear-gradient(45deg, transparent 45%, rgba(100,116,139,0.16) 46% 54%, transparent 55%);
    border-radius: 999px;
}

.odontogram-tooth-card:hover,
.odontogram-tooth-card.selected {
    transform: translateY(-4px) scale(1.02);
    background: linear-gradient(180deg, rgba(219,234,254,0.92), rgba(191,219,254,0.34));
    border-color: rgba(59,130,246,0.24);
    box-shadow: 0 18px 28px rgba(15,23,42,0.10);
}

.odontogram-tooth-card span {
    display: block;
    margin-top: 0.35rem;
    text-align: center;
    font-size: 0.83rem;
    font-weight: 800;
    color: var(--muted);
    position: relative;
    z-index: 3;
}

.tooth-svg {
    width: 100%;
    aspect-ratio: 1;
    overflow: visible;
    position: relative;
    z-index: 2;
    opacity: 1;
    filter: drop-shadow(0 1px 1px rgba(15,23,42,0.10));
}

.surface {
    stroke: rgba(15,23,42,0.14);
    stroke-width: 2;
    cursor: pointer;
    fill-opacity: 1;
    stroke-opacity: 1;
    transition: transform .15s ease, filter .15s ease, stroke .15s ease, opacity .15s ease;
}

.surface:hover,
.surface.selected-surface {
    stroke: rgba(15,23,42,0.56);
    filter: brightness(1.07) saturate(1.08);
    fill-opacity: 0.86;
    stroke-opacity: 0.95;
}

.surface.selected-surface {
    stroke-width: 3;
    opacity: 1;
}

.odontogram-tooth-card:hover .surface {
    opacity: 0.95;
}

.surface.healthy { fill: #ffffff; }
.surface.caries { fill: #ef4444; }
.surface.filling { fill: #3b82f6; }
.surface.crown { fill: #d4a017; }
.surface.missing { fill: #94a3b8; }
.surface.implant { fill: #10b981; }
.surface.root-canal { fill: #8b5cf6; }
.surface.fracture { fill: #fb923c; }

.dental-quick-select {
    padding: 0.9rem 1rem;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(59,130,246,0.10), rgba(16,185,129,0.10));
    border: 1px solid rgba(59,130,246,0.14);
    color: var(--text);
    font-weight: 700;
    display: grid;
    gap: 0.3rem;
}

.timeline-list {
    display: grid;
    gap: 0.9rem;
}

.timeline-item {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 1rem;
    padding: 1rem;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,255,255,0.82));
    border: 1px solid var(--line);
    box-shadow: 0 14px 28px rgba(15,23,42,0.05);
}

.timeline-date {
    font-weight: 800;
    color: var(--primary);
    display: inline-flex;
    align-items: start;
}

.timeline-date::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    margin-inline-end: 0.45rem;
    margin-top: 0.35rem;
    box-shadow: 0 0 0 6px rgba(79,70,229,0.10);
}

.timeline-title {
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.timeline-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    display: inline-flex;
}

.timeline-dot.healthy { background: #ffffff; border: 1px solid rgba(15,23,42,0.16); }
.timeline-dot.caries { background: #ef4444; }
.timeline-dot.filling { background: #3b82f6; }
.timeline-dot.crown { background: #d4a017; }
.timeline-dot.missing { background: #94a3b8; }
.timeline-dot.implant { background: #10b981; }
.timeline-dot.root-canal { background: #8b5cf6; }
.timeline-dot.fracture { background: #fb923c; }

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 0.5rem 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.timeline-note {
    color: var(--text);
    margin-top: 0.3rem;
}

.timeline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.8rem;
}

.timeline-links a {
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(15,157,148,0.08);
    border: 1px solid rgba(15,157,148,0.16);
    color: #0f766e;
    font-weight: 800;
}

.empty-state-box {
    padding: 1.4rem;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.78));
    border: 1px dashed rgba(148,163,184,0.4);
    color: var(--muted);
    text-align: center;
}

html[data-theme="dark"] .chart-summary-card,
html[data-theme="dark"] .dental-chart-workspace,
html[data-theme="dark"] .clinical-type-card,
html[data-theme="dark"] .perio-chart-shell,
html[data-theme="dark"] .perio-index-card,
html[data-theme="dark"] .perio-quadrant-card,
html[data-theme="dark"] .perio-tooth-card,
html[data-theme="dark"] .specialty-metric-card,
html[data-theme="dark"] .aligner-progress-card,
html[data-theme="dark"] .chart-timeline-card,
html[data-theme="dark"] .odontogram-jaw,
html[data-theme="dark"] .timeline-item,
html[data-theme="dark"] .empty-state-box {
    background: var(--surface-2);
}

html[data-theme="dark"] .dental-chart-sidebar .form-card {
    background: linear-gradient(180deg, rgba(10,23,42,0.92), rgba(10,23,42,0.82));
}

html[data-theme="dark"] .chart-summary-card {
    background: linear-gradient(180deg, rgba(10,23,42,0.88), rgba(10,23,42,0.74));
}

html[data-theme="dark"] .clinical-type-card.active,
html[data-theme="dark"] .specialty-hero,
html[data-theme="dark"] .specialty-hero-ortho {
    background: linear-gradient(135deg, rgba(15,23,42,0.92), rgba(30,41,59,0.76));
}

html[data-theme="dark"] .perio-chart-shell {
    border-color: rgba(45,212,191,0.22);
    background:
        radial-gradient(circle at 8% 0%, rgba(45,212,191,0.12), transparent 30%),
        linear-gradient(180deg, rgba(15,23,42,0.92), rgba(15,23,42,0.74));
}

html[data-theme="dark"] .perio-tooth-head {
    background: linear-gradient(135deg, rgba(45,212,191,0.12), rgba(96,165,250,0.08));
    border-bottom-color: rgba(148,163,184,0.14);
}

html[data-theme="dark"] .perio-quadrant-head,
html[data-theme="dark"] .perio-sites-row th,
html[data-theme="dark"] .perio-sites-row td,
html[data-theme="dark"] .perio-row-label,
html[data-theme="dark"] .perio-tooth-heading {
    background: rgba(15, 23, 42, 0.78);
}

html[data-theme="dark"] .perio-matrix-table th,
html[data-theme="dark"] .perio-matrix-table td {
    border-color: rgba(148, 163, 184, 0.13);
}

html[data-theme="dark"] .perio-cell-checks label {
    color: #fecaca;
    background: rgba(127,29,29,0.24);
    border-color: rgba(248,113,113,0.18);
}

html[data-theme="dark"] .perio-filled-value {
    color: #99f6e4 !important;
    border-color: rgba(45, 212, 191, 0.52) !important;
    background: rgba(20, 184, 166, 0.18) !important;
}

html[data-theme="dark"] .perio-cell-checks label.perio-bleeding-checked {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(127, 29, 29, 0.42);
}

html[data-theme="dark"] .perio-mobility-input.perio-mobility-marked {
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.48);
    background: rgba(79, 70, 229, 0.22);
}

html[data-theme="dark"] [data-perio-tooth-cell].perio-tooth-skipped {
    background: rgba(30, 41, 59, 0.72) !important;
}

html[data-theme="dark"] .perio-bleeding-row label {
    color: #fecaca;
    background: rgba(127,29,29,0.24);
    border-color: rgba(248,113,113,0.18);
}

html[data-theme="dark"] .chart-summary-card::after {
    background: rgba(96,165,250,0.12);
}

html[data-theme="dark"] .chart-summary-card i,
html[data-theme="dark"] .jaw-title span {
    background: rgba(96,165,250,0.14);
    color: #bfdbfe;
}

html[data-theme="dark"] .odontogram-tooth-card {
    background: linear-gradient(180deg, rgba(15,23,42,0.70), rgba(15,23,42,0.34));
    border-color: rgba(148,163,184,0.12);
}

html[data-theme="dark"] .odontogram-tooth-card:hover,
html[data-theme="dark"] .odontogram-tooth-card.selected {
    background: linear-gradient(180deg, rgba(30,41,59,0.94), rgba(59,130,246,0.24));
}

html[data-theme="dark"] .timeline-item,
html[data-theme="dark"] .empty-state-box,
html[data-theme="dark"] .odontogram-jaw {
    background: linear-gradient(180deg, rgba(10,23,42,0.92), rgba(10,23,42,0.78));
}

html[data-theme="dark"] .surface.healthy,
html[data-theme="dark"] .timeline-dot.healthy,
html[data-theme="dark"] .legend-dot.healthy {
    background: #dbeafe;
    fill: #dbeafe;
}

@media (max-width: 1200px) {
    .dental-profile-grid,
    .chart-summary-grid,
    .clinical-type-switch,
    .perio-chart-grid,
    .perio-index-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .dental-profile-grid,
    .chart-summary-grid,
    .clinical-type-switch,
    .specialty-metric-grid,
    .perio-chart-grid,
    .perio-index-grid {
        grid-template-columns: 1fr;
    }

    .perio-chart-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .perio-chart-actions .btn {
        flex: 1 1 160px;
    }

    .dental-chart-sidebar .form-card {
        position: static;
    }

    .timeline-item {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .inventory-alert-stats {
        grid-template-columns: 1fr;
    }
}
.portal-brand-shell {
    border-top: 4px solid var(--portal-primary, #0ea5a4);
}

.portal-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(14, 165, 164, 0.22);
    border-radius: 1.25rem;
    background:
        linear-gradient(135deg, rgba(236, 253, 245, 0.78), rgba(240, 249, 255, 0.72)),
        rgba(255, 255, 255, 0.84);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.portal-brand-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    object-fit: cover;
    border: 1px solid rgba(21, 59, 87, 0.12);
    background: #fff;
}

.portal-brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--portal-primary, #0ea5a4), var(--portal-accent, #153b57));
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: 0 16px 40px rgba(21, 59, 87, 0.18);
}

.portal-nav-btn {
    border-color: color-mix(in srgb, var(--portal-primary, #0ea5a4) 28%, #d7e3eb);
    color: var(--portal-accent, #153b57);
}

.portal-nav-btn:hover,
.portal-nav-btn:focus {
    color: #fff;
    background: linear-gradient(135deg, var(--portal-primary, #0ea5a4), var(--portal-accent, #153b57));
    border-color: transparent;
}

.portal-detail-item,
.portal-note-box,
.portal-money-row,
.portal-lab-card {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
}

.portal-detail-item {
    min-height: 86px;
    padding: 1rem;
}

.portal-detail-item span,
.portal-money-row span {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.portal-detail-item strong,
.portal-money-row strong {
    color: var(--text);
    font-size: 1.02rem;
    font-weight: 900;
}

.portal-note-box,
.portal-lab-card {
    padding: 1rem;
}

.portal-money-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    margin-bottom: 0.85rem;
}

.portal-money-row span {
    margin-bottom: 0;
}

html[data-theme="dark"] .portal-detail-item,
html[data-theme="dark"] .portal-note-box,
html[data-theme="dark"] .portal-money-row,
html[data-theme="dark"] .portal-lab-card {
    background: rgba(15, 23, 42, 0.74);
    border-color: rgba(148, 163, 184, 0.18);
}

.portal-booking-grid {
    display: grid;
    grid-template-columns: minmax(240px, 330px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: stretch;
}

.portal-booking-side,
.portal-booking-form-card,
.portal-booking-slots {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.74);
}

.portal-booking-side {
    display: grid;
    align-content: start;
    gap: 1rem;
    padding: 1rem;
}

.portal-booking-form-card {
    padding: 1.25rem;
}

.portal-booking-patient-card,
.portal-booking-hint {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(14, 165, 164, 0.10), rgba(21, 59, 87, 0.08));
}

.portal-booking-avatar {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--portal-primary, #0ea5a4), var(--portal-accent, #153b57));
    box-shadow: 0 16px 30px rgba(14, 165, 164, 0.18);
}

.portal-booking-patient-card span,
.portal-booking-hint span,
.portal-booking-patient-card small {
    display: block;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.portal-booking-patient-card strong,
.portal-booking-hint strong {
    display: block;
    color: var(--text);
    font-size: 1rem;
    font-weight: 900;
}

.portal-booking-hint i {
    color: var(--portal-primary, #0ea5a4);
    font-size: 1.35rem;
}

.portal-booking-slots {
    padding: 1rem;
}

.portal-booking-selected {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    margin-bottom: 0.9rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    color: var(--portal-accent, #153b57);
    background: color-mix(in srgb, var(--portal-primary, #0ea5a4) 12%, #ffffff);
    font-weight: 900;
}

.portal-booking-slot-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.portal-booking-slot {
    border: 1px solid color-mix(in srgb, var(--portal-primary, #0ea5a4) 34%, #d7e3eb);
    border-radius: 999px;
    padding: 0.65rem 0.95rem;
    color: var(--portal-accent, #153b57);
    background: rgba(255, 255, 255, 0.88);
    font-weight: 900;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease;
}

.portal-booking-slot:hover,
.portal-booking-slot.selected {
    color: #fff;
    background: linear-gradient(135deg, var(--portal-primary, #0ea5a4), var(--portal-accent, #153b57));
    box-shadow: 0 14px 28px rgba(14, 165, 164, 0.18);
    transform: translateY(-2px);
}

html[data-theme="dark"] .portal-booking-side,
html[data-theme="dark"] .portal-booking-form-card,
html[data-theme="dark"] .portal-booking-slots {
    background: rgba(15, 23, 42, 0.74);
    border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .portal-booking-patient-card,
html[data-theme="dark"] .portal-booking-hint,
html[data-theme="dark"] .portal-booking-slot {
    background: rgba(15, 23, 42, 0.64);
}

.dashboard-schedule-tabs {
    border-bottom: 0;
    gap: 0.15rem;
    padding-inline: 1rem;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

.dashboard-schedule-tabs .nav-link {
    position: relative;
    margin-bottom: -1px;
    border: 1px solid rgba(148,163,184,0.28);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(248,250,252,0.72));
    color: #64748b;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.85rem 1.15rem;
    box-shadow: 0 -4px 14px rgba(15,23,42,0.04);
    opacity: 1;
}

.dashboard-schedule-tabs .nav-link:not(.active) i {
    color: #64748b;
}

.dashboard-schedule-tabs .nav-link:hover {
    color: var(--primary);
    background: rgba(255,255,255,0.96);
    border-color: rgba(99,102,241,0.24);
    box-shadow: 0 -8px 20px rgba(79,70,229,0.07);
}

.dashboard-schedule-tabs .nav-link.active {
    color: var(--primary);
    background: rgba(255,255,255,0.96);
    border-color: rgba(99,102,241,0.28);
    box-shadow: 0 -10px 24px rgba(79,70,229,0.08);
}

.dashboard-schedule-tabs .nav-link.active::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: -1px;
    height: 2px;
    background: rgba(255,255,255,0.96);
}

.dashboard-schedule-tab-content {
    min-height: 180px;
    margin-top: -1px;
    padding: 1rem;
    border: 1px solid rgba(99,102,241,0.22);
    border-radius: 0 0 24px 24px;
    background: rgba(255,255,255,0.46);
    box-shadow: 0 18px 36px rgba(15,23,42,0.06);
}

.dashboard-doctor-schedule {
    display: grid;
    gap: 1rem;
}

.dashboard-doctor-card {
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
}

.dashboard-doctor-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(14, 165, 233, 0.08));
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.empty-state-card {
    display: grid;
    place-items: center;
    gap: 0.5rem;
    padding: 2rem;
    border-radius: 24px;
    border: 1px dashed rgba(148, 163, 184, 0.36);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.62);
}

.empty-state-card i {
    font-size: 1.8rem;
    color: var(--primary);
}

html[data-theme="dark"] .dashboard-doctor-card,
html[data-theme="dark"] .empty-state-card {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .dashboard-schedule-tabs .nav-link {
    color: #cbd5e1;
    background: linear-gradient(180deg, rgba(30,41,59,0.86), rgba(15,23,42,0.72));
    border-color: rgba(148,163,184,0.26);
    box-shadow: 0 -4px 14px rgba(0,0,0,0.16);
}

html[data-theme="dark"] .dashboard-schedule-tabs .nav-link:not(.active) i {
    color: #cbd5e1;
}

html[data-theme="dark"] .dashboard-schedule-tabs .nav-link:hover {
    color: var(--text);
    background: rgba(30,41,59,0.78);
    border-color: rgba(148,163,184,0.18);
}

html[data-theme="dark"] .dashboard-schedule-tabs .nav-link.active {
    color: #93c5fd;
    background: var(--surface);
    border-color: rgba(147,197,253,0.36);
}

html[data-theme="dark"] .dashboard-schedule-tabs .nav-link.active::after {
    background: var(--surface);
}

html[data-theme="dark"] .dashboard-schedule-tab-content {
    background: rgba(15,23,42,0.5);
    border-color: rgba(147,197,253,0.3);
    box-shadow: 0 18px 40px var(--shadow);
}

html[data-theme="dark"] .dashboard-doctor-card-head {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.12), rgba(45, 212, 191, 0.08));
    border-bottom-color: rgba(148, 163, 184, 0.14);
}

.doctor-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.doctor-avatar,
.doctor-photo-preview {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    object-fit: cover;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #fff;
}

.doctor-photo-preview {
    width: 78px;
    height: 78px;
    border-radius: 22px;
}

.doctor-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.08);
}

.dashboard-doctor-avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    flex: 0 0 auto;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.voice-note-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.voice-note-toolbar .btn {
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.78rem;
    line-height: 1.1;
    padding: 0.34rem 0.62rem;
}

.voice-note-recording {
    color: #fff !important;
    border-color: #dc2626 !important;
    background: linear-gradient(135deg, #ef4444, #be123c) !important;
    box-shadow: 0 12px 24px rgba(220, 38, 38, 0.22);
}

.voice-note-status {
    min-height: 1.35rem;
    font-weight: 700;
}

.patient-editor-tab-content {
    margin-top: 0;
    padding: 1.25rem 1rem 1rem;
    border-color: rgba(99, 102, 241, 0.16);
    border-radius: 0 0 24px 24px;
}

.patient-editor-tab-content .tab-pane > .row:first-child {
    padding-top: 0 !important;
}

.patient-editor-tabs {
    padding-inline: 0.8rem;
}

.patient-editor-tabs .nav-link {
    min-width: 150px;
    text-align: center;
    color: #52627a;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.82));
    border-color: rgba(148, 163, 184, 0.34);
    box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.18);
}

.patient-editor-tabs .nav-link:hover {
    color: var(--primary);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.9));
    border-color: rgba(99, 102, 241, 0.28);
}

.patient-editor-tabs .nav-link.active {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(99, 102, 241, 0.38);
    box-shadow: 0 -10px 24px rgba(79, 70, 229, 0.08);
}

html[data-theme="dark"] .patient-editor-tabs .nav-link {
    color: rgba(226, 232, 240, 0.74);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.86), rgba(15, 23, 42, 0.72));
    border-color: rgba(148, 163, 184, 0.24);
}

html[data-theme="dark"] .patient-editor-tabs .nav-link.active {
    color: #c7d2fe;
    background: rgba(30, 41, 59, 0.96);
    border-color: rgba(129, 140, 248, 0.42);
}

.patient-no-history-check {
    min-width: 270px;
    justify-content: center;
}

.patient-no-history-active .patient-medical-fields {
    opacity: 0.48;
}

.patient-medical-tab .section-card.border {
    border-color: rgba(148, 163, 184, 0.22) !important;
    background: rgba(255, 255, 255, 0.68);
}

html[data-theme="dark"] .patient-medical-tab .section-card.border {
    background: rgba(15, 23, 42, 0.46);
}

#medicalHistoryAlertPanel .alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-height: auto;
    margin-top: 0.8rem !important;
    padding: 0.7rem 0.9rem;
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

#medicalHistoryAlertPanel .alert-danger {
    background: linear-gradient(135deg, rgba(254, 226, 226, 0.92), rgba(255, 247, 237, 0.78));
    border-color: rgba(248, 113, 113, 0.45);
}

#medicalHistoryAlertPanel .alert-warning {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.88), rgba(255, 251, 235, 0.72));
    border-color: rgba(245, 158, 11, 0.34);
}

#medicalHistoryAlertPanel .alert-success {
    background: linear-gradient(135deg, rgba(220, 252, 231, 0.9), rgba(240, 253, 250, 0.72));
    border-color: rgba(34, 197, 94, 0.34);
}

#medicalHistoryAlertPanel .alert-info {
    background: linear-gradient(135deg, rgba(224, 242, 254, 0.9), rgba(240, 249, 255, 0.72));
    border-color: rgba(14, 165, 233, 0.28);
}

#medicalHistoryAlertPanel .alert .fw-bold {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0 !important;
    white-space: nowrap;
}

#medicalHistoryAlertPanel .alert .d-flex {
    flex: 1 1 220px;
    gap: 0.4rem !important;
}

#medicalHistoryAlertPanel .alert .badge {
    border-radius: 999px;
    padding: 0.38rem 0.58rem;
    font-size: 0.78rem;
    line-height: 1;
}

#medicalHistoryAlertPanel .alert .btn {
    margin-top: 0 !important;
    border-radius: 999px;
    padding: 0.42rem 0.8rem;
    font-weight: 800;
    white-space: nowrap;
}

#medicalHistoryAlertPanel .alert .alert-link {
    margin-inline-start: 0.4rem;
    font-weight: 900;
    white-space: nowrap;
}

html[data-theme="dark"] #medicalHistoryAlertPanel .alert-danger {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.42), rgba(67, 20, 7, 0.34));
}

html[data-theme="dark"] #medicalHistoryAlertPanel .alert-warning {
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.42), rgba(69, 26, 3, 0.3));
}

html[data-theme="dark"] #medicalHistoryAlertPanel .alert-success {
    background: linear-gradient(135deg, rgba(20, 83, 45, 0.38), rgba(19, 78, 74, 0.26));
}

html[data-theme="dark"] #medicalHistoryAlertPanel .alert-info {
    background: linear-gradient(135deg, rgba(12, 74, 110, 0.36), rgba(8, 47, 73, 0.24));
}

@media (max-width: 700px) {
    #medicalHistoryAlertPanel .alert {
        align-items: flex-start;
        flex-direction: column;
    }

    #medicalHistoryAlertPanel .alert .d-flex {
        flex: 1 1 auto;
    }

    .portal-link-card {
        align-items: stretch;
        flex-direction: column;
    }
}

.task-form-hint {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.95rem 1rem;
    color: #0f766e;
    background: linear-gradient(135deg, rgba(204, 251, 241, 0.72), rgba(240, 253, 250, 0.48));
    border: 1px solid rgba(20, 184, 166, 0.2);
    border-radius: 18px;
    font-weight: 800;
    line-height: 1.8;
}

.task-form-hint i {
    display: inline-grid;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #0f766e;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 12px;
}

.task-relation-panel {
    padding: 1.1rem;
    background: rgba(248, 250, 252, 0.74);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 24px;
}

.task-relation-title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.95rem;
    padding: 0.42rem 0.78rem;
    color: #4338ca;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 999px;
    font-weight: 900;
}

.task-overdue-check {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding-inline: 0.35rem;
}

.task-filter-form .task-overdue-check {
    min-height: 38px;
    padding: 0.35rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.58);
}

.task-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

@media (max-width: 1200px) {
    .task-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 576px) {
    .task-stats-grid {
        grid-template-columns: 1fr;
    }
}

.task-description {
    max-width: 340px;
    line-height: 1.65;
}

.backup-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.backup-stat-date {
    font-size: 0.95rem;
}

.backup-meta-box {
    min-height: 58px;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
}

.backup-meta-box span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.backup-meta-box strong {
    color: var(--text);
    font-size: 0.9rem;
}

.backup-restore-details {
    position: relative;
}

.backup-restore-details summary {
    list-style: none;
    cursor: pointer;
}

.backup-restore-details summary::-webkit-details-marker {
    display: none;
}

.backup-restore-form {
    position: absolute;
    z-index: 20;
    inset-inline-end: 0;
    top: calc(100% + 0.4rem);
    width: min(280px, 80vw);
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.backup-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.backup-reason {
    max-width: 280px;
    line-height: 1.7;
}

@media (max-width: 1200px) {
    .backup-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 576px) {
    .backup-stats-grid {
        grid-template-columns: 1fr;
    }

    .backup-restore-form {
        position: static;
        margin-top: 0.5rem;
    }
}

.task-row-overdue {
    background: linear-gradient(90deg, rgba(254, 226, 226, 0.42), rgba(255, 255, 255, 0)) !important;
}

.task-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 900;
}

.task-pill.neutral {
    color: #334155;
    background: rgba(148, 163, 184, 0.16);
}

.task-pill.info {
    color: #0369a1;
    background: rgba(14, 165, 233, 0.14);
}

.task-pill.warning {
    color: #b45309;
    background: rgba(245, 158, 11, 0.16);
}

.task-pill.danger {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.13);
}

.status-pill.in-progress {
    color: #0369a1;
    background: rgba(14, 165, 233, 0.14);
}

.task-links {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    flex-wrap: wrap;
}

.task-links a {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #475569;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.task-links a:hover {
    color: #4f46e5;
    border-color: rgba(79, 70, 229, 0.32);
    transform: translateY(-1px);
}

html[data-theme="dark"] .task-form-hint,
html[data-theme="dark"] .task-relation-panel {
    background: rgba(15, 23, 42, 0.5);
}

html[data-theme="dark"] .task-links a {
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.72);
}

.video-consultation-frame {
    border: 1px solid rgba(14, 165, 164, 0.24);
    border-radius: 26px;
    min-height: 68vh;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
}

.video-consultation-frame iframe {
    display: block;
    width: 100%;
    height: 68vh;
    border: 0;
    background: #0f172a;
}

html[data-theme="dark"] .video-consultation-frame {
    border-color: rgba(45, 212, 191, 0.25);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}
