:root {
    --brand-primary: #0d9488;
    --brand-primary-dark: #0f766e;
    --brand-primary-light: #ccfbf1;
    --brand-accent: #4f46e5;
    --ink-900: #0f172a;
    --ink-700: #334155;
    --ink-500: #64748b;
    --surface: #ffffff;
    --bg-app: #f4f7fb;
    --border-soft: #e2e8f0;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
    --shadow-md: 0 10px 25px rgba(15, 23, 42, .08);
    --shadow-lg: 0 24px 48px rgba(15, 23, 42, .16);
}

body {
    background: var(--bg-app);
    color: var(--ink-900);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

h1, h2, h3, h4, h5 {
    font-weight: 700;
    letter-spacing: -0.01em;
}

a { color: var(--brand-primary); }
a:hover { color: var(--brand-primary-dark); }

/* App shell: sidebar + main */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 264px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--ink-900), #0b2b28 60%, var(--brand-primary-dark));
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    transition: transform .25s ease;
}
.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.5rem 1.25rem 1rem;
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    text-decoration: none;
}
.app-sidebar-brand i { font-size: 1.3rem; color: var(--brand-primary-light); }
.app-sidebar-brand:hover { color: #fff; }

.app-nav {
    flex: 1;
    overflow-y: auto;
    padding: .5rem .75rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.app-nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .85rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, .72);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: all .15s ease;
}
.app-nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; }
.app-nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.app-nav-link.active { background: var(--brand-primary); color: #fff; box-shadow: var(--shadow-sm); }

.app-nav-section {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .08em;
    font-weight: 700;
    color: rgba(255, 255, 255, .4);
    padding: 1.1rem .85rem .4rem;
}

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1rem 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
}
.app-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    flex-shrink: 0;
}
.app-user-info { flex: 1; min-width: 0; }
.app-user-name { color: #fff; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-user-role { color: rgba(255, 255, 255, .5); font-size: .72rem; }
.app-user-logout { color: rgba(255, 255, 255, .6); font-size: 1.1rem; flex-shrink: 0; }
.app-user-logout:hover { color: #fff; }

.app-main { flex: 1; margin-left: 264px; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    padding: .75rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.app-sidebar-toggle { border: none; background: none; font-size: 1.4rem; color: var(--ink-900); padding: 0; line-height: 1; }
.app-content { padding: 2rem; max-width: 1400px; width: 100%; margin: 0 auto; }

.app-sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 1035; }
.app-sidebar-backdrop-visible { display: block; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.app-sidebar-abierto { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .app-content { padding: 1.25rem; }
}

/* Cards */
.card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card .card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    font-weight: 600;
}
.card.text-center.h-100 {
    transition: transform .18s ease, box-shadow .18s ease;
}
.card.text-center.h-100:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.card.text-center.h-100 .display-6 {
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Buttons */
.btn { border-radius: var(--radius-sm); font-weight: 500; }
.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
    border: none;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover, .btn-primary:focus {
    filter: brightness(1.06);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.btn-outline-primary { border-color: var(--brand-primary); color: var(--brand-primary-dark); }
.btn-outline-primary:hover { background: var(--brand-primary); border-color: var(--brand-primary); }

/* Tables */
.table { border-radius: var(--radius-md); overflow: hidden; background: var(--surface); margin-bottom: 0; font-size: .86rem; }
.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-soft);
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .04em;
    color: var(--ink-500);
    font-weight: 700;
    padding: .5rem .85rem;
    white-space: nowrap;
}
.table td { padding: .42rem .85rem; border-bottom: 1px solid var(--border-soft); border-top: none; }
.table td, .table th { vertical-align: middle; }
.table-bordered { border-color: var(--border-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color .12s ease; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table tbody tr:nth-child(even):not(:hover) { background: rgba(15, 23, 42, .012); }

/* Card que envuelve una tabla de listado */
.table-card { overflow: hidden; }
.table-card .card-body { padding: 0; }
.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem .75rem;
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--border-soft);
}
.table-toolbar-title { font-weight: 700; font-size: .85rem; color: var(--ink-900); display: flex; align-items: center; gap: .5rem; }
.table-toolbar-title i { color: var(--brand-primary); }
.table-count {
    font-size: .7rem;
    font-weight: 700;
    color: var(--ink-500);
    background: #f1f5f9;
    border-radius: 999px;
    padding: .15em .65em;
}
.table-toolbar-actions { display: flex; align-items: center; gap: .5rem; }

/* Botones de acción tipo ícono dentro de tablas */
.btn-icon {
    width: 26px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    line-height: 1;
}
.btn-icon i { font-size: .82rem; }

/* Estado vacío dentro de una tabla */
.table-empty-state { padding: 2rem 1rem; text-align: center; color: var(--ink-500); font-size: .85rem; }
.table-empty-state i { font-size: 1.6rem; color: var(--border-soft); display: block; margin-bottom: .4rem; }

/* Badges */
.badge { border-radius: 999px; padding: .38em .75em; font-weight: 600; letter-spacing: .01em; font-size: .72rem; }

/* Forms */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-soft);
    padding: .55rem .85rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 .2rem rgba(13, 148, 136, .15);
}

/* Modals */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--border-soft); }
.modal-footer { border-top: 1px solid var(--border-soft); }

/* Login page */
.login-shell {
    min-height: 100vh;
    display: flex;
}
.login-panel-brand {
    flex: 1;
    background: linear-gradient(155deg, var(--ink-900), var(--brand-primary-dark) 120%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    position: relative;
    overflow: hidden;
}
.login-panel-brand::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(13, 148, 136, .35), transparent 70%);
    top: -150px;
    right: -150px;
}
.login-panel-brand h1 { font-size: 2.2rem; max-width: 420px; }
.login-panel-brand p { color: rgba(255, 255, 255, .75); max-width: 380px; }
.login-panel-form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-app);
    padding: 2rem;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
}
@media (max-width: 860px) {
    .login-panel-brand { display: none; }
}

/* Agenda pública */
.agenda-hero {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    border-radius: var(--radius-lg);
    color: #fff;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}
.agenda-hero img { border-radius: var(--radius-md); background: #fff; padding: .5rem; }
.agenda-hero .text-muted { color: rgba(255, 255, 255, .85) !important; }
#listaSlots .btn { border-radius: 999px; min-width: 74px; }
