:root {
    --primary: #0d6efd;
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #0dcaf0;
    --light-bg: #f4f7fb;
    --white: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --border-soft: #e5e7eb;
    --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--light-bg);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-dark);
}

a {
    text-decoration: none;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #fff;
    padding: 24px 18px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    padding: 8px 10px;
}

.brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0d6efd, #0dcaf0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.88);
    padding: 12px 14px;
    border-radius: 12px;
    transition: 0.2s ease;
    font-weight: 500;
}

.menu-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.main-wrapper {
    margin-left: 270px;
    width: calc(100% - 270px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: rgba(255,255,255,0.9);
    border-bottom: 1px solid var(--border-soft);
    padding: 18px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-title {
    font-weight: 700;
    color: var(--text-dark);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    padding: 8px 12px;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.user-avatar {
    font-size: 30px;
    color: var(--primary);
}

.content-area {
    padding: 28px;
}

.content-card,
.table-card,
.form-card,
.kpi-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    border: 1px solid rgba(229, 231, 235, 0.75);
    margin-bottom: 24px;
}

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
}

.kpi-icon.primary { background: #0d6efd; }
.kpi-icon.success { background: #198754; }
.kpi-icon.info { background: #0dcaf0; }
.kpi-icon.warning { background: #ffc107; color: #212529; }

.kpi-label {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
}

.kpi-trend {
    font-size: 0.85rem;
    color: var(--success);
}

.section-title {
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.section-subtitle {
    color: var(--text-muted);
    margin-bottom: 0;
}

.table-modern thead th {
    background: #f8fafc;
    color: #374151;
    border-bottom: 1px solid var(--border-soft);
    font-weight: 700;
    white-space: nowrap;
}

.table-modern tbody td {
    white-space: nowrap;
    vertical-align: middle;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-programada {
    background: #e0f2fe;
    color: #0369a1;
}

.status-confirmada {
    background: #dcfce7;
    color: #166534;
}

.status-cancelada {
    background: #fee2e2;
    color: #991b1b;
}

.status-atendida {
    background: #ede9fe;
    color: #5b21b6;
}

.status-reprogramada {
    background: #fff7ed;
    color: #9a3412;
}

.form-label {
    font-weight: 700;
    color: #374151;
    margin-bottom: 8px;
}

.form-control,
.form-select {
    border-radius: 12px;
    border: 1px solid #d1d5db;
    min-height: 46px;
    padding: 10px 14px;
}

.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.20rem rgba(13, 110, 253, 0.15);
}

textarea.form-control {
    min-height: 110px;
}

.btn {
    border-radius: 12px;
    font-weight: 600;
    min-width: 120px;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .content-area {
        padding: 18px;
    }
}