:root {
    --dbm-bg: #f3f7fc;
    --dbm-surface: rgba(255, 255, 255, 0.94);
    --dbm-surface-muted: #f8fafc;
    --dbm-border: #dbe5f0;
    --dbm-text: #102033;
    --dbm-muted: #64748b;
    --dbm-primary: #0f6cbd;
    --dbm-primary-strong: #07599f;
    --dbm-accent: #12a3b4;
    --dbm-success: #15803d;
    --dbm-danger: #c2413b;
    --dbm-focus: #f8cf57;
    --dbm-shadow: 0 12px 32px rgba(15, 48, 79, 0.08);
    --dbm-shadow-strong: 0 20px 52px rgba(15, 48, 79, 0.14);
    --dbm-radius: 18px;
}

html {
    background: var(--dbm-bg);
    scroll-behavior: smooth;
}

body {
    color: var(--dbm-text);
    background:
        radial-gradient(circle at 8% 0%, rgba(18, 163, 180, 0.12), transparent 28rem),
        radial-gradient(circle at 92% 0%, rgba(15, 108, 189, 0.13), transparent 30rem),
        linear-gradient(180deg, #f8fbff 0, var(--dbm-bg) 28rem, #edf3f9 100%);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--dbm-focus) !important;
    outline-offset: 2px;
}

.page,
#searchHubPage .page {
    width: min(100%, 1180px);
    max-width: 1180px !important;
    padding: 14px clamp(14px, 3vw, 32px) 112px !important;
}

.hero {
    top: max(8px, env(safe-area-inset-top));
    border: 1px solid rgba(255, 255, 255, 0.22);
    background:
        radial-gradient(circle at 12% -20%, rgba(255, 255, 255, 0.24), transparent 42%),
        linear-gradient(125deg, #07599f 0%, #0f6cbd 52%, #0d8797 100%);
    box-shadow: 0 16px 38px rgba(7, 89, 159, 0.2);
}

.glass-card,
.card,
.sheet,
#accountModal > div,
#logoutModal > div {
    border: 1px solid rgba(219, 229, 240, 0.9) !important;
    background: var(--dbm-surface) !important;
    box-shadow: var(--dbm-shadow) !important;
    backdrop-filter: blur(18px);
}

.glass-card,
.card,
.form-card,
.list-card {
    border-radius: var(--dbm-radius) !important;
}

.card {
    padding: clamp(16px, 2.5vw, 26px);
}

.form-card,
.list-card {
    padding: clamp(16px, 2.4vw, 24px) !important;
}

.section-head,
.list-top {
    margin-bottom: 18px;
}

.section-title {
    color: var(--dbm-text);
    font-size: clamp(18px, 2vw, 22px);
    letter-spacing: -0.02em;
}

.section-icon {
    border: 1px solid #d7e7f7;
    background: #edf6ff;
    color: var(--dbm-primary);
    box-shadow: none;
}

.stats-row {
    gap: 12px;
    margin: 14px 0 18px;
}

.stat-card {
    min-height: 126px;
    justify-content: center;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.86);
    box-shadow: 0 10px 24px rgba(15, 48, 79, 0.07);
}

.stat-label {
    color: var(--dbm-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-value,
.stat-blue .stat-value,
.stat-green .stat-value {
    color: var(--dbm-text);
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.stat-sub {
    color: var(--dbm-muted);
}

#rNewCustomers {
    color: var(--dbm-primary-strong);
    font-size: clamp(26px, 3vw, 34px);
}

#rNewCustomersChange {
    min-height: 20px;
    margin-top: 7px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.4;
}

.stat-blue {
    background: linear-gradient(145deg, #f4f9ff, #e5f2ff);
}

.stat-green {
    background: linear-gradient(145deg, #f2fbf7, #e1f5ec);
}

.stat-purple {
    background: linear-gradient(145deg, #faf7ff, #eee8ff);
}

.field {
    gap: 7px;
}

.field label {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.input-wrap input,
.input-wrap select,
.field > input,
.field > select,
.field textarea,
.toolbar input {
    min-height: 48px;
    border: 1px solid #cbd8e6 !important;
    border-radius: 12px !important;
    background: #fff !important;
    color: var(--dbm-text);
    box-shadow: 0 1px 2px rgba(15, 48, 79, 0.03);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input-wrap input:hover,
.input-wrap select:hover,
.field > input:hover,
.field > select:hover,
.field textarea:hover,
.toolbar input:hover {
    border-color: #9fb8d2 !important;
}

.input-wrap input:focus,
.input-wrap select:focus,
.field > input:focus,
.field > select:focus,
.field textarea:focus,
.toolbar input:focus {
    border-color: var(--dbm-primary) !important;
    box-shadow: 0 0 0 4px rgba(15, 108, 189, 0.12) !important;
}

.input-icon {
    color: #557089;
    filter: grayscale(0.15);
}

.btn,
.primary-btn,
.secondary-btn,
.hero-icon-btn,
.mini-btn,
.icon-btn {
    border-radius: 12px;
    font-weight: 750;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--dbm-primary), var(--dbm-primary-strong));
    box-shadow: 0 10px 22px rgba(15, 108, 189, 0.2);
}

.primary-btn {
    border: 0;
    background: linear-gradient(135deg, var(--dbm-primary), var(--dbm-primary-strong));
    color: #fff;
    box-shadow: 0 10px 22px rgba(15, 108, 189, 0.2);
}

.secondary-btn {
    border: 1px solid var(--dbm-border);
    background: #fff;
    color: #334155;
}

.hero-icon-btn {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.btn-secondary,
.mini-btn,
.icon-btn {
    border: 1px solid var(--dbm-border);
    background: #fff;
    color: #334155;
    box-shadow: 0 4px 12px rgba(15, 48, 79, 0.05);
}

.card input:not([type="checkbox"]):not([type="radio"]),
.card select,
.card textarea {
    border: 1px solid #cbd8e6;
    border-radius: 12px;
    background: #fff;
    color: var(--dbm-text);
}

.card input:not([type="checkbox"]):not([type="radio"]):focus,
.card select:focus,
.card textarea:focus {
    border-color: var(--dbm-primary);
    box-shadow: 0 0 0 4px rgba(15, 108, 189, 0.12);
}

.btn:hover:not(:disabled),
.mini-btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1178cf, var(--dbm-primary));
}

.status-card.show {
    border-radius: 12px;
    box-shadow: none;
}

.toolbar {
    gap: 10px;
}

.toolbar .input-wrap {
    width: 100%;
}

.entry-list,
#appointmentsList {
    gap: 14px;
}

.payment-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: thin;
}

.payment-filter {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 11px;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    background: #eef2ff;
    color: #334155;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.payment-filter:hover {
    border-color: #91b8dc;
    background: #e4f1ff;
}

.payment-filter[aria-pressed="true"] {
    border-color: var(--dbm-primary);
    background: var(--dbm-primary);
    color: #fff;
    box-shadow: 0 5px 14px rgba(15, 108, 189, 0.2);
}

.payment-filter[aria-pressed="true"]::before {
    content: "✓ ";
}

.payment-filter:active {
    transform: scale(0.98);
}

.reason-chip {
    min-height: 38px;
    cursor: pointer;
}

.reason-chip[aria-pressed="true"] {
    border-color: var(--dbm-primary) !important;
    background: var(--dbm-primary) !important;
    color: #fff !important;
    box-shadow: 0 5px 14px rgba(15, 108, 189, 0.18);
}

#serviceForm .field > label,
#serviceForm #reasonLabel {
    color: #334155;
    font-size: 13px;
    font-weight: 750;
}

#serviceForm input[aria-invalid="true"],
#serviceForm select[aria-invalid="true"],
#editForm input[aria-invalid="true"],
#editForm select[aria-invalid="true"] {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1) !important;
}

.entry-card,
.entry-item,
.search-result-card {
    border: 1px solid var(--dbm-border) !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 7px 20px rgba(15, 48, 79, 0.06);
}

.entry-card:hover,
.entry-item:hover,
.search-result-card:hover {
    border-color: #b8cde2 !important;
    box-shadow: 0 12px 28px rgba(15, 48, 79, 0.1);
}

.entry-item[role="listitem"] {
    min-width: 0;
}

.entry-item .edit-btn:focus-visible,
.entry-item .action-btn:focus-visible,
.entry-item .cost-btn:focus-visible,
.payment-filter:focus-visible {
    outline: 3px solid rgba(15, 108, 189, 0.28);
    outline-offset: 2px;
}

.search-result-card {
    padding: 18px;
}

.search-result-title {
    margin-bottom: 14px;
    color: var(--dbm-text);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.search-result-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 8px;
    color: #40546a;
    font-size: 14px;
}

.search-result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e6edf4;
}

.search-result-amount {
    color: var(--dbm-success);
    font-size: 16px;
    font-weight: 800;
}

.search-result-payment {
    padding: 5px 9px;
    border-radius: 999px;
    background: #edf6ff;
    color: var(--dbm-primary-strong);
    font-size: 12px;
    font-weight: 750;
}

.empty-state {
    min-height: 180px;
    display: grid;
    place-content: center;
    border: 1px dashed #b9cadc;
    background: #f9fbfd;
}

.loading-state {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--dbm-muted);
    font-weight: 700;
}

.loading-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #d8e6f3;
    border-top-color: var(--dbm-primary);
    border-radius: 50%;
    animation: dbm-spin 0.8s linear infinite;
}

@keyframes dbm-spin {
    to {
        transform: rotate(360deg);
    }
}

.count-badge,
.pill,
.pending-pill {
    border: 1px solid #d7e7f7;
    background: #edf6ff;
    color: var(--dbm-primary-strong);
}

.report-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
}

.report-tab {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.report-tab.active {
    border-color: #fff;
    background: #fff;
    color: var(--dbm-primary-strong);
    box-shadow: 0 6px 18px rgba(7, 89, 159, 0.18);
}

.report-tab:disabled {
    cursor: progress;
    opacity: 0.72;
}

#reportsScreen[aria-busy="true"] .glass-card,
#reportsScreen[aria-busy="true"] .stats-row {
    opacity: 0.62;
    pointer-events: none;
}

#collectionsStrip {
    border-radius: 16px !important;
}

#revenueChart,
#visitorChart {
    border-bottom: 1px solid var(--dbm-border);
    background:
        repeating-linear-gradient(
            to top,
            transparent 0,
            transparent 49px,
            rgba(148, 163, 184, 0.12) 50px
        );
}

#searchHubPage,
#appointmentAddPage {
    background:
        radial-gradient(circle at 8% 0%, rgba(18, 163, 180, 0.11), transparent 26rem),
        linear-gradient(180deg, #f8fbff, var(--dbm-bg)) !important;
}

#searchHubPage .form-card {
    margin-top: 16px;
}

#searchHubResults {
    min-height: 220px;
}

.app-header-action,
.search-hub-action,
.search-export-action,
#appointmentsDatePickerBtn {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
}

.search-export-action,
#appointmentsDatePickerBtn {
    border-color: var(--dbm-border);
    background: #fff;
    color: var(--dbm-primary);
    box-shadow: 0 5px 14px rgba(15, 48, 79, 0.07);
}

#appointmentFilters {
    border-color: var(--dbm-border) !important;
    border-radius: 14px !important;
    background: #f4f7fa !important;
}

#appointmentFilters .chip {
    min-height: 54px;
}

.appointment-type-chip {
    min-height: 42px;
    border-color: var(--dbm-border);
    background: #fff;
}

.appointment-search-toolbar {
    position: relative;
    display: block;
}

.appointment-search-toolbar #appointmentSearch {
    width: 100%;
    min-height: 48px;
    padding-right: 50px;
}

.appointment-search-clear {
    position: absolute;
    top: 50%;
    right: 7px;
    width: 36px;
    height: 36px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 10px;
    background: #e8eef5;
    color: var(--dbm-text);
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.appointment-search-clear[hidden] {
    display: none;
}

.appointment-result-count {
    flex: 0 0 auto;
    color: var(--dbm-muted);
    font-size: 13px;
    font-weight: 700;
}

.appointment-item[aria-busy="true"] {
    opacity: 0.62;
    pointer-events: none;
}

.appointment-item .action-btn {
    min-height: 44px;
}

.appointment-item .action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.appointment-clear-filters,
.appointment-retry {
    width: auto;
    min-height: 42px;
    margin-top: 14px;
    padding: 9px 16px;
}

#appointmentAddPage .page {
    max-width: 760px !important;
}

.appointment-header-action {
    appearance: none;
    flex: 0 0 38px;
    padding: 0;
}

.appointment-header-action:disabled,
#appointmentAddPage .btn:disabled {
    cursor: wait !important;
    opacity: 0.65;
}

.appointment-form-card {
    border-radius: 22px !important;
    box-shadow: var(--dbm-shadow) !important;
}

.appointment-schedule-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.appointment-weekday {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px;
    border: 1px solid var(--dbm-border);
    border-radius: 12px;
    background: #f8fafc;
    color: var(--dbm-text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.appointment-weekday input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--dbm-primary);
}

.appointment-field-error {
    color: var(--dbm-danger) !important;
}

.appointment-form-status {
    margin: 14px 4px 0;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 13px;
    background: #f8fafc;
    color: var(--dbm-muted);
    font-size: 14px;
    font-weight: 650;
    line-height: 1.4;
}

.appointment-form-status:empty {
    display: none;
}

.appointment-form-status.appointment-status-error {
    border-color: #fecaca;
    background: #fff1f2;
    color: #b42318;
}

.appointment-form-status.appointment-status-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: var(--dbm-success);
}

#appointmentAddPage [aria-invalid="true"] {
    border-color: var(--dbm-danger) !important;
    box-shadow: 0 0 0 3px rgba(194, 65, 59, 0.12);
}

.appointment-action-bar {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 5;
}

#accountModal,
#logoutModal,
.sheet-backdrop {
    background: rgba(15, 32, 51, 0.5) !important;
    backdrop-filter: blur(8px);
}

#accountModal > div {
    width: min(92%, 560px) !important;
    border-radius: 22px !important;
    padding: 20px 20px max(28px, env(safe-area-inset-bottom)) !important;
}

.settings-action {
    border: 1px solid var(--dbm-border) !important;
    background: #f8fafc !important;
    box-shadow: 0 1px 2px rgba(15, 48, 79, 0.03);
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.settings-action:hover,
.settings-action:focus-visible {
    border-color: #a9bfd5 !important;
    background: #f1f7fd !important;
}

.settings-action:active {
    transform: scale(0.995);
}

.settings-card {
    margin: 18px auto 0;
    padding: clamp(18px, 3vw, 30px) !important;
    border: 1px solid var(--dbm-border) !important;
    border-radius: 22px !important;
    background: var(--dbm-surface) !important;
    box-shadow: var(--dbm-shadow) !important;
}

.settings-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--dbm-border);
}

.settings-heading h1 {
    margin: 0;
    color: var(--dbm-text);
    font-size: clamp(22px, 3vw, 30px);
    letter-spacing: -0.035em;
}

.settings-heading p {
    max-width: 620px;
    margin: 7px 0 0;
    color: var(--dbm-muted);
    line-height: 1.55;
}

#shopSettingsForm {
    display: grid;
    gap: 10px;
}

#shopSettingsForm label {
    margin-top: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 750;
}

#shopSettingsForm input,
#shopSettingsForm textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #cbd8e6;
    border-radius: 12px;
    background: #fff;
    color: var(--dbm-text);
}

#shopSettingsForm textarea {
    min-height: 112px;
    resize: vertical;
}

#shopSettingsForm input:focus,
#shopSettingsForm textarea:focus {
    border-color: var(--dbm-primary);
    box-shadow: 0 0 0 4px rgba(15, 108, 189, 0.12);
}

#shopSettingsForm .settings-section-title {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--dbm-border);
    color: var(--dbm-text);
    font-size: 16px;
    font-weight: 800;
}

#shopSettingsForm #logoPreview {
    width: 140px !important;
    height: 140px !important;
    padding: 10px;
    border: 1px solid var(--dbm-border) !important;
    border-radius: 14px !important;
    background: #f8fafc;
}

#shopSettingsForm .action-row {
    margin-top: 18px;
}

.sheet {
    border-radius: 24px 24px 0 0 !important;
}

#editSheetBackdrop .sheet {
    width: min(100%, 820px);
    max-height: min(90vh, 860px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

#editForm {
    display: grid;
    gap: 16px;
}

.edit-fields-grid {
    display: grid;
    gap: 14px;
}

.edit-industry-fields {
    display: grid;
    gap: 16px;
    padding-top: 2px;
}

.edit-treatment-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 7px;
}

#editForm .field-label,
#editForm .field > label {
    color: #334155;
    font-size: 13px;
    font-weight: 750;
}

#editForm select {
    width: 100%;
    min-height: 52px;
    padding: 0 12px 0 38px;
    border: 1px solid #cbd8e6;
    border-radius: 14px;
    background: #fff;
    color: var(--dbm-text);
    font-weight: 650;
}

#editStatusCard {
    margin: 0;
}

#editForm .sheet-actions {
    position: sticky;
    bottom: -1px;
    z-index: 2;
    margin: 2px -2px -2px;
    padding: 14px 2px 2px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 28%);
}

.bottom-nav {
    min-height: 72px;
    padding: 8px 12px max(8px, env(safe-area-inset-bottom));
    border: 1px solid rgba(203, 216, 230, 0.92);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -12px 34px rgba(15, 48, 79, 0.11);
    backdrop-filter: blur(22px);
}

.nav-item {
    appearance: none;
    min-width: 62px;
    min-height: 52px;
    padding: 5px 8px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #708196;
    cursor: pointer;
}

.nav-item > .nav-icon {
    font-size: 20px;
    line-height: 1;
}

.nav-item.active {
    background: #eaf4ff;
    color: var(--dbm-primary-strong);
}

.nav-item.active::before {
    display: none;
}

.nav-center {
    appearance: none;
    border: 5px solid var(--dbm-bg);
    background: linear-gradient(135deg, var(--dbm-primary), var(--dbm-accent));
    box-shadow: 0 10px 26px rgba(15, 108, 189, 0.3);
    cursor: pointer;
}

body.patient-picker-open {
    overflow: hidden;
}

.patient-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 4vw, 32px);
    background: rgba(15, 32, 51, 0.52);
    backdrop-filter: blur(4px);
}

.patient-picker-backdrop.is-open {
    display: flex;
}

.patient-picker-dialog {
    width: min(100%, 600px);
    max-height: min(680px, calc(100dvh - 32px));
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: clamp(18px, 3vw, 26px);
    overflow: hidden;
    border: 1px solid var(--dbm-border);
    border-radius: 24px;
    background: #ffffff;
    box-shadow: var(--dbm-shadow-strong);
}

.patient-picker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.patient-picker-header h2 {
    margin: 0;
    color: var(--dbm-text);
    font-size: clamp(20px, 3vw, 24px);
    line-height: 1.2;
}

.patient-picker-header p {
    max-width: 46ch;
    margin: 6px 0 0;
    color: var(--dbm-muted);
    font-size: 14px;
    line-height: 1.45;
}

.patient-picker-close {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--dbm-border);
    border-radius: 13px;
    background: var(--dbm-surface-muted);
    color: var(--dbm-text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.patient-picker-list {
    display: grid;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding: 2px;
    overscroll-behavior: contain;
}

.patient-picker-option {
    width: 100%;
    min-height: 66px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 13px 16px;
    border: 1px solid var(--dbm-border);
    border-radius: 16px;
    background: #ffffff;
    color: var(--dbm-text);
    text-align: left;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        transform 160ms ease;
}

.patient-picker-option:hover {
    border-color: rgba(15, 108, 189, 0.55);
    background: #f4f9ff;
    transform: translateY(-1px);
}

.patient-picker-option-name {
    font-size: 16px;
    font-weight: 750;
}

.patient-picker-option-id {
    color: var(--dbm-muted);
    font-size: 13px;
    font-weight: 600;
}

.patient-picker-add {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(15, 108, 189, 0.2);
    border-radius: 15px;
    background: #eaf4ff;
    color: var(--dbm-primary-strong);
    font-weight: 750;
    cursor: pointer;
}

.patient-picker-add > span {
    font-size: 22px;
    line-height: 1;
}

@media (max-width: 640px) {
    .page,
    #searchHubPage .page {
        padding: 8px 10px 104px !important;
    }

    .hero {
        border-radius: 16px;
        margin-bottom: 10px;
    }

    .stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-row .stat-card:last-child {
        grid-column: 1 / -1;
        min-height: 92px;
    }

    .stat-card {
        min-height: 110px;
        padding: 14px;
    }

    .stat-value,
    .stat-blue .stat-value,
    .stat-green .stat-value {
        font-size: 23px;
    }

    .form-card,
    .list-card {
        padding: 15px !important;
    }

    .toolbar {
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .toolbar .input-wrap {
        grid-column: 1 / -1;
    }

    .action-row {
        gap: 10px;
    }

    .bottom-nav {
        width: calc(100% - 12px);
        border-radius: 18px 18px 0 0;
    }

    .nav-item {
        min-width: 0;
        font-size: 10px;
    }

    .nav-item > .nav-icon {
        font-size: 19px;
    }

    #collectionsStrip {
        align-items: flex-start !important;
    }

    #collectionsStrip > div:last-child {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 8px !important;
    }

    #collectionsStrip > div:last-child > div[style*="width:1px"] {
        display: none !important;
    }

    .patient-picker-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .patient-picker-dialog {
        width: 100%;
        max-height: min(82dvh, 680px);
        padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
        border-radius: 24px 24px 0 0;
    }

    .appointment-form-card {
        padding: 18px 14px !important;
        border-radius: 18px !important;
    }

    .appointment-schedule-grid {
        grid-template-columns: 1fr !important;
    }

    .appointment-weekdays {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* Reports is deliberately split into a brand header and a working range panel. */
.reports-hero {
    min-height: 76px;
    padding: 10px 16px !important;
    margin-bottom: 12px !important;
}

.reports-hero .reports-app-header {
    min-height: 56px;
}

/* Keep header actions above all report and appointment content layers. */
#reportsScreen .reports-hero {
    position: sticky !important;
    z-index: 40 !important;
    overflow: visible !important;
}

#appointmentsPage .hero,
#appointmentAddPage .hero {
    position: relative !important;
    z-index: 40 !important;
    overflow: visible !important;
}

#appointmentsPage .hero {
    top: auto !important;
}

#reportsScreen .reports-app-header,
#reportsScreen .reports-header-actions,
#appointmentsPage .hero-top,
#appointmentAddPage .hero-top {
    position: relative !important;
    z-index: 45 !important;
}

#reportsScreen .reports-header-actions,
#appointmentsPage .hero-top > div:last-child,
#appointmentAddPage .hero-top > div:last-child {
    pointer-events: auto !important;
}

#reportsScreen .reports-header-actions .app-header-action,
#appointmentsPage .hero-top .app-header-action,
#appointmentAddPage .hero-top .appointment-header-action {
    position: relative !important;
    z-index: 46 !important;
    isolation: isolate;
}

.reports-workspace {
    margin: 0 0 16px;
    padding: clamp(18px, 3vw, 28px);
    border: 1px solid #c9d9e9;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: var(--dbm-shadow);
}

.reports-workspace .reports-title-row {
    margin-top: 0;
    align-items: center;
}

.reports-workspace .reports-eyebrow {
    color: var(--dbm-primary);
}

.reports-workspace .reports-title-row h1 {
    color: var(--dbm-text);
}

.reports-workspace .report-date-chip {
    border-color: #b9cee2;
    background: #eef6ff;
    color: var(--dbm-primary-strong);
}

.reports-workspace .report-tabs-primary {
    margin-top: 20px;
}

.reports-workspace .report-tab {
    border-color: #c6d8e9 !important;
    background: #f7fbff !important;
    color: #36516d !important;
}

.reports-workspace .report-tab.active {
    border-color: var(--dbm-primary) !important;
    background: var(--dbm-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 18px rgba(15,108,189,.2) !important;
}

@media (max-width: 640px) {
    .reports-workspace {
        padding: 18px 14px;
        border-radius: 18px;
    }

    .reports-workspace .reports-title-row {
        align-items: flex-start;
    }
}

/* Date-range chips scroll horizontally instead of wrapping onto extra rows. */
.report-tabs-primary {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

.report-tabs-primary::-webkit-scrollbar { display: none; }

/* Chips size to their label; the ID-scoped width:100% rule below would otherwise
   stretch each one to a full row and hide the rest. */
#reportsScreen .report-tabs-primary .report-tab {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 0;
    white-space: nowrap;
    scroll-snap-align: start;
}

/* Mobile keeps the three-tab split; desktop shows every block stacked. */
.report-section-tabs {
    display: flex;
    gap: 6px;
    margin: 14px 0 4px;
    padding: 4px;
    border: 1px solid var(--dbm-border);
    border-radius: 14px;
    background: #eef4fa;
}

.report-section-tab {
    flex: 1 1 0;
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #4b6377;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.report-section-tab.active {
    background: #ffffff;
    color: var(--dbm-primary-strong);
    box-shadow: 0 6px 14px rgba(15,48,79,.1);
}

.report-panel { display: none; }
.report-panel.active { display: block; }

/* Every report is a full-width block, stacked one after another. */
.reports-panels {
    margin-top: 14px;
}

.report-block {
    margin-top: 16px;
}

.report-chart {
    height: 220px;
    position: relative;
}

.report-block-note {
    margin: 12px 0 0;
    color: var(--dbm-muted);
    font-size: 12px;
    line-height: 1.5;
}

@media (min-width: 900px) {
    .report-chart {
        height: 300px;
    }

    /* No tab switching on desktop — there is room for the whole dashboard. */
    .report-section-tabs {
        display: none;
    }

    .report-panel {
        display: block !important;
    }
}

/* Payment breakdown visualization. */
.payment-split-bar {
    display: flex;
    height: 10px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f7;
}

.payment-split-upi {
    background: linear-gradient(90deg, #2563eb, #38bdf8);
    transition: width .3s ease;
}

.payment-split-cash {
    background: linear-gradient(90deg, #15803d, #4ade80);
    transition: width .3s ease;
}

.payment-method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.payment-method-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--dbm-border);
    border-radius: 16px;
    background: #f8fafc;
}

.payment-method-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    font-size: 17px;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15,48,79,.08);
}

.payment-method-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--dbm-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.payment-method-amount {
    margin-top: 2px;
    font-size: 17px;
    font-weight: 800;
    color: var(--dbm-text);
}

.payment-method-count {
    margin-top: 1px;
    font-size: 12px;
    color: var(--dbm-muted);
}

.payment-method-pending .payment-method-amount { color: #b45309; }

/* Weekday performance: horizontal bars keep long day labels readable on phones. */
.weekday-chart {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.weekday-row {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 10px;
}

.weekday-name {
    color: var(--dbm-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.weekday-track {
    height: 22px;
    overflow: hidden;
    border-radius: 8px;
    background: #eef2f7;
}

.weekday-fill {
    height: 100%;
    min-width: 2px;
    border-radius: 8px;
    background: linear-gradient(90deg, #6d28d9, #a78bfa);
    transition: width .3s ease;
}

.weekday-row.is-best .weekday-fill {
    background: linear-gradient(90deg, #07599f, #38bdf8);
}

.weekday-value {
    min-width: 68px;
    color: var(--dbm-text);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

/* Billing activity heatmap. */
.hourly-chart {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
}

.hour-cell {
    display: flex;
    flex: 1 1 52px;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 44px;
    padding: 8px 4px;
    border: 1px solid var(--dbm-border);
    border-radius: 10px;
    background: #f8fafc;
}

.hour-label {
    color: var(--dbm-muted);
    font-size: 11px;
    font-weight: 700;
}

.hour-count {
    color: var(--dbm-text);
    font-size: 14px;
    font-weight: 800;
}

/* Revenue goal. */
.goal-edit-btn {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid #b9cee2;
    border-radius: 10px;
    background: #eef6ff;
    color: var(--dbm-primary-strong);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.goal-body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-top: 16px;
}

.goal-current {
    color: var(--dbm-text);
    font-size: clamp(26px, 4vw, 34px);
    font-weight: 800;
    line-height: 1.1;
}

.goal-target {
    margin-top: 4px;
    color: var(--dbm-muted);
    font-size: 13px;
}

.goal-percent {
    color: var(--dbm-primary-strong);
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 800;
}

.goal-track {
    height: 14px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f7;
}

.goal-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #15803d, #4ade80);
    transition: width .35s ease;
}

.goal-fill.is-behind {
    background: linear-gradient(90deg, #b45309, #fbbf24);
}

/* Premium application dialog. */
#appPopup.app-popup {
    padding: 20px !important;
    background:
        radial-gradient(circle at 50% 35%, rgba(15,108,189,.18), transparent 28rem),
        rgba(8, 24, 42, .66) !important;
    backdrop-filter: blur(14px) saturate(120%) !important;
}

#appPopup .app-popup-panel {
    position: relative;
    width: min(100%, 480px) !important;
    max-width: 480px !important;
    padding: 32px !important;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.92) !important;
    border-radius: 26px !important;
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
    box-shadow:
        0 32px 90px rgba(3,18,35,.38),
        0 2px 0 rgba(255,255,255,.9) inset !important;
    text-align: left !important;
}

#appPopup .app-popup-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, #07599f, #0f6cbd, #12a3b4);
}

#appPopup .app-popup-icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border: 1px solid #b9d9f5;
    border-radius: 16px;
    background: linear-gradient(145deg, #eaf5ff, #dceeff);
    color: #07599f;
    font-size: 25px;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(15,108,189,.14);
}

#appPopup .app-popup-title {
    margin-top: 4px;
    margin-bottom: 8px;
    color: #102033;
    font-size: 22px;
    font-weight: 850;
    letter-spacing: -.02em;
}

#appPopup .app-popup-message {
    margin: 0 0 26px !important;
    color: #52657a !important;
    font-size: 15px !important;
    font-weight: 550 !important;
    line-height: 1.6 !important;
    text-align: left !important;
}

/* Inline input variant of the application dialog. */
#appPopup .app-popup-input-label {
    display: block;
    margin-bottom: 8px;
    color: var(--dbm-text);
    font-size: 14px;
    font-weight: 800;
}

#appPopup .app-popup-input {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    box-sizing: border-box;
    border: 1px solid #b9d1e7;
    border-radius: 12px;
    background: #ffffff;
    color: var(--dbm-text);
    font-size: 17px;
    font-weight: 700;
}

#appPopup .app-popup-input:focus {
    border-color: var(--dbm-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(15,108,189,.14);
}

#appPopup .app-popup-input-hint {
    margin: 10px 0 0;
    color: var(--dbm-muted);
    font-size: 13px;
    font-weight: 500;
}

#appPopup .app-popup-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

#appPopup .app-popup-actions .btn {
    width: 100%;
    min-height: 50px !important;
    border-radius: 14px !important;
    font-size: 15px;
    font-weight: 800;
}

#appPopup .app-popup-actions .btn-primary {
    box-shadow: 0 10px 24px rgba(37,99,235,.24);
}

/* Customer sorting works alongside search and payment filters. */
.entry-sort-control {
    min-width: 210px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 7px 6px 13px;
    border: 1px solid #c9d9e9;
    border-radius: 14px;
    background: #f8fbff;
    color: #52657a;
    font-size: 12px;
    font-weight: 800;
}

.entry-sort-control select {
    min-width: 0;
    flex: 1;
    height: 38px;
    padding: 0 34px 0 11px;
    border: 1px solid #b9cee2;
    border-radius: 10px;
    background: #ffffff;
    color: #102033;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
}

.entry-sort-control select:hover {
    border-color: #6ea8d8;
}

@media (max-width: 640px) {
    .list-top:has(.entry-sort-control) {
        align-items: stretch;
        flex-direction: column;
    }

    .entry-sort-control {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    #appPopup .app-popup-panel {
        padding: 26px 22px 22px !important;
        border-radius: 22px !important;
    }
}

@media (min-width: 768px) {
    .hero {
        top: 12px;
    }

    .stats-row {
        gap: 16px;
    }

    .entry-list,
    #appointmentsList,
    #searchHubResultsBody {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 16px;
    }

    #searchHubPage .form-card {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    #editSheetBackdrop {
        align-items: center;
        padding: 24px;
    }

    #editSheetBackdrop .sheet {
        border-radius: 24px !important;
    }

    .edit-fields-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #searchHubPage .form-card > .action-row {
        grid-column: 1 / -1;
    }

    .bottom-nav {
        width: min(calc(100% - 48px), 1120px);
        border-radius: 18px 18px 0 0;
    }
}

@media (min-width: 1100px) {
    .entry-list,
    #appointmentsList,
    #searchHubResultsBody {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #reportsScreen .glass-card {
        margin-top: 16px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Shared 2.0 page shell corrections. */
[data-profile-menu],
#menuBtn,
.app-header-action,
.appointment-header-action {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 13px !important;
}

.reports-hero {
    padding: 10px 16px !important;
    margin-bottom: 10px !important;
}

.reports-app-header,
.reports-title-row,
.reports-header-actions,
.reports-brand {
    display: flex;
    align-items: center;
}

.reports-app-header,
.reports-title-row {
    justify-content: space-between;
    gap: 14px;
}

.reports-brand {
    min-width: 0;
    gap: 10px;
}

.reports-brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex: 0 0 auto;
}

.reports-brand-name {
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.15;
}

.reports-brand-shop {
    margin-top: 3px;
    color: #dbeafe;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dbm-brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

.dbm-brand-group {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px !important;
}

.dbm-brand-logo {
    width: 48px !important;
    height: 48px !important;
    object-fit: contain;
    flex: 0 0 auto;
}

.dbm-brand-title,
body .hero .hero-top .dbm-brand-copy .dbm-brand-title.dbm-brand-title {
    width: 100%;
    color: #eef4ff !important;
    font-size: 19px !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.dbm-brand-subtitle,
body .hero .hero-top .dbm-brand-copy .dbm-brand-subtitle.dbm-brand-subtitle {
    width: 100%;
    margin-top: 3px;
    color: #dbeafe;
    font-size: 14px !important;
    font-weight: 500;
    line-height: 1.25;
    text-align: left !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

@media (max-width: 480px) {
    .reports-hero {
        min-height: 68px;
        padding: 8px 10px !important;
    }

    .reports-hero .reports-app-header {
        min-height: 52px;
    }

    .dbm-brand-logo {
        width: 34px !important;
        height: 34px !important;
    }

    .dbm-brand-title,
    body .hero .hero-top .dbm-brand-copy .dbm-brand-title.dbm-brand-title {
        font-size: 15px !important;
    }

    .dbm-brand-subtitle,
    body .hero .hero-top .dbm-brand-copy .dbm-brand-subtitle.dbm-brand-subtitle {
        font-size: 12px !important;
    }
}

.reports-header-actions {
    gap: 8px;
    flex: 0 0 auto;
}

.reports-title-row {
    margin-top: 16px;
    align-items: flex-end;
}

.reports-eyebrow,
.appointment-inline-title p {
    margin: 0 0 4px;
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.reports-title-row h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(24px, 4vw, 32px);
    line-height: 1;
}

.report-date-chip {
    max-width: min(54vw, 330px);
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,.36);
    border-radius: 12px;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-size: 12px;
    font-weight: 750;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#reportsScreen > .hero:not(.reports-hero) {
    display: none !important;
}

#reportsScreen > .hero:not(.reports-hero) > div:first-child {
    display: none !important;
}

#reportsScreen .report-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 0;
}

.report-tabs-primary { margin-top: 16px; }

#reportsScreen .report-tabs-primary .report-tab {
    border-color: rgba(255,255,255,.35);
    background: rgba(255,255,255,.13);
    color: #ffffff;
    text-shadow: none;
}

#reportsScreen .report-tabs-primary .report-tab.active {
    border-color: #ffffff;
    background: #ffffff;
    color: #07599f;
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
}

/* One consistent, readable confirmation surface throughout the CRM. */
#appPopup {
    position: fixed !important;
    inset: 0 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box;
    z-index: 1200 !important;
    padding: 20px;
    background: rgba(15, 23, 42, .58) !important;
    backdrop-filter: blur(10px) !important;
}

#appPopup > div {
    width: min(100%, 420px) !important;
    max-width: 420px !important;
    padding: 28px !important;
    border: 1px solid rgba(255,255,255,.82) !important;
    border-radius: 24px !important;
    background: #ffffff !important;
    box-shadow: 0 28px 72px rgba(15,23,42,.3) !important;
}

#popupMessage {
    margin-bottom: 22px !important;
    color: var(--dbm-text) !important;
    font-size: 16px !important;
    font-weight: 650 !important;
    line-height: 1.5 !important;
    text-align: center !important;
}

#appPopup #popupOk,
#appPopup #popupCancel {
    min-height: 46px;
}

#appPopup .app-popup-actions.single-action {
    grid-template-columns: minmax(0, 1fr);
}

#appPopup.announcement-popup > .app-popup-panel {
    width: min(100%, 540px) !important;
    max-width: 540px !important;
    padding: clamp(26px, 4vw, 36px) !important;
}

#appPopup.announcement-popup .app-popup-title {
    margin: 2px 0 16px !important;
    line-height: 1.25;
}

#appPopup.announcement-popup #popupMessage {
    max-height: min(55vh, 520px) !important;
    margin: 0 0 28px !important;
    padding-right: 4px;
    overflow-y: auto !important;
    overflow-wrap: anywhere;
    white-space: pre-wrap !important;
    color: #52657a !important;
    font-size: clamp(15px, 2vw, 16px) !important;
    font-weight: 550 !important;
    line-height: 1.7 !important;
    text-align: left !important;
}

#appPopup.announcement-popup .app-popup-actions {
    margin-top: 4px;
}

/* Announcement severity is unmistakable while reusing the shared CRM dialog. */
#appPopup.announcement-popup-warning {
    background: rgba(69, 45, 5, .64) !important;
}

#appPopup.announcement-popup-warning > .app-popup-panel {
    border-color: #f4c46c !important;
    background: linear-gradient(180deg, #fffdf5 0%, #fff7df 100%) !important;
    box-shadow: 0 28px 72px rgba(91, 57, 5, .34) !important;
}

#appPopup.announcement-popup-warning .app-popup-panel::before {
    background: linear-gradient(90deg, #b54708, #f59e0b) !important;
}

#appPopup.announcement-popup-warning .app-popup-title {
    color: #7a2e0e !important;
}

#appPopup.announcement-popup-warning .app-popup-title::before,
#appPopup.announcement-popup-critical .app-popup-title::before {
    display: block;
    margin-bottom: 7px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
}

#appPopup.announcement-popup-warning .app-popup-title::before {
    content: "Warning announcement";
    color: #b54708;
}

#appPopup.announcement-popup-warning #popupOk {
    border-color: #b54708 !important;
    background: #b54708 !important;
}

#appPopup.announcement-popup-critical {
    background: rgba(74, 12, 12, .7) !important;
}

#appPopup.announcement-popup-critical > .app-popup-panel {
    border-color: #f29b94 !important;
    background: linear-gradient(180deg, #fffafa 0%, #fff0ef 100%) !important;
    box-shadow: 0 28px 72px rgba(101, 18, 18, .4) !important;
}

#appPopup.announcement-popup-critical .app-popup-panel::before {
    height: 7px;
    background: linear-gradient(90deg, #8f1d18, #d92d20) !important;
}

#appPopup.announcement-popup-critical .app-popup-title {
    color: #8f1d18 !important;
}

#appPopup.announcement-popup-critical .app-popup-title::before {
    content: "Critical announcement";
    color: #d92d20;
}

#appPopup.announcement-popup-critical #popupOk {
    border-color: #b42318 !important;
    background: #b42318 !important;
    box-shadow: 0 10px 24px rgba(180,35,24,.28) !important;
}

/* Export is a focused workspace rather than a small bottom sheet. */
#exportSheet {
    z-index: 2300 !important;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: #eef5fb !important;
    backdrop-filter: none;
}

#exportSheet.show { display: flex; }

#exportSheet .sheet {
    width: 100% !important;
    max-width: none !important;
    min-height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: max(28px, env(safe-area-inset-top)) clamp(20px, 6vw, 96px) calc(28px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border: 0 !important;
    border-radius: 0 !important;
    background: radial-gradient(circle at 92% 0%, rgba(18,163,180,.15), transparent 28rem), linear-gradient(135deg,#f8fbff,#eaf3fb) !important;
}

#exportSheet .sheet-handle { display: none; }
#exportSheet .sheet-top,
#exportSheet .field,
#exportSheet .sheet-actions {
    width: min(100%, 1180px);
    margin-left: auto;
    margin-right: auto;
}

#exportSheet .sheet-top {
    position: sticky;
    top: 0;
    z-index: 5;
    align-items: flex-start;
    padding: 20px 24px;
    margin-bottom: 4px;
    border-radius: 20px;
    background: linear-gradient(120deg,#07599f,#0f6cbd 55%,#0b9aaa);
    box-shadow: 0 20px 48px rgba(7,89,159,.2);
}

#exportSheet .sheet-title { color: #fff; font-size: 0; }
#exportSheet .sheet-title::after { content: "Export reports"; font-size: clamp(24px, 3vw, 30px); }
#exportSheet .sheet-subtitle { color: #e3f3ff; font-size: 14px; }
#exportSheet .sheet-top .icon-btn { min-width: 44px; min-height: 44px; border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.14); color: #fff; font-size: 0; }
#exportSheet .sheet-top .icon-btn::after { content: "×"; font-size: 28px; font-weight: 400; line-height: 1; }

#exportSheet .field {
    display: block;
    box-sizing: border-box;
    margin-top: 24px !important;
    padding: 24px;
    border: 1px solid #d7e5f2;
    border-radius: 20px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 10px 28px rgba(30,64,105,.07);
}

#exportSheet .field label { display: block; margin-bottom: 9px; color: #102033; font-size: 17px; font-weight: 800; }
#exportSheet .field select { min-height: 48px; border-color: #b9d1e7; border-radius: 12px; }
#exportSheet .sheet-actions { margin-top: 24px; border: 0 !important; }
#exportSheet .sheet-actions .btn { min-height: 50px; }

#exportSheet #exportPdfBtn,
#exportSheet #exportExcelBtn,
#exportSheet #deliveryDownload,
#exportSheet #deliveryShare {
    min-height: 108px;
    border: 1px solid #cfe0ef !important;
    border-radius: 18px !important;
    background: #fff !important;
    box-shadow: 0 8px 20px rgba(30,64,105,.06);
}

#exportSheet #exportPdfBtn { border-color: #75b9e7 !important; background: #f4faff !important; }
#exportSheet #exportPdfBtn > div:first-child,
#exportSheet #exportExcelBtn > div:first-child,
#exportSheet #deliveryDownload > div:first-child,
#exportSheet #deliveryShare > div:first-child { font-size: 0 !important; }
#exportSheet #exportPdfBtn > div:first-child::after { content: "PDF"; font-size: 15px; font-weight: 900; color: #07599f; letter-spacing: .08em; }
#exportSheet #exportExcelBtn > div:first-child::after { content: "XLS"; font-size: 15px; font-weight: 900; color: #07599f; letter-spacing: .08em; }
#exportSheet #deliveryDownload > div:first-child::after { content: "SAVE"; font-size: 12px; font-weight: 900; color: #07599f; letter-spacing: .08em; }
#exportSheet #deliveryShare > div:first-child::after { content: "SHARE"; font-size: 12px; font-weight: 900; color: #07599f; letter-spacing: .08em; }
#exportSheet .export-range-btn { min-height: 48px; border-radius: 12px; }

/* Keep export controls compact and aligned like the CRM's regular page controls. */
#exportSheet .sheet > div:not(.sheet-handle):not(.sheet-top):not(.sheet-actions) {
    width: min(100%, 1180px);
    margin-left: auto !important;
    margin-right: auto !important;
}

#exportSheet div:has(> #rangeTodayBtn) {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px !important;
}

#exportSheet .export-range-btn {
    min-height: 42px;
    padding: 0 10px;
    font-size: 14px;
    border-radius: 10px;
}

#exportSheet #exportPdfBtn,
#exportSheet #exportExcelBtn {
    height: 108px !important;
    padding: 14px !important;
}

#exportSheet #deliveryDownload,
#exportSheet #deliveryShare {
    min-height: 98px;
    padding: 13px !important;
}

#exportSheet #exportPdfBtn > div:nth-child(2),
#exportSheet #exportExcelBtn > div:nth-child(2) { margin-top: 8px !important; font-size: 16px !important; }
#exportSheet #exportPdfBtn > div:nth-child(3),
#exportSheet #exportExcelBtn > div:nth-child(3) { margin-top: 3px !important; }

/* About must stay above the full-screen Account & Settings workspace. */
#aboutModal.about-dialog {
    z-index: 2400 !important;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(8,24,42,.66) !important;
    backdrop-filter: blur(14px) saturate(120%);
}

#aboutModal.about-dialog > div {
    width: min(100%, 420px) !important;
    max-width: 420px !important;
    padding: 28px !important;
    border: 1px solid rgba(255,255,255,.8);
    border-radius: 24px !important;
    box-shadow: 0 32px 90px rgba(3,18,35,.38) !important;
}

@media (max-width: 600px) {
    #exportSheet .sheet-top { padding: 22px; }
    #exportSheet .field { padding: 20px; }
    #exportSheet div:has(> #rangeTodayBtn) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Compact, consistent hero actions. */
.hero #searchBtn,
.hero #appointmentSearchBtn,
.hero #reportsRefreshBtn,
.hero #reportsSearchBtn,
.hero .app-refresh-btn,
.hero #menuBtn,
.hero [data-profile-menu] {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    border: 1px solid rgba(255,255,255,.3) !important;
    border-radius: 14px !important;
    background: rgba(255,255,255,.14) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
    font-size: 19px !important;
}

.hero #searchBtn::after,
.hero #appointmentSearchBtn::after,
.hero #reportsRefreshBtn::after,
.hero #reportsSearchBtn::after,
.hero .app-refresh-btn::after,
.hero #menuBtn::after,
.hero [data-profile-menu]::after {
    display: none !important;
    content: none !important;
}

.hero #searchBtn:hover,
.hero #appointmentSearchBtn:hover,
.hero #reportsRefreshBtn:hover,
.hero #reportsSearchBtn:hover,
.hero .app-refresh-btn:hover,
.hero #menuBtn:hover,
.hero [data-profile-menu]:hover {
    background: rgba(255,255,255,.24) !important;
    transform: translateY(-1px);
}

/* Account menu is a true full-screen workspace. */
#accountModal {
    z-index: 2200 !important;
    padding: 0 !important;
    background: var(--dbm-bg) !important;
    align-items: stretch !important;
    overflow: hidden !important;
}

#accountModal > div {
    position: relative;
    width: 100% !important;
    max-width: none !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: max(24px, env(safe-area-inset-top)) clamp(18px, 5vw, 72px) calc(36px + env(safe-area-inset-bottom)) !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    box-shadow: none !important;
}

#accountModal > div > * {
    width: min(100%, 900px);
    margin-left: auto;
    margin-right: auto;
}

.account-menu-close {
    flex-shrink: 0;
    width: 46px !important;
    height: 46px;
    margin: 0 !important;
    border: 1px solid var(--dbm-border);
    border-radius: 14px;
    background: #ffffff;
    color: var(--dbm-text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--dbm-shadow);
}

body.account-menu-active .bottom-nav {
    visibility: hidden;
}

/* Account workspace: clear hierarchy, grouped controls, strong state visibility. */
#accountModal > div {
    background:
        radial-gradient(circle at 10% 0%, rgba(15,108,189,.12), transparent 32rem),
        linear-gradient(180deg, #edf4fb 0%, #f7faff 38%, #eef4f9 100%) !important;
}

#accountModal > div > * {
    width: min(100%, 1120px);
    box-sizing: border-box;
}

.account-menu-header {
    position: sticky;
    top: 0;
    z-index: 3;
    min-height: 104px;
    padding: 22px 24px !important;
    border: 0 !important;
    border-radius: 22px !important;
    background:
        radial-gradient(circle at 90% -20%, rgba(255,255,255,.22), transparent 34%),
        linear-gradient(125deg, #07599f, #0f6cbd 56%, #0d8797) !important;
    box-shadow: 0 18px 42px rgba(7,89,159,.22) !important;
}

.account-menu-header > div:first-child > div:first-child {
    width: 52px !important;
    height: 52px !important;
    border: 1px solid rgba(255,255,255,.36);
    background: rgba(255,255,255,.16) !important;
    box-shadow: none !important;
}

.account-menu-header #accountModalTitle,
.account-menu-header #accountModalTitle + div {
    color: #ffffff !important;
}

.account-menu-header #accountModalTitle {
    font-size: clamp(22px, 3vw, 30px) !important;
}

.account-menu-header #accountModalTitle + div {
    margin-top: 4px;
    color: #dbeafe !important;
    font-size: 14px !important;
}

.account-menu-header .account-menu-close {
    border-color: rgba(255,255,255,.45);
    background: rgba(7,32,60,.26);
    color: #ffffff;
    box-shadow: none;
    backdrop-filter: blur(12px);
}

.account-menu-identity,
.account-menu-license {
    display: flex !important;
    width: min(100%, 1120px) !important;
    box-sizing: border-box;
    border: 1px solid #c8d9ea !important;
    background: #ffffff !important;
    box-shadow: 0 8px 22px rgba(15,48,79,.07);
}

.account-menu-identity {
    margin-top: 18px !important;
    border-left: 5px solid var(--dbm-primary) !important;
}

.account-menu-license {
    margin-left: auto !important;
    margin-right: auto !important;
    border-left: 5px solid #12a3b4 !important;
}

.account-menu-section-title {
    margin: 28px auto 12px !important;
    color: #334155;
    font-size: 13px;
    letter-spacing: .09em;
    text-transform: uppercase;
}

#accountModal .settings-action,
.account-menu-automation,
.account-menu-support {
    margin-bottom: 14px !important;
    border: 1px solid #c8d9ea !important;
    border-radius: 18px !important;
    background: #ffffff !important;
    box-shadow: 0 7px 20px rgba(15,48,79,.06) !important;
}

#accountModal .settings-action {
    min-height: 78px;
    padding: 17px 18px !important;
    border-left: 5px solid #6ea8d8 !important;
}

#accountModal .settings-action:hover,
#accountModal .settings-action:focus-visible {
    border-color: #7eafd7 !important;
    border-left-color: var(--dbm-primary) !important;
    background: #f7fbff !important;
    box-shadow: 0 12px 28px rgba(15,108,189,.12) !important;
    transform: translateY(-1px);
}

.account-menu-automation {
    padding: 18px !important;
    border-left: 5px solid #18a67a !important;
    background: linear-gradient(90deg, #f0fdf8, #ffffff 42%) !important;
}

#accountModal .switch {
    width: 78px !important;
    height: 34px !important;
    cursor: pointer;
}

#accountModal .slider {
    border: 1px solid #94a3b8;
    background: #cbd5e1 !important;
}

#accountModal .slider::before {
    width: 26px;
    height: 26px;
    left: 3px;
    bottom: 3px;
}

#accountModal .slider::after {
    content: "OFF";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    color: #334155;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
}

#accountModal .switch input:checked + .slider {
    border-color: #15803d;
    background: #16a34a !important;
}

#accountModal .switch input:checked + .slider::before {
    transform: translateX(43px);
}

#accountModal .switch input:checked + .slider::after {
    content: "ON";
    right: auto;
    left: 12px;
    color: #ffffff;
}

.account-menu-support {
    padding: 10px !important;
    background: #f8fbff !important;
}

#accountModal .account-menu-logout {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    margin: 8px 0 0 !important;
    border-color: #fecaca !important;
    border-left-color: #dc2626 !important;
    background: #fff1f2 !important;
    color: #b42318 !important;
    text-align: left !important;
    font-weight: 400 !important;
}

@media (min-width: 800px) {
    .account-menu-identity,
    .account-menu-license {
        display: flex !important;
        width: min(100%, 1120px) !important;
        min-height: 76px;
    }
}

@media (max-width: 640px) {
    #accountModal > div {
        padding: max(12px, env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom)) !important;
    }

    .account-menu-header {
        min-height: 94px;
        padding: 16px !important;
        border-radius: 18px !important;
    }

    .account-menu-close {
        width: 40px !important;
        height: 40px;
        font-size: 24px;
    }
}

#reportsScreen .report-tab {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
    white-space: nowrap;
}

/* The add form uses the same appointment design, without extending the list page. */
#appointmentAddPage {
    position: fixed !important;
    inset: 0 !important;
    z-index: 950 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 8% 0%, rgba(18, 163, 180, 0.11), transparent 26rem),
        linear-gradient(180deg, #f8fbff, var(--dbm-bg)) !important;
}

#appointmentAddPage .page {
    max-width: 1180px !important;
    padding-top: 14px !important;
}

#appointmentAddPage .hero {
    display: none !important;
}

.appointment-inline-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin: 8px 0 12px;
    padding: 18px;
    border: 1px solid var(--dbm-border);
    border-radius: 18px;
    background: var(--dbm-surface);
    box-shadow: var(--dbm-shadow);
}

.appointment-inline-title p {
    color: var(--dbm-primary);
}

.appointment-inline-title h1 {
    margin: 0;
    color: var(--dbm-text);
    font-size: 24px;
}

.appointment-inline-title span {
    display: block;
    margin-top: 5px;
    color: var(--dbm-muted);
    font-size: 14px;
}

.appointment-inline-title button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--dbm-border);
    border-radius: 12px;
    background: var(--dbm-surface-muted);
    color: var(--dbm-text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 640px) {
    .reports-title-row {
        align-items: center;
    }

    .reports-title-row h1 {
        font-size: 26px;
    }

    #reportsScreen .report-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
