/* Redesign module: Clinic core pages (budget + agenda + patient register) */

.k-clinic-core-page {
    width: min(1280px, 100%);
    margin: 0 auto;
}

.k-clinic-core-page .k-page-title-wrap {
    gap: 13px;
}

.k-clinic-core-page .k-page-title {
    margin: 0;
    font-size: clamp(1.95rem, 2.15vw, 2.35rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.k-clinic-core-page .k-page-icon {
    font-size: 2.05rem;
}

.k-clinic-budget-page .k-page-header,
.k-clinic-agenda-page .k-page-header,
.k-clinic-register-page .k-page-header {
    align-items: center;
    margin-bottom: 20px;
}

.k-clinic-budget-page .k-page-title-wrap,
.k-clinic-agenda-page .k-page-title-wrap,
.k-clinic-register-page .k-page-title-wrap {
    gap: 13px;
}

.k-clinic-budget-page .k-page-title,
.k-clinic-agenda-page .k-page-title,
.k-clinic-register-page .k-page-title {
    margin: 0;
    font-size: clamp(2rem, 2.2vw, 2.45rem);
    line-height: 1.06;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.k-clinic-budget-page .k-page-icon,
.k-clinic-agenda-page .k-page-icon,
.k-clinic-register-page .k-page-icon {
    font-size: 2.1rem;
}

.k-clinic-page-subtitle {
    margin-top: 6px;
    font-size: 0.88rem;
    letter-spacing: 0.01em;
}

.k-clinic-budget-page .form-control,
.k-clinic-agenda-page .form-control,
.k-clinic-register-page .form-control {
    min-height: 44px;
    border-radius: 14px;
}

.k-clinic-budget-page textarea.form-control,
.k-clinic-agenda-page textarea.form-control,
.k-clinic-register-page textarea.form-control {
    border-radius: 14px;
}

.k-clinic-budget-page .k-budget-search-wrap .form-control {
    border-radius: 999px;
}

.k-clinic-budget-page .k-clinic-block-title,
.k-clinic-agenda-page .k-clinic-block-title {
    letter-spacing: 0.11em;
    font-weight: 700;
}

.k-clinic-register-page .k-step-title {
    margin-bottom: 10px;
    font-size: 0.93rem;
    letter-spacing: 0.08em;
}

.k-clinic-register-page .k-register-search-grid {
    grid-template-columns: minmax(320px, 1fr) minmax(340px, 1.15fr);
    gap: 20px;
}

.k-clinic-register-page .k-search-status-area {
    min-height: 100%;
}

.k-clinic-register-page .k-form-header {
    margin-bottom: 14px;
}

.k-clinic-budget-page .k-budget-layout {
    grid-template-columns: minmax(0, 1.28fr) minmax(330px, 0.72fr);
    gap: 26px;
}

.k-clinic-budget-page .k-budget-side {
    position: sticky;
    top: 24px;
    align-self: start;
}

.k-clinic-budget-page .k-budget-clear {
    border-radius: 14px;
    min-height: 44px;
    font-weight: 700;
}

.k-clinic-budget-page .k-budget-actions-right .btn {
    border-radius: 14px;
}

.k-clinic-budget-page .k-receipt-total-label {
    letter-spacing: 0.01em;
}

.k-clinic-agenda-page .k-agenda-grid {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
}

.k-clinic-agenda-page .k-agenda-card {
    min-height: 230px;
}

body.light-mode .k-clinic-budget-page .k-page-title,
body.light-mode .k-clinic-agenda-page .k-page-title,
body.light-mode .k-clinic-register-page .k-page-title {
    color: #1565c0;
}

body.light-mode .k-clinic-budget-page .k-page-icon,
body.light-mode .k-clinic-agenda-page .k-page-icon,
body.light-mode .k-clinic-register-page .k-page-icon {
    color: #00b8e6;
}

body.light-mode .k-clinic-budget-page .k-clinic-block-title,
body.light-mode .k-clinic-agenda-page .k-clinic-block-title {
    color: #00b8e6;
}

body.light-mode .k-clinic-budget-page .k-page-subtitle,
body.light-mode .k-clinic-agenda-page .k-page-subtitle {
    color: #60758e;
}

body.light-mode .k-budget-search-hint {
    color: #60758e;
}

body.light-mode .k-clinic-budget-page .k-budget-clear {
    background: #edf3f8;
    border-color: #d2dde9;
    color: #475569;
    box-shadow: none;
}

body.light-mode .k-clinic-budget-page .k-budget-clear:hover {
    background: #e4edf7;
}

body:not(.light-mode) .k-clinic-budget-page .k-page-title,
body:not(.light-mode) .k-clinic-agenda-page .k-page-title,
body:not(.light-mode) .k-clinic-register-page .k-page-title {
    color: #00e5ff;
}

body:not(.light-mode) .k-clinic-budget-page .k-page-icon,
body:not(.light-mode) .k-clinic-agenda-page .k-page-icon,
body:not(.light-mode) .k-clinic-register-page .k-page-icon {
    color: #00e5ff;
}

body:not(.light-mode) .k-clinic-budget-page .k-clinic-block-title,
body:not(.light-mode) .k-clinic-agenda-page .k-clinic-block-title {
    color: #00e5ff;
}

body:not(.light-mode) .k-budget-search-hint {
    color: #95a9c0;
}

@media (max-width: 1100px) {
    .k-clinic-budget-page .k-budget-layout {
        grid-template-columns: 1fr;
    }

    .k-clinic-budget-page .k-budget-side {
        position: static;
    }
}

@media (max-width: 900px) {
    .k-budget-layout {
        grid-template-columns: 1fr;
    }

    .k-budget-item-grid {
        grid-template-columns: 1fr;
    }

    .k-budget-actions-row {
        flex-direction: column;
    }

    .k-budget-clear {
        flex: 1;
    }

    .k-history-actions {
        grid-template-columns: 1fr;
    }

    .k-agenda-toolbar-grid {
        grid-template-columns: 1fr;
    }

    .k-agenda-grid {
        grid-template-columns: 1fr;
    }

    .k-agenda-action-grid {
        grid-template-columns: 1fr;
    }

    .k-agenda-form-grid {
        grid-template-columns: 1fr;
    }

    .k-agenda-patient-search-row {
        grid-template-columns: 1fr;
    }

    .k-clinic-register-page .k-register-search-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .k-clinic-register-page .k-search-status-area {
        border-left: 0;
        border-top: 1px solid var(--border-subtle);
        padding-left: 0;
        padding-top: 10px;
    }

    .k-clinic-agenda-page .k-agenda-grid {
        grid-template-columns: 1fr;
    }
}

/* Extracted from redesign_structural.css (clinic module split) */
.k-clinic-block-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.k-budget-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 24px;
}

.k-budget-main,
.k-budget-side {
    min-width: 0;
}

.k-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.k-clinic-budget-page .k-tab-btn {
    min-height: 42px;
    border-radius: 999px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
}

.k-clinic-budget-page .k-tab-btn .material-icons {
    font-size: 1rem;
}

.k-budget-block {
    margin-bottom: 18px;
}

.k-clinic-budget-page .k-budget-block > .k-clinic-block-title,
.k-clinic-budget-page .k-budget-block-inner > .k-clinic-block-title,
.k-clinic-budget-page .k-budget-side > .k-clinic-block-title {
    justify-content: center;
    text-align: center;
    width: 100%;
}

.k-clinic-budget-page .k-budget-patient-form .k-form-header {
    justify-content: center;
    text-align: center;
}

.k-budget-search-wrap {
    margin-bottom: 14px;
    position: relative;
}

.k-budget-search-hint {
    font-size: 0.84rem;
    margin-top: -2px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.k-lookup-dropdown {
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
}

.k-budget-patient-card {
    padding: 14px;
    margin-bottom: 14px;
}

.k-budget-patient-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.k-budget-patient-caption {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.k-budget-patient-name {
    font-size: 1.08rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.k-budget-patient-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.86rem;
}

.k-budget-patient-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.k-budget-patient-meta .material-icons {
    font-size: 0.92rem;
}

.k-budget-block-inner {
    margin-bottom: 12px;
}

.k-budget-subcard {
    padding: 14px;
}

.k-budget-patient-form {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 10px;
}

.k-budget-patient-rif-row {
    margin: 10px 0;
}

.k-budget-save-patient {
    margin-top: 12px;
}

.k-budget-item-details {
    margin-top: 8px;
}

.k-budget-item-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.k-budget-subtotal-box {
    border-radius: 10px;
    padding: 8px;
    text-align: center;
}

.k-budget-subtotal-caption {
    font-size: 0.7rem;
}

.k-budget-subtotal-value {
    font-size: 1.08rem;
    font-weight: 700;
}

.k-budget-add-item {
    margin-top: 12px;
}

.k-history-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: center;
}

.k-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.k-cart-items {
    min-height: 100px;
}

.k-receipt-card {
    border: 1px solid var(--border-medium);
    border-radius: 18px;
    padding: 16px;
}

.k-receipt-total-wrap {
    border-top: 2px dashed var(--border-medium);
    margin-top: 14px;
    padding-top: 14px;
}

.k-receipt-header {
    text-align: center;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.k-receipt-header h4 {
    margin: 0 0 7px;
    font-size: 0.84rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.k-receipt-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.k-receipt-total-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.k-receipt-total-label {
    font-size: 1.15rem;
    font-weight: 700;
}

.k-receipt-currency-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
}

.k-receipt-currency-text {
    font-size: 0.72rem;
    font-weight: 700;
}

.k-receipt-currency-text.k-currency-mode-eur {
    color: var(--accent-primary);
}

.k-receipt-currency-text.k-currency-mode-usd {
    color: var(--accent-warning, #f59e0b);
}

.k-receipt-total-amount {
    font-size: 1.2rem;
    font-weight: 700;
}

.k-receipt-meta-row {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.86rem;
}

.k-budget-actions-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-top: 12px;
}

.k-budget-clear {
    flex: 0 0 30%;
}

.k-budget-actions-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.k-budget-actions-right #budget-notes {
    min-height: 44px;
}

.k-agenda-toolbar {
    margin-bottom: 18px;
}

.k-agenda-toolbar-card {
    padding-top: 18px;
    padding-bottom: 18px;
}

.k-agenda-toolbar-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 14px;
    align-items: end;
}

.k-agenda-spec-filter {
    min-height: 46px;
    max-height: 130px;
    padding: 8px 6px;
    overflow-y: auto;
}

.k-agenda-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.k-agenda-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.k-agenda-modal {
    width: min(640px, 96vw);
    max-width: 640px;
}

.k-agenda-patient-search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
}

.k-agenda-patient-search-btn {
    min-width: 96px;
}

.k-agenda-patient-result {
    margin-bottom: 12px;
    font-weight: 600;
}

.k-agenda-locked-patient {
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
}

.k-agenda-locked-label {
    font-size: 0.8rem;
}

.k-agenda-locked-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.k-agenda-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}

.k-agenda-reason-row {
    margin-bottom: 10px;
}

.k-agenda-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.k-lookup-dropdown {
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

.k-lookup-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
}

.k-lookup-item:last-child {
    border-bottom: 0;
}

.k-lookup-item-title {
    font-weight: 700;
    margin-bottom: 2px;
}

.k-lookup-item-subtitle {
    font-size: 0.8rem;
}

.k-lookup-item--split {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.k-lookup-item-main {
    min-width: 0;
}

.k-lookup-item-price {
    font-weight: 700;
}

.k-lookup-empty {
    padding: 12px;
    text-align: center;
    font-size: 0.88rem;
}

.k-lookup-create-btn {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--border-subtle);
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    background: transparent;
}

.k-history-card {
    padding: 15px;
    border-left: 4px solid transparent;
}

.k-history-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.k-history-card-right {
    text-align: right;
}

.k-history-patient-name {
    font-weight: 700;
    font-size: 1rem;
}

.k-history-specialist {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    margin-top: 3px;
}

.k-history-specialist .material-icons {
    font-size: 0.86rem;
}

.k-history-total {
    font-size: 1.08rem;
    font-weight: 700;
}

.k-history-meta {
    font-size: 0.74rem;
}

.k-history-treatment-box {
    border-radius: 10px;
    padding: 9px 10px;
    margin-bottom: 8px;
}

.k-history-treatment-line {
    font-size: 0.82rem;
    margin-bottom: 2px;
}

.k-history-treatment-line:last-child {
    margin-bottom: 0;
}

.k-history-treatment-empty {
    font-size: 0.82rem;
    font-style: italic;
}

.k-history-status-row {
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.k-history-status {
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.k-history-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 11px;
    padding-top: 11px;
    border-top: 1px solid var(--border-subtle);
}

.k-history-btn {
    min-height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-medium);
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-weight: 600;
    font-size: 0.78rem;
}

.k-history-btn .material-icons {
    font-size: 0.95rem;
}

.k-budget-wa-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}

.k-budget-wa-modal {
    width: min(380px, 100%);
    padding: 22px;
}

.k-budget-wa-title {
    font-weight: 700;
    font-size: 1.08rem;
    margin-bottom: 8px;
}

.k-budget-wa-subtitle {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.k-budget-wa-input {
    margin-bottom: 12px;
}

.k-budget-wa-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.k-agenda-card {
    padding: 14px;
    border-left: 6px solid var(--border-medium);
}

.k-agenda-card--agendado {
    --agenda-status-color: var(--status-agendado);
    --agenda-status-bg: var(--status-agendado-bg);
}

.k-agenda-card--en-sala {
    --agenda-status-color: var(--status-ensala);
    --agenda-status-bg: var(--status-ensala-bg);
}

.k-agenda-card--finalizado {
    --agenda-status-color: var(--status-finalizado);
    --agenda-status-bg: var(--status-finalizado-bg);
}

.k-agenda-card--cancelado {
    --agenda-status-color: var(--status-cancelado);
    --agenda-status-bg: var(--status-cancelado-bg);
}

.k-agenda-card--default {
    --agenda-status-color: var(--text-secondary);
    --agenda-status-bg: rgba(148, 163, 184, 0.18);
}

.k-agenda-card--terminal {
    opacity: 0.62;
    transform: scale(0.985);
}

.k-agenda-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.k-agenda-time {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--agenda-status-color);
}

.k-agenda-status-wrap {
    text-align: right;
}

.k-agenda-status-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.71rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    background: var(--agenda-status-bg);
    color: var(--agenda-status-color);
}

.k-agenda-specialist {
    margin-top: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.k-agenda-patient-box {
    margin-bottom: 10px;
}

.k-agenda-patient {
    font-size: 1.12rem;
    font-weight: 700;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.k-agenda-meta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.83rem;
}

.k-agenda-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.k-agenda-meta .material-icons {
    font-size: 0.92rem;
}

.k-agenda-motive-box {
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.k-agenda-motive-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.k-agenda-motive-text {
    font-size: 0.93rem;
    font-style: italic;
}

.k-agenda-action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.k-agenda-btn {
    min-height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-medium);
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-weight: 700;
    font-size: 0.8rem;
}

.k-agenda-btn .material-icons {
    font-size: 0.96rem;
}


body.light-mode .k-clinic-block-title,
body.light-mode .k-receipt-total-label,
body.light-mode .k-modal-title {
    color: #1565c0;
}

body.light-mode .k-clinic-budget-page .k-tab-btn {
    background: #f8fbff;
    border-color: #d2dde9;
    color: #4b5f75;
}

body.light-mode .k-clinic-budget-page .k-tab-btn.active {
    background: #e7f1ff;
    border-color: #1565c0;
    color: #1565c0;
}

body.light-mode .k-budget-patient-card {
    background: #f2f8ff;
    border-color: #cde0f4;
}

body.light-mode .k-budget-patient-caption,
body.light-mode .k-budget-patient-meta,
body.light-mode .k-receipt-meta-row,
body.light-mode .k-agenda-locked-label,
body.light-mode .k-agenda-patient-result {
    color: #5f748b;
}

body.light-mode .k-budget-subtotal-box,
body.light-mode .k-receipt-currency-chip {
    background: #eef5ff;
}

body.light-mode .k-receipt-card {
    background: #ffffff;
    border-color: #d9e3ef;
}

body.light-mode .k-budget-subtotal-value,
body.light-mode .k-receipt-total-amount {
    color: #1565c0;
}

body.light-mode .k-agenda-locked-patient {
    background: #eef5ff;
    border: 1px solid #cde0f4;
}

body.light-mode .k-lookup-dropdown {
    background: #ffffff;
    border-color: #d9e3ef;
}

body.light-mode .k-lookup-item-title {
    color: #334155;
}

body.light-mode .k-lookup-item-subtitle {
    color: #5f748b;
}

body.light-mode .k-lookup-item-price,
body.light-mode .k-history-total {
    color: #1565c0;
}

body.light-mode .k-lookup-item:hover {
    background: #eef5ff;
}

body.light-mode .k-lookup-empty {
    color: #6b7f95;
}

body.light-mode .k-lookup-create-btn {
    color: #1565c0;
}

body.light-mode .k-lookup-create-btn:hover {
    background: #eef5ff;
}

body.light-mode .k-history-card {
    background: #ffffff;
}

body.light-mode .k-history-card--approved {
    border-left-color: #16a34a;
}

body.light-mode .k-history-card--sent {
    border-left-color: #2563eb;
}

body.light-mode .k-history-card--draft {
    border-left-color: #d97706;
}

body.light-mode .k-history-card--default {
    border-left-color: #94a3b8;
}

body.light-mode .k-history-patient-name {
    color: #334155;
}

body.light-mode .k-history-specialist,
body.light-mode .k-history-meta {
    color: #64748b;
}

body.light-mode .k-history-treatment-box {
    background: #f8fbff;
    border: 1px solid #d9e3ef;
}

body.light-mode .k-history-treatment-line {
    color: #4b5f75;
}

body.light-mode .k-history-treatment-empty {
    color: #74869d;
}

body.light-mode .k-history-status {
    color: #334155;
    background: #e2e8f0;
}

body.light-mode .k-history-status--approved {
    color: #166534;
    background: #dcfce7;
}

body.light-mode .k-history-status--sent {
    color: #1d4ed8;
    background: #dbeafe;
}

body.light-mode .k-history-status--draft {
    color: #92400e;
    background: #fef3c7;
}

body.light-mode .k-history-btn {
    color: #4b5f75;
    border-color: #d2dde9;
    background: #f8fbff;
}

body.light-mode .k-history-btn:hover {
    background: #eef5ff;
    border-color: #bfd3eb;
}

body.light-mode .k-history-btn--approve {
    color: #1565c0;
    border-color: #bfd3eb;
    background: #e7f1ff;
}

body.light-mode .k-budget-wa-overlay {
    background: rgba(15, 23, 42, 0.34);
}

body.light-mode .k-budget-wa-title {
    color: #1565c0;
}

body.light-mode .k-budget-wa-subtitle {
    color: #64748b;
}

body.light-mode .k-agenda-card {
    border-left-color: var(--agenda-status-color);
    background: #ffffff;
}

body.light-mode .k-agenda-specialist {
    color: #1565c0;
}

body.light-mode .k-agenda-patient {
    color: #334155;
}

body.light-mode .k-agenda-meta {
    color: #64748b;
}

body.light-mode .k-agenda-motive-box {
    background: #f8fbff;
    border: 1px solid #d9e3ef;
}

body.light-mode .k-agenda-motive-label {
    color: #64748b;
}

body.light-mode .k-agenda-motive-text {
    color: #4b5f75;
}

body.light-mode .k-agenda-btn {
    border-color: #d2dde9;
    color: #4b5f75;
    background: #f8fbff;
}

body.light-mode .k-agenda-btn:hover {
    background: #eef5ff;
}

body.light-mode .k-agenda-btn--primary {
    border-color: #1565c0;
    background: #1565c0;
    color: #ffffff;
}

body.light-mode .k-agenda-btn--primary:hover {
    background: #0d47a1;
}

body.light-mode .k-agenda-btn--danger {
    border-color: #fca5a5;
    color: #b91c1c;
    background: #fef2f2;
}


body:not(.light-mode) .k-clinic-block-title,
body:not(.light-mode) .k-receipt-total-label,
body:not(.light-mode) .k-modal-title {
    color: #00e5ff;
}

body:not(.light-mode) .k-clinic-budget-page .k-tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
    color: #9eb1c7;
}

body:not(.light-mode) .k-clinic-budget-page .k-tab-btn.active {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.34);
    color: #00e5ff;
}

body:not(.light-mode) .k-budget-patient-card {
    background: rgba(0, 229, 255, 0.07);
    border-color: rgba(0, 229, 255, 0.24);
}

body:not(.light-mode) .k-budget-patient-caption,
body:not(.light-mode) .k-budget-patient-meta,
body:not(.light-mode) .k-receipt-meta-row,
body:not(.light-mode) .k-agenda-locked-label,
body:not(.light-mode) .k-agenda-patient-result {
    color: #9eb1c7;
}

body:not(.light-mode) .k-budget-subtotal-box,
body:not(.light-mode) .k-receipt-currency-chip {
    background: rgba(0, 0, 0, 0.24);
}

body:not(.light-mode) .k-receipt-card {
    background: rgba(8, 18, 32, 0.72);
    border-color: rgba(0, 229, 255, 0.18);
}

body:not(.light-mode) .k-budget-subtotal-value,
body:not(.light-mode) .k-receipt-total-amount {
    color: #00e5ff;
}

body:not(.light-mode) .k-agenda-locked-patient {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

body:not(.light-mode) .k-lookup-dropdown {
    background: rgba(6, 12, 24, 0.96);
    border-color: rgba(0, 229, 255, 0.22);
}

body:not(.light-mode) .k-lookup-item-title {
    color: #dbe8f5;
}

body:not(.light-mode) .k-lookup-item-subtitle {
    color: #9eb1c7;
}

body:not(.light-mode) .k-lookup-item-price,
body:not(.light-mode) .k-history-total {
    color: #00e5ff;
}

body:not(.light-mode) .k-lookup-item:hover {
    background: rgba(0, 229, 255, 0.1);
}

body:not(.light-mode) .k-lookup-empty {
    color: #9eb1c7;
}

body:not(.light-mode) .k-lookup-create-btn {
    color: #00e5ff;
}

body:not(.light-mode) .k-lookup-create-btn:hover {
    background: rgba(0, 229, 255, 0.1);
}

body:not(.light-mode) .k-history-card {
    background: rgba(8, 18, 32, 0.72);
}

body:not(.light-mode) .k-history-card--approved {
    border-left-color: #22c55e;
}

body:not(.light-mode) .k-history-card--sent {
    border-left-color: #3b82f6;
}

body:not(.light-mode) .k-history-card--draft {
    border-left-color: #f59e0b;
}

body:not(.light-mode) .k-history-card--default {
    border-left-color: #94a3b8;
}

body:not(.light-mode) .k-history-patient-name {
    color: #dbe8f5;
}

body:not(.light-mode) .k-history-specialist,
body:not(.light-mode) .k-history-meta {
    color: #9eb1c7;
}

body:not(.light-mode) .k-history-treatment-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body:not(.light-mode) .k-history-treatment-line {
    color: #cbd5e1;
}

body:not(.light-mode) .k-history-treatment-empty {
    color: #94a3b8;
}

body:not(.light-mode) .k-history-status {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.16);
}

body:not(.light-mode) .k-history-status--approved {
    color: #86efac;
    background: rgba(34, 197, 94, 0.14);
}

body:not(.light-mode) .k-history-status--sent {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.14);
}

body:not(.light-mode) .k-history-status--draft {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.14);
}

body:not(.light-mode) .k-history-btn {
    color: #9eb1c7;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
}

body:not(.light-mode) .k-history-btn:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.35);
    color: #d8f7ff;
}

body:not(.light-mode) .k-history-btn--approve {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.34);
    color: #00e5ff;
}

body:not(.light-mode) .k-budget-wa-overlay {
    background: rgba(0, 0, 0, 0.5);
}

body:not(.light-mode) .k-budget-wa-title {
    color: #00e5ff;
}

body:not(.light-mode) .k-budget-wa-subtitle {
    color: #9eb1c7;
}

body:not(.light-mode) .k-agenda-card {
    border-left-color: var(--agenda-status-color);
    background: rgba(8, 18, 32, 0.72);
}

body:not(.light-mode) .k-agenda-specialist {
    color: #8bd8ff;
}

body:not(.light-mode) .k-agenda-patient {
    color: #dbe8f5;
}

body:not(.light-mode) .k-agenda-meta {
    color: #9eb1c7;
}

body:not(.light-mode) .k-agenda-motive-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

body:not(.light-mode) .k-agenda-motive-label {
    color: #9eb1c7;
}

body:not(.light-mode) .k-agenda-motive-text {
    color: #cbd5e1;
}

body:not(.light-mode) .k-agenda-btn {
    border-color: rgba(255, 255, 255, 0.18);
    color: #9eb1c7;
    background: rgba(255, 255, 255, 0.04);
}

body:not(.light-mode) .k-agenda-btn:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.35);
    color: #d8f7ff;
}

body:not(.light-mode) .k-agenda-btn--primary {
    border-color: rgba(0, 229, 255, 0.35);
    color: #00e5ff;
    background: rgba(0, 229, 255, 0.14);
}

body:not(.light-mode) .k-agenda-btn--danger {
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.14);
}



/* Agenda Clinica timeline redesign (isolated) */
.k-clinic-agenda-page .k-agx-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.k-clinic-agenda-page .k-agx-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.k-clinic-agenda-page .k-agx-specialist-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 14px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.9);
}

.k-clinic-agenda-page .k-agx-toolbar-label {
    font-weight: 700;
    font-size: 0.98rem;
    white-space: nowrap;
}

.k-clinic-agenda-page .k-agx-chip-list {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    min-width: 0;
    flex: 1;
    padding: 2px;
    scrollbar-width: thin;
}

.k-clinic-agenda-page .k-agx-spec-chevron {
    color: #64748b;
    font-size: 20px;
}

.k-clinic-agenda-page .k-agx-chip {
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(241, 245, 249, 0.92);
    color: #334155;
    border-radius: 999px;
    padding: 6px 10px;
    font-weight: 600;
    font-size: 0.96rem;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.18s ease;
}

.k-clinic-agenda-page .k-agx-chip:hover {
    border-color: rgba(37, 99, 235, 0.55);
}

.k-clinic-agenda-page .k-agx-chip.is-active {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: #fff;
    border-color: rgba(37, 99, 235, 0.85);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
}

.k-clinic-agenda-page .k-agx-date-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.k-clinic-agenda-page .k-agx-date-input {
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.k-clinic-agenda-page .k-agx-new-btn {
    min-height: 42px;
    border-radius: 999px;
    padding-inline: 22px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.k-clinic-agenda-page .k-agx-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 352px;
    gap: 14px;
    align-items: start;
}

.k-clinic-agenda-page .k-agx-schedule {
    border-radius: 16px;
    overflow: hidden;
}

.k-clinic-agenda-page .k-agx-day-header {
    background: linear-gradient(90deg, #0e7490 0%, #0891b2 55%, #0e7490 100%);
    color: #e6fbff;
    font-weight: 800;
    text-align: center;
    padding: 11px 16px;
    font-size: 1.12rem;
    letter-spacing: 0.2px;
}

.k-clinic-agenda-page .k-agx-schedule-body {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    height: 620px;
    overflow: auto;
}

.k-clinic-agenda-page .k-agx-time-col {
    position: relative;
    border-right: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.62);
}

.k-clinic-agenda-page .k-agx-time-label {
    position: absolute;
    right: 8px;
    transform: translateY(-50%);
    font-size: 0.92rem;
    font-weight: 800;
    color: #334155;
    white-space: nowrap;
}

.k-clinic-agenda-page .k-agx-track-wrap {
    position: relative;
    overflow: hidden;
    min-height: 620px;
    background: rgba(248, 250, 252, 0.7);
}

.k-clinic-agenda-page .k-agx-hour-lines,
.k-clinic-agenda-page .k-agx-track {
    position: absolute;
    inset: 0;
    min-width: 100%;
}

.k-clinic-agenda-page .k-agx-hour-lines {
    pointer-events: none;
    z-index: 1;
}

.k-clinic-agenda-page .k-agx-track {
    z-index: 2;
}

.k-clinic-agenda-page #loading-grid.k-hidden {
    display: none !important;
}

.k-clinic-agenda-page .k-agx-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    border-top: 1px dashed rgba(148, 163, 184, 0.34);
}

.k-clinic-agenda-page .k-agx-hour-line--half {
    border-top-style: dotted;
    opacity: 0.55;
}

.k-clinic-agenda-page .k-agx-appt {
    position: absolute;
    border: none;
    border-radius: 9px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 10px;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 8px 14px rgba(15, 23, 42, 0.12);
    transition: transform 0.16s ease, box-shadow 0.16s ease, outline-color 0.16s ease;
}

.k-clinic-agenda-page .k-agx-appt:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.16);
}

.k-clinic-agenda-page .k-agx-appt.is-selected {
    outline: 2px solid rgba(15, 23, 42, 0.28);
}

.k-clinic-agenda-page .k-agx-appt-main {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.k-clinic-agenda-page .k-agx-appt-sub {
    font-size: 0.83rem;
    opacity: 0.95;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.k-clinic-agenda-page .k-agx-appt--agendado {
    background: linear-gradient(90deg, #2b6cb0 0%, #3182ce 100%);
}

.k-clinic-agenda-page .k-agx-appt--en-sala {
    background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
}

.k-clinic-agenda-page .k-agx-appt--finalizado {
    background: linear-gradient(90deg, #15803d 0%, #22c55e 100%);
}

.k-clinic-agenda-page .k-agx-appt--cancelado {
    background: linear-gradient(90deg, #b91c1c 0%, #ef4444 100%);
}

.k-clinic-agenda-page .k-agx-detail {
    border-radius: 16px;
    padding: 15px 14px;
    min-height: 440px;
    position: sticky;
    top: 0;
}

.k-clinic-agenda-page .k-agx-detail::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 46%;
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    border-left: 1px solid rgba(148, 163, 184, 0.22);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    background: inherit;
}

.k-clinic-agenda-page .k-agx-detail-empty {
    color: #64748b;
    font-weight: 600;
    text-align: center;
    padding: 22px 10px;
}

.k-clinic-agenda-page .k-agx-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.k-clinic-agenda-page .k-agx-detail-head h3 {
    margin: 0;
    font-size: 1.38rem;
    font-weight: 800;
    line-height: 1.05;
}

.k-clinic-agenda-page .k-agx-detail-close {
    border: none;
    background: transparent;
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.k-clinic-agenda-page .k-agx-detail-close:hover {
    background: rgba(148, 163, 184, 0.15);
}

.k-clinic-agenda-page .k-agx-detail-grid {
    display: grid;
    gap: 10px;
}

.k-clinic-agenda-page .k-agx-detail-grid label {
    display: block;
    font-size: 0.96rem;
    font-weight: 800;
    color: #334155;
    margin-bottom: 1px;
}

.k-clinic-agenda-page .k-agx-detail-grid p {
    margin: 0;
    font-size: 1.1rem;
    color: #0f172a;
    line-height: 1.2;
}

.k-clinic-agenda-page .k-agx-detail-reason p {
    font-size: 1.02rem;
    line-height: 1.25;
}

.k-clinic-agenda-page .k-agx-status-text {
    font-weight: 800;
}

.k-clinic-agenda-page .k-agx-status-text--agendado { color: #2563eb; }
.k-clinic-agenda-page .k-agx-status-text--en-sala { color: #d97706; }
.k-clinic-agenda-page .k-agx-status-text--finalizado { color: #15803d; }
.k-clinic-agenda-page .k-agx-status-text--cancelado { color: #b91c1c; }

.k-clinic-agenda-page .k-agx-detail-actions {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.k-clinic-agenda-page .k-agx-action-btn {
    border-radius: 10px;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(241, 245, 249, 0.8);
    color: #0f172a;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}

.k-clinic-agenda-page .k-agx-action-btn .material-icons {
    font-size: 18px;
}

.k-clinic-agenda-page .k-agx-action-btn--primary {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    border-color: rgba(37, 99, 235, 0.9);
    color: #fff;
}

.k-clinic-agenda-page .k-agx-action-btn--ghost {
    background: rgba(241, 245, 249, 0.85);
}

.k-clinic-agenda-page .k-agx-action-btn--danger {
    background: rgba(254, 242, 242, 0.85);
    border-color: rgba(239, 68, 68, 0.4);
    color: #b91c1c;
}

.k-clinic-agenda-page .k-agx-action-btn.is-disabled,
.k-clinic-agenda-page .k-agx-action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-toolbar,
body:not(.light-mode) .k-clinic-agenda-page .k-agx-schedule,
body:not(.light-mode) .k-clinic-agenda-page .k-agx-detail {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.22);
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-chip {
    background: rgba(30, 41, 59, 0.9);
    color: #dbeafe;
    border-color: rgba(71, 85, 105, 0.85);
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-specialist-field {
    background: rgba(15, 23, 42, 0.78);
    border-color: rgba(100, 116, 139, 0.55);
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-date-btn {
    background: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
    border-color: rgba(71, 85, 105, 0.85);
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-time-col {
    background: rgba(15, 23, 42, 0.6);
    border-right-color: rgba(71, 85, 105, 0.6);
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-time-label {
    color: #e2e8f0;
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-track-wrap {
    background: rgba(15, 23, 42, 0.5);
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-hour-line {
    border-top-color: rgba(148, 163, 184, 0.28);
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-spec-chevron {
    color: #cbd5e1;
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-detail-empty,
body:not(.light-mode) .k-clinic-agenda-page .k-agx-detail-close,
body:not(.light-mode) .k-clinic-agenda-page .k-agx-detail-grid label {
    color: #cbd5e1;
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-detail-grid p {
    color: #f8fafc;
}

body:not(.light-mode) .k-clinic-agenda-page .k-agx-action-btn--ghost {
    background: rgba(30, 41, 59, 0.88);
    color: #e2e8f0;
    border-color: rgba(100, 116, 139, 0.55);
}

@media (max-width: 1280px) {
    .k-clinic-agenda-page .k-agx-layout {
        grid-template-columns: 1fr;
    }

    .k-clinic-agenda-page .k-agx-detail {
        min-height: 0;
        position: static;
    }

    .k-clinic-agenda-page .k-agx-detail::before {
        display: none;
    }
}

@media (max-width: 960px) {
    .k-clinic-agenda-page .k-agx-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .k-clinic-agenda-page .k-agx-toolbar-left {
        width: 100%;
        flex-wrap: wrap;
    }

    .k-clinic-agenda-page .k-agx-specialist-field {
        width: 100%;
    }

    .k-clinic-agenda-page .k-agx-new-btn {
        width: 100%;
        justify-content: center;
    }

    .k-clinic-agenda-page .k-agx-schedule-body {
        grid-template-columns: 78px minmax(0, 1fr);
        height: 560px;
    }

    .k-clinic-agenda-page .k-agx-detail-actions {
        grid-template-columns: 1fr;
    }
}
