@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-w: 256px;

    --bg:          #080c0a;
    --sidebar-bg:  #0d1410;
    --topbar-bg:   #0d1410;
    --card-bg:     #111a13;
    --card-bg2:    #141f16;
    --surface:     #192b1c;
    --surface-h:   #1f3522;

    --border:       #1e3222;
    --border-light: rgba(255,255,255,0.055);
    --border-glow:  rgba(34, 197, 94, 0.2);

    --primary:        #22c55e;
    --primary-hover:  #16a34a;
    --primary-dark:   #15803d;
    --primary-light:  #4ade80;
    --primary-alpha:  rgba(34, 197, 94, 0.12);
    --primary-glow:   rgba(34, 197, 94, 0.22);
    --primary-soft:   rgba(34, 197, 94, 0.06);

    --success:        #22c55e;
    --success-alpha:  rgba(34, 197, 94, 0.13);
    --danger:         #ef4444;
    --danger-alpha:   rgba(239, 68, 68, 0.13);
    --warning:        #f59e0b;
    --warning-alpha:  rgba(245, 158, 11, 0.13);
    --info:           #3b82f6;
    --info-alpha:     rgba(59, 130, 246, 0.13);

    --text:        #ddeede;
    --text-soft:   #a0b8a4;
    --text-muted:  #587060;
    --text-dim:    #374d3c;

    --radius-xl:  18px;
    --radius-lg:  12px;
    --radius-md:  8px;
    --radius-sm:  6px;
    --radius-full:999px;
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.35);
    --shadow-md:  0 8px 24px rgba(0,0,0,0.45);
    --shadow-lg:  0 16px 48px rgba(0,0,0,0.55);
}

html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary), var(--primary-light));
}

.sidebar-logo {
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 3px;
}

.sidebar-logo .icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #071009;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.sidebar-logo .brand {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.2;
}

.sidebar-logo .brand small {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.1rem;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-title {
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 0 0.65rem;
    margin: 1.2rem 0 0.35rem;
}

.nav-section-title:first-child { margin-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.68rem 0.85rem;
    border-radius: var(--radius-md);
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.18s ease;
    margin-bottom: 0.15rem;
    position: relative;
}

.nav-item:hover {
    background: var(--primary-soft);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-alpha);
    color: var(--primary-light);
    border: 1px solid var(--primary-glow);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: var(--primary);
    border-radius: var(--radius-full);
}

.nav-icon { flex-shrink: 0; display: flex; align-items: center; opacity: 0.8; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-bottom {
    padding: 0.85rem 0.75rem;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
}

.sidebar-user .avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #061008;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem;
    font-weight: 800;
    flex-shrink: 0;
}

.sidebar-user .info { font-size: 0.8rem; }
.sidebar-user .info .name { font-weight: 700; color: var(--text); }
.sidebar-user .info .role { color: var(--text-muted); font-size: 0.68rem; margin-top: 0.05rem; }

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}

.topbar {
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.9rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.topbar-actions { display: flex; align-items: center; gap: 0.65rem; }

.topbar-date {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
}

.page-content {
    padding: 2rem;
    flex: 1;
}

.guide-banner {
    background: linear-gradient(135deg, var(--primary-soft), transparent);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.guide-icon { color: var(--primary); flex-shrink: 0; margin-top: 2px; }

.guide-content h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 0.2rem;
}

.guide-content p {
    font-size: 0.82rem;
    color: var(--text-soft);
    line-height: 1.55;
}

.guide-content ul {
    margin-top: 0.35rem;
    margin-left: 1.15rem;
    font-size: 0.8rem;
    color: var(--text-soft);
}

.guide-content li { margin-bottom: 0.18rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.stat-card:hover::after { opacity: 1; }

.stat-card.green::after  { background: linear-gradient(90deg, var(--success), var(--primary-light)); }
.stat-card.blue::after   { background: linear-gradient(90deg, var(--info), #60a5fa); }
.stat-card.amber::after  { background: linear-gradient(90deg, var(--warning), #fcd34d); }
.stat-card.purple::after { background: linear-gradient(90deg, #a855f7, #c084fc); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.stat-icon.green  { background: var(--success-alpha); color: var(--success); }
.stat-icon.blue   { background: var(--info-alpha);    color: #60a5fa; }
.stat-icon.amber  { background: var(--warning-alpha); color: var(--warning); }
.stat-icon.purple { background: rgba(168,85,247,0.13); color: #c084fc; }

.stat-value { font-size: 1.9rem; font-weight: 900; line-height: 1; letter-spacing: -0.03em; color: var(--text); }
.stat-label { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; margin-top: 0.25rem; letter-spacing: 0.01em; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s;
}

.card:hover { border-color: var(--border-light); }

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: var(--card-bg2);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text);
}

.card-body { padding: 1.5rem; }

.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.855rem; }

thead th {
    text-align: left;
    padding: 0.8rem 1rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(0,0,0,0.22);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
    transition: background 0.15s;
}

tbody tr:hover { background: rgba(255,255,255,0.025); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0.22rem 0.62rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-success { background: var(--success-alpha); color: #4ade80; border: 1px solid rgba(34,197,94,0.28); }
.badge-danger  { background: var(--danger-alpha);  color: #f87171; border: 1px solid rgba(239,68,68,0.28); }
.badge-warning { background: var(--warning-alpha); color: #fbbf24; border: 1px solid rgba(245,158,11,0.28); }
.badge-info    { background: var(--info-alpha);    color: #93c5fd; border: 1px solid rgba(59,130,246,0.28); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.58rem 1.05rem;
    border-radius: var(--radius-md);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.17s ease;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #061008;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-danger  { background: var(--danger-alpha); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover  { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-warning { background: var(--warning-alpha); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.btn-warning:hover { background: var(--warning); color: #07080a; border-color: var(--warning); }

.btn-ghost   { background: transparent; color: var(--text-soft); border: 1px solid var(--border); }
.btn-ghost:hover   { background: rgba(255,255,255,0.04); color: var(--text); border-color: var(--border-light); }

.btn-sm { padding: 0.38rem 0.7rem; font-size: 0.76rem; }
.btn-xs { padding: 0.25rem 0.55rem; font-size: 0.7rem; }

.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

.form-group  { margin-bottom: 1.1rem; }
.form-label  {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 0.38rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.88rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-alpha);
}

.form-control::placeholder { color: var(--text-dim); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.94) translateY(10px);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg2);
}

.modal-title { font-weight: 700; font-size: 0.97rem; color: var(--text); }
.modal-close {
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer; font-size: 1.3rem;
    line-height: 1; padding: 0.2rem;
    transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    background: var(--card-bg2);
}

.search-bar {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-input-wrap { position: relative; flex: 1; min-width: 180px; }

.search-input-wrap .search-icon {
    position: absolute;
    left: 0.75rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.search-input-wrap .form-control { padding-left: 2.2rem; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 1.25rem;
    border-top: 1px solid var(--border);
}

.page-btn {
    min-width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}

.page-btn:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #061008; font-weight: 800; }
.page-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    font-weight: 600;
}

.alert-danger  { background: var(--danger-alpha);  border-color: rgba(239,68,68,0.22);  color: #fca5a5; }
.alert-success { background: var(--success-alpha); border-color: rgba(34,197,94,0.22);  color: #86efac; }
.hidden { display: none !important; }

.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: 0.25s;
    border: 1px solid var(--border);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 2px; top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.25s;
}

.toggle input:checked + .toggle-slider {
    background: var(--primary-alpha);
    border-color: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: var(--primary);
}

.login-page {
    background: #060a07;
    background-image:
        radial-gradient(ellipse 70% 50% at 20% 20%, rgba(21, 128, 61, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(34, 197, 94, 0.07) 0%, transparent 55%);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.4s ease;
}

.login-logo { text-align: center; margin-bottom: 2rem; }

.login-logo .icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #061008;
    border-radius: var(--radius-lg);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px var(--primary-glow);
}

.login-logo h1 { font-size: 1.25rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.login-logo p  { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.25rem; }

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state svg { color: var(--text-dim); margin-bottom: 0.75rem; opacity: 0.6; }
.empty-state p { font-size: 0.875rem; font-weight: 500; }

.block-list { display: flex; flex-direction: column; gap: 0.5rem; }

.block-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.18s;
}

.block-item:hover { border-color: var(--border-light); }
.block-info { font-size: 0.865rem; }
.block-info .block-date { font-weight: 700; color: var(--text); }
.block-info .block-hora { color: var(--primary); font-size: 0.78rem; font-weight: 600; margin-top: 0.08rem; }
.block-info .block-motivo { color: var(--text-muted); font-size: 0.76rem; margin-top: 0.08rem; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.schedule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: border-color 0.18s;
}

.schedule-item.booked {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.18);
}

.schedule-item.free {
    background: rgba(34, 197, 94, 0.05);
    border-color: rgba(34, 197, 94, 0.14);
}

.schedule-time {
    font-weight: 800;
    font-size: 1rem;
    min-width: 48px;
    color: var(--text);
}

.schedule-info { flex: 1; padding: 0 0.75rem; font-size: 0.85rem; }
.schedule-name { font-weight: 600; color: var(--text); }
.schedule-phone { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.05rem; }

.menu-toggle { display: none; }

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

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: flex; }
    .page-content { padding: 1.25rem; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0.7rem 1rem; }
    .card-body { padding: 1rem; }
}
