:root {
    --bg: #070b14;
    --bg-soft: #0d1424;
    --card: rgba(9, 18, 34, 0.82);
    --card-strong: rgba(10, 18, 36, 0.94);
    --line: rgba(109, 167, 255, 0.22);
    --text: #edf4ff;
    --muted: #90a6c8;
    --brand: #3562ac;
    --brand-glow: rgba(53, 98, 172, 0.45);
    --consultation: #00d3ff;
    --procedure: #b14dff;
    --cancelled: #ff4d6d;
    --success: #25d47d;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(53, 98, 172, 0.22), transparent 26%),
        radial-gradient(circle at top right, rgba(0, 211, 255, 0.09), transparent 22%),
        linear-gradient(135deg, #05070e 0%, #09101e 35%, #070b14 100%);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(circle at center, black 55%, transparent 100%);
    pointer-events: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    padding: 24px;
    min-height: 100vh;
}

.glass, .glass-lg {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow), 0 0 35px rgba(53, 98, 172, 0.12) inset;
    backdrop-filter: blur(16px);
}

.glass-lg { background: var(--card-strong); }
.sidebar {
    border-radius: 28px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand-logo { width: 100%; max-width: 220px; filter: drop-shadow(0 0 10px rgba(53,98,172,.35)); }
.brand-subtitle { color: var(--muted); line-height: 1.5; }
.topbar, .calendar-panel { border-radius: 28px; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; margin-bottom: 24px;
}
.eyebrow { color: #80b8ff; text-transform: uppercase; letter-spacing: .18em; font-size: 12px; margin: 0 0 6px; }
h1, h2, h3 { margin: 0; }
.month-nav { display: flex; align-items: center; gap: 12px; }

.btn {
    border: 1px solid rgba(120, 175, 255, 0.22);
    color: var(--text);
    background: linear-gradient(180deg, rgba(19,32,58,.95), rgba(12,18,30,.95));
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: .22s ease;
    box-shadow: 0 0 0 0 rgba(53, 98, 172, 0.4);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 24px rgba(53, 98, 172, 0.28); }
.btn-primary {
    background: linear-gradient(180deg, rgba(53,98,172,1), rgba(28,52,95,1));
    border-color: rgba(114,168,255,.45);
}
.btn-secondary { padding-inline: 14px; }
.btn-danger {
    background: linear-gradient(180deg, rgba(161,39,66,.95), rgba(93,21,39,.95));
    border-color: rgba(255,77,109,.35);
}
.btn-pulse { animation: pulse 1.8s infinite; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(53,98,172,.55); }
    70% { box-shadow: 0 0 0 14px rgba(53,98,172,0); }
    100% { box-shadow: 0 0 0 0 rgba(53,98,172,0); }
}

.legend-card {
    border-radius: 22px;
    padding: 18px;
}
.neon-box {
    background: linear-gradient(180deg, rgba(7,13,25,0.95), rgba(8,17,30,0.82));
    border: 1px solid rgba(89,142,228,.24);
    box-shadow: inset 0 0 25px rgba(53,98,172,.08), 0 0 32px rgba(53,98,172,.12);
}
.legend-item { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: 0 0 12px currentColor; }
.dot.consultation { background: var(--consultation); color: var(--consultation); }
.dot.procedure { background: var(--procedure); color: var(--procedure); }
.dot.cancelled { background: var(--cancelled); color: var(--cancelled); }
.small-text p { color: var(--muted); margin: 10px 0 0; }

.calendar-panel { padding: 16px; }
.weekday-row, .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
}
.weekday-row {
    padding: 10px 8px 16px;
    color: #93b8ee;
    font-weight: 700;
    text-align: center;
}
.calendar-grid { min-height: 720px; }
.day-cell {
    position: relative;
    min-height: 132px;
    border-radius: 18px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(11,18,33,.82), rgba(8,13,23,.92));
    border: 1px solid rgba(109, 167, 255, 0.12);
    overflow: hidden;
}
.day-cell.other-month { opacity: .35; }
.day-cell.today { border-color: rgba(0,211,255,.46); box-shadow: inset 0 0 18px rgba(0,211,255,.1), 0 0 18px rgba(0,211,255,.08); }
.day-number { font-weight: 800; font-size: 14px; color: #dce7fa; margin-bottom: 10px; }
.day-events { display: flex; flex-direction: column; gap: 8px; }
.event-pill {
    border: 0;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    color: white;
    cursor: pointer;
    transition: .18s ease;
}
.event-pill:hover { transform: scale(1.02); }
.event-pill.consulta { background: linear-gradient(180deg, rgba(0,211,255,.9), rgba(0,123,171,.92)); }
.event-pill.procedimento { background: linear-gradient(180deg, rgba(177,77,255,.94), rgba(91,23,149,.92)); }
.event-pill.cancelled { background: linear-gradient(180deg, rgba(255,77,109,.95), rgba(122,23,46,.92)); opacity: .75; }
.event-time { display: block; font-size: 11px; opacity: .9; margin-bottom: 3px; }

.modal {
    position: fixed; inset: 0; background: rgba(1, 5, 12, .68);
    display: grid; place-items: center; padding: 20px; z-index: 20;
}
.hidden { display: none !important; }
.hidden-soft { display: none; }
.modal-card { width: min(880px, 100%); border-radius: 28px; padding: 24px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.icon-btn {
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
    background: rgba(15, 26, 47, .9); color: white; cursor: pointer;
}
.form-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.full-width { grid-column: 1 / -1; }
label span {
    display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; color: #c7dbfa;
}
input, select, textarea {
    width: 100%; border-radius: 14px; border: 1px solid rgba(110, 162, 255, .18);
    background: rgba(10, 18, 34, .88); color: white; padding: 13px 14px;
    outline: none; transition: .2s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(0, 211, 255, .62); box-shadow: 0 0 0 4px rgba(0, 211, 255, .1);
}
textarea { resize: vertical; }
.modal-actions {
    display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 12px;
}
.toast {
    position: fixed; right: 20px; bottom: 20px; z-index: 30;
    background: rgba(8,16,30,.96); border: 1px solid rgba(110, 168, 255, .22);
    color: white; padding: 14px 18px; border-radius: 14px; box-shadow: var(--shadow);
}

@media (max-width: 1080px) {
    .app-shell { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .topbar { flex-direction: column; align-items: flex-start; gap: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .calendar-grid { gap: 8px; }
    .day-cell { min-height: 110px; }
}


.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: 100%; max-width: 520px; }
.login-card { border-radius: 32px; padding: 34px; }
.login-logo { max-width: 260px; margin-bottom: 10px; }
.login-text { color: var(--muted); line-height: 1.6; }
.login-form { display: grid; gap: 16px; margin-top: 18px; }
.full-btn { width: 100%; }
.alert-error { margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: rgba(255,77,109,.12); border: 1px solid rgba(255,77,109,.28); color: #ffd6de; }
.nav-stack { display: grid; gap: 10px; }
.nav-btn { text-align: left; border-radius: 14px; padding: 12px 14px; border: 1px solid rgba(120,175,255,.16); background: rgba(10,18,34,.82); color: var(--text); font-weight: 700; cursor: pointer; }
.nav-btn.active, .nav-btn:hover { border-color: rgba(0,211,255,.45); box-shadow: 0 0 0 3px rgba(0,211,255,.08), 0 0 18px rgba(0,211,255,.12); }
.app-shell-wide { grid-template-columns: 300px 1fr; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filter-inline span { display: block; margin-bottom: 6px; color: #c7dbfa; font-size: 12px; font-weight: 700; }
.cards-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.stat-card { border-radius: 24px; padding: 20px; }
.stat-card span { color: var(--muted); display: block; font-size: 13px; margin-bottom: 8px; }
.stat-card strong { font-size: 34px; line-height: 1; }
.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.inner-panel { border-radius: 24px; padding: 20px; }
.section-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.calendar-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.table-like { display: grid; gap: 10px; }
.row-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(10,18,34,.72); border: 1px solid rgba(109,167,255,.16); cursor: pointer; }
.row-card:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.row-card p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.empty-state { padding: 18px; border-radius: 16px; color: var(--muted); background: rgba(10,18,34,.7); border: 1px dashed rgba(109,167,255,.2); }
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 920px; }
.data-table th, .data-table td { padding: 12px 10px; border-bottom: 1px solid rgba(109,167,255,.12); text-align: left; vertical-align: top; }
.data-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #a8c9ff; }
.mini-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 86px; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.badge-consultation { background: rgba(0,211,255,.14); color: #92eeff; border: 1px solid rgba(0,211,255,.26); }
.badge-procedure { background: rgba(177,77,255,.14); color: #dfb2ff; border: 1px solid rgba(177,77,255,.26); }
.badge-cancelled, .badge-fail { background: rgba(255,77,109,.14); color: #ffb2c1; border: 1px solid rgba(255,77,109,.26); }
.badge-ok { background: rgba(37,212,125,.14); color: #baffd8; border: 1px solid rgba(37,212,125,.26); }
.payload-pre { white-space: pre-wrap; word-break: break-word; max-width: 420px; margin: 0; font-size: 12px; color: #d9e9ff; }
@media (max-width: 1200px) { .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .panel-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .app-shell-wide { grid-template-columns: 1fr; } .cards-grid { grid-template-columns: 1fr; } }
