:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #687386;
    --line: #e4e9f1;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eaf1ff;
    --success: #059669;
    --success-soft: #e8f8f2;
    --warning: #d97706;
    --warning-soft: #fff6df;
    --danger: #dc2626;
    --danger-soft: #fff0f0;
    --dark: #334155;
    --shadow: 0 10px 30px rgba(30, 41, 59, .07);
    --radius: 18px;
    --sidebar: 260px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 26px; margin-bottom: 0; letter-spacing: -.03em; }
h2 { font-size: 20px; margin-bottom: 0; letter-spacing: -.02em; }
h3 { font-size: 15px; margin-bottom: 3px; }
small { font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; background: #111827; color: #dbe3f1; display: flex; flex-direction: column; z-index: 50; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #4f8cff, #2454dc); color: white; font-size: 21px; font-weight: 800; box-shadow: 0 8px 18px rgba(37, 99, 235, .3); }
.brand strong, .brand small { display: block; }
.brand strong { color: white; font-size: 17px; letter-spacing: -.02em; }
.brand small { color: #8792a8; margin-top: 1px; }
.nav-menu { display: grid; gap: 5px; }
.nav-item { border: 0; width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 12px; color: #aeb8ca; background: transparent; text-align: left; transition: .18s ease; }
.nav-item span { width: 22px; text-align: center; font-size: 18px; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: linear-gradient(90deg, rgba(37,99,235,.9), rgba(37,99,235,.65)); box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 13px; border-radius: 14px; background: rgba(255,255,255,.06); }
.user-card strong, .user-card small { display: block; }
.user-card strong { color: white; font-size: 13px; }
.user-card small { color: #8d99ac; text-transform: capitalize; }
.logout-button { font-size: 13px; }

.main-area { min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 92px; padding: 20px 30px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px); }
.topbar > div:nth-child(2) { flex: 1; }
.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.top-actions, .toolbar-actions, .hero-actions, .invoice-actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mobile-menu { display: none; }
.content { flex: 1; padding: 26px 30px 40px; min-width: 0; }
.footer { padding: 16px 30px 25px; color: var(--muted); font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 21px; min-width: 0; }
.card-header { min-height: 44px; margin-bottom: 19px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.toolbar-wrap { align-items: center; flex-wrap: wrap; }
.stack-column { display: grid; gap: 18px; align-content: start; }

.btn { min-height: 40px; border: 1px solid transparent; border-radius: 11px; padding: 9px 15px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; transition: .16s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 8px 16px rgba(37,99,235,.18); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: white; border-color: var(--line); color: var(--text); }
.btn-light:hover { border-color: #cbd5e1; background: var(--surface-soft); }
.btn-success { background: var(--success); color: white; }
.btn-sm { min-height: 34px; padding: 6px 10px; border-radius: 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-danger-ghost { color: var(--danger); background: transparent; border-color: #fecaca; }
.icon-button { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: white; display: grid; place-items: center; font-size: 18px; }
.text-link { color: var(--primary); font-weight: 700; font-size: 13px; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.muted { color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.stats-grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.stat-card { min-height: 105px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); display: flex; gap: 13px; align-items: center; }
.stat-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 18px; }
.stat-card small, .stat-card strong { display: block; }
.stat-card small { color: var(--muted); margin-bottom: 4px; }
.stat-card strong { font-size: 22px; line-height: 1.1; letter-spacing: -.03em; }
.stat-emphasis { background: linear-gradient(145deg, #1e40af, #2563eb); color: white; border-color: transparent; }
.stat-emphasis .stat-icon { background: rgba(255,255,255,.16); color: white; }
.stat-emphasis small { color: #d9e5ff; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(270px, .75fr); gap: 18px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.big-number { font-size: 31px; font-weight: 800; letter-spacing: -.04em; margin: 3px 0 8px; }

.timeline { display: grid; }
.timeline-item { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 17px; padding: 16px 0 16px 13px; border-bottom: 1px solid var(--line); border-left: 3px solid #cbd5e1; }
.timeline-item:last-child { border-bottom: 0; }
.status-border-confirmed, .status-border-arrived { border-left-color: var(--warning); }
.status-border-in_progress { border-left-color: var(--primary); }
.status-border-completed { border-left-color: var(--success); }
.status-border-cancelled, .status-border-no_show { border-left-color: var(--danger); }
.timeline-time strong, .timeline-time small { display: block; }
.timeline-time strong { font-size: 17px; }
.timeline-time small { color: var(--muted); }
.timeline-heading { display: flex; justify-content: space-between; gap: 15px; }
.timeline-heading p, .schedule-title p, .visit-patient p { margin: 0; color: var(--muted); font-size: 13px; }
.timeline-actions { margin-top: 10px; display: flex; gap: 8px; }

.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 25px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge-neutral { color: #475569; background: #eef2f7; }
.badge-info, .badge-primary { color: #1d4ed8; background: #e6efff; }
.badge-warning { color: #a16207; background: #fff4d6; }
.badge-success { color: #047857; background: #dcfce7; }
.badge-danger { color: #b91c1c; background: #fee2e2; }
.badge-dark { color: white; background: #475569; }
.pill { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 11px; }
.pill-warning { background: var(--warning-soft); color: #a16207; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th { padding: 11px 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; text-align: left; white-space: nowrap; }
.data-table td { padding: 14px 13px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfcfe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.table-subtext { display: block; color: var(--muted); margin-top: 2px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell strong, .person-cell small { display: block; }
.person-cell small { color: var(--muted); }
.actions-cell { display: flex; justify-content: flex-end; gap: 7px; }
.code-chip { display: inline-flex; padding: 5px 8px; border-radius: 7px; background: #eef2f7; color: #475569; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px; display: grid; place-items: center; background: #334155; color: white; font-weight: 800; font-size: 12px; }
.avatar-soft { background: var(--primary-soft); color: var(--primary); }
.avatar-xl { width: 58px; height: 58px; flex-basis: 58px; border-radius: 17px; font-size: 17px; background: linear-gradient(145deg, #4f8cff, #2454dc); }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 750; color: #475569; }
.field input, .field select, .field textarea, .search-form input, .filter-form input, .filter-form select, .inline-form input, .inline-form select { width: 100%; border: 1px solid #dbe1ea; border-radius: 10px; background: white; color: var(--text); padding: 10px 11px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field input, .field select { min-height: 42px; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search-form input:focus, .filter-form input:focus, .filter-form select:focus { border-color: #7ba4fb; box-shadow: 0 0 0 3px rgba(37,99,235,.11); }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: #f4f6f9; color: #657085; }
.form-grid { display: grid; gap: 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.stack-form { display: grid; gap: 15px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr); gap: 18px; }
.narrow-layout { max-width: 950px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 3px 0; }
.required-note, .autosave-note { color: var(--muted); font-size: 11px; }
.check-field { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.check-field input { width: 18px; height: 18px; accent-color: var(--primary); }
.medical-card { border-color: #fed7aa; background: linear-gradient(180deg, #fffdfa, #fff); }
.search-form, .filter-form { display: flex; align-items: flex-end; gap: 9px; flex-wrap: wrap; }
.search-form input { width: 240px; min-height: 40px; }
.compact-field { min-width: 155px; }
.compact-field input, .compact-field select { min-height: 38px; padding: 7px 10px; }

.empty-state { min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; color: var(--muted); }
.empty-state h3 { color: var(--text); font-size: 18px; }
.empty-state p { max-width: 430px; }
.empty-icon { width: 58px; height: 58px; margin-bottom: 13px; border-radius: 18px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 24px; }
.compact-empty { min-height: 240px; }

.flash-stack { position: fixed; right: 24px; top: 108px; z-index: 100; display: grid; gap: 9px; width: min(420px, calc(100vw - 30px)); }
.alert { padding: 13px 14px; border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.14); display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; animation: slideIn .2s ease; }
.alert button { border: 0; background: transparent; font-size: 18px; line-height: 1; color: inherit; }
.alert-success { background: #eafaf3; color: #066844; border: 1px solid #b7ecd4; }
.alert-danger { background: #fff0f0; color: #a61b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fff7e7; color: #9a5b00; border: 1px solid #f8df9b; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.auth-body { min-height: 100vh; background: radial-gradient(circle at 10% 20%, #dbeafe 0, transparent 35%), radial-gradient(circle at 90% 80%, #e0e7ff 0, transparent 34%), #f8fafc; }
.auth-shell { min-height: 100vh; padding: 32px; display: grid; place-items: center; }
.login-card { width: min(1020px, 100%); min-height: 610px; display: grid; grid-template-columns: 1.08fr .92fr; background: white; border-radius: 28px; overflow: hidden; box-shadow: 0 30px 80px rgba(30,41,59,.16); }
.login-visual { padding: 34px; background: linear-gradient(145deg, #0f172a, #1e3a8a 65%, #2563eb); color: white; display: flex; flex-direction: column; }
.brand-login { padding: 0; }
.login-copy { margin-top: auto; max-width: 480px; padding: 30px 10px 20px; }
.login-copy .pill { background: rgba(255,255,255,.12); color: #dbeafe; }
.login-copy h2 { margin-top: 16px; font-size: 38px; line-height: 1.12; letter-spacing: -.045em; }
.login-copy p { color: #c8d5ec; font-size: 16px; }
.login-form-wrap { padding: 60px 54px; display: flex; flex-direction: column; justify-content: center; }
.login-form-header { margin-bottom: 26px; }
.login-form-header h1 { font-size: 30px; margin-bottom: 7px; }
.login-form-header > p:last-child { color: var(--muted); }
.demo-box { margin-top: 20px; padding: 13px; border-radius: 11px; background: #f8fafc; border: 1px dashed #cbd5e1; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }

.patient-hero, .visit-header { display: flex; align-items: center; gap: 22px; margin-bottom: 18px; }
.patient-identity, .visit-patient { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 250px; }
.patient-identity p { margin: 0; color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: minmax(260px,.7fr) minmax(0,1.4fr) minmax(0,1.4fr); gap: 18px; }
.details-list { margin: 0; display: grid; }
.details-list > div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.details-list > div:last-child { border-bottom: 0; }
.details-list dt { color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.details-list dd { margin: 0; font-weight: 700; }
.alert-panel { margin-bottom: 18px; padding: 17px 20px; border: 1px solid #f7c57c; border-radius: 15px; background: var(--warning-soft); color: #7a4a08; }
.alert-panel > strong { display: block; margin-bottom: 11px; }
.alert-panel-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.alert-panel-grid > div { padding-right: 14px; border-right: 1px solid rgba(161,98,7,.18); }
.alert-panel-grid > div:last-child { border-right: 0; }
.alert-panel-grid small, .alert-panel-grid span { display: block; }
.alert-panel-grid small { opacity: .75; margin-bottom: 2px; }
.critical-alert { border-color: #fda4af; background: #fff1f2; color: #9f1239; }

.date-nav { display: flex; justify-content: center; gap: 8px; margin: 5px 0 18px; }
.schedule-list { display: grid; gap: 11px; }
.schedule-card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; display: grid; grid-template-columns: 64px 6px minmax(0,1fr) auto; gap: 14px; align-items: center; }
.schedule-card:hover { border-color: #bfd1f7; box-shadow: 0 7px 20px rgba(37,99,235,.07); }
.schedule-time strong, .schedule-time small { display: block; }
.schedule-time strong { font-size: 18px; }
.schedule-time small { color: var(--muted); }
.dentist-dot, .dentist-color { width: 6px; height: 46px; border-radius: 999px; background: var(--dot); }
.dentist-color { width: 13px; height: 13px; }
.schedule-title { display: flex; gap: 10px; justify-content: space-between; }
.schedule-reason { margin: 7px 0; }
.meta-row { display: flex; gap: 22px; color: var(--muted); font-size: 12px; }
.schedule-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; max-width: 260px; }
.flow-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.flow-steps li { display: flex; gap: 11px; padding: 12px; border-radius: 12px; background: #f8fafc; color: var(--muted); }
.flow-steps li > span { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 50%; background: #e2e8f0; font-weight: 800; }
.flow-steps strong, .flow-steps small { display: block; }
.flow-steps.done, .flow-steps .done { color: var(--success); }
.flow-steps li.done > span { background: var(--success-soft); }
.flow-steps li.active { background: var(--primary-soft); color: var(--primary); }
.flow-steps li.active > span { color: white; background: var(--primary); }
.success-banner { padding: 13px 15px; border-radius: 12px; background: var(--success-soft); color: #076d4d; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.success-banner span { color: #24775f; }

.visit-header { flex-wrap: wrap; }
.visit-meta { display: flex; gap: 25px; padding: 0 20px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.visit-meta small, .visit-meta strong { display: block; }
.visit-meta small { color: var(--muted); margin-bottom: 2px; }
.title-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.visit-grid { display: grid; grid-template-columns: minmax(280px,.72fr) minmax(0,1.35fr); gap: 18px; align-items: start; }
.clinical-panel { position: sticky; top: 112px; }
.treatment-list { display: grid; gap: 12px; }
.treatment-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.treatment-main { padding: 14px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: start; }
.treatment-code { padding: 5px 8px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-family: ui-monospace, monospace; font-size: 11px; font-weight: 800; }
.treatment-info p { margin: 0; color: var(--muted); font-size: 12px; }
.treatment-notes { margin-top: 6px !important; color: #475569 !important; }
.treatment-price { text-align: right; }
.treatment-price strong, .treatment-price small { display: block; }
.treatment-price strong { font-size: 16px; }
.treatment-price small { color: var(--muted); }
.material-tags { padding: 0 14px 12px 64px; display: flex; gap: 6px; flex-wrap: wrap; }
.material-tags span { padding: 4px 7px; border-radius: 7px; background: #f1f5f9; color: #475569; font-size: 11px; }
.treatment-actions { padding: 10px 14px; border-top: 1px solid var(--line); background: #fbfcfe; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.inline-details summary { cursor: pointer; color: var(--primary); font-weight: 750; font-size: 12px; }
.inline-details[open] { width: 100%; }
.inline-form { margin-top: 9px; display: grid; grid-template-columns: minmax(170px,1fr) 90px auto; gap: 7px; }
.inline-form input, .inline-form select { min-height: 34px; padding: 6px 8px; }
.visit-summary { margin-top: 19px; padding-top: 17px; border-top: 1px solid var(--line); display: grid; gap: 13px; }
.visit-summary > div:first-child { display: flex; align-items: center; justify-content: space-between; }
.visit-summary > div:first-child span { color: var(--muted); font-weight: 700; }
.visit-summary > div:first-child strong { font-size: 25px; letter-spacing: -.03em; }

.modal-dialog { width: min(720px, calc(100% - 24px)); max-height: calc(100vh - 40px); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 30px 90px rgba(15,23,42,.3); }
.modal-dialog::backdrop { background: rgba(15,23,42,.55); backdrop-filter: blur(3px); }
.modal-card { display: grid; max-height: calc(100vh - 40px); }
.modal-header, .modal-footer { padding: 18px 21px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-body { padding: 20px 21px; overflow-y: auto; }
.tooth-picker { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #f8fafc; }
.tooth-picker small { display: block; color: var(--muted); margin-bottom: 8px; }
.tooth-picker > div { display: grid; grid-template-columns: repeat(16, minmax(28px,1fr)); gap: 4px; }
.tooth-picker button { min-height: 29px; border: 1px solid #dce2ea; border-radius: 6px; background: white; color: #475569; font-size: 10px; padding: 2px; }
.tooth-picker button:hover, .tooth-picker button.selected { color: white; background: var(--primary); border-color: var(--primary); }
.calculated-total { padding: 13px 15px; border-radius: 11px; background: #eef5ff; color: var(--primary); display: flex; justify-content: space-between; align-items: center; }
.calculated-total strong { font-size: 18px; }

.invoice-shell { max-width: 1050px; margin: 0 auto; padding: 34px; }
.invoice-top { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.invoice-brand { padding: 0; }
.invoice-brand strong { color: var(--text); }
.invoice-top p { color: var(--muted); margin: 10px 0 0; }
.invoice-title { text-align: right; }
.invoice-title h2 { font-size: 30px; margin-bottom: 8px; }
.invoice-parties { padding: 25px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.invoice-parties > div { display: flex; flex-direction: column; gap: 3px; }
.invoice-parties > div:last-child { text-align: right; }
.invoice-parties small { color: var(--muted); margin-top: 6px; }
.invoice-table { min-width: 650px; }
.invoice-totals { width: min(390px,100%); margin: 22px 0 0 auto; display: grid; gap: 8px; }
.invoice-totals > div { display: flex; justify-content: space-between; gap: 20px; padding: 4px 0; }
.invoice-totals span { color: var(--muted); }
.invoice-totals .grand-total { padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 18px; }
.invoice-actions-row { max-width: 1050px; margin: 15px auto; justify-content: flex-end; }
.invoice-lower-grid { max-width: 1050px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.payments-list span { display: block; }
.payments-list small { display: block; color: var(--muted); }

.compact-list { display: grid; }
.compact-list > div { min-height: 47px; padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.compact-list > div:last-child { border-bottom: 0; }
.compact-list small { display: block; color: var(--muted); }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }

@media (max-width: 1280px) {
    .stats-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .visit-meta { order: 3; width: 100%; border: 0; padding: 10px 0 0 72px; }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(0,0,0,.25); }
    .sidebar.open { transform: translateX(0); }
    .mobile-menu { display: grid; }
    .dashboard-grid, .visit-grid, .form-layout { grid-template-columns: 1fr; }
    .span-2, .span-3 { grid-column: span 1; }
    .profile-grid { grid-template-columns: 1fr; }
    .clinical-panel { position: static; }
    .settings-grid { grid-template-columns: 1fr; }
    .settings-grid .span-2 { grid-column: span 1; }
    .schedule-card { grid-template-columns: 60px 5px minmax(0,1fr); }
    .schedule-actions { grid-column: 3; justify-content: flex-start; max-width: none; }
    .login-card { grid-template-columns: 1fr; }
    .login-visual { min-height: 290px; }
    .login-copy { padding-bottom: 0; }
    .login-copy h2 { font-size: 30px; }
}

@media (max-width: 720px) {
    .content { padding: 18px 14px 30px; }
    .topbar { padding: 15px 14px; min-height: 76px; }
    .topbar h1 { font-size: 21px; }
    .top-actions .btn-light { display: none; }
    .top-actions .btn { min-height: 36px; padding: 7px 10px; font-size: 12px; }
    .stats-grid, .stats-grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .stat-card { min-height: 90px; padding: 13px; }
    .stat-card strong { font-size: 18px; }
    .card { padding: 16px; border-radius: 15px; }
    .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
    .field.span-2, .check-field.span-2 { grid-column: span 1; }
    .patient-hero, .visit-header { align-items: flex-start; }
    .hero-actions { width: 100%; }
    .alert-panel-grid { grid-template-columns: 1fr; }
    .alert-panel-grid > div { border-right: 0; border-bottom: 1px solid rgba(161,98,7,.18); padding-bottom: 10px; }
    .visit-meta { padding-left: 0; overflow-x: auto; }
    .timeline-item { grid-template-columns: 56px 1fr; }
    .timeline-heading { display: block; }
    .timeline-heading .badge { margin-top: 7px; }
    .treatment-main { grid-template-columns: 1fr; }
    .treatment-price { text-align: left; }
    .material-tags { padding-left: 14px; }
    .inline-form { grid-template-columns: 1fr; }
    .tooth-picker > div { grid-template-columns: repeat(8,1fr); }
    .invoice-shell { padding: 20px 15px; }
    .invoice-top, .invoice-parties { grid-template-columns: 1fr; display: grid; }
    .invoice-title, .invoice-parties > div:last-child { text-align: left; }
    .invoice-lower-grid { grid-template-columns: 1fr; }
    .login-form-wrap { padding: 38px 25px; }
    .auth-shell { padding: 12px; }
    .demo-box { display: grid; }
}

@media print {
    .sidebar, .topbar, .footer, .no-print, .flash-stack { display: none !important; }
    .app-shell { display: block; }
    .content { padding: 0; }
    .invoice-shell { box-shadow: none; border: 0; max-width: none; }
    body { background: white; }
}
.account-grid { max-width: 950px; }
.account-identity { margin: 8px 0 18px; }
.account-identity h3 { font-size: 19px; margin-bottom: 3px; }
.account-identity p { color: var(--muted); margin-bottom: 8px; }
.account-note { padding-top: 15px; border-top: 1px solid var(--line); }

/* =========================================================
   DentalPro 2026 – enhanced blue interface and icon system
   ========================================================= */
:root {
    --bg: #eef4ff;
    --surface: #ffffff;
    --surface-soft: #f5f9ff;
    --text: #10213d;
    --muted: #64748b;
    --line: #dce7f7;
    --primary: #0b63f6;
    --primary-dark: #084ec1;
    --primary-soft: #e8f1ff;
    --primary-lighter: #f3f7ff;
    --cyan: #0891b2;
    --cyan-soft: #e7f9fd;
    --indigo: #4f46e5;
    --indigo-soft: #eeefff;
    --success: #0f9f7f;
    --success-soft: #e8faf5;
    --warning: #d97706;
    --warning-soft: #fff7e6;
    --danger: #dc2626;
    --danger-soft: #fff0f2;
    --shadow: 0 12px 34px rgba(34, 87, 154, .10);
}

body {
    background:
        radial-gradient(circle at 96% 2%, rgba(11, 99, 246, .08), transparent 24rem),
        radial-gradient(circle at 28% 90%, rgba(8, 145, 178, .055), transparent 25rem),
        var(--bg);
}

.sidebar {
    background: linear-gradient(180deg, #061a3a 0%, #0a326f 52%, #071a3b 100%);
    border-right: 1px solid rgba(147, 197, 253, .13);
    box-shadow: 12px 0 42px rgba(5, 27, 63, .16);
}

.brand-mark {
    background: linear-gradient(145deg, #42b8ff, #0b63f6 58%, #2445d8);
    box-shadow: 0 10px 24px rgba(21, 112, 239, .38);
}
.brand-icon { width: 22px; height: 22px; }
.brand small { color: #91b4e5; }

.ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    display: inline-block;
    vertical-align: middle;
}

.nav-item { gap: 11px; }
.nav-item > .ui-icon { width: 19px; height: 19px; color: #93b9eb; }
.nav-item > span { width: auto; text-align: left; font-size: inherit; }
.nav-item:hover > .ui-icon,
.nav-item.active > .ui-icon { color: white; }
.nav-item.active {
    background: linear-gradient(105deg, #0b63f6 0%, #2187fa 100%);
    box-shadow: 0 10px 24px rgba(3, 38, 91, .34);
}

.topbar {
    background: rgba(255, 255, 255, .90);
    border-bottom-color: #d9e7fa;
    box-shadow: 0 5px 24px rgba(30, 83, 147, .045);
}

.card {
    border-color: #dce7f7;
    box-shadow: var(--shadow);
}
.card:hover { border-color: #d2e2f7; }

.btn {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}
.btn .ui-icon { width: 17px; height: 17px; }
.btn-primary {
    background: linear-gradient(135deg, #0b63f6 0%, #1683f8 100%);
    box-shadow: 0 9px 20px rgba(11, 99, 246, .24);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #084ec1 0%, #0b6ee7 100%);
    box-shadow: 0 12px 24px rgba(11, 99, 246, .28);
}
.btn-light {
    border-color: #d6e3f4;
    color: #24415f;
    background: linear-gradient(180deg, #fff, #f8fbff);
}
.btn-light:hover {
    border-color: #a9c6ee;
    color: var(--primary);
    background: #f4f8ff;
}
.btn-success {
    background: linear-gradient(135deg, #0f9f7f, #14b88f);
    box-shadow: 0 9px 20px rgba(15, 159, 127, .20);
}
.btn-danger-ghost:hover { background: var(--danger-soft); }

.icon-button,
.icon-action {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid #d6e3f4;
    border-radius: 11px;
    background: linear-gradient(180deg, #fff, #f7faff);
    color: #3c5d82;
    transition: transform .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.icon-button .ui-icon,
.icon-action .ui-icon { width: 17px; height: 17px; }
.icon-button:hover,
.icon-action:hover {
    transform: translateY(-1px);
    color: var(--primary);
    border-color: #9fc1ee;
    box-shadow: 0 7px 16px rgba(34, 96, 173, .12);
}
.icon-action-primary {
    color: white;
    border-color: transparent;
    background: linear-gradient(135deg, #0b63f6, #1683f8);
    box-shadow: 0 7px 16px rgba(11, 99, 246, .20);
}
.icon-action-primary:hover { color: white; border-color: transparent; }
.icon-actions { display: flex; justify-content: flex-end; gap: 7px; }

.section-title-with-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--primary);
    background: linear-gradient(145deg, #edf5ff, #dceaff);
    border: 1px solid #d3e4fb;
}
.section-icon .ui-icon { width: 20px; height: 20px; }
.section-icon-cyan { color: var(--cyan); background: var(--cyan-soft); border-color: #c8eef6; }
.section-icon-indigo { color: var(--indigo); background: var(--indigo-soft); border-color: #dcddff; }
.section-icon-warning { color: #c96a06; background: #fff1d5; border-color: #f8d798; }

.section-card-blue {
    background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
    border-top: 3px solid #4c9aff;
}
.patient-hero-blue {
    background:
        linear-gradient(118deg, rgba(11, 99, 246, .065), rgba(8, 145, 178, .025) 42%, #fff 78%),
        #fff;
    border-left: 4px solid var(--primary);
}

.field > span,
.gender-field legend {
    color: #36506e;
    font-size: 12px;
    font-weight: 780;
}
.field-help {
    color: #8291a6;
    font-size: 10.5px;
}
.field input,
.field select,
.field textarea,
.search-form input,
.filter-form input,
.filter-form select,
.inline-form input,
.inline-form select {
    border-color: #cfdced;
    background: #fff;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.search-form input:focus,
.filter-form input:focus,
.filter-form select:focus {
    border-color: #4c97f5;
    box-shadow: 0 0 0 4px rgba(11, 99, 246, .11);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-icon > .ui-icon {
    position: absolute;
    left: 12px;
    z-index: 1;
    width: 17px;
    height: 17px;
    color: #6d88a8;
    pointer-events: none;
}
.input-with-icon input { padding-left: 39px; }
.search-input input { width: min(310px, 100%); }

.gender-field {
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
}
.gender-field legend { margin-bottom: 7px; }
.gender-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.gender-option { position: relative; cursor: pointer; }
.gender-option input { position: absolute; opacity: 0; pointer-events: none; }
.gender-option > span {
    min-height: 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid #cfdded;
    border-radius: 11px;
    color: #526a84;
    background: linear-gradient(180deg, #fff, #f8fbff);
    transition: .16s ease;
}
.gender-option > span .ui-icon { width: 17px; height: 17px; }
.gender-option input:checked + span {
    border-color: #4b93ef;
    color: var(--primary);
    background: #eaf3ff;
    box-shadow: 0 0 0 3px rgba(11, 99, 246, .09);
}

.safety-card {
    border-color: #f2d59f;
    background: linear-gradient(145deg, #fffdf8, #fff 72%);
}
.safety-field > span {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #93520a;
}
.safety-field > span .ui-icon { width: 16px; height: 16px; }
.safety-field textarea { background: rgba(255, 253, 247, .8); }
.pill { align-items: center; gap: 6px; }
.pill .ui-icon { width: 14px; height: 14px; }

.alert-panel > strong {
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-panel > strong .ui-icon { width: 17px; height: 17px; }
.alert-panel-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.safety-alert {
    background: linear-gradient(120deg, #fff7e8, #fffaf1);
    border-color: #f3ca83;
    box-shadow: 0 9px 22px rgba(181, 103, 10, .07);
}

.data-table th { background: #f6f9fe; color: #607792; }
.data-table tbody tr:hover { background: #f5f9ff; }
.mono-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #2e537c;
    letter-spacing: .025em;
}
.empty-icon .ui-icon { width: 27px; height: 27px; }
.inline-details summary { display: inline-flex; align-items: center; gap: 5px; }
.inline-details summary .ui-icon { width: 14px; height: 14px; }
.flash-stack .alert button .ui-icon { width: 16px; height: 16px; }

@media (max-width: 720px) {
    .alert-panel-grid-2 { grid-template-columns: 1fr; }
    .gender-options { grid-template-columns: 1fr 1fr; }
    .search-form { width: 100%; }
    .search-input { flex: 1; min-width: 180px; }
    .search-input input { width: 100%; }
    .icon-actions { min-width: 92px; }
}

/* =========================================================
   Weekly appointment calendar – July 2026 upgrade
   ========================================================= */
.calendar-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.weekly-calendar-card { padding: 0; overflow: hidden; }
.calendar-toolbar { padding: 22px 24px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #ffffff 0%, #f3f8ff 100%); }
.calendar-toolbar h2 { font-size: 23px; }
.calendar-subtitle { margin: 5px 0 0; color: var(--muted); }
.calendar-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calendar-legend { min-height: 48px; padding: 10px 24px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: #fbfdff; color: #48627e; font-size: 12px; font-weight: 700; }
.calendar-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend-scheduled { background: #3b82f6; }
.legend-waiting { background: #f59e0b; }
.legend-exam { background: #8b5cf6; }
.legend-completed { background: #10b981; }
.legend-cancelled { background: #ef4444; }
.calendar-live-note { margin-left: auto; color: var(--primary); }
.calendar-live-note .ui-icon { width: 15px; height: 15px; }

.weekly-calendar-scroll { width: 100%; overflow: auto; max-height: calc(100vh - 250px); background: #f8fbff; }
.weekly-calendar { --calendar-days: 6; min-width: calc(82px + (var(--calendar-days) * 205px)); display: grid; grid-template-columns: 82px repeat(var(--calendar-days), minmax(205px, 1fr)); align-items: stretch; }
.calendar-corner, .calendar-day-header { position: sticky; top: 0; z-index: 12; min-height: 67px; padding: 12px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid #dce7f7; border-bottom: 1px solid #d3e1f4; background: rgba(248, 251, 255, .97); backdrop-filter: blur(9px); }
.calendar-corner { left: 0; z-index: 15; align-items: center; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.calendar-day-header { align-items: center; text-align: center; }
.calendar-day-header strong { color: #17355b; font-size: 13px; }
.calendar-day-header span { color: var(--muted); font-size: 12px; }
.calendar-day-header.is-today { color: white; background: linear-gradient(135deg, #0b63f6, #1789f8); border-color: #0b63f6; }
.calendar-day-header.is-today strong, .calendar-day-header.is-today span { color: white; }
.calendar-time-label { position: sticky; left: 0; z-index: 8; min-height: 118px; padding: 12px 8px; display: flex; align-items: flex-start; justify-content: center; border-right: 1px solid #d7e4f5; border-bottom: 1px solid #e2eaf5; background: #f8fbff; color: #365574; }
.calendar-time-label strong { font-size: 12px; }
.calendar-slot { position: relative; min-height: 118px; padding: 7px; border-right: 1px solid #e0e9f5; border-bottom: 1px solid #e0e9f5; background: #fff; transition: background .16s ease, box-shadow .16s ease; }
.calendar-slot.is-today { background: #fbfdff; }
.calendar-slot:hover { background: #f3f8ff; box-shadow: inset 0 0 0 1px #bcd4f4; }
.calendar-slot.has-appointments { padding: 5px; }
.slot-add-button { position: absolute; inset: 7px 7px auto auto; z-index: 2; width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid #a9c9f4; border-radius: 9px; background: white; color: var(--primary); opacity: 0; transform: translateY(-3px); transition: .15s ease; box-shadow: 0 6px 16px rgba(11, 99, 246, .12); }
.slot-add-button .ui-icon { width: 14px; height: 14px; }
.calendar-slot:hover .slot-add-button, .slot-add-button:focus { opacity: 1; transform: none; }
.calendar-slot.has-appointments .slot-add-button { width: 24px; height: 24px; opacity: .72; }

.calendar-appointment { position: relative; z-index: 3; margin-bottom: 5px; padding: 8px 8px 7px 10px; border: 1px solid #d6e4f6; border-left: 4px solid var(--dentist-color, var(--primary)); border-radius: 11px; background: linear-gradient(145deg, #fff, #f7fbff); box-shadow: 0 5px 13px rgba(33, 88, 154, .08); cursor: pointer; outline: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.calendar-appointment:last-child { margin-bottom: 0; }
.calendar-appointment:hover, .calendar-appointment:focus-visible { transform: translateY(-1px); border-color: #aac7ed; box-shadow: 0 9px 20px rgba(33, 88, 154, .13); }
.calendar-appointment.appointment-status-arrived { background: linear-gradient(145deg, #fffdf7, #fff7e6); border-color: #f4d28f; border-left-color: #f59e0b; }
.calendar-appointment.appointment-status-in_progress { background: linear-gradient(145deg, #fbfaff, #f1edff); border-color: #c9bdf7; border-left-color: #8b5cf6; }
.calendar-appointment.appointment-status-completed { background: linear-gradient(145deg, #f3fff9, #e9fbf3); border-color: #9fdfc3; border-left-color: var(--success); }
.calendar-appointment.appointment-status-cancelled, .calendar-appointment.appointment-status-no_show { opacity: .68; background: #fff5f5; border-left-color: var(--danger); filter: grayscale(.12); }
.calendar-appointment.needs-final-status { border-color: #f1b84b; box-shadow: 0 0 0 2px rgba(245, 158, 11, .14), 0 9px 22px rgba(143, 83, 6, .14); }
.appointment-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.appointment-card-top > strong { color: #0f3e79; font-size: 12px; }
.calendar-appointment h3 { margin: 5px 0 1px; max-width: calc(100% - 4px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.calendar-appointment p, .calendar-appointment > small { display: block; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.calendar-appointment .badge { padding: 3px 6px; font-size: 9px; }
.appointment-status-actions { margin-top: 7px; padding-top: 6px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; border-top: 1px solid rgba(148, 163, 184, .18); }
.status-mini-button { min-width: 0; min-height: 28px; padding: 4px 3px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid #d9e5f3; border-radius: 7px; background: rgba(255,255,255,.88); color: #59718c; font-size: 8px; font-weight: 800; line-height: 1.05; transition: .14s ease; }
.status-mini-button .ui-icon { width: 11px; height: 11px; flex: 0 0 11px; }
.status-mini-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-mini-button:hover { border-color: #9ebee9; color: var(--primary); }
.status-mini-button.status-scheduled.active { color: #075dcc; border-color: #8fb9f3; background: #eaf3ff; }
.status-mini-button.status-waiting.active { color: #a35b05; border-color: #f5c46b; background: #fff5dc; }
.status-mini-button.status-exam.active { color: #6d35cf; border-color: #bca6ef; background: #f1ebff; }
.status-mini-button:disabled { opacity: .45; cursor: not-allowed; }
.appointment-final-actions { margin-top: 5px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.appointment-final-actions[hidden] { display: none !important; }
.status-final-button { min-height: 30px; padding: 5px 6px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border-radius: 8px; font-size: 9px; font-weight: 900; line-height: 1; transition: transform .14s ease, box-shadow .14s ease; }
.status-final-button:hover { transform: translateY(-1px); }
.status-final-button .ui-icon { width: 12px; height: 12px; }
.status-final-button.status-completed { border: 1px solid #76cfa8; background: #e8fbf2; color: #08734c; }
.status-final-button.status-completed:hover { box-shadow: 0 6px 15px rgba(16, 185, 129, .18); }
.status-final-button.status-cancelled { border: 1px solid #f1a2a2; background: #fff0f0; color: #b42323; }
.status-final-button.status-cancelled:hover { box-shadow: 0 6px 15px rgba(239, 68, 68, .16); }
.status-final-button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.outside-schedule-card { margin-top: 20px; }
.outside-appointment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.outside-appointment-grid .calendar-appointment { min-height: 115px; }

.modal-dialog > form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100vh - 40px); }
.appointment-modal { width: min(720px, calc(100% - 24px)); }
.quick-patient-modal { width: min(850px, calc(100% - 24px)); }
.service-dashboard-modal { width: min(850px, calc(100% - 24px)); }
.appointment-time-summary { padding: 13px 14px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; border: 1px solid #cfe0f6; border-radius: 13px; background: linear-gradient(135deg, #eef6ff, #f8fbff); color: #21466e; }
.appointment-time-summary > .ui-icon { width: 20px; height: 20px; color: var(--primary); }
.appointment-time-summary small, .appointment-time-summary strong { display: block; }
.appointment-time-summary small { color: var(--muted); }
.appointment-time-summary > span { padding: 5px 8px; border-radius: 8px; background: white; color: var(--primary); font-size: 11px; font-weight: 800; }
.patient-search-field { position: relative; }
.patient-search-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; }
.patient-search-input-wrap { min-height: 43px; padding: 0 11px; display: flex; align-items: center; gap: 8px; border: 1px solid #ccd9e9; border-radius: 11px; background: #fff; }
.patient-search-input-wrap:focus-within { border-color: #7eaceb; box-shadow: 0 0 0 3px rgba(11,99,246,.10); }
.patient-search-input-wrap .ui-icon { color: #6e86a1; }
.patient-search-input-wrap input { width: 100%; min-height: 39px; padding: 0; border: 0; outline: 0; background: transparent; }
.patient-search-results { position: absolute; top: 71px; left: 0; right: 50px; z-index: 90; max-height: 260px; overflow-y: auto; padding: 6px; border: 1px solid #cbdcf2; border-radius: 12px; background: white; box-shadow: 0 18px 45px rgba(22, 61, 111, .20); }
.patient-result-item { width: 100%; padding: 9px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; }
.patient-result-item:hover { background: #eef5ff; }
.patient-result-item strong, .patient-result-item small { display: block; }
.patient-result-item small { color: var(--muted); }
.patient-result-loading, .patient-result-empty { padding: 13px; color: var(--muted); text-align: center; }
.selected-patient-card { margin-top: 9px; padding: 10px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; border: 1px solid #a9c9ef; border-radius: 12px; background: #f1f7ff; }
.selected-patient-card[hidden] { display: none; }
.selected-patient-card strong, .selected-patient-card small { display: block; }
.selected-patient-card small { color: var(--muted); }
.status-default-note { padding: 11px 13px; display: flex; align-items: center; gap: 9px; border-radius: 11px; background: #eaf3ff; color: #27527f; font-size: 12px; }
.status-default-note .ui-icon { color: var(--primary); }
.quick-patient-message { padding: 11px 13px; border-radius: 10px; background: var(--success-soft); color: var(--success); font-weight: 700; }
.quick-patient-message.error { background: var(--danger-soft); color: var(--danger); }
.modal-patient-line { margin: 5px 0 0; color: var(--muted); }
.service-appointment-summary { padding: 12px; display: grid; grid-template-columns: auto 1fr 1fr; gap: 12px; align-items: center; border-radius: 12px; background: linear-gradient(135deg, #eef5ff, #f8fbff); }
.service-appointment-summary > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: white; color: var(--primary); }
.service-appointment-summary small, .service-appointment-summary strong { display: block; }
.service-appointment-summary small { color: var(--muted); }

.schedule-settings-card { background: linear-gradient(150deg, #fff 0%, #f8fbff 100%); }
.working-days-field { border: 0; padding: 0; margin: 0; }
.working-days-field legend { margin-bottom: 8px; font-size: 12px; font-weight: 800; color: #334e6b; }
.working-day-options { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.working-day-options label { cursor: pointer; }
.working-day-options input { position: absolute; opacity: 0; pointer-events: none; }
.working-day-options span { min-height: 40px; padding: 8px 5px; display: grid; place-items: center; border: 1px solid #d6e2f1; border-radius: 10px; background: white; color: #58708a; font-size: 11px; font-weight: 800; text-align: center; transition: .15s ease; }
.working-day-options input:checked + span { color: white; border-color: var(--primary); background: linear-gradient(135deg, #0b63f6, #1683f8); box-shadow: 0 7px 16px rgba(11,99,246,.18); }
.calendar-rule-note { padding: 13px 15px; display: flex; align-items: center; gap: 11px; border: 1px solid #d3e3f8; border-radius: 12px; background: #f1f7ff; }
.calendar-rule-note > .ui-icon { color: var(--primary); }
.calendar-rule-note strong, .calendar-rule-note span { display: block; }
.calendar-rule-note span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.settings-subsection { margin-top: 5px; padding-top: 18px; border-top: 1px solid var(--line); }
.subsection-heading { margin-bottom: 14px; }
.pill-primary { color: #075dcc; background: #eaf3ff; }

@media (max-width: 1100px) {
    .calendar-toolbar { align-items: flex-start; flex-direction: column; }
    .calendar-live-note { width: 100%; margin-left: 0; }
    .working-day-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .calendar-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .calendar-toolbar { padding: 17px 15px; }
    .calendar-toolbar-actions { width: 100%; }
    .calendar-toolbar-actions .btn { flex: 1; }
    .calendar-legend { padding: 10px 15px; gap: 10px; }
    .weekly-calendar-scroll { max-height: calc(100vh - 210px); }
    .weekly-calendar { min-width: calc(68px + (var(--calendar-days) * 185px)); grid-template-columns: 68px repeat(var(--calendar-days), minmax(185px, 1fr)); }
    .calendar-time-label { min-height: 112px; }
    .calendar-slot { min-height: 112px; }
    .status-mini-button span { display: none; }
    .status-mini-button .ui-icon { width: 13px; height: 13px; }
    .working-day-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .service-appointment-summary { grid-template-columns: auto 1fr; }
    .service-appointment-summary > div:last-child { grid-column: 2; }
}

/* =========================================================
   Focused calendar + modal settings hub
   ========================================================= */
.brand-copy { min-width: 0; }
.brand-copy strong { max-width: 165px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.calendar-summary-strip {
    margin-bottom: 12px;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    border: 1px solid #dbe7f7;
    border-radius: 15px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 7px 20px rgba(29, 78, 139, .055);
}
.calendar-summary-strip > span {
    min-height: 45px;
    padding: 6px 10px;
    display: grid;
    grid-template-columns: 30px 1fr auto;
    align-items: center;
    gap: 8px;
    border-right: 1px solid #e6eef8;
}
.calendar-summary-strip > span:last-child { border-right: 0; }
.calendar-summary-strip small { color: var(--muted); font-weight: 700; }
.calendar-summary-strip strong { font-size: 18px; color: #173d6e; }
.summary-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: #eaf3ff; }
.summary-icon .ui-icon { width: 15px; height: 15px; }
.summary-warning { color: #b76505; background: #fff3d9; }
.summary-exam { color: #6d35cf; background: #f1ebff; }

.weekly-calendar-card { border-radius: 20px; box-shadow: 0 17px 45px rgba(27, 76, 137, .11); }
.calendar-toolbar { padding: 16px 20px 13px; }
.calendar-toolbar h2 { font-size: 21px; }
.calendar-legend { min-height: 40px; padding: 7px 20px; }
.weekly-calendar-scroll { max-height: calc(100vh - 205px); }
.weekly-calendar { min-width: calc(74px + (var(--calendar-days) * 180px)); grid-template-columns: 74px repeat(var(--calendar-days), minmax(180px, 1fr)); }
.calendar-corner, .calendar-day-header { min-height: 58px; padding: 8px; }
.calendar-time-label { min-height: 91px; padding: 9px 6px; }
.calendar-slot { min-height: 91px; padding: 4px; }
.calendar-slot.has-appointments { padding: 3px; }
.calendar-appointment { margin-bottom: 3px; padding: 5px 6px 5px 8px; border-left-width: 3px; border-radius: 9px; box-shadow: 0 3px 9px rgba(33, 88, 154, .07); }
.calendar-appointment h3 { margin: 3px 0 0; font-size: 11.5px; }
.calendar-appointment p { font-size: 9px; }
.calendar-appointment > small { display: none; }
.calendar-appointment .badge { min-height: 18px; padding: 1px 5px; font-size: 7.5px; }
.appointment-card-top > strong { font-size: 10px; }
.appointment-status-actions { margin-top: 4px; padding-top: 4px; gap: 3px; }
.status-mini-button { min-height: 22px; padding: 2px; border-radius: 6px; }
.status-mini-button span { display: none; }
.status-mini-button .ui-icon { width: 11px; height: 11px; }
.slot-add-button { inset: 4px 4px auto auto; width: 25px; height: 25px; }
.calendar-slot.has-appointments .slot-add-button { width: 21px; height: 21px; }

.appointment-modal { width: min(880px, calc(100% - 28px)); }
.quick-patient-modal { width: min(1180px, calc(100% - 28px)); }
.quick-patient-modal .modal-header,
.quick-patient-modal .modal-footer { padding-left:28px; padding-right:28px; }
.quick-patient-modal .modal-body { padding:24px 28px; }
.quick-patient-modal .form-grid { gap:16px; }
.quick-patient-modal input,
.quick-patient-modal select,
.quick-patient-modal textarea { min-height:46px; font-size:14px; }
.quick-patient-modal textarea { min-height:104px; }
.service-dashboard-modal { width: min(1160px, calc(100% - 28px)); }
.service-dashboard-modal .modal-body { padding: 24px 28px; }
.service-dashboard-modal .modal-header, .service-dashboard-modal .modal-footer { padding-left: 28px; padding-right: 28px; }

.settings-hub { display: grid; gap: 18px; }
.settings-intro {
    min-height: 138px;
    padding: 24px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    border: 1px solid #cfe0f5;
    border-radius: 22px;
    color: white;
    background: linear-gradient(125deg, #073b83 0%, #0b63f6 58%, #25a7e8 100%);
    box-shadow: 0 18px 42px rgba(11, 99, 246, .22);
    overflow: hidden;
    position: relative;
}
.settings-intro::after { content:""; position:absolute; width:260px; height:260px; right:-85px; top:-125px; border-radius:50%; background:rgba(255,255,255,.09); }
.settings-intro h2 { font-size: 26px; }
.settings-intro p:not(.eyebrow) { max-width: 720px; margin: 7px 0 0; color: #dbeafe; }
.settings-intro .eyebrow { color: #bfdbfe; }
.settings-intro-icon { width: 74px; height: 74px; flex: 0 0 74px; display:grid; place-items:center; border-radius:22px; color:#fff; background:rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.22); position:relative; z-index:1; }
.settings-intro-icon .ui-icon { width: 34px; height: 34px; }

.settings-module-grid { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:14px; }
.settings-module-card {
    min-height: 142px;
    padding: 18px;
    display:grid;
    grid-template-columns: 48px minmax(0,1fr) 30px;
    align-items:center;
    gap:13px;
    text-align:left;
    border:1px solid #d9e6f7;
    border-radius:18px;
    color:var(--text);
    background:linear-gradient(145deg,#fff,#f8fbff);
    box-shadow:0 10px 28px rgba(31,83,148,.075);
    transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease;
}
.settings-module-card:hover { transform:translateY(-3px); border-color:#8db9ef; box-shadow:0 16px 34px rgba(31,83,148,.14); }
.settings-module-icon { width:48px; height:48px; display:grid; place-items:center; border-radius:15px; color:#0b63f6; background:#eaf3ff; }
.settings-module-icon .ui-icon { width:23px; height:23px; }
.settings-module-copy { min-width:0; display:grid; }
.settings-module-copy small { color:#2f6fb5; font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.07em; }
.settings-module-copy strong { margin:3px 0; font-size:16px; }
.settings-module-copy em { color:var(--muted); font-size:11px; font-style:normal; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.settings-module-arrow { width:29px; height:29px; display:grid; place-items:center; border-radius:9px; color:#5c7da4; background:#f0f5fb; }
.settings-module-arrow .ui-icon { width:14px; height:14px; }
.module-doctors .settings-module-icon { color:#6366f1; background:#eeeeff; }
.module-chairs .settings-module-icon { color:#0891b2; background:#e6f9fc; }
.module-schedule .settings-module-icon { color:#0b63f6; background:#eaf3ff; }
.module-materials .settings-module-icon { color:#7c3aed; background:#f2ebff; }
.module-services .settings-module-icon { color:#0284c7; background:#e8f7ff; }
.settings-overview-strip { padding:13px 16px; display:flex; align-items:center; justify-content:space-between; gap:14px; border:1px solid #dae6f5; border-radius:16px; background:#fff; box-shadow:0 8px 22px rgba(31,83,148,.06); }
.settings-overview-strip > span { display:flex; align-items:center; gap:8px; color:#4b6380; }
.settings-overview-strip > span .ui-icon { color:var(--primary); }

.settings-detail-modal { width:min(920px,calc(100% - 28px)); }
.settings-crud-modal { width:min(1120px,calc(100% - 28px)); max-height:calc(100vh - 28px); }
.settings-crud-modal-wide { width:min(1260px,calc(100% - 28px)); }
.settings-dialog-shell { display:grid; grid-template-rows:auto minmax(0,1fr); max-height:calc(100vh - 28px); background:#fff; }
.settings-crud-body { min-height:0; display:grid; grid-template-columns:minmax(0,1.55fr) minmax(300px,.75fr); }
.settings-record-list { min-width:0; min-height:0; padding:18px 20px 22px; border-right:1px solid var(--line); display:grid; grid-template-rows:auto minmax(0,1fr); }
.settings-list-heading { margin-bottom:12px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.settings-list-heading strong, .settings-list-heading small { display:block; }
.settings-list-heading small { color:var(--muted); }
.settings-record-table { min-height:0; overflow:auto; display:grid; align-content:start; gap:7px; }
.settings-record-row { min-height:61px; padding:8px 9px; display:grid; grid-template-columns:38px minmax(0,1fr) auto 34px 34px; align-items:center; gap:8px; border:1px solid #e1eaf6; border-radius:12px; background:#fff; transition:.15s ease; }
.settings-record-row:hover { border-color:#aecbef; background:#f8fbff; }
.settings-record-row.is-inactive { opacity:.58; background:#f8fafc; }
.settings-record-row > form { margin:0; }
.record-color { --record-color:#2563eb; width:36px; height:36px; display:grid; place-items:center; border-radius:11px; color:var(--record-color); background:#eef5ff; background:color-mix(in srgb,var(--record-color) 12%,white); }
.record-color .ui-icon { width:18px; height:18px; }
.record-color-cyan { color:#0891b2; background:#e6f9fc; }
.record-color-indigo { color:#7c3aed; background:#f2ebff; }
.record-color-blue { color:#0b63f6; background:#eaf3ff; }
.record-main { min-width:0; }
.record-main strong,.record-main small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.record-main small { color:var(--muted); }
.record-status { color:#60748d; font-size:10px; font-weight:800; white-space:nowrap; }
.record-status.low-stock { color:#c26705; }
.status-dot { width:7px; height:7px; margin-right:4px; display:inline-block; border-radius:50%; background:#94a3b8; }
.status-dot.active { background:#10b981; box-shadow:0 0 0 3px #dcfce7; }
.danger-action { color:var(--danger); border-color:#fee2e2; }
.settings-editor-panel { min-width:0; padding:20px; display:grid; align-content:start; gap:13px; background:linear-gradient(150deg,#f9fbff,#fff); overflow:auto; }
.settings-editor-panel.is-editing { background:linear-gradient(150deg,#eef5ff,#fff); }
.editor-heading { padding-bottom:12px; display:flex; align-items:center; gap:11px; border-bottom:1px solid var(--line); }
.editor-heading small,.editor-heading strong { display:block; }
.editor-heading small { color:var(--primary); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.07em; }
.switch-field { min-height:42px; padding:9px 11px; display:flex; align-items:center; gap:9px; border:1px solid #dce6f3; border-radius:11px; background:#fff; font-weight:700; color:#405b79; }
.settings-modal-lead { padding:14px; display:flex; align-items:center; gap:12px; border:1px solid #d4e3f6; border-radius:14px; background:linear-gradient(135deg,#eef6ff,#fbfdff); }
.settings-modal-lead > .ui-icon { width:24px; height:24px; color:var(--primary); }
.settings-modal-lead strong,.settings-modal-lead span { display:block; }
.settings-modal-lead span { color:var(--muted); font-size:12px; }

@media (max-width: 1050px) {
    .settings-module-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .settings-crud-body { grid-template-columns:1fr; }
    .settings-record-list { border-right:0; border-bottom:1px solid var(--line); max-height:52vh; }
}
@media (max-width: 720px) {
    .calendar-summary-strip { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .calendar-summary-strip > span { border-right:0; }
    .settings-module-grid { grid-template-columns:1fr; }
    .settings-intro { padding:20px; }
    .settings-intro-icon { display:none; }
    .settings-overview-strip { align-items:stretch; flex-direction:column; }
    .settings-overview-strip .btn { width:100%; }
    .settings-record-row { grid-template-columns:34px minmax(0,1fr) 32px 32px; }
    .record-status { display:none; }
    .settings-crud-modal,.settings-crud-modal-wide,.settings-detail-modal,.service-dashboard-modal,.quick-patient-modal,.appointment-modal { width:calc(100% - 12px); max-height:calc(100vh - 12px); }
    .settings-dialog-shell { max-height:calc(100vh - 12px); }
}


/* =========================================================
   Readability and active-appointment interaction upgrade
   ========================================================= */
body { font-size: 15.5px; line-height: 1.56; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
small { font-size: 13px; }
.eyebrow { font-size: 12px; }
.brand strong { font-size: 18px; }
.nav-item { font-size: 15px; }
.user-card strong, .logout-button { font-size: 14px; }
.footer { font-size: 13px; }
.btn { font-size: 14.5px; }
.btn-sm { font-size: 13px; }
.field > span { font-size: 13px; }
.field input, .field select, .field textarea,
.search-form input, .filter-form input, .filter-form select,
.inline-form input, .inline-form select { font-size: 15px; }
.data-table th { font-size: 12px; }
.badge, .pill { font-size: 12px; }
.text-link { font-size: 14px; }
.calendar-day-header strong { font-size: 14px; }
.calendar-day-header span, .calendar-time-label strong { font-size: 13px; }
.calendar-appointment h3 { font-size: 14px; }
.calendar-appointment p, .calendar-appointment > small { font-size: 11px; }
.calendar-appointment .badge { font-size: 10px; }
.appointment-card-top > strong { font-size: 13px; }
.status-mini-button { font-size: 9.5px; }

.calendar-appointment.is-current-time {
    border-color: #7c9cff;
    border-left-color: #6547e8;
    background: linear-gradient(145deg, #ffffff 0%, #f1efff 100%);
    box-shadow: 0 0 0 2px rgba(99, 72, 226, .14), 0 12px 28px rgba(74, 61, 180, .18);
    animation: currentAppointmentPulse 2.4s ease-in-out infinite;
}
@keyframes currentAppointmentPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(99, 72, 226, .12), 0 10px 24px rgba(74, 61, 180, .14); }
    50% { box-shadow: 0 0 0 4px rgba(99, 72, 226, .08), 0 14px 32px rgba(74, 61, 180, .22); }
}

@media (max-width: 720px) {
    body { font-size: 15px; }
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
}

.summary-success { color: #078c5c !important; background: #e9fbf3 !important; }
.summary-danger { color: #c53030 !important; background: #fff0f0 !important; }

/* =========================================================
   Collapsible icon-only desktop navigation
   ========================================================= */
:root {
    --sidebar-collapsed: 84px;
    --sidebar-expanded: 260px;
    --sidebar: var(--sidebar-collapsed);
}

html.sidebar-expanded { --sidebar: var(--sidebar-expanded); }

.app-shell {
    transition: grid-template-columns .24s ease;
}

.sidebar {
    width: var(--sidebar);
    padding: 14px 12px 16px;
    overflow: hidden;
    transition: width .24s ease, padding .24s ease;
}

.sidebar-toggle-row {
    min-height: 42px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(147, 197, 253, .24);
    border-radius: 12px;
    color: #dbeafe;
    background: rgba(255, 255, 255, .075);
    box-shadow: 0 7px 18px rgba(2, 18, 45, .18);
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.sidebar-toggle:hover {
    color: #fff;
    border-color: rgba(147, 197, 253, .48);
    background: rgba(33, 135, 250, .24);
}
.sidebar-toggle .ui-icon {
    width: 19px;
    height: 19px;
    transition: transform .24s ease;
}
html.sidebar-expanded .sidebar-toggle .ui-icon { transform: rotate(180deg); }
html.sidebar-expanded .sidebar-toggle-row { justify-content: flex-end; }

.sidebar .brand {
    min-height: 58px;
    padding: 5px 0 17px;
    justify-content: center;
    gap: 0;
    white-space: nowrap;
}
.sidebar .brand-copy,
.sidebar .nav-item > span,
.sidebar .user-card > span:last-child {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    transform: translateX(-7px);
    transition: max-width .18s ease, opacity .14s ease, transform .18s ease, visibility .18s ease;
}

.sidebar .nav-menu {
    gap: 7px;
}
.sidebar .nav-item {
    width: 52px;
    min-height: 48px;
    margin-inline: auto;
    padding: 0;
    justify-content: center;
    gap: 0;
    border-radius: 14px;
    white-space: nowrap;
}
.sidebar .nav-item > .ui-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
}
.sidebar .nav-item.active {
    box-shadow: 0 9px 22px rgba(2, 18, 45, .32), inset 0 0 0 1px rgba(255,255,255,.10);
}

.sidebar-footer {
    width: 100%;
    justify-items: center;
}
.sidebar-footer form { width: 100%; }
.sidebar .user-card {
    width: 52px;
    min-height: 52px;
    padding: 6px;
    justify-content: center;
    gap: 0;
    border: 1px solid rgba(147, 197, 253, .13);
}
.sidebar .avatar {
    width: 37px;
    height: 37px;
    flex: 0 0 37px;
}
.sidebar .logout-button { margin-inline: auto; }

html.sidebar-expanded .sidebar .brand {
    justify-content: flex-start;
    gap: 12px;
    padding-inline: 10px;
}
html.sidebar-expanded .sidebar .brand-copy {
    max-width: 180px;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}
html.sidebar-expanded .sidebar .nav-item {
    width: 100%;
    padding: 11px 13px;
    justify-content: flex-start;
    gap: 12px;
}
html.sidebar-expanded .sidebar .nav-item > span {
    max-width: 175px;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}
html.sidebar-expanded .sidebar-footer { justify-items: stretch; }
html.sidebar-expanded .sidebar .user-card {
    width: 100%;
    padding: 10px;
    justify-content: flex-start;
    gap: 10px;
}
html.sidebar-expanded .sidebar .user-card > span:last-child {
    max-width: 165px;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}
html.sidebar-expanded .sidebar .logout-button { margin-inline: 0; }

@media (max-width: 980px) {
    :root,
    html.sidebar-expanded { --sidebar: min(280px, 86vw); }
    .sidebar {
        width: min(280px, 86vw);
        padding: 18px 16px;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .sidebar-toggle-row { display: none; }
    .sidebar .brand,
    html.sidebar-expanded .sidebar .brand {
        justify-content: flex-start;
        gap: 12px;
        padding: 4px 10px 22px;
    }
    .sidebar .brand-copy,
    .sidebar .nav-item > span,
    .sidebar .user-card > span:last-child {
        max-width: 190px;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    .sidebar .nav-item,
    html.sidebar-expanded .sidebar .nav-item {
        width: 100%;
        min-height: 46px;
        margin-inline: 0;
        padding: 11px 13px;
        justify-content: flex-start;
        gap: 12px;
    }
    .sidebar-footer { justify-items: stretch; }
    .sidebar .user-card,
    html.sidebar-expanded .sidebar .user-card {
        width: 100%;
        padding: 10px;
        justify-content: flex-start;
        gap: 10px;
    }
    .sidebar .logout-button { margin-inline: 0; }
}

/* =========================================================
   System-time statuses + professional service modal
   ========================================================= */
.status-mini-button[disabled] { cursor: default; }
.status-mini-button[disabled].active { opacity: 1; }
.status-mini-button[disabled]:not(.active) { opacity: .42; }
.status-mini-button.status-exam.service-ready {
    opacity: 1;
    cursor: pointer;
    color: #5632c5;
    border-color: #9f8ae8;
    background: linear-gradient(135deg, #f4f0ff, #e9e5ff);
    box-shadow: 0 5px 14px rgba(95, 67, 190, .18);
}
.status-mini-button.status-exam.service-ready:hover {
    transform: translateY(-1px);
    color: #4724b1;
    border-color: #8066da;
    box-shadow: 0 8px 18px rgba(95, 67, 190, .24);
}
.status-final-button[hidden] + .status-cancelled { grid-column: 1 / -1; }
.status-final-button.status-cancelled.active {
    color: #fff;
    border-color: #dc2626;
    background: linear-gradient(135deg, #ef4444, #c81e1e);
}

.service-dashboard-modal {
    width: min(1120px, calc(100% - 30px));
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 34px 110px rgba(15, 45, 86, .34);
}
.service-dashboard-modal > form {
    background: #f7faff;
}
.service-dashboard-modal .service-modal-header {
    min-height: 92px;
    padding: 20px 26px;
    border-bottom-color: #cfe0f4;
    background:
        radial-gradient(circle at 78% 15%, rgba(52, 152, 255, .17), transparent 30%),
        linear-gradient(135deg, #f8fbff 0%, #edf5ff 58%, #e6f1ff 100%);
}
.service-modal-heading,
.service-modal-header-actions,
.service-section-heading,
.tooth-picker-title {
    display: flex;
    align-items: center;
}
.service-modal-heading { gap: 14px; }
.service-modal-heading h2 { margin: 2px 0 0; color: #123a68; font-size: 23px; }
.service-modal-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    flex: 0 0 50px;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(145deg, #0b63f6, #19a3f5);
    box-shadow: 0 12px 25px rgba(11, 99, 246, .25);
}
.service-modal-icon .ui-icon { width: 24px; height: 24px; }
.service-modal-header-actions { gap: 11px; }
.service-live-status {
    min-height: 34px;
    padding: 7px 11px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #baa9f0;
    border-radius: 999px;
    color: #5b35c8;
    background: rgba(246, 243, 255, .9);
    font-size: 12px;
    font-weight: 900;
}
.service-live-status i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7956dc;
    box-shadow: 0 0 0 4px rgba(121, 86, 220, .13);
}
.service-dashboard-modal .service-modal-body {
    padding: 22px 26px 26px;
    background: linear-gradient(180deg, #f7faff 0%, #f4f8fd 100%);
}
.professional-summary {
    margin-bottom: 18px;
    padding: 14px 16px;
    grid-template-columns: auto minmax(170px, 1fr) minmax(170px, 1fr) minmax(160px, .85fr);
    border: 1px solid #cbdff6;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 8px 24px rgba(29, 81, 143, .07);
}
.professional-summary > span {
    background: linear-gradient(145deg, #edf5ff, #fff);
    box-shadow: inset 0 0 0 1px #d3e4f8;
}
.service-patient-chip {
    padding-left: 14px;
    border-left: 1px solid #d9e6f4;
}
.service-modal-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(285px, .75fr);
    gap: 18px;
    align-items: start;
}
.service-form-panel,
.service-price-panel {
    padding: 20px;
    border: 1px solid #d2e1f2;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(27, 73, 128, .07);
}
.service-price-panel {
    position: sticky;
    top: 0;
    background: linear-gradient(155deg, #ffffff 0%, #f1f7ff 100%);
}
.service-section-heading {
    gap: 10px;
    margin-bottom: 17px;
}
.service-section-heading > span {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    border-radius: 11px;
    color: #0b63f6;
    background: #eaf3ff;
}
.service-section-heading > span .ui-icon { width: 19px; height: 19px; }
.service-section-heading small,
.service-section-heading h3 { display: block; }
.service-section-heading small { color: #6c85a0; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.service-section-heading h3 { margin: 1px 0 0; color: #1a3f68; font-size: 17px; }
.service-primary-field { margin-bottom: 15px; }
.service-primary-field select {
    min-height: 48px;
    border-color: #a9c9ee;
    background-color: #fbfdff;
    font-weight: 700;
}
.service-position-grid { margin-bottom: 14px; }
.professional-tooth-picker {
    margin-bottom: 15px;
    padding: 14px;
    border-color: #cbdcf0;
    background: linear-gradient(145deg, #f8fbff, #f2f7fd);
}
.tooth-picker-title { gap: 9px; margin-bottom: 11px; }
.tooth-picker-title > span {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #0b63f6;
    background: #fff;
    box-shadow: 0 4px 12px rgba(22, 82, 148, .08);
}
.tooth-picker-title strong,
.tooth-picker-title small { display: block; }
.tooth-picker-title strong { color: #24496f; font-size: 13px; }
.tooth-picker-title small { margin: 1px 0 0; font-size: 11px; }
.professional-tooth-picker > div:last-child { gap: 5px; }
.professional-tooth-picker button {
    min-height: 32px;
    border-color: #d2deed;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
}
.service-price-fields { display: grid; gap: 13px; }
.service-price-fields .field input { background: rgba(255,255,255,.92); }
.professional-total {
    margin-top: 18px;
    padding: 17px;
    border: 1px solid #9bc1f2;
    border-radius: 15px;
    background: linear-gradient(135deg, #eaf3ff, #dcecff);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.professional-total > span small,
.professional-total > span strong { display: block; }
.professional-total > span small { margin-bottom: 3px; color: #55789e; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.professional-total > span strong { color: #075dcc; font-size: 23px; }
.professional-total > i {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, #0b63f6, #1689ed);
    box-shadow: 0 8px 18px rgba(11,99,246,.22);
}
.professional-total > i .ui-icon { width: 21px; height: 21px; }
.service-modal-note {
    margin-top: 14px;
    padding: 12px 13px;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    border: 1px solid #d6e5f5;
    border-radius: 12px;
    color: #52708f;
    background: rgba(255,255,255,.72);
}
.service-modal-note .ui-icon { width: 18px; height: 18px; flex: 0 0 18px; color: #0b63f6; }
.service-modal-note p { margin: 0; font-size: 12px; line-height: 1.55; }
.service-dashboard-modal .service-modal-footer {
    padding: 16px 26px;
    border-top-color: #cfdff1;
    background: #fff;
    justify-content: space-between;
}
.service-footer-actions { display: flex; align-items: center; gap: 9px; }
.service-dashboard-modal .modal-patient-line { margin-top: 4px; color: #55718d; font-weight: 700; }

@media (max-width: 900px) {
    .service-modal-layout { grid-template-columns: 1fr; }
    .service-price-panel { position: static; }
    .professional-summary { grid-template-columns: auto 1fr 1fr; }
    .service-patient-chip { grid-column: 2 / -1; padding: 10px 0 0; border-left: 0; border-top: 1px solid #d9e6f4; }
}

@media (max-width: 620px) {
    .service-dashboard-modal { width: calc(100% - 14px); max-height: calc(100vh - 14px); border-radius: 18px; }
    .service-dashboard-modal .service-modal-header,
    .service-dashboard-modal .service-modal-body,
    .service-dashboard-modal .service-modal-footer { padding-left: 15px; padding-right: 15px; }
    .service-modal-header { align-items: flex-start; }
    .service-modal-icon { width: 42px; height: 42px; flex-basis: 42px; }
    .service-live-status { display: none; }
    .professional-summary { grid-template-columns: auto 1fr; }
    .professional-summary > div { grid-column: 2; }
    .service-patient-chip { grid-column: 2; }
    .service-form-panel, .service-price-panel { padding: 15px; border-radius: 15px; }
    .service-dashboard-modal .service-modal-footer { align-items: stretch; flex-direction: column; }
    .service-footer-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .service-dashboard-modal .service-modal-footer > a { width: 100%; justify-content: center; }
}

/* =========================================================
   Manual appointment status controls
   ========================================================= */
.manual-status-actions .status-mini-button,
.manual-final-actions .status-final-button {
    cursor: pointer;
    opacity: 1;
}
.manual-status-actions .status-mini-button:not(.active):hover,
.manual-final-actions .status-final-button:not(.active):hover {
    transform: translateY(-1px);
}
.manual-status-actions .status-mini-button.active,
.manual-final-actions .status-final-button.active {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.65), 0 5px 13px rgba(28, 75, 133, .13);
}
.status-final-button.status-completed.active {
    color: #fff;
    border-color: #07865a;
    background: linear-gradient(135deg, #10b981, #07865a);
}
.manual-status-actions .status-mini-button:disabled,
.manual-final-actions .status-final-button:disabled {
    opacity: .62;
    cursor: wait;
}
.calendar-live-note {
    font-weight: 750;
}

/* =========================================================
   Patient photos, dental X-rays and focused status summary
   ========================================================= */
.calendar-summary-strip.calendar-summary-strip-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.patient-profile-photo {
    display: block;
    object-fit: cover;
    background: #eaf3ff;
    border: 2px solid rgba(255,255,255,.92);
    box-shadow: 0 8px 22px rgba(23, 61, 110, .15);
}
.patient-profile-photo-hero {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    border-radius: 22px;
}
.patient-profile-photo-list {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 13px;
}

.patient-photo-upload-card {
    padding: 18px 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(290px, .72fr);
    align-items: center;
    gap: 22px;
    border-color: #cfe1f7;
    background: linear-gradient(135deg, #fbfdff 0%, #eef6ff 100%);
}
.patient-photo-preview-wrap {
    display: flex;
    align-items: center;
    gap: 17px;
}
.patient-photo-preview {
    width: 92px;
    height: 92px;
    flex: 0 0 92px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 24px;
    color: #3974c9;
    background: linear-gradient(145deg, #dcecff, #f4f9ff);
    border: 1px solid #bfd8f5;
    box-shadow: inset 0 0 0 5px rgba(255,255,255,.65);
}
.patient-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.patient-photo-preview .ui-icon { width: 34px; height: 34px; }
.patient-photo-preview-wrap h2 { margin: 3px 0 5px; }
.patient-photo-preview-wrap p:last-child { margin: 0; }

.upload-dropzone {
    min-height: 84px;
    padding: 15px 17px;
    display: flex;
    align-items: center;
    gap: 13px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1.5px dashed #8eb8ea;
    border-radius: 15px;
    color: #1d5da9;
    background: rgba(255,255,255,.82);
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.upload-dropzone:hover {
    border-color: #2563eb;
    background: #f7fbff;
    transform: translateY(-1px);
}
.upload-dropzone > .ui-icon { width: 25px; height: 25px; flex: 0 0 25px; }
.upload-dropzone span { display: grid; gap: 2px; }
.upload-dropzone strong { color: #174f91; }
.upload-dropzone small { color: #6782a5; font-weight: 600; }
.upload-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.upload-dropzone-compact { min-height: 76px; }

.patient-xray-section {
    overflow: hidden;
    border-color: #cfe1f7;
}
.xray-card-header { margin-bottom: 15px; }
.pill-blue { color: #1557a6; background: #e5f1ff; }
.xray-upload-panel {
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid #d6e5f6;
    border-radius: 17px;
    background: linear-gradient(135deg, #f8fbff, #eef6ff);
}
.xray-upload-fields {
    display: grid;
    grid-template-columns: minmax(150px, .55fr) minmax(150px, .55fr) minmax(300px, 1.5fr) auto;
    gap: 12px;
    align-items: end;
}
.xray-tooth-field[hidden] { display: none !important; }
.xray-file-picker { min-height: 66px; }
.xray-upload-button { min-height: 46px; white-space: nowrap; }
.selected-files-summary {
    margin-top: 9px;
    color: #587392;
    font-size: 12px;
    font-weight: 700;
}
.patient-xray-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}
.xray-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #d7e3f1;
    border-radius: 17px;
    background: white;
    box-shadow: 0 8px 24px rgba(26, 73, 126, .08);
    transition: transform .17s ease, box-shadow .17s ease, border-color .17s ease;
}
.xray-card:hover {
    transform: translateY(-2px);
    border-color: #9fc3ee;
    box-shadow: 0 14px 32px rgba(26, 73, 126, .13);
}
.xray-image-link {
    height: 210px;
    display: block;
    position: relative;
    overflow: hidden;
    background: #101b2b;
}
.xray-image-link img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    transition: transform .2s ease;
}
.xray-card:hover .xray-image-link img { transform: scale(1.025); }
.xray-zoom {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    position: absolute;
    right: 10px;
    bottom: 10px;
    border-radius: 11px;
    color: white;
    background: rgba(10, 29, 54, .78);
    backdrop-filter: blur(8px);
}
.xray-zoom .ui-icon { width: 18px; height: 18px; }
.xray-card-body {
    padding: 13px 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.xray-card-body > div { min-width: 0; }
.xray-card-body h3 {
    margin: 8px 0 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    color: #173d6e;
}
.xray-card-body small { color: var(--muted); }
.icon-action-danger { color: #c62929; background: #fff2f2; border-color: #ffd0d0; }
.icon-action-danger:hover { color: white; background: #dc2626; border-color: #dc2626; }
.compact-empty-state { min-height: 210px; }

@media (max-width: 1180px) {
    .xray-upload-fields { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .xray-file-picker { grid-column: 1 / -1; }
    .xray-upload-button { justify-self: start; }
    .patient-xray-gallery { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
    .calendar-summary-strip.calendar-summary-strip-3 { grid-template-columns: 1fr; }
    .calendar-summary-strip.calendar-summary-strip-3 > span { border-right: 0; border-bottom: 1px solid #e6eef8; }
    .calendar-summary-strip.calendar-summary-strip-3 > span:last-child { border-bottom: 0; }
    .patient-photo-upload-card { grid-template-columns: 1fr; }
    .patient-photo-preview-wrap { align-items: flex-start; }
    .xray-upload-fields { grid-template-columns: 1fr; }
    .xray-file-picker { grid-column: auto; }
    .xray-upload-button { width: 100%; justify-content: center; }
    .patient-xray-gallery { grid-template-columns: 1fr; }
    .xray-image-link { height: 230px; }
}

/* Professional patient image upload UI */
.patient-photo-upload-card {
    grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr);
    padding: 22px;
    gap: 28px;
    border: 1px solid #cbdff6;
    background:
        radial-gradient(circle at 95% 10%, rgba(59,130,246,.10), transparent 32%),
        linear-gradient(135deg, #ffffff 0%, #f3f8ff 100%);
    box-shadow: 0 10px 30px rgba(37, 99, 235, .07);
}
.patient-photo-copy { min-width: 0; }
.patient-photo-copy h2 { margin: 3px 0 6px; }
.upload-requirements {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 11px;
}
.upload-requirements > span {
    min-height: 28px;
    padding: 5px 9px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d9e7f8;
    border-radius: 999px;
    color: #4d6f98;
    background: rgba(255,255,255,.82);
    font-size: 11px;
    font-weight: 750;
}
.upload-requirements .ui-icon { width: 14px; height: 14px; }
.professional-upload-control { display: grid; gap: 8px; }

.upload-dropzone {
    min-height: 92px;
    padding: 15px 16px;
    gap: 13px;
    border: 1.5px dashed #84afe1;
    border-radius: 17px;
    background: rgba(255,255,255,.94);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.58);
}
.upload-dropzone:hover,
.upload-dropzone.is-dragging {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 4px rgba(37,99,235,.09);
    transform: translateY(-1px);
}
.upload-icon-badge {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid !important;
    place-items: center;
    border-radius: 13px;
    color: #1d5fb8;
    background: linear-gradient(145deg, #e8f3ff, #d9eaff);
    border: 1px solid #c2dcf8;
}
.upload-icon-badge .ui-icon { width: 22px; height: 22px; }
.upload-icon-badge-lg {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    border-radius: 16px;
}
.upload-icon-badge-lg .ui-icon { width: 27px; height: 27px; }
.upload-copy {
    min-width: 0;
    flex: 1;
    display: grid !important;
    gap: 4px !important;
}
.upload-copy strong {
    color: #123f75;
    font-size: 13px;
    line-height: 1.35;
}
.upload-copy small {
    color: #6b82a0;
    font-size: 11px;
    line-height: 1.4;
}
.upload-select-label {
    min-height: 34px;
    padding: 7px 11px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid #bfd7f3;
    border-radius: 10px;
    color: #1659a7;
    background: #f7fbff;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}
.upload-dropzone:hover .upload-select-label,
.upload-dropzone.is-dragging .upload-select-label {
    color: white;
    border-color: #2563eb;
    background: #2563eb;
}
.upload-file-status {
    min-height: 28px;
    padding: 5px 8px;
    color: #607b9c;
    font-size: 11px;
    font-weight: 650;
}
.upload-file-status.has-file { color: #166534; }

.xray-upload-panel {
    margin-bottom: 22px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #cbdff5;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 12px 34px rgba(28, 75, 130, .09);
}
.xray-upload-panel-header {
    min-height: 72px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid #dce8f6;
    background: linear-gradient(135deg, #f8fbff 0%, #edf5ff 100%);
}
.xray-upload-panel-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.xray-upload-panel-title > div { min-width: 0; display: grid; gap: 3px; }
.xray-upload-panel-title strong { color: #173f70; font-size: 14px; }
.xray-upload-panel-title small { color: #68809d; font-size: 11px; }
.upload-panel-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: white;
    background: linear-gradient(145deg, #2f80ed, #1d4ed8);
    box-shadow: 0 7px 16px rgba(37,99,235,.22);
}
.upload-panel-icon .ui-icon { width: 20px; height: 20px; }
.upload-limit-badge {
    min-height: 29px;
    padding: 5px 10px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    color: #245b9d;
    background: #e4f0ff;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.xray-upload-options {
    padding: 16px 18px 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 220px));
    gap: 12px;
}
.professional-xray-picker {
    margin: 15px 18px 0;
    min-height: 106px;
    padding: 18px;
    border-width: 1.5px;
    background: linear-gradient(135deg, #fbfdff, #f3f8ff);
}
.xray-selection-area {
    min-height: 64px;
    padding: 12px 18px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.selected-files-summary {
    margin: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #607995;
    font-size: 11px;
    font-weight: 700;
}
.selected-files-summary.has-files { color: #17683f; }
.selection-status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #a9b8ca;
    box-shadow: 0 0 0 4px rgba(148,163,184,.13);
}
.selected-files-summary.has-files .selection-status-dot {
    background: #22a06b;
    box-shadow: 0 0 0 4px rgba(34,160,107,.13);
}
.xray-upload-button {
    min-height: 38px;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
    white-space: nowrap;
}
.xray-file-preview-grid {
    padding: 0 18px 17px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 9px;
}
.xray-file-preview-grid[hidden] { display: none !important; }
.xray-file-preview-item {
    min-width: 0;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1 / .76;
    border: 1px solid #d8e5f3;
    border-radius: 12px;
    background: #edf3fa;
}
.xray-file-preview-item img { width: 100%; height: 100%; display: block; object-fit: cover; }
.xray-file-preview-item span {
    position: absolute;
    left: 5px;
    right: 5px;
    bottom: 5px;
    padding: 4px 6px;
    overflow: hidden;
    border-radius: 7px;
    color: white;
    background: rgba(15,37,67,.78);
    backdrop-filter: blur(7px);
    font-size: 9px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.xray-file-preview-more {
    display: grid;
    place-items: center;
    color: #245b9d;
    background: #e9f3ff;
    font-size: 12px;
    font-weight: 800;
}

/* Compact filter action */
.filter-show-button {
    min-height: 32px;
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 11px;
    gap: 6px;
}
.filter-show-button .ui-icon { width: 14px; height: 14px; }

@media (max-width: 1180px) {
    .patient-photo-upload-card { grid-template-columns: 1fr; }
    .xray-file-preview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .patient-photo-upload-card { padding: 18px; gap: 18px; }
    .upload-requirements { gap: 6px; }
    .upload-dropzone { align-items: flex-start; }
    .upload-select-label { display: none !important; }
    .xray-upload-panel-header { align-items: flex-start; }
    .xray-upload-options { grid-template-columns: 1fr; }
    .professional-xray-picker { margin-inline: 14px; }
    .xray-selection-area { align-items: stretch; flex-direction: column; }
    .xray-upload-button { width: 100%; }
    .xray-file-preview-grid { padding-inline: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =========================================================
   Clinical center, finance and inventory modules
   ========================================================= */
.clinical-patient-head { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:22px 24px; background:linear-gradient(135deg,#f8fbff,#edf6ff); }
.clinical-section-nav { position:sticky; top:10px; z-index:20; display:flex; gap:7px; padding:9px; overflow-x:auto; }
.clinical-section-nav a { padding:9px 13px; border-radius:10px; color:#365b86; background:#f2f7fd; font-size:12px; font-weight:800; white-space:nowrap; }
.clinical-section-nav a:hover { color:#0758d0; background:#dfedff; }
.clinical-module { scroll-margin-top:90px; }
.clinical-grid-two { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.subsection-title { margin:0 0 12px; color:#173f70; font-size:15px; }

.odontogram-legend { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:5px; max-width:650px; }
.odontogram-legend span { padding:4px 7px; border-radius:999px; font-size:9px; font-weight:800; border:1px solid transparent; }
.odontogram-chart { display:grid; grid-template-columns:repeat(16,minmax(44px,1fr)); gap:7px; padding:15px 0 4px; }
.odontogram-tooth { min-width:0; min-height:92px; padding:8px 4px; display:grid; place-items:center; align-content:center; gap:3px; border:1px solid #dce7f3; border-radius:13px; color:#345577; background:#fff; cursor:pointer; transition:.18s ease; }
.odontogram-tooth:hover { transform:translateY(-2px); border-color:#62a2f6; box-shadow:0 8px 20px rgba(32,101,185,.12); }
.odontogram-tooth .tooth-shape { width:31px; height:34px; display:grid; place-items:center; }
.odontogram-tooth .tooth-shape .ui-icon { width:28px; height:28px; }
.odontogram-tooth strong { font-size:12px; }
.odontogram-tooth small { max-width:100%; overflow:hidden; font-size:8px; text-overflow:ellipsis; white-space:nowrap; }
.odontogram-tooth.quadrant-break { margin-left:10px; }
.tooth-state-healthy { color:#2c6b54!important; background:#effaf5!important; border-color:#c9eadc!important; }
.tooth-state-caries { color:#a44330!important; background:#fff1ed!important; border-color:#f4c4b9!important; }
.tooth-state-filling { color:#145b91!important; background:#eaf6ff!important; border-color:#bfddf5!important; }
.tooth-state-crown { color:#7a5b12!important; background:#fff8df!important; border-color:#ead797!important; }
.tooth-state-bridge { color:#705119!important; background:#f9f0d8!important; border-color:#e4cc8d!important; }
.tooth-state-implant { color:#535b6d!important; background:#eef0f4!important; border-color:#cfd4de!important; }
.tooth-state-missing { color:#7b8798!important; background:#f2f4f7!important; border-color:#d6dbe2!important; opacity:.76; }
.tooth-state-root_canal { color:#603a9b!important; background:#f4edff!important; border-color:#d6c0f7!important; }
.tooth-state-fracture { color:#9b3131!important; background:#fff0f0!important; border-color:#efb8b8!important; }
.tooth-state-periodontal { color:#8e5c18!important; background:#fff5e8!important; border-color:#efcf9f!important; }
.tooth-state-planned { color:#164ea4!important; background:#edf4ff!important; border-color:#bcd4fa!important; }
.tooth-state-other { color:#4d647e!important; background:#edf2f7!important; border-color:#ccd8e5!important; }

.plan-list { display:grid; gap:14px; }
.plan-card { padding:17px; border:1px solid #dfe9f4; border-radius:15px; background:#fbfdff; }
.plan-card > header { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.plan-card h3 { margin:6px 0 3px; color:#173f70; font-size:16px; }
.plan-card p { margin:0; color:#71849b; font-size:11px; }
.plan-card > header > strong { color:#0d64d8; font-size:18px; }
.plan-items { margin:13px 0; border-top:1px solid #e5edf6; }
.plan-items > div { padding:9px 0; display:flex; justify-content:space-between; gap:12px; border-bottom:1px solid #e9f0f7; }
.plan-items span { display:grid; gap:2px; }
.plan-items small { color:#708399; font-size:10px; }
.plan-add-item { margin-top:12px; }
.plan-add-item summary { color:#1664ca; font-size:12px; font-weight:800; cursor:pointer; }
.plan-add-item summary .ui-icon { width:15px; vertical-align:middle; }
.compact-form { margin-top:12px; padding:13px; border-radius:12px; background:#f1f7fe; }
.plan-status-form { margin-top:12px; justify-content:flex-end; }

.consent-layout { display:grid; grid-template-columns:1.2fr .8fr; gap:20px; }
.signature-panel { display:grid; align-content:start; gap:10px; }
.signature-panel > span { color:#315270; font-size:12px; font-weight:800; }
.signature-panel canvas { width:100%; max-width:520px; height:210px; border:1.5px dashed #9cb9d9; border-radius:13px; background:#fff; touch-action:none; }
.small-text { font-size:10px; }
.document-list { display:grid; gap:10px; }
.document-list article { padding:13px; border:1px solid #e1e9f3; border-radius:13px; background:#fbfdff; }
.document-list article > div { display:flex; align-items:center; gap:10px; }
.document-icon { width:34px; height:34px; display:grid; place-items:center; border-radius:10px; color:#1564ca; background:#e7f1ff; }
.document-list article span { display:grid; gap:2px; }
.document-list small { color:#75879b; font-size:10px; }
.document-list ul { margin:9px 0 0 44px; padding-left:15px; color:#47627e; font-size:11px; }
.medicine-row { display:grid; grid-template-columns:1.4fr repeat(5,1fr); gap:8px; margin-bottom:8px; }
.medicine-row input { min-width:0; }
.installment-card { padding:13px; border:1px solid #dfe9f4; border-radius:13px; }
.installment-card header { display:flex; justify-content:space-between; }
.installment-track { display:flex; flex-wrap:wrap; gap:6px; margin-top:11px; }
.installment-track span { width:27px; height:27px; display:grid; place-items:center; border-radius:8px; color:#3c5e80; background:#edf3f9; font-size:10px; font-weight:900; }
.installment-track .installment-paid { color:#167249; background:#e5f8ef; }
.installment-track .installment-overdue { color:#a13939; background:#fff0f0; }

.cash-date-bar,.inventory-toolbar { display:flex; align-items:end; justify-content:space-between; gap:12px; }
.cash-stats { grid-template-columns:repeat(5,minmax(0,1fr)); }
.compact-field { min-width:190px; }
.inventory-alerts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:13px; }
.alert-card { min-height:83px; padding:15px; display:flex; align-items:center; gap:12px; border:1px solid #dfe9f3; border-radius:15px; background:#fff; }
.alert-card > span { width:38px; height:38px; display:grid; place-items:center; border-radius:11px; color:#1766cf; background:#e8f2ff; }
.alert-card > div { display:grid; gap:3px; }
.alert-card strong { color:#173f70; font-size:15px; }
.alert-card small { color:#74869b; font-size:10px; }
.alert-card-danger > span { color:#a43c3c; background:#fff0f0; }
.alert-card-warning > span { color:#97630d; background:#fff5df; }
.row-alert { background:#fff5f5!important; }
.row-warning { background:#fffaf0!important; }
.template-list { display:grid; gap:11px; }
.template-card { padding:14px; border:1px solid #dfe8f2; border-radius:13px; background:#fbfdff; }
.template-card header { display:flex; justify-content:space-between; gap:10px; }
.template-card header > div { display:grid; gap:2px; }
.template-card small { color:#7c8ea1; font-size:10px; }
.template-card p { margin:10px 0 0; color:#4a6580; font-size:11px; line-height:1.55; }
.template-card.is-inactive { opacity:.56; }
.clinical-template-picker { padding:11px; border:1px solid #cfe1f5; border-radius:12px; background:#edf6ff; }
.installment-plan-section { margin-top:18px; }
.installment-summary { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:14px; }
.installment-summary > div { padding:11px; display:grid; gap:3px; border-radius:11px; background:#f1f6fc; }
.installment-summary span { color:#71859a; font-size:10px; }

@media (max-width:1300px){.odontogram-chart{grid-template-columns:repeat(8,minmax(50px,1fr));}.odontogram-tooth.quadrant-break{margin-left:0}.cash-stats{grid-template-columns:repeat(3,1fr)}.medicine-row{grid-template-columns:repeat(3,1fr)}}
@media (max-width:900px){.clinical-patient-head,.cash-date-bar,.inventory-toolbar{align-items:stretch;flex-direction:column}.clinical-grid-two,.consent-layout{grid-template-columns:1fr}.inventory-alerts{grid-template-columns:1fr}.odontogram-chart{grid-template-columns:repeat(4,minmax(55px,1fr))}.cash-stats{grid-template-columns:repeat(2,1fr)}.medicine-row{grid-template-columns:1fr}.installment-summary{grid-template-columns:1fr}}


.referral-list { display:grid; gap:10px; }
.referral-card { border:1px solid #dfe9f4; border-radius:13px; background:#fbfdff; overflow:hidden; }
.referral-card summary { padding:13px; display:flex; align-items:center; justify-content:space-between; gap:12px; cursor:pointer; list-style:none; }
.referral-card summary::-webkit-details-marker { display:none; }
.referral-card summary > span:first-child { display:grid; gap:2px; }
.referral-card summary small { color:#74879c; font-size:10px; }
.referral-card > p { margin:0; padding:0 13px 10px; color:#4c6680; font-size:11px; }
.referral-card form { margin:0 13px 13px; }
.prescription-allergy-warning { padding:12px 14px; border:1px solid #f0b8b8; border-radius:12px; color:#8e2f2f; background:#fff4f4; }
.prescription-allergy-warning strong { display:flex; align-items:center; gap:7px; }
.prescription-allergy-warning strong .ui-icon { width:16px; height:16px; }
.prescription-allergy-warning p { margin:6px 0 9px; font-size:11px; }
.prescription-allergy-warning label { display:flex; align-items:flex-start; gap:8px; color:#653333; font-size:10px; font-weight:700; }
.plan-item-status { margin-left:auto; }
.plan-item-status select { min-width:116px; }
.quote-plan-title,.quote-notes { margin:16px 0; padding:13px; border-radius:12px; background:#f4f8fc; }
.quote-plan-title { display:flex; justify-content:space-between; gap:12px; }
.quote-plan-title span,.quote-notes p { color:#647c94; }


/* Cancelled appointment deletion */
.appointment-delete-form { margin-top: 5px; }
.appointment-delete-form[hidden] { display: none !important; }
.appointment-delete-button {
    width: 100%; min-height: 29px; padding: 5px 8px;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    border: 1px solid #ef9a9a; border-radius: 8px;
    background: linear-gradient(180deg, #fff7f7, #ffe8e8);
    color: #a61b1b; font-size: 9px; font-weight: 900; cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.appointment-delete-button:hover {
    transform: translateY(-1px); background: #ffe0e0;
    box-shadow: 0 6px 15px rgba(220, 38, 38, .15);
}
.appointment-delete-button .ui-icon { width: 12px; height: 12px; }


/* Calendar view switch and structured wide appointment cards */
.calendar-toolbar-structured { gap: 14px; }
.calendar-period-navigation,
.calendar-view-switch { display: inline-flex; align-items: center; gap: 7px; }
.calendar-view-switch { padding: 4px; border: 1px solid #dbe5ef; border-radius: 13px; background: #f5f8fc; }
.calendar-view-button { min-height: 38px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 7px; border-radius: 10px; color: #5a6e83; font-size: 11px; font-weight: 850; }
.calendar-view-button .ui-icon { width: 16px; height: 16px; }
.calendar-view-button:hover { color: #1e5fae; background: #fff; }
.calendar-view-button.active { color: #fff; background: linear-gradient(135deg, #2563eb, #397fe5); box-shadow: 0 7px 16px rgba(37,99,235,.2); }
.weekly-calendar { min-width: calc(82px + (var(--calendar-days) * 225px)); grid-template-columns: 82px repeat(var(--calendar-days), minmax(225px, 1fr)); }
.calendar-appointment { min-width: 0; padding: 9px; }
.calendar-appointment h3 { font-size: 12px; }
.calendar-appointment p { font-size: 10px; }
.calendar-appointment .appointment-status-actions,
.calendar-appointment .appointment-final-actions { gap: 5px; }
.appointment-final-actions { align-items: stretch; }
.appointment-delete-form { margin-top: 0; }
.appointment-delete-form:not([hidden]) { display: block; grid-column: auto; }
.appointment-delete-button { min-height: 31px; }
.status-final-button[hidden] { display: none !important; }

/* Daily appointments: card-based day navigation and completed service summary */
.appointments-day-page { display: grid; gap: 16px; }
.appointments-day-hero { padding: 20px 22px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.appointments-day-hero h2 { margin-bottom: 5px; }
.appointments-day-hero > div > p:last-child { margin: 0; color: var(--muted); }
.appointments-day-filter { align-items: end; }
.appointments-day-navigation { padding: 8px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.day-nav-button { min-height: 58px; padding: 9px 14px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid #e0e7ef; border-radius: 13px; color: #425971; background: #fbfdff; }
.day-nav-button:hover { border-color: #a9c5e8; background: #f2f7fd; }
.day-nav-button > span { display: grid; gap: 2px; }
.day-nav-button small { color: #8493a5; font-size: 10px; }
.day-nav-button strong { font-size: 13px; }
.day-nav-button .ui-icon { width: 17px; height: 17px; }
.day-nav-today { color: #1d61b5; background: #edf5ff; }
.day-nav-today.active { color: #fff; border-color: transparent; background: linear-gradient(135deg,#2563eb,#3c82e5); }
.day-nav-today.active small { color: rgba(255,255,255,.72); }
.daily-appointment-card-grid { display: grid; gap: 12px; }
.daily-appointment-card { min-height: 150px; padding: 17px 18px; display: grid; grid-template-columns: 82px minmax(0,1fr) 130px; gap: 18px; align-items: stretch; border: 1px solid #dfe7f0; border-radius: 17px; background: #fff; box-shadow: 0 8px 24px rgba(30,64,100,.055); }
.daily-appointment-card:hover { border-color: #b8cee6; box-shadow: 0 13px 30px rgba(30,64,100,.09); }
.daily-appointment-card.status-cancelled { opacity: .76; background: #fff8f8; }
.daily-appointment-time { padding-right: 15px; display: flex; flex-direction: column; align-items: flex-start; border-right: 1px solid #e7edf4; }
.daily-appointment-time strong { color: #183d66; font-size: 22px; line-height: 1; }
.daily-appointment-time span { margin-top: 5px; color: #7c8b9c; font-size: 11px; }
.daily-appointment-time i { width: 32px; height: 5px; margin-top: auto; border-radius: 999px; background: var(--dentist-color); }
.daily-appointment-content { min-width: 0; display: grid; align-content: start; gap: 12px; }
.daily-appointment-content > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.daily-appointment-content h3 { margin: 0 0 3px; font-size: 17px; }
.daily-appointment-content header p { margin: 0; color: var(--muted); font-size: 11px; }
.daily-appointment-meta { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.daily-appointment-meta > span { min-width: 0; padding: 9px 10px; display: grid; grid-template-columns: 20px 1fr; column-gap: 7px; border-radius: 10px; background: #f6f9fc; }
.daily-appointment-meta .ui-icon { grid-row: span 2; width: 16px; height: 16px; color: #3c78bb; }
.daily-appointment-meta small { color: #8391a2; font-size: 9px; }
.daily-appointment-meta strong { overflow: hidden; color: #334e68; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.completed-service-summary { padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid #bfe8d3; border-radius: 12px; background: #effbf5; }
.completed-service-summary > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: #138153; background: #d9f5e7; }
.completed-service-summary .ui-icon { width: 16px; height: 16px; }
.completed-service-summary div { min-width: 0; display: grid; gap: 2px; }
.completed-service-summary small { color: #56806c; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.completed-service-summary strong { overflow: hidden; color: #17603f; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.daily-appointment-actions { display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.daily-appointment-actions form, .daily-appointment-actions .btn { width: 100%; }
.daily-appointment-actions .btn { justify-content: center; }

@media (max-width: 1100px) {
    .appointments-day-hero { align-items: stretch; flex-direction: column; }
    .daily-appointment-card { grid-template-columns: 72px minmax(0,1fr); }
    .daily-appointment-actions { grid-column: 1 / -1; flex-direction: row; }
    .daily-appointment-actions form, .daily-appointment-actions .btn { width: auto; }
}
@media (max-width: 760px) {
    .calendar-toolbar-structured { width: 100%; align-items: stretch; flex-direction: column; }
    .calendar-period-navigation, .calendar-view-switch { width: 100%; }
    .calendar-period-navigation .btn, .calendar-view-button { flex: 1; justify-content: center; }
    .calendar-view-button span { display: none; }
    .appointments-day-navigation { grid-template-columns: 1fr 1fr 1fr; }
    .appointments-day-filter { width: 100%; display: grid; grid-template-columns: 1fr; }
    .daily-appointment-card { grid-template-columns: 1fr; }
    .daily-appointment-time { padding: 0 0 10px; flex-direction: row; align-items: center; gap: 8px; border-right: 0; border-bottom: 1px solid #e7edf4; }
    .daily-appointment-time i { width: 36px; margin: 0 0 0 auto; }
    .daily-appointment-meta { grid-template-columns: 1fr; }
    .daily-appointment-actions { grid-column: auto; display: grid; grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   Dashboard clinical command modal — full visit record
   ========================================================= */
.visit-command-modal {
    width: min(1480px, calc(100vw - 28px));
    max-width: 1480px;
    max-height: calc(100vh - 24px);
    border: 0;
    border-radius: 26px;
    overflow: hidden;
    background: #f4f8fd;
    box-shadow: 0 36px 120px rgba(20, 48, 84, .38);
}
.visit-command-shell {
    min-height: min(880px, calc(100vh - 24px));
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f6fc 100%);
}
.visit-command-header {
    flex: 0 0 auto;
    min-height: 96px !important;
    background:
        radial-gradient(circle at 80% 0%, rgba(14, 165, 233, .18), transparent 34%),
        linear-gradient(135deg, #f9fcff 0%, #edf6ff 56%, #e7f2ff 100%) !important;
}
.visit-command-header .service-modal-heading h2 {
    font-size: clamp(22px, 2vw, 29px);
    letter-spacing: -.02em;
}
.visit-command-body {
    position: relative;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 22px 28px 30px !important;
}
.visit-command-loading {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 12px;
    color: #315b83;
    background: rgba(244, 248, 253, .9);
    backdrop-filter: blur(3px);
}
.visit-command-loading[hidden] { display: none; }
.visit-loading-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #cfe2f7;
    border-top-color: #1976d2;
    border-radius: 50%;
    animation: visit-spin .8s linear infinite;
}
@keyframes visit-spin { to { transform: rotate(360deg); } }

.visit-identity-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr .8fr;
    gap: 12px;
    margin-bottom: 16px;
}
.visit-identity-grid article {
    min-width: 0;
    padding: 14px 15px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid #d7e4f2;
    border-radius: 15px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 7px 20px rgba(32, 76, 126, .06);
}
.visit-identity-grid article > span {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #1768c4;
    background: #eaf3ff;
}
.visit-identity-grid article:nth-child(2) > span { color: #0f8f73; background: #e5f8f2; }
.visit-identity-grid article:nth-child(3) > span { color: #7c4cc9; background: #f0eaff; }
.visit-identity-grid article:nth-child(4) > span { color: #b46a0a; background: #fff4dc; }
.visit-identity-grid small,
.visit-identity-grid strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit-identity-grid small { color: #7890a8; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.visit-identity-grid strong { margin-top: 3px; color: #1f466d; font-size: 14px; }

.visit-module-card {
    border: 1px solid #d6e3f0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(27, 69, 117, .065);
}
.visit-module-heading,
.visit-module-title,
.visit-entry-toolbar,
.visit-entry-buttons,
.visit-record-header,
.financial-card-heading,
.service-editor-footer,
.visit-command-footer,
.visit-command-footer .service-footer-actions {
    display: flex;
    align-items: center;
}
.visit-module-heading {
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 15px;
}
.visit-module-title { gap: 10px; min-width: 0; }
.visit-module-title > span,
.financial-card-heading > span {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #1268c8;
    background: #e9f3ff;
}
.visit-module-title small,
.visit-module-title h3,
.financial-card-heading small,
.financial-card-heading h3 { display: block; }
.visit-module-title small,
.financial-card-heading small { color: #718aa4; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .09em; }
.visit-module-title h3,
.financial-card-heading h3 { margin: 2px 0 0; color: #1b456d; font-size: 17px; }

.tooth-status-module { padding: 18px; }
.selected-teeth-counter,
.record-count-badge {
    padding: 7px 11px;
    border: 1px solid #cfe0f2;
    border-radius: 999px;
    color: #55718e;
    background: #f5f9fd;
    font-size: 12px;
    font-weight: 800;
}
.selected-teeth-counter strong,
.record-count-badge strong { color: #1469c7; }
.multi-tooth-picker {
    display: grid;
    grid-template-columns: repeat(16, minmax(42px, 1fr));
    gap: 6px;
    margin-bottom: 14px;
}
.multi-tooth-picker button {
    min-height: 48px;
    padding: 5px 2px;
    display: grid;
    place-content: center;
    gap: 1px;
    border: 1px solid #d4e0ec;
    border-radius: 9px;
    color: #315775;
    background: #f9fbfd;
    cursor: pointer;
    transition: .16s ease;
}
.multi-tooth-picker button span { font-size: 12px; font-weight: 900; }
.multi-tooth-picker button small { max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8496a8; font-size: 8px; font-weight: 800; }
.multi-tooth-picker button:hover { z-index: 1; transform: translateY(-1px); border-color: #7eb5ea; box-shadow: 0 6px 14px rgba(28, 102, 174, .13); }
.multi-tooth-picker button.selected { color: #fff; border-color: #176fca; background: linear-gradient(145deg, #2183df, #1262b7); box-shadow: 0 7px 16px rgba(23, 105, 196, .24); }
.multi-tooth-picker button.selected small { color: rgba(255,255,255,.8); }
.multi-tooth-picker button.tooth-condition-caries:not(.selected) { border-color: #f6a9a9; background: #fff1f1; }
.multi-tooth-picker button.tooth-condition-filling:not(.selected) { border-color: #86c9f3; background: #ecf8ff; }
.multi-tooth-picker button.tooth-condition-crown:not(.selected),
.multi-tooth-picker button.tooth-condition-bridge:not(.selected) { border-color: #dab5f5; background: #f8f0ff; }
.multi-tooth-picker button.tooth-condition-implant:not(.selected) { border-color: #8bd7c1; background: #edfbf7; }
.multi-tooth-picker button.tooth-condition-missing:not(.selected) { opacity: .58; text-decoration: line-through; }
.multi-tooth-picker button.tooth-condition-root_canal:not(.selected) { border-color: #f2bd79; background: #fff7e9; }
.multi-tooth-picker button.tooth-condition-planned:not(.selected) { border-color: #f0cf6a; background: #fffbe9; }
.tooth-status-controls {
    display: grid;
    grid-template-columns: minmax(190px, .8fr) minmax(150px, .6fr) minmax(240px, 1.25fr) auto;
    gap: 10px;
    align-items: end;
}
.tooth-status-controls .field { margin: 0; }
.tooth-save-button { min-height: 45px; white-space: nowrap; }

.visit-entry-toolbar {
    justify-content: space-between;
    gap: 18px;
    margin: 22px 2px 12px;
}
.visit-entry-toolbar h3 { margin: 2px 0 0; color: #21486d; font-size: 20px; }
.visit-entry-buttons { gap: 9px; flex-wrap: wrap; }
.visit-entry-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, .8fr);
    gap: 16px;
    align-items: stretch;
}
.visit-editor-panel { padding: 18px; transition: box-shadow .2s ease, border-color .2s ease; }
.visit-editor-panel.is-focused { border-color: #66a9e7; box-shadow: 0 0 0 4px rgba(35, 126, 211, .12), 0 14px 34px rgba(27,69,117,.1); }
.modal-service-editor .form-grid { gap: 11px; }
.modal-service-editor .field { margin: 0; }
.service-editor-footer {
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e0e9f2;
}
.inline-service-total small,
.inline-service-total strong { display: block; }
.inline-service-total small { color: #7b8fa4; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.inline-service-total strong { margin-top: 2px; color: #0b63c4; font-size: 21px; }
.clinical-template-form { display: grid; gap: 11px; }
.clinical-template-form .field { margin: 0; }
.clinical-template-form button { justify-self: end; }

.visit-record-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(310px, 360px);
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}
.visit-record-main,
.visit-financial-card {
    border: 1px solid #d4e2ef;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(27, 69, 117, .065);
}
.visit-record-main { padding: 18px; }
.visit-record-header { justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.visit-record-header h3 { margin: 2px 0 0; color: #1e466e; font-size: 18px; }
.visit-service-records { display: grid; gap: 8px; }
.record-empty-state {
    min-height: 112px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 4px;
    border: 1px dashed #c8d9e9;
    border-radius: 13px;
    color: #71879d;
    background: #f8fbfe;
    text-align: center;
}
.record-empty-state strong { color: #3d607e; }
.visit-service-record {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) minmax(145px, auto) auto;
    gap: 11px;
    align-items: center;
    padding: 11px 12px;
    border: 1px solid #dde7f0;
    border-radius: 13px;
    background: linear-gradient(135deg, #fff, #f9fbfd);
    transition: .16s ease;
}
.visit-service-record:hover { border-color: #b9d3ea; box-shadow: 0 6px 17px rgba(29,78,125,.07); }
.record-sequence {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #176ac5;
    background: #eaf3fd;
    font-size: 12px;
    font-weight: 900;
}
.record-service-copy { min-width: 0; }
.record-service-copy strong,
.record-service-copy span,
.record-service-copy small { display: block; }
.record-service-copy strong { color: #244d72; font-size: 14px; }
.record-service-copy span { margin-top: 2px; color: #6f8499; font-size: 11px; font-weight: 700; }
.record-service-copy small { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8193a6; }
.record-financial-mini { min-width: 135px; text-align: right; }
.record-financial-mini small,
.record-financial-mini strong,
.record-financial-mini em { display: block; }
.record-financial-mini small { color: #7b8fa3; font-size: 10px; }
.record-financial-mini strong { margin-top: 2px; color: #1069c7; font-size: 15px; }
.record-financial-mini em { color: #d47b12; font-size: 10px; font-style: normal; font-weight: 800; }
.record-actions { display: flex; gap: 5px; }
.record-edit-button,
.record-delete-button {
    min-height: 34px;
    padding: 7px 9px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #cdddec;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}
.record-edit-button { color: #1165be; background: #eef6ff; }
.record-delete-button { color: #c43d3d; border-color: #efcaca; background: #fff3f3; }
.record-edit-button:hover { border-color: #7db2e5; background: #e3f1ff; }
.record-delete-button:hover { border-color: #e69b9b; background: #ffe8e8; }

.visit-financial-card {
    position: sticky;
    top: 0;
    padding: 18px;
    background: linear-gradient(155deg, #ffffff 0%, #f1f7ff 100%);
}
.financial-card-heading { gap: 10px; margin-bottom: 15px; }
.visit-financial-breakdown { margin: 0; display: grid; gap: 8px; }
.visit-financial-breakdown > div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #d7e2ed;
}
.visit-financial-breakdown dt { color: #698096; font-size: 12px; }
.visit-financial-breakdown dd { margin: 0; color: #315674; font-size: 12px; font-weight: 800; }
.visit-financial-total {
    margin-top: 14px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    border: 1px solid #99c3ee;
    border-radius: 14px;
    background: linear-gradient(135deg, #e8f3ff, #d9ebff);
}
.visit-financial-total span { color: #567796; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.visit-financial-total strong { color: #075fbd; font-size: 22px; }
.financial-edit-hint {
    margin: 12px 0 0;
    padding: 10px;
    display: flex;
    align-items: flex-start;
    gap: 7px;
    border-radius: 10px;
    color: #607990;
    background: rgba(255,255,255,.72);
    font-size: 11px;
    line-height: 1.45;
}
.financial-edit-hint .ui-icon { width: 16px; height: 16px; flex: 0 0 16px; color: #2875c2; }
.invoice-state { margin-top: 10px; padding: 9px; border-radius: 9px; color: #24634f; background: #e9f8f2; font-size: 11px; font-weight: 800; }
.visit-command-footer { justify-content: space-between; gap: 16px; flex: 0 0 auto; }
.visit-command-footer .service-footer-actions { gap: 12px; }
.modal-save-state { color: #72869a; font-size: 11px; font-weight: 700; }
.modal-save-state[data-state="loading"] { color: #b16a0b; }
.modal-save-state[data-state="error"] { color: #c83a3a; }
.modal-save-state[data-state="locked"] { color: #7d4fb6; }

@media (max-width: 1180px) {
    .visit-identity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .multi-tooth-picker { grid-template-columns: repeat(8, minmax(42px, 1fr)); }
    .visit-entry-grid { grid-template-columns: 1fr; }
    .visit-record-section { grid-template-columns: 1fr; }
    .visit-financial-card { position: static; }
}
@media (max-width: 760px) {
    .visit-command-modal { width: calc(100vw - 10px); max-height: calc(100vh - 10px); border-radius: 17px; }
    .visit-command-shell { min-height: calc(100vh - 10px); }
    .visit-command-body { padding: 14px !important; }
    .visit-command-header { padding: 14px !important; }
    .visit-command-header .service-modal-icon { display: none; }
    .visit-identity-grid { grid-template-columns: 1fr; }
    .multi-tooth-picker { grid-template-columns: repeat(4, minmax(44px, 1fr)); }
    .tooth-status-controls { grid-template-columns: 1fr; }
    .visit-entry-toolbar { align-items: flex-start; flex-direction: column; }
    .visit-entry-buttons { width: 100%; }
    .visit-entry-buttons .btn { flex: 1; }
    .visit-service-record { grid-template-columns: 30px minmax(0, 1fr); }
    .record-financial-mini { grid-column: 2; text-align: left; }
    .record-actions { grid-column: 1 / -1; }
    .record-actions button { flex: 1; justify-content: center; }
    .visit-command-footer { align-items: stretch; flex-direction: column; }
    .visit-command-footer > a,
    .visit-command-footer .service-footer-actions,
    .visit-command-footer .service-footer-actions button { width: 100%; }
    .visit-command-footer .service-footer-actions { flex-direction: column; }
    .modal-save-state { text-align: center; }
}

/* =========================================================
   Five-day dashboard, elevated status cards and modal workflow
   ========================================================= */
.topbar:has(.topbar-status-cards) {
    min-height: 122px;
    padding-block: 18px;
    align-items: center;
}
.topbar:has(.topbar-status-cards) > .topbar-title-block {
    flex: 0 1 285px;
    min-width: 220px;
}
.topbar-status-cards {
    flex: 1 1 620px;
    max-width: 760px;
    display: grid;
    grid-template-columns: repeat(3, minmax(170px, 1fr));
    gap: 12px;
    margin-inline: auto;
}
.topbar-status-card {
    min-height: 76px;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    gap: 13px;
    border: 1px solid #dce5ef;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 9px 24px rgba(30, 62, 98, .08);
}
.topbar-status-card > span {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
}
.topbar-status-card > span .ui-icon { width: 21px; height: 21px; }
.topbar-status-card small,
.topbar-status-card strong { display: block; }
.topbar-status-card small { color: #64748b; font-size: 12px; font-weight: 800; }
.topbar-status-card strong { margin-top: 1px; color: #17324d; font-size: 25px; line-height: 1; }
.topbar-status-scheduled { border-color: #cfe0fa; background: linear-gradient(135deg,#fff,#f2f7ff); }
.topbar-status-scheduled > span { color: #2563eb; background: #e8f1ff; }
.topbar-status-waiting { border-color: #f4ddb2; background: linear-gradient(135deg,#fff,#fff9ed); }
.topbar-status-waiting > span { color: #d97706; background: #fff1d6; }
.topbar-status-exam { border-color: #c5e6d8; background: linear-gradient(135deg,#fff,#f0fbf6); }
.topbar-status-exam > span { color: #059669; background: #e2f7ee; }

.calendar-toolbar-five-days {
    min-height: 92px;
    justify-content: center;
    padding: 14px 22px;
}
.calendar-date-navigation {
    display: grid;
    grid-template-columns: 48px minmax(250px, 360px) 48px;
    align-items: center;
    gap: 14px;
}
.calendar-nav-arrow {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid #cfdae7;
    border-radius: 14px;
    color: #28577e;
    background: #fff;
    box-shadow: 0 6px 18px rgba(38, 75, 112, .08);
    transition: .16s ease;
}
.calendar-nav-arrow:hover { color: #fff; border-color: #2563eb; background: #2563eb; transform: translateY(-1px); }
.calendar-current-date {
    min-height: 58px;
    padding: 8px 22px;
    display: grid;
    place-items: center;
    border: 1px solid #c9dced;
    border-radius: 17px;
    background: linear-gradient(135deg,#fff,#f1f7fd);
    box-shadow: 0 8px 22px rgba(37, 73, 109, .08);
    text-align: center;
}
.calendar-current-date small { color: #6c8297; font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.calendar-current-date strong { margin-top: 2px; color: #173f64; font-size: 18px; }
.weekly-calendar.calendar-view-five-days {
    min-width: calc(82px + (5 * 245px));
    grid-template-columns: 82px repeat(5, minmax(245px, 1fr));
}
.calendar-day-header.is-closed-day { color: #7c8794; background: #f1f3f5; }
.calendar-day-header.is-closed-day strong,
.calendar-day-header.is-closed-day span { color: #6b7280; }
.calendar-day-header.is-closed-day small { margin-top: 2px; color: #9a5e62; font-size: 9px; font-weight: 800; }
.calendar-slot.is-closed-day { background: repeating-linear-gradient(135deg,#f6f7f8,#f6f7f8 8px,#f1f3f5 8px,#f1f3f5 16px); }
.calendar-slot.is-closed-day:hover { box-shadow: none; background: repeating-linear-gradient(135deg,#f6f7f8,#f6f7f8 8px,#f1f3f5 8px,#f1f3f5 16px); }
.calendar-appointment { padding: 10px; }
.calendar-appointment h3 { font-size: 13.5px; }
.calendar-appointment p { font-size: 10.5px; }
.appointment-cancel-delete-slot { display: inline-flex; min-width: 0; }
.appointment-cancel-delete-slot > button,
.appointment-cancel-delete-slot > form,
.appointment-cancel-delete-slot > form > button { width: 100%; }
.appointment-delete-form[hidden],
.status-final-button[hidden] { display: none !important; }
.appointment-delete-button { color: #fff !important; border-color: #b91c1c !important; background: linear-gradient(135deg,#dc2626,#b91c1c) !important; }

.visit-command-modal-maximized {
    width: 100vw !important;
    max-width: none !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
}
.visit-command-modal-maximized .visit-command-shell { min-height: 100dvh; height: 100dvh; }
.visit-command-modal-maximized .visit-command-body { padding: 24px 34px 34px !important; }
.visit-entry-toolbar-command {
    margin-top: 20px;
    padding: 17px 19px;
    align-items: center;
    border: 1px solid #d5e2ef;
    border-radius: 18px;
    background: linear-gradient(135deg,#fff,#f4f8fc);
    box-shadow: 0 8px 22px rgba(29, 65, 100, .06);
}
.btn-lg { min-height: 48px; padding: 11px 18px; font-size: 14px; }
.visit-record-section-full { display: block; }
.visit-record-section-full .visit-record-main { width: 100%; }
.visit-record-total-bar {
    margin-top: 14px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid #bdd5ec;
    border-radius: 14px;
    color: #536f88;
    background: linear-gradient(135deg,#f5faff,#eaf4fe);
    font-weight: 800;
}
.visit-record-total-bar strong { color: #0c63b9; font-size: 22px; }

.visit-submodal {
    width: min(1080px, calc(100vw - 34px));
    max-width: 1080px;
    max-height: calc(100dvh - 34px);
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 38px 130px rgba(15, 40, 67, .42);
}
.visit-template-entry-modal { width: min(980px, calc(100vw - 34px)); }
.visit-submodal > form { max-height: calc(100dvh - 34px); display: flex; flex-direction: column; }
.visit-submodal-header { flex: 0 0 auto; min-height: 88px; padding: 19px 24px; background: linear-gradient(135deg,#f8fbff,#eaf4ff); }
.visit-submodal-header h2 { margin: 2px 0 0; font-size: 22px; }
.visit-submodal-body { flex: 1 1 auto; overflow-y: auto; padding: 24px; background: #f7f9fc; }
.service-entry-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .65fr); gap: 18px; align-items: start; }
.service-entry-clinical,
.service-entry-finance {
    padding: 20px;
    border: 1px solid #d8e3ee;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(29, 61, 94, .06);
}
.service-entry-finance { display: grid; gap: 12px; background: linear-gradient(155deg,#fff,#f1f7fd); }
.service-entry-finance .field { margin: 0; }
.service-entry-calculation {
    margin-top: 4px;
    padding: 18px;
    border: 1px solid #91bde7;
    border-radius: 15px;
    background: linear-gradient(135deg,#eaf4ff,#dbeeff);
}
.service-entry-calculation small,
.service-entry-calculation strong { display: block; }
.service-entry-calculation small { color: #617d97; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.service-entry-calculation strong { margin-top: 4px; color: #075eb6; font-size: 25px; }
.clinical-template-modal-body { display: grid; gap: 16px; }
.clinical-template-modal-body .field { margin: 0; }

@media (max-width: 1280px) {
    .topbar:has(.topbar-status-cards) { flex-wrap: wrap; }
    .topbar:has(.topbar-status-cards) > .topbar-title-block { flex: 1 1 320px; }
    .topbar-status-cards { order: 3; flex-basis: 100%; max-width: none; }
    .weekly-calendar.calendar-view-five-days { min-width: calc(72px + (5 * 220px)); grid-template-columns: 72px repeat(5,minmax(220px,1fr)); }
}
@media (max-width: 860px) {
    .topbar-status-cards { grid-template-columns: repeat(3,minmax(120px,1fr)); gap: 7px; }
    .topbar-status-card { min-height: 64px; padding: 9px 10px; gap: 8px; }
    .topbar-status-card > span { width: 34px; height: 34px; flex-basis: 34px; }
    .topbar-status-card strong { font-size: 20px; }
    .topbar-status-card small { font-size: 10px; }
    .calendar-date-navigation { grid-template-columns: 44px minmax(190px,1fr) 44px; width: 100%; }
    .calendar-nav-arrow { width: 44px; height: 44px; }
    .service-entry-layout { grid-template-columns: 1fr; }
    .visit-submodal { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); border-radius: 18px; }
    .visit-submodal > form { max-height: calc(100dvh - 12px); }
}
@media (max-width: 620px) {
    .topbar-status-cards { grid-template-columns: 1fr; }
    .topbar-status-card { min-height: 55px; }
    .calendar-current-date { padding-inline: 10px; }
    .calendar-current-date strong { font-size: 15px; }
    .visit-command-modal-maximized .visit-command-body { padding: 14px !important; }
    .visit-submodal-body { padding: 14px; }
    .service-entry-clinical,
    .service-entry-finance { padding: 14px; }
}

/* ========================================================================
   Compact five-day calendar — no Sunday
   ======================================================================== */
.weekly-calendar-card {
    border-radius: 16px;
}
.calendar-toolbar-five-days {
    min-height: 56px;
    padding: 7px 14px;
}
.calendar-date-navigation {
    grid-template-columns: 34px minmax(205px, 285px) 34px;
    gap: 8px;
}
.calendar-nav-arrow {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    box-shadow: 0 3px 9px rgba(38, 75, 112, .06);
}
.calendar-nav-arrow .ui-icon { width: 15px; height: 15px; }
.calendar-current-date {
    min-height: 38px;
    padding: 4px 14px;
    border-radius: 11px;
    box-shadow: 0 4px 12px rgba(37, 73, 109, .06);
}
.calendar-current-date small { font-size: 8px; }
.calendar-current-date strong { margin-top: 0; font-size: 14px; }
.calendar-legend {
    min-height: 30px;
    padding: 4px 12px;
    gap: 11px;
    font-size: 9px;
}
.calendar-legend .legend-dot { width: 7px; height: 7px; }
.weekly-calendar-scroll {
    max-height: calc(100vh - 148px);
}
.weekly-calendar.calendar-view-five-days {
    min-width: calc(58px + (5 * 170px));
    grid-template-columns: 58px repeat(5, minmax(170px, 1fr));
}
.calendar-corner,
.calendar-day-header {
    min-height: 40px;
    padding: 4px 5px;
}
.calendar-corner { font-size: 9px; }
.calendar-day-header strong { font-size: 10.5px; }
.calendar-day-header span { font-size: 9px; }
.calendar-day-header.is-closed-day small { display: none; }
.calendar-time-label {
    min-height: 58px;
    padding: 5px 3px;
    align-items: flex-start;
}
.calendar-time-label strong { font-size: 9px; }
.calendar-slot,
.calendar-slot.has-appointments {
    min-height: 58px;
    padding: 2px;
}
.slot-add-button,
.calendar-slot.has-appointments .slot-add-button {
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 6px;
}
.slot-add-button .ui-icon { width: 10px; height: 10px; }
.calendar-appointment {
    margin-bottom: 2px;
    padding: 3px 4px 3px 6px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 4px;
    border-left-width: 3px;
    border-radius: 7px;
    box-shadow: 0 2px 6px rgba(33, 88, 154, .06);
}
.calendar-appointment:hover,
.calendar-appointment:focus-visible {
    transform: none;
    box-shadow: 0 4px 10px rgba(33, 88, 154, .11);
}
.calendar-appointment .appointment-card-top {
    grid-column: 1 / -1;
    min-width: 0;
}
.appointment-card-top > strong { font-size: 9px; }
.calendar-appointment .badge {
    min-height: 14px;
    padding: 1px 4px;
    border-radius: 5px;
    font-size: 6.5px;
}
.calendar-appointment h3 {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 9.5px;
    line-height: 1.1;
}
.calendar-appointment p,
.calendar-appointment > small {
    display: none;
}
.calendar-appointment .appointment-status-actions {
    grid-column: 1;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    border-top: 0;
}
.calendar-appointment .appointment-final-actions {
    grid-column: 2;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}
.calendar-appointment .status-mini-button,
.calendar-appointment .status-final-button {
    width: 19px;
    min-width: 19px;
    height: 19px;
    min-height: 19px;
    padding: 0;
    gap: 0;
    border-radius: 5px;
}
.calendar-appointment .status-mini-button span,
.calendar-appointment .status-final-button span {
    display: none;
}
.calendar-appointment .status-mini-button .ui-icon,
.calendar-appointment .status-final-button .ui-icon {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
}
.calendar-appointment .appointment-cancel-delete-slot,
.calendar-appointment .appointment-cancel-delete-slot > button,
.calendar-appointment .appointment-cancel-delete-slot > form,
.calendar-appointment .appointment-cancel-delete-slot > form > button {
    width: 19px;
    min-width: 19px;
}

@media (max-width: 1280px) {
    .weekly-calendar.calendar-view-five-days {
        min-width: calc(54px + (5 * 155px));
        grid-template-columns: 54px repeat(5, minmax(155px, 1fr));
    }
}
@media (max-width: 860px) {
    .weekly-calendar.calendar-view-five-days {
        min-width: calc(52px + (5 * 145px));
        grid-template-columns: 52px repeat(5, minmax(145px, 1fr));
    }
    .calendar-date-navigation {
        grid-template-columns: 32px minmax(180px, 1fr) 32px;
    }
    .calendar-nav-arrow { width: 32px; height: 32px; }
}

/* ========================================================================
   Compact professional visit modal — patient header, service table, print
   ======================================================================== */
.visit-command-modal,
.visit-submodal {
    font-size: 12px;
}
.visit-command-header-compact {
    min-height: 72px !important;
    padding: 10px 16px !important;
    gap: 14px;
}
.visit-header-summary {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 13px;
}
.visit-command-header-compact .service-modal-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
}
.visit-command-header-compact .service-modal-icon .ui-icon {
    width: 19px;
    height: 19px;
}
.visit-header-fact {
    min-width: 0;
    display: grid;
    gap: 1px;
}
.visit-header-patient {
    min-width: 190px;
    max-width: 300px;
}
.visit-header-fact small {
    color: #72879b;
    font-size: 8.5px;
    font-weight: 900;
    letter-spacing: .08em;
    line-height: 1.2;
    text-transform: uppercase;
}
.visit-header-fact strong {
    max-width: 280px;
    overflow: hidden;
    color: #173e63;
    font-size: 12.5px;
    font-weight: 850;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.visit-header-patient strong {
    font-size: 16px;
}
.visit-header-patient > span {
    color: #587087;
    font-size: 10.5px;
    font-weight: 750;
}
.visit-header-separator {
    width: 1px;
    height: 34px;
    flex: 0 0 1px;
    background: #cbd9e6;
}
.visit-command-header-compact .service-modal-header-actions {
    flex: 0 0 auto;
    gap: 7px;
}
.visit-record-pill,
.visit-command-header-compact .service-live-status {
    min-height: 28px;
    padding: 5px 9px;
    font-size: 9.5px;
}
.visit-command-header-compact .icon-button {
    width: 32px;
    height: 32px;
}
.visit-command-modal-maximized .visit-command-body {
    padding: 12px 18px 14px !important;
}
.visit-command-modal .visit-module-card {
    border-radius: 13px;
}
.visit-command-modal .tooth-status-module {
    padding: 10px 12px;
}
.visit-command-modal .visit-module-heading {
    gap: 8px;
    margin-bottom: 8px;
}
.visit-command-modal .visit-module-title {
    gap: 7px;
}
.visit-command-modal .visit-module-title > span {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border-radius: 9px;
}
.visit-command-modal .visit-module-title > span .ui-icon {
    width: 16px;
    height: 16px;
}
.visit-command-modal .visit-module-title small {
    font-size: 8px;
}
.visit-command-modal .visit-module-title h3,
.visit-command-modal .visit-entry-toolbar h3,
.visit-command-modal .visit-record-header h3 {
    font-size: 13px;
}
.visit-command-modal .selected-teeth-counter,
.visit-command-modal .record-count-badge {
    padding: 4px 8px;
    font-size: 9.5px;
}
.visit-command-modal .multi-tooth-picker {
    grid-template-columns: repeat(16, minmax(34px, 1fr));
    gap: 4px;
    margin-bottom: 8px;
}
.visit-command-modal .multi-tooth-picker button {
    min-height: 35px;
    padding: 3px 1px;
    gap: 0;
    border-radius: 7px;
}
.visit-command-modal .multi-tooth-picker button span {
    font-size: 10px;
}
.visit-command-modal .multi-tooth-picker button small {
    max-width: 43px;
    font-size: 6.5px;
}
.visit-command-modal .tooth-status-controls {
    grid-template-columns: minmax(165px, .75fr) minmax(130px, .55fr) minmax(210px, 1.2fr) auto;
    gap: 7px;
}
.visit-command-modal .field > span,
.visit-submodal .field > span {
    margin-bottom: 4px;
    font-size: 9px;
}
.visit-command-modal input,
.visit-command-modal select,
.visit-command-modal textarea,
.visit-submodal input,
.visit-submodal select,
.visit-submodal textarea {
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 8px;
    font-size: 11px;
}
.visit-command-modal textarea,
.visit-submodal textarea {
    min-height: auto;
}
.visit-command-modal .tooth-save-button {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 10px;
}
.visit-command-modal .visit-entry-toolbar-command {
    margin: 10px 0 8px;
    padding: 9px 11px;
    border-radius: 12px;
}
.visit-command-modal .visit-entry-toolbar-command .eyebrow,
.visit-command-modal .visit-record-header .eyebrow {
    font-size: 7.5px;
}
.visit-command-modal .visit-entry-buttons {
    gap: 6px;
}
.visit-command-modal .btn-lg {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 10.5px;
}
.visit-command-modal .visit-record-main {
    padding: 10px 12px;
    border-radius: 13px;
}
.visit-command-modal .visit-record-header {
    margin-bottom: 7px;
}
.visit-service-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #d9e4ee;
    border-radius: 10px;
    background: #fff;
}
.visit-service-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    font-size: 10px;
}
.visit-service-table th {
    padding: 6px 7px;
    color: #5c7186;
    border-bottom: 1px solid #d7e2ec;
    background: #f4f8fb;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.visit-service-table td {
    padding: 6px 7px;
    color: #334e68;
    border-bottom: 1px solid #e8eef4;
    vertical-align: middle;
}
.visit-service-table tbody tr:last-child td {
    border-bottom: 0;
}
.visit-service-table tbody tr:hover {
    background: #f8fbfd;
}
.visit-service-table td > small,
.visit-service-name-cell small {
    display: block;
    margin-top: 1px;
    color: #7c8fa1;
    font-size: 8px;
    line-height: 1.25;
}
.visit-service-name-cell {
    min-width: 220px;
}
.visit-service-name-cell strong {
    display: block;
    color: #244967;
    font-size: 10.5px;
}
.visit-service-index,
.visit-service-number,
.visit-service-discount {
    text-align: center;
}
.visit-service-money,
.visit-service-total {
    text-align: right;
    white-space: nowrap;
}
.visit-service-total {
    color: #0f6d5d !important;
    font-weight: 900;
}
.visit-service-actions {
    width: 130px;
    white-space: nowrap;
}
.visit-service-actions .record-edit-button,
.visit-service-actions .record-delete-button {
    min-height: 27px;
    padding: 4px 7px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 7px;
    font-size: 9px;
}
.visit-service-actions .record-edit-button + .record-delete-button {
    margin-left: 3px;
}
.visit-command-modal .visit-record-total-bar {
    margin-top: 7px;
    padding: 8px 11px;
    border-radius: 9px;
    font-size: 10px;
}
.visit-command-modal .visit-record-total-bar strong {
    font-size: 15px;
}
.visit-command-footer-actions {
    min-height: 56px;
    padding: 9px 16px !important;
}
.visit-command-footer-actions .modal-save-state {
    font-size: 9.5px;
}
.visit-command-footer-actions .service-footer-actions {
    margin-left: auto;
    gap: 7px;
}
.visit-command-footer-actions .btn {
    min-height: 34px;
    padding: 7px 13px;
    font-size: 10.5px;
}
.visit-submodal-header {
    min-height: 66px;
    padding: 11px 16px;
}
.visit-submodal-header h2 {
    font-size: 16px;
}
.visit-submodal-body {
    padding: 14px;
}
.visit-submodal .service-entry-layout {
    gap: 10px;
}
.visit-submodal .service-entry-clinical,
.visit-submodal .service-entry-finance {
    padding: 12px;
    border-radius: 12px;
}
.visit-submodal .service-entry-finance {
    gap: 7px;
}
.visit-submodal .financial-card-heading > span {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
}
.visit-submodal .financial-card-heading h3 {
    font-size: 13px;
}
.visit-submodal .service-entry-calculation {
    padding: 10px;
    border-radius: 10px;
}
.visit-submodal .service-entry-calculation strong {
    font-size: 17px;
}
.visit-submodal .modal-footer {
    min-height: 54px;
    padding: 9px 14px;
}
.visit-submodal .modal-footer .btn {
    min-height: 34px;
    padding: 7px 12px;
    font-size: 10.5px;
}

@media (max-width: 1100px) {
    .visit-header-summary { flex-wrap: wrap; gap: 7px 11px; }
    .visit-header-separator { display: none; }
    .visit-header-fact { min-width: 150px; }
    .visit-command-header-compact { align-items: flex-start; }
    .visit-command-modal .multi-tooth-picker { grid-template-columns: repeat(8, minmax(34px, 1fr)); }
}
@media (max-width: 680px) {
    .visit-command-header-compact { padding: 9px 10px !important; }
    .visit-command-header-compact .service-modal-icon,
    .visit-record-pill { display: none; }
    .visit-header-patient { min-width: calc(100% - 40px); max-width: none; }
    .visit-header-fact { min-width: 46%; }
    .visit-command-modal .multi-tooth-picker { grid-template-columns: repeat(4, minmax(32px, 1fr)); }
    .visit-command-modal .tooth-status-controls { grid-template-columns: 1fr; }
    .visit-command-footer-actions { align-items: stretch; flex-direction: column; }
    .visit-command-footer-actions .service-footer-actions { width: 100%; margin-left: 0; }
    .visit-command-footer-actions .service-footer-actions .btn { flex: 1; }
}

/* DentalPro 3.10.8 — explicit All filter in the calendar status cards. */
.topbar-status-cards:has(.topbar-status-all) {
    grid-template-columns: repeat(4, minmax(108px, 1fr));
    max-width: 650px;
}
.topbar-status-all {
    border-color: #d8e1ea;
    background: linear-gradient(135deg, #fff, #f6f8fb);
}
.topbar-status-all > span {
    color: #475569;
    background: #e9eef4;
}
.topbar-status-card[aria-pressed="true"] {
    box-shadow: 0 0 0 2px rgba(15, 118, 110, .18), 0 10px 22px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}
@media (max-width: 920px) {
    .topbar-status-cards:has(.topbar-status-all) {
        grid-template-columns: repeat(4, minmax(100px, 1fr));
        max-width: none;
    }
}
@media (max-width: 640px) {
    .topbar-status-cards:has(.topbar-status-all) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* DentalPro 3.10.9 — compact calendar status cards. */
.topbar:has(.topbar-status-cards) {
    min-height: 102px;
    padding-block: 11px;
}
.topbar-status-cards:has(.topbar-status-all) {
    grid-template-columns: repeat(4, minmax(96px, 1fr));
    max-width: 560px;
    gap: 8px;
}
.topbar-status-card {
    min-height: 58px;
    padding: 8px 10px;
    gap: 8px;
    border-radius: 13px;
    box-shadow: 0 6px 16px rgba(30, 62, 98, .065);
}
.topbar-status-card > span {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 10px;
}
.topbar-status-card > span .ui-icon {
    width: 17px;
    height: 17px;
}
.topbar-status-card small {
    font-size: 10px;
    line-height: 1.1;
}
.topbar-status-card strong {
    margin-top: 2px;
    font-size: 20px;
}
@media (max-width: 920px) {
    .topbar-status-cards:has(.topbar-status-all) {
        grid-template-columns: repeat(4, minmax(86px, 1fr));
        gap: 7px;
    }
    .topbar-status-card {
        min-height: 54px;
        padding: 7px 8px;
    }
}
@media (max-width: 640px) {
    .topbar:has(.topbar-status-cards) {
        min-height: auto;
    }
    .topbar-status-cards:has(.topbar-status-all) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ========================================================================
   3.13.78 — Simplified calendar appointment cards
   ======================================================================== */
#weeklyCalendarApp .calendar-appointment-simple {
    padding: 6px 7px 6px 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    border-left-width: 3px;
    border-radius: 9px;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-top {
    grid-column: 1;
    min-width: 0;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-top > strong {
    color: #193f70;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .01em;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-top .badge {
    max-width: 88px;
    min-height: 17px;
    padding: 2px 6px;
    overflow: hidden;
    font-size: 7px;
    font-weight: 900;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-person {
    min-width: 0;
    display: grid;
    gap: 2px;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-person h3 {
    margin: 0;
    overflow: hidden;
    color: #172f50;
    font-size: 10.5px !important;
    font-weight: 900;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-person small {
    display: block !important;
    margin: 0;
    overflow: hidden;
    color: #687892;
    font-size: 7.5px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-footer {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-status-actions,
#weeklyCalendarApp .calendar-appointment-simple .appointment-final-actions {
    grid-column: auto;
    margin: 0;
    padding: 0;
    border: 0;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-status-actions {
    display: flex;
    align-items: center;
    gap: 3px;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-final-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
#weeklyCalendarApp .calendar-appointment-simple .status-mini-button,
#weeklyCalendarApp .calendar-appointment-simple .status-final-button {
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
    padding: 0;
    border-radius: 6px;
}
#weeklyCalendarApp .calendar-appointment-simple .status-mini-button span,
#weeklyCalendarApp .calendar-appointment-simple .status-final-button span {
    display: none;
}
#weeklyCalendarApp .calendar-appointment-simple .status-mini-button .ui-icon,
#weeklyCalendarApp .calendar-appointment-simple .status-final-button .ui-icon {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
}
#weeklyCalendarApp .calendar-appointment-simple .status-mini-button:disabled {
    opacity: .42;
    cursor: default;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-cancel-delete-slot,
#weeklyCalendarApp .calendar-appointment-simple .appointment-cancel-delete-slot > button,
#weeklyCalendarApp .calendar-appointment-simple .appointment-cancel-delete-slot > form,
#weeklyCalendarApp .calendar-appointment-simple .appointment-cancel-delete-slot > form > button {
    width: 22px;
    min-width: 22px;
}
#weeklyCalendarApp .calendar-appointment-simple .status-cancelled {
    color: #b42318;
    border-color: #fecaca;
    background: #fff1f2;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-delete-button {
    color: #fff;
    border-color: #dc2626;
    background: #dc2626;
}
@media (max-width: 860px) {
    #weeklyCalendarApp .calendar-appointment-simple {
        padding: 7px 8px;
    }
    #weeklyCalendarApp .calendar-appointment-simple .appointment-simple-person h3 {
        font-size: 11px !important;
    }
}


/* ========================================================================
   3.13.79 — Cleaner appointment selector, borderless calendar cards,
   and maximum-width application content
   ======================================================================== */
.app-body .content {
    width: 100%;
    max-width: none;
    padding: 16px 12px 32px;
}
#weeklyCalendarApp .calendar-appointment-simple {
    border: 0 !important;
    box-shadow: 0 4px 12px rgba(31, 73, 66, .08);
}
#weeklyCalendarApp .calendar-appointment-simple:hover,
#weeklyCalendarApp .calendar-appointment-simple:focus-visible {
    border: 0 !important;
    box-shadow: 0 8px 18px rgba(31, 73, 66, .13);
}
#weeklyCalendarApp .calendar-appointment-simple.needs-final-status {
    border: 0 !important;
    box-shadow: 0 6px 16px rgba(31, 73, 66, .12);
}
@media (max-width: 900px) {
    .app-body .content { padding-inline: var(--mobile-page-pad, 12px); }
}

/* Medibox v123 — complete translated appointment edit */
.appointment-edit-form-pro .appointment-edit-fields { align-items:start; }
.appointment-edit-form-pro .appointment-auto-status-note { align-self:end; min-height:42px; }
.appointment-edit-summary-list { display:grid; gap:10px; padding:4px 0; }
.appointment-edit-summary-list > span { display:flex; align-items:center; gap:9px; padding:10px 11px; border:1px solid #e3e8ef; border-radius:10px; background:#fbfcfe; color:#42566f; }
.appointment-edit-summary-list .ui-icon { width:16px; height:16px; }
.appointment-edit-summary-list strong { font-size:12px; font-weight:750; }
