* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #111827;
}

/* Utilidades */

.text-muted {
    color: #9ca3af;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Login */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: radial-gradient(circle at top left, #bfdbfe 0, #f3f4f6 40%, #e5e7eb 100%);
}

.login-hero {
    flex: 1;
    background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #eff6ff;
}

.login-hero h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.login-hero p {
    font-size: 14px;
    max-width: 420px;
}

.login-hero-metrics {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.login-hero-metric {
    background: rgba(15, 23, 42, 0.16);
    border-radius: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(191, 219, 254, 0.9);
    backdrop-filter: blur(8px);
}

.login-hero-metric .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #e5e7eb;
    margin-bottom: 6px;
}

.login-hero-metric .value {
    font-size: 18px;
    font-weight: 600;
}

.login-hero-visual {
    margin-top: 32px;
}

.hero-figure {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(191, 219, 254, 0.9);
    box-shadow: 0 18px 35px rgba(15,23,42,0.45);
}

.hero-illustration {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}

.hero-caption {
    font-size: 12px;
    color: #e5e7eb;
}

/* Lado del formulario */

.login-form-side {
    flex: 1;
    padding: 40px 32px;
    background: #f3f4f6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 24px;
    padding: 28px 24px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.12);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.logo-img {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: #eff6ff;
    padding: 3px;
}

.login-logo-text {
    font-size: 30px;
    font-weight: 600;
    color: #050505;
}

.login-logo-sub {
    font-size: 11px;
    color: #6b7280;
}

.login-card h2 {
    font-size: 20px;
    margin-bottom: 6px;
}

.login-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.login-back-wrapper {
    text-align: center;
    margin-top: 12px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.btn-back-hub {
    background: linear-gradient(135deg, #ff8a00, #ff6600);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(255, 102, 0, 0.26);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.login-card p {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 18px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
    color: #111827;
}

.form-control, .form-select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    font-size: 13px;
}

.form-control:focus, .form-select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
    border-color: #3b82f6;
}

.helper-text {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

.row-inline {
    display: flex;
    gap: 10px;
}

.row-inline > * {
    flex: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.btn-primary {
    background: #00C5A1;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(0, 197, 161, 0.35);
    width: 100%;
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(0, 197, 161, 0.4);
}

.btn-secondary {
    background: #003c46;
    color: #e6f7f9;
    border: 1px solid #002f36;
    font-size: 12px;
    padding: 6px 10px;
}

.btn-secondary:hover {
    background: #05515d;
}

.login-footer {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #6b7280;
}

/* Layout principal dashboard */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: transparent;
}

.sidebar {
    width: 244px;
    background: #003C46;
    border-right: 1px solid #002f36;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    color: #e6f7f9;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-img {
    width: 30px;
    height: 30px;
    border-radius: 12px;
    background: #eff6ff;
    padding: 3px;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: #e6f7f9;
}

.sidebar-subtitle {
    font-size: 11px;
    color: #5fb6c4;
}

.sidebar-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7fd0db;
    margin-bottom: 4px;
}

.sidebar-user {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 10px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
}

.sidebar-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.sidebar-user-name {
    font-weight: 600;
}

.sidebar-role {
    font-size: 11px;
    color: #b7e3ea;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav button {
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: #e6f7f9;
    padding: 7px 10px;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-nav button span.icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.sidebar-nav button.active {
    background: rgba(255, 128, 93, 0.18);
    border-color: #ff805d;
    color: #ffdbc9;
}

.sidebar-nav button:hover:not(.active):not(.disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav button.disabled {
    opacity: 0.45;
    cursor: default;
}

.sidebar-footer {
    margin-top: auto;
    font-size: 11px;
    color: #e6f7f9;
    line-height: 1.4;
}

.sidebar-footer-brand {
    margin-top: 4px;
    font-size: 10px;
    color: #5fb6c4;
}

/* Área principal */

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    color: #0f172a;
}

.topbar {
    height: 56px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.topbar-left {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.topbar-subtitle {
    font-size: 12px;
    color: #5fb6c4;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: #0f172a;
}

.pill {
    border-radius: 999px;
    border: 1px solid #ff805d;
    padding: 6px 12px;
    background: #ffe8e0;
    color: #9b3c24;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.session-pill {
    font-size: 13px;
    padding: 8px 14px;
    min-height: 38px;
}
.topbar .btn-secondary {
    min-height: 38px;
    padding: 8px 14px;
}

.session-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.session-countdown {
    font-variant-numeric: tabular-nums;
}

.pill-warning {
    border-color: #fbbf24;
    background: #fffbeb;
    color: #92400e;
}

.pill-danger {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}

.main-content {
    padding: 18px 20px 28px 20px;
    overflow: auto;
}

/* Tarjetas y grillas */

.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.card {
    background: #c8eef0;
    border-radius: 18px;
    padding: 14px 14px 12px 14px;
    border: 1px solid #9ed5da;
    box-shadow: 0 8px 18px rgba(0, 60, 70, 0.12);
    color: #0f172a;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: #003c46;
}

.card-subtitle {
    font-size: 11px;
    color: #3B6170;
}

.card-main-value {
    font-size: 20px;
    font-weight: 600;
    margin-top: 6px;
    color: #003c46;
}

.card-trend {
    font-size: 12px;
    margin-top: 4px;
}

.text-up {
    color: #0A8F57;
}

.text-down {
    color: #dc2626;
}

/* Tabla simple */

.table-wrapper {
    margin-top: 12px;
    border-radius: 16px;
    border: 1px solid #9ed5da;
    overflow: hidden;
    background: #ffffff;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: #0f172a;
}

.table thead {
    background: #e8f6f8;
}

.table th,
.table td {
    padding: 8px 10px;
    border-bottom: 1px solid #d1e9ec;
}

.table th {
    text-align: left;
    font-weight: 500;
    color: #5fb6c4;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.table tbody tr:nth-child(odd) td {
    background: #ffffff;
}

.table tbody tr:nth-child(even) td {
    background: #f6fcfd;
}

.chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
}

.chip-green {
    background: #e3f9f2;
    color: #29c58f;
}

.chip-amber {
    background: #fef3c7;
    color: #92400e;
}

.chip-red {
    background: #fee2e2;
    color: #b91c1c;
}

/* Encabezados de sección */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #003c46;
}

.section-subtitle {
    font-size: 12px;
    color: #5fb6c4;
}

/* Calendario de citas */

.calendar-wrapper {
    margin-top: 18px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.calendar-title {
    font-size: 14px;
    font-weight: 600;
}

.calendar-subtitle {
    font-size: 11px;
    color: #5fb6c4;
}

.calendar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.calendar-actions .pill {
    min-height: 36px;
    padding: 8px 14px;
}
.calendar-actions .btn-primary {
    width: auto;
    margin: 0;
    min-height: 36px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
}

.calendar-day {
    background: #c8eef0;
    border-radius: 14px;
    border: 1px solid #9ed5da;
    padding: 8px 8px 6px 8px;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    min-height: 140px;
    color: #0f172a;
}

.calendar-day-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.calendar-day-name {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5fb6c4;
}

.calendar-day-date {
    font-weight: 600;
    font-size: 12px;
}

.calendar-day-appointments {
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 40px;
}

.calendar-day-appointments.drag-over {
    background: #e8f6f8;
    border-radius: 10px;
    outline: 1px dashed #60a5fa;
    outline-offset: 2px;
}

.appointment-pill {
    border-radius: 999px;
    padding: 3px 6px;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #d1e9ec;
    font-size: 10px;
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

.appointment-pill.dragging {
    opacity: 0.7;
    box-shadow: 0 0 0 2px #60a5fa;
}

.clinicops-page {
    min-height: 100vh;
    background: linear-gradient(135deg, rgba(14,54,122,0.85), rgba(14,54,122,0.6)),
                url('assets/bg_calendar.jpg') center/cover no-repeat;
}
.clinicops-page .login-wrapper {
    background: transparent;
}
.clinicops-page .login-hero {
    background: linear-gradient(135deg, rgba(29,78,216,0.35), rgba(14,165,233,0.25));
}
.clinicops-page .login-form-side {
    background: rgba(243,244,246,0.55);
}
.clinicops-page .login-card {
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(229, 231, 235, 0.6);
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
}

/* Fondo neutro para el dashboard */
body.clinicops-shell {
  background: #e8f6f8;
}

/* En el contenedor principal, fondo neutro */
body.clinicops-shell .app-shell {
  background: #ffffff;
}

/* Modal genérico */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    width: 560px;
    max-width: 96vw;
    box-shadow: 0 18px 36px rgba(0, 60, 70, 0.22);
    border: 1px solid #d1e9ec;
}

.modal.modal-wide {
    width: 720px;
    max-width: 98vw;
}

.modal-header h4 {
    margin: 0 0 8px 0;
    color: #003c46;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-x: auto;
}

.modal-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #003c46;
}

.modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.modal-actions .btn {
    min-height: 46px;
    padding: 0 16px;
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    margin-top: 0;
    width: 100%;
}


/* Responsivo */

@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .main-area {
        border-left: none;
    }

    .topbar {
        padding: 0 14px;
    }

    .login-wrapper {
        flex-direction: column;
    }

    .login-hero {
        display: none;
    }

    .login-form-side {
        padding: 24px 18px;
    }

    .calendar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
