@font-face {
    font-family: "Majorant";
    src: url("../fonts/Majorant-Light.otf") format("opentype");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Majorant";
    src: url("../fonts/Majorant-Black.otf") format("opentype");
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --kova-font: "Majorant", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --kova-gray: #575756;
    --kova-yellow: #e7c553;
    --kova-green: #759c57;
    --kova-teal: #76c7cc;
    --kova-teal-dark: #178a94;
    --kova-lime: #c4d65c;
    --kova-lime-dark: #759c57;
    --kova-ink: #17202d;
    --kova-muted: #7e8a99;
    --kova-bg: #f5f8fa;
    --kova-sidebar: #17202d;
    --kova-sidebar-2: #1f2a3a;
    --kova-border: #e6edf2;
    --sidebar-width: 286px;
    --sidebar-width-collapsed: 82px;
    --topbar-height: 78px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--kova-ink);
    background: var(--kova-bg);
    font-family: var(--kova-font);
    font-weight: 300;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-body {
    min-height: 100vh;
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: var(--sidebar-width);
    color: #fff;
    background:
        linear-gradient(180deg, rgba(102, 199, 204, 0.12), transparent 28%),
        var(--kova-sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    transition: width 0.22s ease, transform 0.22s ease;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-link img {
    width: 188px;
    max-width: 100%;
    height: auto;
    display: block;
}

.brand-link img[src*="odontoos-logo"] {
    height: 54px;
    padding: 3px 6px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 4px;
}

.sidebar-icon-btn,
.topbar-icon-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    background: rgba(255, 255, 255, 0.08);
}

.topbar-icon-btn {
    color: var(--kova-ink);
    background: #eef5f7;
}

.topbar-icon-btn:hover,
.sidebar-icon-btn:hover {
    background: rgba(102, 199, 204, 0.18);
}

.kova-help-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
}

.kova-help-menu .dropdown-item i {
    color: var(--kova-teal-dark);
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px 14px;
}

.profile-avatar,
.user-chip-avatar,
.login-mark,
.metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.profile-avatar,
.user-chip-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    color: var(--kova-sidebar);
    background: var(--kova-lime);
    font-weight: 800;
}

.profile-meta {
    min-width: 0;
}

.profile-name,
.profile-role {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-name {
    font-size: 0.94rem;
    font-weight: 700;
}

.profile-role {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.78rem;
}

.sidebar-menu {
    padding: 8px 14px 24px;
    overflow-y: auto;
}

.menu-item,
.menu-section-toggle {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.72);
    background: transparent;
    font-size: 0.92rem;
    font-weight: 650;
    text-align: left;
    transition: background 0.18s ease, color 0.18s ease;
}

.menu-item i,
.menu-section-toggle i:first-child {
    width: 22px;
    color: rgba(102, 199, 204, 0.9);
    font-size: 1.08rem;
}

.menu-item:hover,
.menu-section-toggle:hover,
.menu-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.menu-item.active {
    box-shadow: inset 3px 0 0 var(--kova-lime);
}

.menu-section {
    margin-top: 8px;
}

.menu-section-toggle {
    justify-content: space-between;
}

.menu-section-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.menu-sub {
    display: none;
    padding: 4px 0 0 12px;
}

.menu-section.open .menu-sub {
    display: block;
}

.app-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.22s ease;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--kova-border);
}

.topbar-left,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.doctor-alert-button {
    position: relative;
}

.doctor-alert-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 19px;
    height: 19px;
    border: 2px solid #fff;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--kova-sidebar);
    background: var(--kova-lime);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}

.doctor-alert-menu {
    width: min(360px, calc(100vw - 32px));
    padding: 0;
    overflow: hidden;
}

.doctor-alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--kova-border);
}

.doctor-alert-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px 12px;
}

.doctor-alert-item {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 0;
}

button.doctor-alert-item {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
}

button.doctor-alert-item:hover {
    color: inherit;
    background: rgba(102, 199, 204, 0.08);
}

.doctor-alert-item + .doctor-alert-item {
    border-top: 1px solid var(--kova-border);
}

.doctor-alert-time {
    color: var(--kova-teal-dark);
    font-size: 0.82rem;
    font-weight: 800;
}

.doctor-alert-body {
    min-width: 0;
}

.doctor-alert-body strong,
.doctor-alert-body span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doctor-alert-body span {
    color: var(--kova-muted);
    font-size: 0.84rem;
}

.doctor-alert-body .status-pill {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    color: inherit;
    overflow: visible;
    white-space: normal;
}

.topbar-eyebrow {
    color: var(--kova-muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
}

.topbar-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0;
}

.app-content {
    padding: 28px;
}

.content-panel {
    min-height: calc(100vh - var(--topbar-height) - 56px);
}

.user-chip {
    border: 1px solid var(--kova-border);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 6px 12px 6px 6px;
    color: var(--kova-ink);
    background: #fff;
}

.user-chip::after {
    margin-left: 2px;
}

.user-chip-text {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.btn-kova,
.btn-kova-soft {
    border-radius: 8px;
    font-weight: 750;
}

.btn-kova {
    border-color: var(--kova-teal-dark);
    color: #fff;
    background: var(--kova-teal-dark);
}

.btn-kova:hover {
    border-color: #11747c;
    color: #fff;
    background: #11747c;
}

.btn-kova-soft {
    border-color: rgba(102, 199, 204, 0.28);
    color: var(--kova-teal-dark);
    background: rgba(102, 199, 204, 0.12);
}

.btn-kova-soft:hover {
    border-color: rgba(102, 199, 204, 0.4);
    color: var(--kova-teal-dark);
    background: rgba(102, 199, 204, 0.2);
}

.card-kova,
.module-card,
.table-card {
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(21, 38, 53, 0.05);
}

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

.metric-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px;
}

.metric-label {
    color: var(--kova-muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.metric-value {
    margin-top: 4px;
    font-size: 1.72rem;
    line-height: 1;
    font-weight: 850;
}

.metric-value-sm {
    max-width: 170px;
    font-size: 0.98rem;
    line-height: 1.18;
    overflow-wrap: anywhere;
}

.metric-icon {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    color: var(--kova-teal-dark);
    background: rgba(102, 199, 204, 0.14);
    font-size: 1.28rem;
}

.cash-cut-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.cash-cut-card {
    min-height: 88px;
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

button.cash-cut-card {
    text-align: left;
}

button.cash-cut-card:hover {
    border-color: rgba(102, 199, 204, 0.55);
    background: rgba(102, 199, 204, 0.08);
}

.cash-cut-card span {
    display: block;
    color: var(--kova-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.cash-cut-card strong {
    display: block;
    margin-top: 8px;
    color: var(--kova-sidebar);
    font-size: 1.32rem;
    line-height: 1.08;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.module-card {
    padding: 20px;
}

.module-card h2,
.table-card h2 {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 820;
}

.module-card p {
    color: var(--kova-muted);
}

.table-card {
    overflow: hidden;
}

.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--kova-border);
}

.kova-column-filters th {
    background: #fff;
    padding: 0.62rem 0.75rem;
}

.kova-column-filters .form-control,
.kova-column-filters .form-select {
    min-height: 34px;
    font-size: 0.78rem;
}

.select2-container {
    width: 100% !important;
    font-family: var(--kova-font);
}

.select2-container--default .select2-selection--single {
    min-height: 38px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    background: #fff;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    width: 100%;
    padding-left: 0.75rem;
    padding-right: 2rem;
    color: var(--kova-ink);
    line-height: 36px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
    right: 8px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: rgba(23, 138, 148, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(102, 199, 204, 0.22);
}

.select2-container--default .select2-selection--single.is-invalid,
.select2-container--default .select2-selection--multiple.is-invalid {
    border-color: #dc3545;
}

.select2-dropdown {
    border-color: var(--kova-border);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(21, 38, 53, 0.12);
    overflow: hidden;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    color: #fff;
    background: var(--kova-teal-dark);
}

.invalid-feedback {
    font-size: 0.78rem;
    font-weight: 650;
}

.dataTables_wrapper .datatable-footer {
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--kova-border);
    background: #fff;
}

.dataTables_wrapper .dataTables_info {
    padding: 0;
    color: var(--kova-muted);
    font-size: 0.82rem;
}

.dataTables_wrapper .pagination {
    margin: 0;
}

.dataTables_wrapper .page-link {
    color: var(--kova-teal-dark);
}

.dataTables_wrapper .active > .page-link,
.dataTables_wrapper .page-link.active {
    border-color: var(--kova-teal-dark);
    background: var(--kova-teal-dark);
}

.clinical-modal {
    max-width: min(1380px, calc(100vw - 32px));
}

.clinical-modal .modal-body {
    max-height: calc(100vh - 168px);
    overflow: auto;
    background: var(--kova-bg);
}

.clinical-modal .module-card,
.clinical-modal .table-card {
    box-shadow: none;
}

.expediente-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.expediente-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--kova-border);
    border-left: 6px solid var(--kova-teal-dark);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.expediente-hero h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 900;
}

.expediente-hero p {
    margin: 4px 0 0;
    color: var(--kova-muted);
}

.expediente-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.expediente-tab-btn {
    min-height: 38px;
    font-weight: 850;
}

.expediente-tab-panel {
    min-height: 260px;
}

.expediente-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.expediente-metrics div {
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.expediente-metrics span {
    display: block;
    color: var(--kova-muted);
    font-size: 0.76rem;
    font-weight: 780;
}

.expediente-metrics strong {
    display: block;
    margin-top: 3px;
    font-size: 1.02rem;
    font-weight: 900;
}

.expediente-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.expediente-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}

.empty-mini-state {
    margin-top: 12px;
    border: 1px dashed var(--kova-border);
    border-radius: 8px;
    padding: 18px;
    color: var(--kova-muted);
    background: #fbfdfe;
    font-weight: 750;
    text-align: center;
}

.patient-actions {
    display: inline-flex;
    justify-content: flex-end;
    gap: 6px;
}

.patient-actions .btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.color-swatch {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    border: 1px solid rgba(21, 38, 53, 0.12);
    border-radius: 6px;
}

.brand-preview-img {
    width: 100%;
    max-width: 180px;
    max-height: 84px;
    object-fit: contain;
    padding: 12px;
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    background: #fff;
}

.brand-preview-dark {
    width: 100%;
    max-width: 200px;
    padding: 14px;
    border-radius: 8px;
    background: var(--kova-sidebar);
}

.brand-preview-dark .brand-preview-img {
    border-color: rgba(255, 255, 255, .16);
    background: transparent;
    padding: 0;
}

.brand-live-preview {
    min-height: 68px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--kova-teal) 36%, #dbe5eb);
    border-left: 6px solid var(--kova-teal);
    border-radius: 8px;
    background: color-mix(in srgb, var(--kova-teal) 8%, #fff);
}

.brand-live-preview span {
    color: var(--kova-muted);
}

.brand-live-preview strong {
    color: var(--kova-sidebar);
    font-weight: 900;
}

.appointment-actions {
    min-width: 118px;
}

.agenda-patient-panel,
.quick-patient-card,
.selected-patient-box {
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.agenda-patient-results {
    max-height: 220px;
    overflow: auto;
}

.agenda-patient-results .list-group-item {
    border-color: var(--kova-border);
}

.agenda-visual-shell {
    padding: 16px 20px 20px;
    border-bottom: 1px solid var(--kova-border);
    background: #fbfdfe;
}

.agenda-visual-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.agenda-visual-toolbar h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 820;
    text-transform: capitalize;
}

.agenda-visual-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.agenda-visual-actions .btn-kova-soft {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.agenda-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 10px;
    color: var(--kova-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.agenda-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.legend-free {
    background: rgba(91, 204, 174, 0.72);
}

.legend-busy {
    background: var(--kova-teal-dark);
}

.legend-closed {
    background: #a6b0ba;
}

.legend-warn {
    background: var(--kova-yellow);
}

.legend-danger {
    background: #dc5c4e;
}

.agenda-availability-summary {
    margin-bottom: 12px;
    color: var(--kova-muted);
    font-size: 0.84rem;
}

.agenda-availability-summary strong {
    color: var(--kova-ink);
}

.agenda-week-scroll {
    overflow: auto;
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    background: #fff;
}

.agenda-doctor-timeline {
    margin-top: 14px;
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.agenda-timeline-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--kova-border);
    background: #f8fafc;
}

.agenda-timeline-heading h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 850;
}

.agenda-doctor-row {
    display: grid;
    grid-template-columns: minmax(220px, 0.9fr) minmax(190px, 0.75fr) minmax(360px, 2fr);
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--kova-border);
}

.agenda-doctor-row:last-child {
    border-bottom: 0;
}

.agenda-doctor-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.agenda-doctor-meta strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 850;
}

.agenda-doctor-color {
    width: 14px;
    height: 42px;
    border-radius: 999px;
    background: var(--doctor-color, var(--kova-teal-dark));
    flex: 0 0 auto;
}

.agenda-doctor-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--kova-muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.agenda-doctor-stats span {
    border: 1px solid var(--kova-border);
    border-radius: 999px;
    padding: 5px 9px;
    background: #fbfdfe;
}

.agenda-hour-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.agenda-hour-chip {
    min-height: 30px;
    border: 1px solid var(--kova-border);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 0.74rem;
    font-weight: 850;
    white-space: nowrap;
}

button.agenda-hour-chip {
    cursor: pointer;
}

.agenda-hour-chip.is-free {
    color: #19715e;
    border-color: rgba(25, 113, 94, 0.24);
    background: rgba(91, 204, 174, 0.12);
}

.agenda-hour-chip.is-free:hover,
.agenda-hour-chip.is-free:focus {
    color: #fff;
    border-color: var(--doctor-color, var(--kova-teal-dark));
    background: var(--doctor-color, var(--kova-teal-dark));
    outline: 0;
}

.agenda-hour-chip.is-busy {
    color: #17657a;
    background: rgba(102, 199, 204, 0.14);
}

.agenda-hour-chip.is-muted,
.agenda-hour-chip.is-closed {
    color: var(--kova-muted);
    background: #f4f7f9;
}

.agenda-empty-timeline {
    padding: 18px;
    color: var(--kova-muted);
    font-weight: 750;
    text-align: center;
}

.agenda-week-grid {
    display: grid;
    grid-template-columns: 72px repeat(7, minmax(136px, 1fr));
    min-width: 1040px;
}

.agenda-grid-corner,
.agenda-day-heading,
.agenda-time-label,
.agenda-slot-cell {
    border-right: 1px solid var(--kova-border);
    border-bottom: 1px solid var(--kova-border);
}

.agenda-grid-corner {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--kova-muted);
    background: #f8fafc;
    font-size: 0.78rem;
    font-weight: 800;
}

.agenda-day-heading {
    min-height: 62px;
    border-top: 0;
    border-left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--kova-ink);
    background: #f8fafc;
}

.agenda-day-heading span {
    color: var(--kova-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.agenda-day-heading strong {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 850;
}

.agenda-day-heading.is-selected strong,
.agenda-day-heading.is-today strong {
    color: #fff;
    background: var(--kova-teal-dark);
}

.agenda-day-heading.is-selected {
    background: rgba(102, 199, 204, 0.12);
}

.agenda-time-label {
    min-height: 62px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10px;
    color: var(--kova-muted);
    background: #f8fafc;
    font-size: 0.78rem;
    font-weight: 800;
}

.agenda-slot-cell {
    position: relative;
    min-height: 62px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 5px;
    background: #fff;
    cursor: pointer;
    transition: background 0.16s ease, box-shadow 0.16s ease;
}

.agenda-slot-cell.is-selected-day {
    background: #fcfef5;
}

.agenda-slot-cell.is-free:hover,
.agenda-slot-cell.is-free:focus {
    background: rgba(91, 204, 174, 0.13);
    box-shadow: inset 0 0 0 2px rgba(25, 113, 94, 0.2);
    outline: 0;
}

.agenda-slot-cell.is-busy {
    background: rgba(23, 138, 148, 0.04);
}

.agenda-slot-cell.is-closed {
    background: #f1f4f6;
    cursor: not-allowed;
}

.agenda-free-label {
    min-height: 48px;
    border: 1px dashed rgba(25, 113, 94, 0.22);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #19715e;
    background: rgba(91, 204, 174, 0.08);
    font-size: 0.75rem;
    font-weight: 800;
}

.agenda-closed-label {
    min-height: 48px;
    border: 1px dashed #d1d8df;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #8a96a3;
    background: #f8fafc;
    font-size: 0.75rem;
    font-weight: 800;
}

.agenda-free-chip {
    align-self: flex-start;
    border-radius: 999px;
    padding: 2px 8px;
    color: #19715e;
    background: rgba(91, 204, 174, 0.18);
    font-size: 0.68rem;
    font-weight: 850;
}

.agenda-event {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-left: 5px solid var(--doctor-color, var(--kova-teal-dark));
    border-radius: 8px;
    display: block;
    padding: 6px 7px;
    color: var(--kova-ink);
    background: rgba(102, 199, 204, 0.16);
    text-align: left;
    overflow: hidden;
}

.agenda-event:hover,
.agenda-event:focus {
    outline: 0;
    box-shadow: 0 0 0 2px rgba(23, 138, 148, 0.22);
}

.agenda-event strong,
.agenda-event span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agenda-event strong {
    margin-top: 1px;
    font-size: 0.78rem;
    font-weight: 850;
}

.agenda-event span {
    color: #455160;
    font-size: 0.7rem;
    font-weight: 700;
}

.agenda-event-time {
    color: var(--kova-teal-dark) !important;
}

.agenda-event-pendiente,
.agenda-event-reprogramada {
    background: rgba(231, 197, 83, 0.28);
}

.agenda-event-confirmada,
.agenda-event-atendida {
    background: rgba(91, 204, 174, 0.2);
}

.agenda-event-cancelada,
.agenda-event-no_asistio {
    background: rgba(220, 92, 78, 0.15);
}

.agenda-continuation {
    min-height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    color: var(--kova-muted);
    background: rgba(23, 138, 148, 0.07);
    font-size: 0.72rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agenda-more {
    color: var(--kova-muted);
    font-size: 0.7rem;
    font-weight: 800;
}

.selected-patient-box {
    background: var(--kova-teal-soft);
}

.quick-patient-card {
    background: #f8fafc;
}

.tarifa-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    background: #f8fafc;
    padding: 14px;
}

.tarifa-summary span {
    display: block;
    color: var(--kova-muted);
    font-size: 0.78rem;
}

.tarifa-summary strong {
    display: block;
    margin-top: 2px;
}

.table > :not(caption) > * > * {
    padding: 0.92rem 1rem;
}

.status-pill {
    border-radius: 999px;
    padding: 0.32rem 0.62rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 800;
}

.status-ok {
    color: #19715e;
    background: rgba(91, 204, 174, 0.18);
}

.status-warn {
    color: #875700;
    background: rgba(201, 220, 78, 0.24);
}

.status-info {
    color: #17657a;
    background: rgba(102, 199, 204, 0.16);
}

.status-danger {
    color: #9b2f22;
    background: rgba(220, 92, 78, 0.14);
}

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

.kova-tour-layer {
    position: fixed;
    inset: 0;
    z-index: 2050;
    pointer-events: auto;
}

.kova-tour-layer.is-hidden {
    display: none;
}

.kova-tour-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    pointer-events: auto;
}

.kova-tour-spotlight {
    position: fixed;
    border: 3px solid var(--kova-teal);
    border-radius: 12px;
    box-shadow:
        0 0 0 9999px rgba(15, 23, 42, 0.48),
        0 20px 60px rgba(15, 23, 42, 0.28);
    transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, height 0.18s ease;
    pointer-events: none;
}

.kova-tour-card {
    position: fixed;
    width: min(390px, calc(100vw - 28px));
    border: 1px solid rgba(102, 199, 204, 0.5);
    border-radius: 8px;
    color: var(--kova-ink);
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    pointer-events: auto;
}

.kova-tour-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    color: #fff;
    background: var(--kova-teal-dark);
}

.kova-tour-card-header strong {
    font-size: 0.95rem;
    font-weight: 900;
}

.kova-tour-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
}

.kova-tour-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

.kova-tour-progress {
    height: 4px;
    background: rgba(102, 199, 204, 0.2);
}

.kova-tour-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--kova-lime);
    transition: width 0.18s ease;
}

.kova-tour-card-body {
    padding: 16px 16px 12px;
}

.kova-tour-card-body h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 900;
}

.kova-tour-card-body p {
    margin: 0;
    color: var(--kova-muted);
    line-height: 1.45;
}

.kova-tour-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px 16px;
}

.kova-tour-count {
    color: var(--kova-muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.kova-tour-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 575px) {
    .kova-tour-card {
        left: 14px !important;
        right: 14px;
        width: auto;
    }

    .kova-tour-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .kova-tour-actions {
        justify-content: stretch;
    }

    .kova-tour-actions .btn {
        flex: 1 1 auto;
    }
}

.odontograma-board {
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    padding: 18px;
    background: #fbfdfe;
    overflow-x: auto;
}

.dental-arch + .dental-midline,
.dental-midline + .dental-arch {
    margin-top: 18px;
}

.dental-arch-label {
    margin-bottom: 10px;
    color: var(--kova-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.dental-midline {
    height: 1px;
    background: var(--kova-border);
}

.tooth-grid {
    display: grid;
    grid-template-columns: repeat(16, minmax(54px, 1fr));
    gap: 8px;
    min-width: 840px;
}

.tooth-card {
    position: relative;
    min-height: 112px;
    border: 1px solid #d9e4ea;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 8px 6px;
    color: var(--kova-ink);
    background: #fff;
    text-align: center;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.tooth-card:hover {
    border-color: var(--tooth-color, var(--kova-teal-dark));
    box-shadow: 0 8px 18px rgba(21, 38, 53, 0.08);
    transform: translateY(-1px);
}

.tooth-card.selected {
    border-color: var(--kova-teal-dark);
    box-shadow: 0 0 0 3px rgba(102, 199, 204, 0.24);
}

.tooth-card.has-detail {
    border-color: var(--tooth-color, #64748b);
    background: color-mix(in srgb, var(--tooth-color, #64748b) 12%, #fff);
}

.tooth-card-empty {
    justify-content: center;
    color: var(--kova-muted);
    background: #f4f7f9;
}

.tooth-crown {
    width: 32px;
    height: 42px;
    border: 2px solid var(--tooth-color, #cbd5e1);
    border-radius: 12px 12px 8px 8px;
    display: block;
    background: linear-gradient(180deg, #fff 0%, #eef4f7 100%);
}

.tooth-number {
    font-size: 0.9rem;
    line-height: 1.05;
    font-weight: 850;
}

.tooth-name {
    width: 100%;
    min-height: 26px;
    color: var(--kova-muted);
    font-size: 0.68rem;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tooth-count {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 19px;
    height: 19px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--tooth-color, #64748b);
    font-size: 0.68rem;
    font-weight: 850;
}

.condition-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.condition-chip {
    border: 1px solid var(--kova-border);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 10px;
    color: var(--kova-ink);
    background: #fff;
    font-size: 0.78rem;
    font-weight: 750;
}

.condition-chip:hover {
    border-color: rgba(102, 199, 204, 0.55);
    background: rgba(102, 199, 204, 0.08);
}

.condition-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 auto;
}

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(380px, 480px) 1fr;
    background: #fff;
}

.login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px;
}

.login-logo {
    width: 260px;
    max-width: 100%;
    margin-bottom: 34px;
}

.odontoos-login-logo {
    height: 150px;
    object-fit: contain;
    margin-bottom: 18px;
}

.login-page .btn-kova {
    color: #ffffff;
    background: #087d88;
    border-color: #087d88;
}

.login-page .btn-kova:hover,
.login-page .btn-kova:focus {
    color: #ffffff;
    background: #056b75;
    border-color: #056b75;
}

.login-card {
    width: 100%;
    max-width: 390px;
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 1.7rem;
    font-weight: 850;
}

.login-card p {
    color: var(--kova-muted);
}

.login-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(23, 138, 148, 0.95), rgba(21, 38, 53, 0.98)),
        var(--kova-sidebar);
}

.login-page .login-visual {
    background: #061a33;
}

.login-visual .odontoos-visual-logo {
    padding: 10px;
    background: #ffffff;
    border-radius: 6px;
}

.login-page .login-mark {
    color: #061a33;
    background: #08bfc3;
}

.login-visual-inner {
    width: min(620px, 72%);
}

.login-visual img {
    width: 320px;
    max-width: 100%;
    margin-bottom: 40px;
}

.login-visual h2 {
    font-size: 2.4rem;
    font-weight: 850;
}

.login-visual p {
    max-width: 520px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 1.02rem;
}

.login-mark {
    width: 74px;
    height: 74px;
    border-radius: 18px;
    margin-bottom: 22px;
    color: var(--kova-sidebar);
    background: var(--kova-lime);
    font-size: 2rem;
}

.alert-login {
    display: none;
}

.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-width-collapsed);
}

.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-width-collapsed);
}

.sidebar-collapsed .brand-link img,
.sidebar-collapsed .profile-meta,
.sidebar-collapsed .menu-item span,
.sidebar-collapsed .menu-section-toggle span,
.sidebar-collapsed .menu-section-toggle .bi-chevron-down {
    display: none;
}

.sidebar-collapsed .sidebar-brand,
.sidebar-collapsed .sidebar-profile,
.sidebar-collapsed .menu-item,
.sidebar-collapsed .menu-section-toggle {
    justify-content: center;
}

.sidebar-collapsed .menu-sub {
    padding-left: 0;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1199px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .expediente-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: min(86vw, var(--sidebar-width));
    }

    .sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1035;
        display: block;
        background: rgba(21, 38, 53, 0.48);
    }

    .app-main,
    .sidebar-collapsed .app-main {
        margin-left: 0;
    }

    .app-topbar {
        padding: 0 18px;
    }

    .app-content {
        padding: 18px;
    }

    .login-page {
        grid-template-columns: 1fr;
    }

    .login-visual {
        display: none;
    }
}

@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .topbar-actions .btn-kova-soft span,
    .user-chip-text {
        display: none;
    }

    .login-panel {
        padding: 32px 22px;
    }

    .table-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .tarifa-summary {
        grid-template-columns: 1fr;
    }

    .agenda-visual-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .agenda-timeline-heading,
    .expediente-hero,
    .expediente-list-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .agenda-visual-actions {
        width: 100%;
    }

    .agenda-visual-actions .btn-light {
        flex: 1;
    }

    .agenda-week-grid {
        grid-template-columns: 66px repeat(7, minmax(122px, 1fr));
        min-width: 920px;
    }

    .agenda-slot-cell,
    .agenda-time-label {
        min-height: 58px;
    }

    .expediente-metrics {
        grid-template-columns: 1fr;
    }

    .cash-cut-grid {
        grid-template-columns: 1fr;
    }

    .odontograma-board {
        padding: 12px;
    }

    .tooth-grid {
        grid-template-columns: repeat(8, minmax(54px, 1fr));
        min-width: 448px;
    }

    .tooth-card {
        min-height: 104px;
    }
}
