/* ============================================================
   Proposta Flex — style.css
   Paleta: Azul #1E88E5, Verde/Teal #26A69A, Cinza claro
   Fonte: Poppins
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue:        #1E88E5;
    --blue-dark:   #1565C0;
    --blue-light:  #E3F2FD;
    --teal:        #26A69A;
    --teal-dark:   #00796B;
    --teal-light:  #E0F2F1;
    --green:       #43A047;
    --green-light: #E8F5E9;
    --amber:       #FB8C00;
    --amber-light: #FFF3E0;
    --red:         #E53935;
    --red-light:   #FFEBEE;
    --gray-50:     #F8FAFC;
    --gray-100:    #F1F5F9;
    --gray-200:    #E2E8F0;
    --gray-300:    #CBD5E1;
    --gray-400:    #94A3B8;
    --gray-500:    #64748B;
    --gray-600:    #475569;
    --gray-700:    #334155;
    --gray-800:    #1E293B;
    --gray-900:    #0F172A;
    --white:       #FFFFFF;
    --sidebar-w:   260px;
    --topbar-h:    64px;
    --radius:      10px;
    --radius-lg:   16px;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow:      0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg:   0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --transition:  all .2s ease;
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--gray-900);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform .25s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 16px;
    flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-name { color: var(--gray-300); font-size: .78rem; font-weight: 400; }
.logo-flex { color: white; font-size: 1.05rem; font-weight: 700; letter-spacing: -.3px; }

.sidebar-close {
    display: none;
    background: none; border: none;
    color: var(--gray-400); cursor: pointer;
    font-size: 16px; padding: 4px;
}

.sidebar-company {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.company-icon {
    width: 32px; height: 32px;
    background: rgba(255,255,255,.08);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-400); font-size: 13px;
    flex-shrink: 0;
}
.company-name { color: white; font-size: .8rem; font-weight: 500; display: block; }
.company-sub  { color: var(--gray-500); font-size: .7rem; display: block; }

.sidebar-nav {
    flex: 1;
    padding: 12px 12px 8px;
}

.nav-section-label {
    color: var(--gray-600);
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 12px 10px 6px;
}

.menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--gray-400);
    font-size: .82rem;
    font-weight: 400;
    transition: var(--transition);
    margin-bottom: 2px;
    white-space: nowrap;
}
.menu-item i { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; }
.menu-item:hover { background: rgba(255,255,255,.07); color: var(--gray-200); }
.menu-item.active {
    background: linear-gradient(135deg, rgba(30,136,229,.35), rgba(38,166,154,.2));
    color: white;
    font-weight: 500;
}
.menu-item.active i { color: var(--blue); }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-logout {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--gray-500);
    font-size: .82rem;
    transition: var(--transition);
}
.sidebar-logout:hover { background: rgba(229,57,53,.15); color: var(--red); }
.sidebar-logout i { width: 18px; text-align: center; }

/* ---- Main content ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---- Topbar ---- */
.topbar {
    height: var(--topbar-h);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
}
.sidebar-toggle {
    background: none; border: none; cursor: pointer;
    color: var(--gray-500); font-size: 18px;
    padding: 6px; border-radius: 6px;
    display: none;
    transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--gray-100); color: var(--gray-700); }
.topbar-title { font-size: 1.05rem; font-weight: 600; color: var(--gray-800); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-menu { position: relative; }
.user-menu-btn {
    display: flex; align-items: center; gap: 8px;
    background: none; border: 1px solid var(--gray-200);
    padding: 6px 12px 6px 6px;
    border-radius: 50px; cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.user-menu-btn:hover { background: var(--gray-50); }
.user-avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: .75rem; font-weight: 600;
}
.user-name { font-size: .82rem; font-weight: 500; color: var(--gray-700); }
.user-menu-btn .fa-chevron-down { font-size: .65rem; color: var(--gray-400); }

.user-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    overflow: hidden;
    display: none;
    z-index: 9999;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    color: var(--gray-700); font-size: .83rem;
    transition: var(--transition);
}
.user-dropdown a:hover { background: var(--gray-50); color: var(--blue); }
.logout-link:hover { color: var(--red) !important; }

/* ---- Page content ---- */
.page-content { padding: 24px; }

/* ---- Page header ---- */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 24px;
}
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.page-sub { color: var(--gray-500); font-size: .82rem; margin-top: 2px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: visible; /* Permite dropdowns aparecerem sobre a tabela */
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}
.card-header h3 {
    font-size: .9rem; font-weight: 600; color: var(--gray-700);
    display: flex; align-items: center; gap: 8px;
}
.card-header h3 i { color: var(--blue); }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }
.mb-4 { margin-bottom: 20px; }

/* ============================================================
   KPI GRID (Dashboard)
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    padding: 20px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.kpi-blue    { background: var(--blue-light);  color: var(--blue); }
.kpi-teal    { background: var(--teal-light);  color: var(--teal); }
.kpi-green   { background: var(--green-light); color: var(--green); }
.kpi-emerald { background: #E0F7FA; color: #00838F; }
.kpi-amber   { background: var(--amber-light); color: var(--amber); }
.kpi-value   { font-size: 1.6rem; font-weight: 700; color: var(--gray-900); line-height: 1; display: block; }
.kpi-value-sm{ font-size: 1.1rem; font-weight: 700; color: var(--gray-900); line-height: 1; display: block; }
.kpi-label   { font-size: .72rem; color: var(--gray-500); margin-top: 4px; display: block; }

/* ---- Dashboard grid ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 20px;
}
.chart-card .card-body { padding: 16px 20px; }

/* ---- Follow-up ---- */
.badge-count {
    background: var(--blue); color: white;
    border-radius: 50px; padding: 2px 8px;
    font-size: .72rem; font-weight: 600;
}
.followup-list { }
.followup-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    gap: 12px;
}
.followup-item:last-child { border-bottom: none; }
.followup-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.followup-number { font-size: .7rem; color: var(--gray-400); font-weight: 500; }
.followup-title  { font-size: .85rem; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.followup-client { font-size: .75rem; color: var(--gray-500); }
.followup-value  { font-size: .8rem; color: var(--blue); font-weight: 600; }
.followup-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }

.empty-state-sm {
    padding: 32px 20px; text-align: center;
    color: var(--gray-400);
}
.empty-state-sm i { font-size: 2rem; margin-bottom: 8px; display: block; }
.empty-state-sm p { font-size: .82rem; }

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { overflow: visible; }
.table {
    width: 100%; border-collapse: collapse;
    font-size: .83rem;
}
.table th {
    background: var(--gray-50);
    padding: 11px 16px;
    text-align: left; font-weight: 600;
    color: var(--gray-600); font-size: .75rem;
    letter-spacing: .03em; text-transform: uppercase;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-400); }

.empty-state {
    padding: 64px 24px; text-align: center;
    color: var(--gray-400);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; opacity: .4; }
.empty-state h3 { font-size: 1rem; color: var(--gray-600); margin-bottom: 6px; }
.empty-state p { font-size: .82rem; margin-bottom: 20px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 50px;
    font-size: .7rem; font-weight: 600;
    letter-spacing: .02em; white-space: nowrap;
}
.badge-lg { padding: 5px 14px; font-size: .8rem; }
.badge-draft    { background: var(--gray-100);   color: var(--gray-600); }
.badge-sent     { background: #E3F2FD;            color: #1565C0; }
.badge-approved { background: var(--green-light); color: #2E7D32; }
.badge-rejected { background: var(--red-light);   color: #C62828; }
.badge-info     { background: var(--blue-light);  color: var(--blue); }
.badge-product  { background: var(--blue-light);  color: var(--blue-dark); }
.badge-service  { background: var(--teal-light);  color: var(--teal-dark); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: 8px; border: none; cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: .83rem; font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--blue); color: white;
    box-shadow: 0 2px 8px rgba(30,136,229,.3);
}
.btn-primary:hover { background: var(--blue-dark); color: white; box-shadow: 0 4px 12px rgba(30,136,229,.4); }

.btn-secondary {
    background: white; color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-50); color: var(--gray-900); border-color: var(--gray-400); }

.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: var(--red); color: white; }

.btn-whatsapp { background: #E8F5E9; color: #2E7D32; }
.btn-whatsapp:hover { background: #25D366; color: white; }

.btn-approve { background: var(--green); color: white; font-size: .95rem; padding: 12px 28px; box-shadow: 0 2px 8px rgba(67,160,71,.3); }
.btn-approve:hover { background: #388E3C; color: white; }
.btn-reject  { background: white; color: var(--red); border: 2px solid var(--red); font-size: .95rem; padding: 10px 28px; }
.btn-reject:hover  { background: var(--red); color: white; }

.btn-sm { padding: 5px 10px; font-size: .75rem; border-radius: 6px; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 16px;
}
label {
    display: block; margin-bottom: 6px;
    font-size: .8rem; font-weight: 500; color: var(--gray-700);
}
.required { color: var(--red); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: .83rem;
    color: var(--gray-800);
    background: white;
    transition: var(--transition);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(30,136,229,.12);
}
input:disabled, select:disabled {
    background: var(--gray-50); color: var(--gray-400); cursor: not-allowed;
}
textarea { resize: vertical; min-height: 80px; }

.form-select { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 36px; }

.input-icon-wrap { position: relative; }
.input-icon-wrap > i,
.input-icon-wrap > .input-prefix {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400); font-size: .85rem;
    pointer-events: none;
}
.input-icon-wrap input,
.input-icon-wrap select { padding-left: 36px; }
.input-icon-wrap .input-prefix { font-size: .8rem; font-weight: 600; color: var(--gray-500); }

.password-toggle {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--gray-400); font-size: .85rem;
    padding: 4px;
}
.password-toggle:hover { color: var(--gray-600); }

.radio-group { display: flex; gap: 12px; }
.radio-label {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px; cursor: pointer;
    transition: var(--transition);
    font-size: .82rem; font-weight: 400;
    color: var(--gray-600);
    margin-bottom: 0;
}
.radio-label input[type="radio"] { width: auto; margin: 0; }
.radio-label:has(input:checked) { border-color: var(--blue); background: var(--blue-light); color: var(--blue-dark); font-weight: 500; }

.search-form {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.search-form .input-icon-wrap { flex: 1; min-width: 180px; }
.search-form select { min-width: 160px; width: auto; flex: 0 0 auto; }
.search-form input { width: auto; }

.flex-wrap { flex-wrap: wrap; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(4px);
    z-index: 400;
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: white; border-radius: var(--radius-lg);
    width: 100%; max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: .95rem; font-weight: 600; color: var(--gray-800); }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--gray-400); font-size: 16px;
    padding: 4px; border-radius: 6px;
    transition: var(--transition);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-600); }
.modal-body { padding: 20px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ============================================================
   STATUS DROPDOWN
   ============================================================ */
.status-dropdown-wrap { position: relative; display: inline-block; }
.status-toggle-btn {
    cursor: pointer; border: none; font-family: inherit;
    display: inline-flex; align-items: center; gap: 4px;
}
.status-toggle-btn .fa-chevron-down { font-size: .55rem; }
.status-menu {
    position: absolute; top: calc(100% + 4px); left: 0;
    background: white; border: 1px solid var(--gray-200);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    min-width: 140px; z-index: 9999; display: none; overflow: hidden;
}
.status-menu.open { display: block; }
.status-option {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 9px 12px;
    background: none; border: none;
    font-family: 'Poppins', sans-serif; font-size: .8rem;
    color: var(--gray-700); cursor: pointer;
    transition: var(--transition); text-align: left;
}
.status-option:hover { background: var(--gray-50); }
.status-option.active { font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-rascunho  { background: var(--gray-400); }
.dot-enviado   { background: var(--blue); }
.dot-aprovado  { background: var(--green); }
.dot-reprovado { background: var(--red); }

/* ============================================================
   PROPOSAL FORM
   ============================================================ */
.proposal-number-badge {
    display: inline-block;
    background: var(--blue-light); color: var(--blue-dark);
    border-radius: 8px; padding: 4px 12px;
    font-size: .8rem; font-weight: 600;
    margin-bottom: 16px;
}
.items-table input[type="text"] { padding: 7px 10px; font-size: .8rem; }
.items-table .form-select { padding: 7px 30px 7px 10px; font-size: .8rem; }
.item-row td { padding: 8px 10px; }
.item-total { font-weight: 600; color: var(--gray-800); }
.items-footer { padding: 12px 16px; border-top: 1px solid var(--gray-100); }
.total-display {
    font-size: .85rem; color: var(--gray-600);
}
.total-display strong { color: var(--green); font-size: 1.05rem; }
.form-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 4px 0 20px;
}
.mono-textarea { font-family: 'Courier New', monospace; font-size: .82rem; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.settings-full { grid-column: 1 / -1; }
.help-text { color: var(--gray-500); font-size: .82rem; margin-bottom: 16px; }
.variables-grid {
    display: grid; grid-template-columns: auto 1fr;
    gap: 6px 12px; align-items: center;
    margin-bottom: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px 16px;
}
.variable-tag {
    background: var(--blue-light); color: var(--blue-dark);
    font-family: monospace; font-size: .78rem; font-weight: 600;
    padding: 3px 8px; border-radius: 4px;
    white-space: nowrap;
}
.variable-desc { font-size: .8rem; color: var(--gray-600); }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius);
    margin: 16px 24px 0;
    font-size: .83rem; font-weight: 500;
    position: relative;
}
.flash-success { background: var(--green-light); color: #1B5E20; border: 1px solid #A5D6A7; }
.flash-error   { background: var(--red-light);   color: #B71C1C; border: 1px solid #EF9A9A; }
.flash-info    { background: var(--blue-light);  color: var(--blue-dark); border: 1px solid #90CAF9; }
.flash-close {
    background: none; border: none; cursor: pointer;
    opacity: .5; margin-left: auto; font-size: 12px; padding: 4px;
}
.flash-close:hover { opacity: 1; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-body {
    background: var(--gray-50);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.auth-container {
    display: flex;
    width: 100%; max-width: 900px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-height: 580px;
}
.auth-card {
    flex: 0 0 440px; padding: 48px 40px;
    display: flex; flex-direction: column;
}
.auth-card-wide { flex: 0 0 100%; max-width: 640px; }
.auth-bg {
    flex: 1;
    background: linear-gradient(135deg, #1565C0 0%, #1E88E5 40%, #26A69A 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
}
.auth-bg-content { color: white; }
.auth-bg-content h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 12px; }
.auth-bg-content p { opacity: .85; line-height: 1.6; margin-bottom: 24px; font-size: .9rem; }
.auth-features { display: flex; flex-direction: column; gap: 10px; }
.auth-feature { display: flex; align-items: center; gap: 8px; font-size: .85rem; opacity: .9; }
.auth-feature i { color: #A5D6A7; }

.auth-logo {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 28px;
}
.auth-logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px;
}
.auth-logo-text { font-size: 1.2rem; }
.auth-logo-text span { color: var(--gray-600); font-weight: 400; }
.auth-logo-text strong { color: var(--gray-900); font-weight: 700; }
.auth-title    { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.auth-subtitle { color: var(--gray-500); font-size: .85rem; margin-bottom: 24px; }
.auth-form { flex: 1; }
.auth-footer { margin-top: 20px; text-align: center; font-size: .82rem; color: var(--gray-500); }
.auth-footer a { color: var(--blue); font-weight: 500; }

/* ============================================================
   PUBLIC PROPOSAL PAGE
   ============================================================ */
.public-body {
    background: var(--gray-50);
    min-height: 100vh;
}
.public-container {
    max-width: 800px; margin: 0 auto;
    padding: 20px;
}
.public-header {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.public-logo { display: flex; align-items: center; gap: 12px; }
.public-logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px;
}
.public-company { font-weight: 700; color: var(--gray-900); font-size: .95rem; }
.public-brand   { color: var(--gray-400); font-size: .72rem; }
.public-meta    { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.proposal-num   { font-size: .85rem; font-weight: 600; color: var(--gray-600); }

.public-content {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 16px;
}
.public-info-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-bottom: 1px solid var(--gray-100);
}
.public-info-card {
    padding: 20px;
    border-right: 1px solid var(--gray-100);
}
.public-info-card:last-child { border-right: none; }
.public-info-card h4 { font-size: .75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.public-info-card p  { font-size: .82rem; color: var(--gray-700); margin-bottom: 3px; }
.info-company { font-weight: 600; color: var(--gray-900) !important; }

.public-section { padding: 20px 24px; border-bottom: 1px solid var(--gray-100); }
.public-section:last-child { border-bottom: none; }
.public-section h3 { font-size: .85rem; font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.public-title { font-size: 1.3rem; font-weight: 700; color: var(--gray-900); margin-bottom: 12px; }
.public-obs { background: var(--gray-50); border-radius: 8px; padding: 14px; border-left: 3px solid var(--blue); }
.public-obs h4 { font-size: .75rem; font-weight: 600; color: var(--gray-500); margin-bottom: 6px; }
.public-obs p { font-size: .83rem; color: var(--gray-700); line-height: 1.6; }

.public-table tfoot .total-row td { padding-top: 14px; border-top: 2px solid var(--gray-200); }
.total-value { font-size: 1.05rem; color: var(--blue); }

.public-actions {
    padding: 28px 24px; text-align: center;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}
.public-actions h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }
.public-actions p { color: var(--gray-500); font-size: .83rem; margin-bottom: 20px; }
.public-btn-group { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.public-decision {
    display: flex; align-items: center; gap: 16px;
    padding: 24px;
    font-size: 2rem;
}
.public-decision.approved { background: var(--green-light); color: var(--green); }
.public-decision.rejected { background: var(--red-light);   color: var(--red); }
.public-decision h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.public-decision p  { font-size: .82rem; opacity: .8; margin: 0; }

.public-footer {
    text-align: center; padding: 16px;
    color: var(--gray-400); font-size: .75rem;
}


/* ============================================================
   DATEPICKER — Calendário customizado
   ============================================================ */
#datepicker-popup {
    display: none;
    position: absolute;
    z-index: 99999;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0,0,0,.14);
    width: 280px;
    padding: 12px;
    font-family: 'Poppins', sans-serif;
    animation: dpFadeIn .15s ease;
}
@keyframes dpFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.dp-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.dp-title {
    font-size: .85rem; font-weight: 600; color: var(--gray-800);
}
.dp-nav {
    background: none; border: none; cursor: pointer;
    width: 28px; height: 28px; border-radius: 6px;
    color: var(--gray-500); font-size: 1.2rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.dp-nav:hover { background: var(--gray-100); color: var(--blue); }

.dp-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    margin-bottom: 6px;
}
.dp-weekdays span {
    text-align: center; font-size: .68rem; font-weight: 600;
    color: var(--gray-400); padding: 4px 0;
    text-transform: uppercase; letter-spacing: .03em;
}

.dp-days {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.dp-empty { visibility: hidden; }
.dp-day {
    text-align: center; padding: 7px 2px;
    font-size: .8rem; color: var(--gray-700);
    border-radius: 6px; cursor: pointer;
    transition: background .12s, color .12s;
    line-height: 1;
}
.dp-day:hover {
    background: var(--blue-light); color: var(--blue-dark);
}
.dp-today {
    font-weight: 700; color: var(--blue);
    background: var(--blue-light);
}
.dp-selected {
    background: var(--blue) !important;
    color: white !important;
    font-weight: 600;
}

/* Ícone de calendário nos inputs de data */
.date-input {
    cursor: pointer !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-left: 12px !important;  /* sem ícone à esquerda */
    padding-right: 36px !important;
    user-select: none;
}

/* ============================================================
   SIDEBAR OVERLAY (MOBILE)
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
}


/* ---- Fix: selects dentro de search-form não ocupam linha inteira ---- */
.search-form .form-select {
    width: auto;
    min-width: 160px;
    flex-shrink: 0;
}
.search-form .input-icon-wrap input {
    min-width: 180px;
}
/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    :root { --sidebar-w: 260px; }

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close { display: block; }
    .sidebar-overlay.open { display: block; }

    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; }

    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .auth-container { flex-direction: column; max-width: 480px; }
    .auth-bg { display: none; }
    .auth-card { flex: none; }
    .public-info-grid { grid-template-columns: 1fr; }
    .public-info-card { border-right: none; border-bottom: 1px solid var(--gray-100); }
}

@media (max-width: 600px) {
    .page-content { padding: 16px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .flash { margin: 12px 16px 0; }
    .topbar { padding: 0 16px; }
    .user-name { display: none; }
    .actions-cell { white-space: nowrap; }
}

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