:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e3a5f;
    --darker: #162d4a;
    /* Fundo de menus / headers (paleta pedida) */
    --surface-menu: #DEF1FE;
    --light: #f8fafc;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 52px;
    --topbar-height: 64px;
    --accent-cyan: #22d3ee;
    --accent-gradient: linear-gradient(135deg, #0ea5e9, #22d3ee);
    /* Fundo da área principal com menu lateral expandido */
    --page-bg-sidebar-open: #e8f4fc;
    --page-bg-sidebar-open-alt: #eef6ff;
    /* Menu lateral — alinhado ao #DEF1FE */
    --sidebar-bg-top: #DEF1FE;
    --sidebar-bg-bottom: #cfe8fc;
    --sidebar-text: #0c4a6e;
    --sidebar-text-soft: #0369a1;
    --sidebar-muted: #64748b;
    --sidebar-border: rgba(14, 165, 233, 0.28);
    --sidebar-nav-hover-bg: rgba(255, 255, 255, 0.65);
    --sidebar-nav-active-bg: #ffffff;
    --sidebar-nav-active-shadow: 0 2px 8px rgba(14, 165, 233, 0.18);
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f4f8;
    color: #334155;
    min-height: 100vh;
    transition: background-color 0.3s ease;
}

/* Menu lateral aberto: fundo geral das telas em azul bem claro */
body.sidebar-expanded {
    background: linear-gradient(180deg, var(--page-bg-sidebar-open-alt) 0%, var(--page-bg-sidebar-open) 55%, #dff0fa 100%);
}

body.sidebar-expanded .main-content {
    background: transparent;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-collapsed-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-bg-top) 0%, var(--sidebar-bg-bottom) 100%);
    box-shadow: 2px 0 12px rgba(14, 165, 233, 0.08);
    z-index: 1000;
    transition: width 0.3s ease, background 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar.expanded {
    width: var(--sidebar-width);
}

.sidebar-brand {
    padding: 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 70px;
}

a.sidebar-brand-link {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

a.sidebar-brand-link:hover {
    opacity: 0.9;
}

a.sidebar-brand-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sidebar-brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand h4 {
    color: var(--sidebar-text);
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar-brand small {
    color: var(--sidebar-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar:not(.expanded) .sidebar-brand h4,
.sidebar:not(.expanded) .sidebar-brand small {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar:not(.expanded) .sidebar-brand {
    justify-content: center;
    padding: 1rem 0.4rem;
}

.sidebar:not(.expanded) .sidebar-brand-logo {
    width: 30px;
    height: 30px;
}

.sidebar-nav { padding: 0.75rem 0; flex: 1; }

.nav-section { padding: 0 0.75rem; margin-bottom: 0.15rem; }

.sidebar:not(.expanded) .nav-section { padding: 0 0.35rem; }

.nav-section-title {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sidebar-muted);
    padding: 0.75rem 0.75rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease, color 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    border-radius: 6px;
}

.nav-section-title:hover {
    color: var(--sidebar-text-soft);
}

.nav-section-arrow {
    font-size: 0.55rem;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.nav-section.collapsed .nav-section-arrow {
    transform: rotate(-90deg);
}

.nav-section-links {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.3s ease;
}

.nav-section.collapsed .nav-section-links {
    max-height: 0;
}

.sidebar:not(.expanded) .nav-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

.sidebar:not(.expanded) .nav-section.collapsed .nav-section-links {
    max-height: 500px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    color: var(--sidebar-text-soft);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    border: 1px solid transparent;
}

.sidebar:not(.expanded) .sidebar-nav .nav-link {
    justify-content: center;
    padding: 0.5rem;
    border-radius: 10px;
    font-size: 0;
    gap: 0;
    width: 36px;
    height: 36px;
    margin: 1px auto;
}

.sidebar:not(.expanded) .sidebar-nav .nav-link i {
    font-size: 1.1rem;
}

.sidebar-nav .nav-link:hover {
    color: var(--sidebar-text);
    background: var(--sidebar-nav-hover-bg);
}

.sidebar-nav .nav-link:hover i {
    color: var(--sidebar-text);
}

.sidebar-nav .nav-link.active {
    color: var(--primary-dark);
    background: var(--sidebar-nav-active-bg);
    box-shadow: var(--sidebar-nav-active-shadow);
    border: 1px solid var(--sidebar-border);
    font-weight: 600;
}

.sidebar-nav .nav-link.active i {
    color: var(--primary);
    opacity: 1;
}

.sidebar-nav .nav-link i {
    width: 20px;
    font-size: 1rem;
    text-align: center;
    opacity: 1;
    flex-shrink: 0;
    color: var(--sidebar-text-soft);
    -webkit-text-stroke: 0;
}

.sidebar-nav .nav-link .badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.2em 0.55em;
}

.sidebar:not(.expanded) .sidebar-nav .nav-link .badge {
    display: none;
}

.sidebar-nav .nav-link {
    position: relative;
}

.sidebar:not(.expanded) .sidebar-nav .nav-link:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-text);
    color: #fff;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    z-index: 1100;
    pointer-events: none;
    box-shadow: 0 2px 12px rgba(12, 74, 110, 0.2);
}

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

.sidebar-footer a.text-white-50 {
    color: var(--sidebar-muted) !important;
}

.sidebar-footer a.text-white-50:hover {
    color: var(--primary) !important;
}

.sidebar:not(.expanded) .sidebar-footer {
    padding: 0.6rem 0.3rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar:not(.expanded) .sidebar-user {
    justify-content: center;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name { color: var(--sidebar-text); font-size: 0.825rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role { color: var(--sidebar-muted); font-size: 0.7rem; text-transform: capitalize; }

.sidebar:not(.expanded) .sidebar-user-info,
.sidebar:not(.expanded) .sidebar-user a {
    display: none;
}

.main-content {
    margin-left: var(--sidebar-collapsed-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

body.sidebar-expanded .main-content {
    margin-left: var(--sidebar-width);
}

.topbar {
    height: var(--topbar-height);
    background: var(--surface-menu);
    border-bottom: 1px solid rgba(12, 74, 110, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

.topbar-account-dropdown .topbar-account-btn:hover {
    background: #e0f2fe !important;
    border-color: #bae6fd !important;
}

.topbar-account-dropdown .dropdown-menu {
    z-index: 1055;
}

.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--dark); }
.topbar-subtitle { font-size: 0.8rem; color: var(--secondary); margin-top: 1px; }

.topbar-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.35rem 0.85rem;
    background: linear-gradient(135deg, #f0f9ff, #f0fdf4);
    border-radius: 10px;
    border: 1px solid #e0f2fe;
}

.topbar-user-name {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
}

.topbar-user-phone {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--secondary);
    white-space: nowrap;
}

.topbar-user-name i,
.topbar-user-phone i {
    font-size: 0.75rem;
    opacity: 0.7;
}

.btn-toggle-sidebar {
    display: block;
    border: none;
    background: none;
    font-size: 1.25rem;
    color: var(--dark);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
}

.btn-toggle-sidebar:hover { background: #f1f5f9; }

.page-content { padding: 1.5rem; }

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.stat-card .stat-icon.blue { background: #e0f2fe; color: var(--primary); }
.stat-card .stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-card .stat-icon.yellow { background: #fef3c7; color: var(--warning); }
.stat-card .stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-card .stat-icon.cyan { background: #cffafe; color: var(--info); }
.stat-card .stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--secondary);
    font-weight: 500;
}

.content-card {
    background: white;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.content-card .card-header-custom {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.content-card .card-header-custom h6 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.content-card .card-body { padding: 1.25rem; }

.table-custom { margin-bottom: 0; }
.table-custom th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--secondary);
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}
.table-custom td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
}
.table-custom tbody tr:hover { background: #f8fafc; }
.table-custom tbody tr:last-child td { border-bottom: none; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-badge.aberto { background: #e0f2fe; color: #0369a1; }
.status-badge.em_andamento { background: #fef3c7; color: #b45309; }
.status-badge.concluido { background: #d1fae5; color: #059669; }
.status-badge.cancelado { background: #fee2e2; color: #dc2626; }
.status-badge.pendente { background: #f3f4f6; color: #6b7280; }
.status-badge.aceita { background: #d1fae5; color: #059669; }
.status-badge.recusada { background: #fee2e2; color: #dc2626; }

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #DEF1FE 0%, #cfe8fc 45%, #bae6fd 100%);
    padding: 1rem;
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 40%, rgba(14,165,233,0.12) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(34,211,238,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 50px rgba(12, 74, 110, 0.12);
    position: relative;
}

.login-card .login-logo {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    object-fit: contain;
    margin: 0 auto 1.25rem;
    display: block;
}

.login-card h3 {
    text-align: center;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--secondary);
    font-size: 0.875rem;
    margin-bottom: 1.75rem;
}

.form-label-custom {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.375rem;
}

.form-control-custom {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.65rem 0.875rem;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}

.btn-primary-custom {
    background: var(--accent-gradient);
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    width: 100%;
    transition: all 0.2s;
}

.btn-primary-custom:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    box-shadow: 0 4px 15px rgba(14,165,233,0.35);
}

.btn-primary-custom:active { transform: scale(0.98); }

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

.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state h5 { color: var(--dark); font-weight: 600; margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; }

.moeda-icon { color: var(--warning); }

.notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}

.proposta-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}

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

.proposta-card .proposta-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.proposta-card .proposta-valor {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--success);
}

.card {
    border-radius: 16px !important;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 999;
    display: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show { display: block; }

@media (max-width: 991.98px) {
    .sidebar { width: 0; }
    .sidebar.expanded { width: var(--sidebar-width); }
    .main-content { margin-left: 0 !important; }
}

@media (max-width: 767.98px) {
    .topbar-user-phone { display: none; }
    .topbar-user-info { gap: 0; }
}

@media (max-width: 575.98px) {
    .page-content { padding: 1rem; }
    .login-card { padding: 1.5rem; }
    .stat-value { font-size: 1.5rem; }
    .topbar-user-name { font-size: 0.75rem; }
}
