/* =============================================================
   GestaoObras — Global CSS
   ============================================================= */
:root {
    --primary:       #1a56db;
    --primary-dark:  #1241a8;
    --primary-light: #e8f0fd;
    --secondary:     #0d9488;
    --accent:        #f59e0b;
    --success:       #16a34a;
    --warning:       #d97706;
    --error:         #dc2626;
    --neutral-50:    #f8fafc;
    --neutral-100:   #f1f5f9;
    --neutral-200:   #e2e8f0;
    --neutral-300:   #cbd5e1;
    --neutral-400:   #94a3b8;
    --neutral-500:   #64748b;
    --neutral-600:   #475569;
    --neutral-700:   #334155;
    --neutral-800:   #1e293b;
    --neutral-900:   #0f172a;
    --sidebar-w:     260px;
    --header-h:      64px;
    --radius:        8px;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
    --shadow:        0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:     0 8px 32px rgba(0,0,0,.14);
    --font:          'Inter', 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--neutral-100);
    color: var(--neutral-800);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* Sidebar Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    background: var(--neutral-900);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
}
.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand .logo-icon {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.sidebar-brand h1 { font-size: .95rem; font-weight: 700; line-height: 1.2; }
.sidebar-brand span { font-size: .7rem; color: var(--neutral-400); }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section { padding: 8px 16px 4px; font-size: .65rem; font-weight: 700;
    letter-spacing: .08em; color: var(--neutral-500); text-transform: uppercase; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; font-size: .88rem; color: var(--neutral-400);
    border-radius: 0; transition: all .15s;
    cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,.07);
    color: #fff;
    text-decoration: none;
}
.nav-link.active { border-left: 3px solid var(--primary); padding-left: 17px; }
.nav-link .icon { width: 20px; text-align: center; font-size: 1rem; }
.nav-badge {
    margin-left: auto; background: var(--primary);
    color: #fff; font-size: .65rem; padding: 2px 7px;
    border-radius: 99px; font-weight: 700;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: .8rem; color: var(--neutral-400);
}
.sidebar-footer a { color: var(--error); font-weight: 600; }

/* Main content */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.topbar {
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--neutral-200);
    display: flex; align-items: center;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 50;
    gap: 16px;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--neutral-800); flex: 1; }
.topbar-user {
    display: flex; align-items: center; gap: 10px;
    font-size: .85rem; color: var(--neutral-600);
}
.avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .85rem;
}
.content { padding: 28px; flex: 1; }

/* Cards */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--neutral-200);
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--neutral-200);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.card-header h2 { font-size: 1rem; font-weight: 700; color: var(--neutral-800); }
.card-body { padding: 24px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px 24px;
    border: 1px solid var(--neutral-200);
    box-shadow: var(--shadow-sm);
    display: flex; align-items: center; gap: 16px;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.stat-info .value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-info .label { font-size: .78rem; color: var(--neutral-500); margin-top: 4px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--radius);
    font-size: .875rem; font-weight: 600; cursor: pointer;
    border: none; transition: all .15s; white-space: nowrap;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--neutral-200); color: var(--neutral-700); }
.btn-secondary:hover { background: var(--neutral-300); text-decoration: none; color: var(--neutral-800); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; text-decoration: none; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; text-decoration: none; color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--neutral-300); color: var(--neutral-700); }
.btn-outline:hover { background: var(--neutral-100); text-decoration: none; color: var(--neutral-800); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--neutral-700); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 9px 14px;
    border: 1px solid var(--neutral-300);
    border-radius: var(--radius);
    font-size: .9rem; color: var(--neutral-800);
    background: #fff;
    transition: border .15s, box-shadow .15s;
    font-family: var(--font);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}
.form-control.is-invalid { border-color: var(--error); }
.form-text { font-size: .78rem; color: var(--neutral-500); margin-top: 4px; }
.invalid-feedback { font-size: .78rem; color: var(--error); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--neutral-50);
    padding: 10px 14px;
    font-size: .78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--neutral-500);
    border-bottom: 1px solid var(--neutral-200);
    text-align: left;
    white-space: nowrap;
}
tbody td {
    padding: 12px 14px;
    font-size: .875rem;
    border-bottom: 1px solid var(--neutral-100);
    vertical-align: middle;
}
tbody tr:hover { background: var(--neutral-50); }
tbody tr:last-child td { border-bottom: none; }
.td-actions { display: flex; gap: 6px; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 99px;
    font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-green   { background: #dcfce7; color: #15803d; }
.badge-yellow  { background: #fef9c3; color: #92400e; }
.badge-red     { background: #fee2e2; color: #b91c1c; }
.badge-gray    { background: var(--neutral-200); color: var(--neutral-600); }
.badge-teal    { background: #ccfbf1; color: #0f766e; }

/* Alerts / Flash */
.alert {
    padding: 12px 18px; border-radius: var(--radius);
    font-size: .875rem; margin-bottom: 18px;
    display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.alert-warning { background: #fef9c3; color: #713f12; border: 1px solid #fde047; }
.alert-info    { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }

/* Progress bar */
.progress { background: var(--neutral-200); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar {
    height: 100%; background: var(--primary);
    border-radius: 99px; transition: width .4s ease;
}

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 200; display: flex; align-items: center; justify-content: center;
    padding: 20px; display: none;
}
.modal-overlay.open { display: flex; }
.modal {
    background: #fff; border-radius: var(--radius); max-width: 600px;
    width: 100%; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 18px 24px; border-bottom: 1px solid var(--neutral-200);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--neutral-200);
    display: flex; justify-content: flex-end; gap: 10px;
}
.btn-close {
    background: none; border: none; font-size: 1.2rem;
    cursor: pointer; color: var(--neutral-500); line-height: 1;
    padding: 2px;
}
.btn-close:hover { color: var(--neutral-800); }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--neutral-200); margin-bottom: 24px; }
.tab-link {
    padding: 10px 20px; font-size: .875rem; font-weight: 600;
    color: var(--neutral-500); cursor: pointer; border: none; background: none;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: all .15s;
}
.tab-link:hover { color: var(--neutral-800); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Pagination */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 16px; justify-content: center; }
.page-btn {
    min-width: 34px; height: 34px; padding: 0 10px;
    border: 1px solid var(--neutral-300); border-radius: var(--radius);
    background: #fff; color: var(--neutral-700); font-size: .85rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.page-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Stepper */
.stepper { display: flex; gap: 0; align-items: center; margin-bottom: 28px; }
.step { display: flex; align-items: center; gap: 0; flex: 1; }
.step-circle {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--neutral-200); color: var(--neutral-500);
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700; flex-shrink: 0; z-index: 1;
    transition: all .2s;
}
.step-circle.done { background: var(--success); color: #fff; }
.step-circle.active { background: var(--primary); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--neutral-200); margin: 0 4px; }
.step-line.done { background: var(--success); }
.step-label { display: none; }

/* Upload drop zone */
.dropzone {
    border: 2px dashed var(--neutral-300); border-radius: var(--radius);
    padding: 40px 20px; text-align: center; cursor: pointer;
    transition: all .2s; background: var(--neutral-50);
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.dropzone .dz-icon { font-size: 2.5rem; color: var(--neutral-400); margin-bottom: 12px; }
.dropzone p { font-size: .875rem; color: var(--neutral-500); }
.dropzone span { font-weight: 700; color: var(--primary); }

/* Login page */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--neutral-900) 0%, var(--neutral-800) 100%);
}
.login-box {
    background: #fff; border-radius: 16px; padding: 44px 40px;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-box .brand { text-align: center; margin-bottom: 32px; }
.login-box .brand h1 { font-size: 1.6rem; color: var(--neutral-900); font-weight: 800; }
.login-box .brand p { color: var(--neutral-500); font-size: .875rem; }

/* Responsive */
.hamburger { display: none; }
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .hamburger { display: flex; align-items: center; justify-content: center;
        width: 36px; height: 36px; background: none; border: none;
        font-size: 1.4rem; cursor: pointer; color: var(--neutral-700); }
    .sidebar-overlay {
        display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99;
    }
    .sidebar-overlay.open { display: block; }
}
@media (max-width: 600px) {
    .content { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--neutral-500); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--neutral-200); margin: 20px 0; }

/* =============================================================
   Orcamentista 1.1 — visual moderno
   ============================================================= */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #14b8a6;
    --accent: #f59e0b;
    --neutral-50: #f7f9fc;
    --neutral-100: #eef2f7;
    --neutral-900: #07152f;
    --sidebar-w: 272px;
    --header-h: 72px;
    --radius: 14px;
    --shadow-sm: 0 8px 28px rgba(15, 23, 42, .06);
    --shadow: 0 18px 50px rgba(15, 23, 42, .10);
    --shadow-lg: 0 28px 80px rgba(2, 8, 23, .22);
    --font: 'Manrope', 'Segoe UI', system-ui, sans-serif;
}

body {
    background:
        radial-gradient(circle at 94% 0%, rgba(37, 99, 235, .08), transparent 28rem),
        var(--neutral-50);
}

.sidebar {
    background: linear-gradient(165deg, #07152f 0%, #0d2146 58%, #123467 100%);
    padding: 12px;
    box-shadow: 12px 0 40px rgba(4, 13, 31, .14);
}

.sidebar-brand {
    margin: 0 0 8px;
    padding: 16px 14px 22px;
    border-bottom-color: rgba(255, 255, 255, .09);
}

.sidebar-brand .logo-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: linear-gradient(135deg, #3b82f6, #14b8a6);
    box-shadow: 0 10px 28px rgba(37, 99, 235, .35);
}

.sidebar-brand h1 { font-size: 1rem; letter-spacing: -.02em; }
.sidebar-brand span { color: #93a8c8; }
.sidebar-nav { padding: 8px 0; }
.nav-section { padding: 16px 12px 6px; color: #6f86aa; }
.nav-link {
    margin: 3px 0;
    padding: 10px 13px;
    border-radius: 10px;
    color: #adbed8;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); transform: translateX(2px); }
.nav-link.active {
    border: 0;
    padding-left: 13px;
    color: #fff;
    background: linear-gradient(90deg, rgba(59, 130, 246, .32), rgba(20, 184, 166, .11));
    box-shadow: inset 3px 0 #5eead4;
}
.nav-link .icon { color: #80a9ee; }
.nav-link.active .icon { color: #5eead4; }
.sidebar-footer { margin-top: 8px; border-radius: 12px; background: rgba(255,255,255,.04); }
.sidebar-footer a { color: #fda4af; display: inline-flex; gap: 8px; align-items: center; }

.topbar {
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid rgba(203, 213, 225, .7);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.topbar-title { letter-spacing: -.025em; }
.version-chip {
    padding: 4px 9px;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-light);
    font-size: .67rem;
    font-weight: 800;
}
.avatar { background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 7px 20px rgba(37, 99, 235, .24); }
.content { max-width: 1660px; width: 100%; margin: 0 auto; padding: 32px; }

.card, .stat-card {
    border-color: rgba(203, 213, 225, .72);
    box-shadow: var(--shadow-sm);
}
.card { overflow: hidden; }
.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
    content: '';
    position: absolute;
    width: 90px;
    height: 90px;
    right: -35px;
    top: -40px;
    border-radius: 50%;
    background: var(--stat-glow, rgba(37, 99, 235, .08));
}
.stat-info .value { letter-spacing: -.045em; }

.btn {
    min-height: 40px;
    padding: 10px 17px;
    border-radius: 11px;
    font-weight: 750;
    letter-spacing: -.01em;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 9px 24px rgba(37, 99, 235, .24);
}
.btn-primary:hover { box-shadow: 0 13px 30px rgba(37, 99, 235, .32); }
.btn-secondary { background: #fff; border: 1px solid var(--neutral-200); }
.btn-outline { background: rgba(255,255,255,.78); }
.btn-sm { min-height: 34px; border-radius: 9px; }
.btn:focus-visible, .nav-link:focus-visible, .form-control:focus-visible { outline: 3px solid rgba(37,99,235,.25); outline-offset: 2px; }

.form-control {
    min-height: 44px;
    border-color: #d7dfeb;
    border-radius: 11px;
    background: #fbfdff;
}
.form-control:focus { background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .11); }
.form-help { display: block; margin-top: 6px; color: var(--neutral-500); font-size: .76rem; }

.page-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading { margin-top: 8px; font-size: clamp(1.45rem, 2.3vw, 2.1rem); line-height: 1.15; letter-spacing: -.045em; color: var(--neutral-900); }
.page-subtitle { margin-top: 7px; color: var(--neutral-500); font-size: .88rem; }
.back-link { display: inline-flex; align-items: center; gap: 7px; color: var(--neutral-500); font-size: .8rem; font-weight: 700; }

.dashboard-hero {
    position: relative;
    display: grid;
    grid-template-columns: 1.5fr .8fr;
    gap: 24px;
    padding: 28px 30px;
    margin-bottom: 22px;
    border-radius: 20px;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(120deg, #07152f 0%, #123a73 62%, #0f766e 135%);
    box-shadow: 0 22px 50px rgba(7, 21, 47, .18);
}
.dashboard-hero::after { content: ''; position: absolute; right: -80px; top: -150px; width: 330px; height: 330px; border: 60px solid rgba(255,255,255,.05); border-radius: 50%; }
.dashboard-hero h1 { font-size: clamp(1.55rem, 3vw, 2.35rem); line-height: 1.16; letter-spacing: -.05em; max-width: 650px; }
.dashboard-hero p { color: #bdd0ec; margin-top: 10px; max-width: 600px; }
.hero-metric { position: relative; z-index: 1; align-self: center; padding: 18px 20px; border: 1px solid rgba(255,255,255,.13); border-radius: 15px; background: rgba(255,255,255,.07); backdrop-filter: blur(10px); }
.hero-metric small { display: block; color: #9fb7d8; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.hero-metric strong { display: block; font-size: 1.75rem; margin-top: 5px; letter-spacing: -.04em; }

.finance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px; }
.finance-card { padding: 20px; }
.finance-card .eyebrow { color: var(--neutral-500); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.finance-card .amount { display: block; margin-top: 8px; font-size: 1.65rem; font-weight: 800; letter-spacing: -.05em; }
.finance-card .trend { margin-top: 5px; color: var(--neutral-500); font-size: .76rem; }
.charts-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 20px; margin-bottom: 22px; }
.chart-card { min-height: 390px; }
.chart-wrap { position: relative; height: 300px; padding: 16px 20px 22px; }

.blueprint-shell { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 650px; background: #0b1220; border: 1px solid #1f2b40; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.blueprint-stage { position: relative; display: grid; place-items: center; min-width: 0; background-color: #0d1728; background-image: linear-gradient(rgba(80,120,180,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(80,120,180,.07) 1px, transparent 1px); background-size: 24px 24px; }
.blueprint-stage iframe, .blueprint-stage img { width: 100%; height: 650px; border: 0; object-fit: contain; }
.blueprint-stage img { padding: 24px; }
.blueprint-versions { padding: 18px; overflow-y: auto; background: #101c30; border-left: 1px solid #23324a; }
.blueprint-panel-title { margin: 2px 4px 14px; color: #dbeafe; font-size: .78rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.blueprint-version { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: #b9c9df; text-align: left; cursor: pointer; }
.blueprint-version:hover, .blueprint-version.active { background: rgba(59,130,246,.13); border-color: rgba(96,165,250,.23); color: #fff; }
.blueprint-version .file-icon { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.07); color: #60a5fa; }
.blueprint-version span:last-child { min-width: 0; }
.blueprint-version strong, .blueprint-version small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blueprint-version strong { font-size: .82rem; }
.blueprint-version small { margin-top: 3px; color: #7890b1; font-size: .68rem; }
.empty-state { min-height: 420px; display: grid; place-items: center; align-content: center; text-align: center; padding: 40px; border: 1px dashed #cbd5e1; border-radius: 20px; background: rgba(255,255,255,.65); }
.empty-state .empty-icon { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 18px; border-radius: 20px; color: var(--primary); background: var(--primary-light); font-size: 1.8rem; }
.empty-state p { max-width: 470px; margin-top: 7px; color: var(--neutral-500); }

.login-page { background: radial-gradient(circle at 70% 10%, rgba(37,99,235,.32), transparent 30rem), linear-gradient(135deg, #061229, #0d2852); padding: 22px; }
.login-box { border: 1px solid rgba(255,255,255,.5); border-radius: 22px; padding: 42px; }

@media (max-width: 1100px) {
    .charts-grid, .blueprint-shell { grid-template-columns: 1fr; }
    .blueprint-versions { border-left: 0; border-top: 1px solid #23324a; max-height: 300px; }
    .blueprint-stage iframe, .blueprint-stage img { height: 520px; }
}
@media (max-width: 760px) {
    .content { padding: 20px 16px; }
    .dashboard-hero, .finance-grid { grid-template-columns: 1fr; }
    .page-actions { align-items: stretch; flex-direction: column; }
    .page-actions .btn { justify-content: center; }
    .version-chip { display: none; }
    .blueprint-stage iframe, .blueprint-stage img { height: 420px; }
}
@media (max-width: 520px) {
    .stats-grid { grid-template-columns: 1fr; }
    .dashboard-hero { padding: 23px 20px; }
    .login-box { padding: 32px 24px; }
}

/* =============================================================
   Orcamentista 1.2 — navegação horizontal e catálogo técnico
   ============================================================= */
:root {
    --primary: #1f568f;
    --primary-dark: #174675;
    --primary-light: #edf4fb;
    --secondary: #159669;
    --neutral-50: #f5f7fa;
    --neutral-100: #edf1f6;
    --neutral-900: #102a43;
    --header-h: 66px;
    --radius: 10px;
    --shadow-sm: 0 2px 8px rgba(16, 42, 67, .045);
    --shadow: 0 12px 34px rgba(16, 42, 67, .09);
}

body { background: #f4f6f9; color: #162f49; }
body.nav-open { overflow: hidden; }
.layout { display: block; }
.main { margin-left: 0; min-width: 0; }

.sidebar {
    position: sticky;
    inset: 0 0 auto 0;
    width: 100%;
    height: 50px;
    min-height: 50px;
    padding: 0;
    display: block;
    color: #fff;
    background: #1f568f;
    box-shadow: none;
    z-index: 100;
}
.sidebar-frame {
    width: 100%;
    max-width: 1580px;
    height: 50px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
}
.sidebar-brand {
    flex: 0 0 auto;
    height: 50px;
    margin: 0;
    padding: 0 16px;
    gap: 9px;
    border: 0;
    color: #fff;
}
.sidebar-brand:hover { color: #fff; text-decoration: none; background: rgba(0, 0, 0, .08); }
.sidebar-brand .logo-icon {
    width: 29px;
    height: 29px;
    border-radius: 7px;
    font-size: .85rem;
    background: rgba(255, 255, 255, .15);
    box-shadow: none;
}
.sidebar-brand h1 { font-size: .82rem; white-space: nowrap; }
.sidebar-brand span { display: none; }
.sidebar-nav {
    min-width: 0;
    height: 50px;
    padding: 0;
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-section { display: none; }
.nav-link {
    flex: 0 0 auto;
    width: auto;
    height: 38px;
    margin: 6px 1px;
    padding: 0 11px;
    display: inline-flex;
    justify-content: center;
    border-radius: 6px;
    color: #e9f3ff;
    font-size: .76rem;
    font-weight: 600;
    white-space: nowrap;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, .10); transform: none; text-decoration: none; }
.nav-link.active {
    padding-left: 11px;
    color: #fff;
    background: rgba(255, 255, 255, .17);
    box-shadow: inset 0 -2px #cfe7ff;
}
.nav-link .icon { display: none; }
.sidebar-footer {
    flex: 0 0 auto;
    height: 50px;
    margin: 0;
    padding: 0 10px;
    display: flex;
    align-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.sidebar-user { display: none; }
.sidebar-footer .logout-link { padding: 8px; color: #e9f3ff; border-radius: 6px; }
.sidebar-footer .logout-link:hover { color: #fff; background: rgba(255, 255, 255, .12); text-decoration: none; }
.sidebar-footer .logout-link span { display: none; }
.nav-close { display: none; }

.topbar {
    top: 50px;
    height: var(--header-h);
    padding: 0;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid #dbe3ed;
    box-shadow: 0 1px 4px rgba(16, 42, 67, .035);
}
.topbar-inner {
    width: 100%;
    max-width: 1440px;
    height: 100%;
    margin: 0 auto;
    padding: 0 26px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.topbar-copy { min-width: 0; flex: 1; }
.topbar-eyebrow { display: block; margin-bottom: 1px; color: #7890a8; font-size: .61rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.topbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #102a43; font-size: 1rem; }
.avatar-small { width: 28px; height: 28px; font-size: .7rem; box-shadow: none; }
.content { max-width: 1440px; padding: 24px 26px 40px; }

.card, .stat-card {
    border-color: #dbe3ed;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}
.btn {
    min-height: 39px;
    border-radius: 8px;
    box-shadow: none;
}
.btn:hover { transform: none; }
.btn-primary { background: #1f568f; box-shadow: none; }
.btn-primary:hover { background: #174675; box-shadow: none; }
.form-control { border-radius: 8px; background: #fff; }
.page-heading { color: #102a43; font-size: clamp(1.35rem, 2vw, 1.8rem); letter-spacing: -.035em; }
.dashboard-hero { border-radius: 12px; background: linear-gradient(110deg, #173f6a, #1f568f 72%, #147d70); box-shadow: 0 10px 28px rgba(23, 63, 106, .14); }

/* Catálogo de plantas */
.catalog-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 10px; }
.catalog-heading h1 { font-size: clamp(1.45rem, 2.2vw, 1.9rem); line-height: 1.15; letter-spacing: -.04em; color: #102a43; }
.catalog-heading p { margin-top: 5px; color: #657b91; font-size: .82rem; }
.catalog-filter {
    margin-bottom: 18px;
    padding: 20px 22px;
    display: grid;
    grid-template-columns: minmax(240px, 1.45fr) minmax(180px, .85fr) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 14px;
    background: #fff;
    border: 1px solid #dbe3ed;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}
.catalog-filter .form-group { margin: 0; }
.catalog-filter-actions { display: flex; gap: 8px; }
.catalog-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.catalog-metric {
    min-height: 96px;
    padding: 17px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    background: #fff;
    border: 1px solid #dbe3ed;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}
.catalog-metric strong { display: block; color: #174675; font-size: clamp(1.45rem, 2.3vw, 1.9rem); line-height: 1; letter-spacing: -.045em; }
.catalog-metric span { margin-top: 8px; color: #657b91; font-size: .75rem; }
.document-section { padding: 22px; background: #fff; border: 1px solid #dbe3ed; border-radius: 10px; box-shadow: var(--shadow-sm); }
.document-section-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.document-section-header h2 { color: #102a43; font-size: 1rem; }
.document-section-header span { color: #7890a8; font-size: .74rem; }
.document-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.document-card {
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #d8e1ec;
    border-radius: 10px;
    box-shadow: 0 2px 7px rgba(16, 42, 67, .045);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.document-card:hover { border-color: #a9c3de; box-shadow: 0 10px 24px rgba(16, 42, 67, .10); transform: translateY(-2px); }
.document-preview {
    position: relative;
    height: 176px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #f8fafc;
    background-image: linear-gradient(135deg, rgba(31, 86, 143, .035) 25%, transparent 25%, transparent 50%, rgba(31, 86, 143, .035) 50%, rgba(31, 86, 143, .035) 75%, transparent 75%, transparent);
    background-size: 18px 18px;
}
.document-preview img { width: 100%; height: 100%; padding: 7px; object-fit: contain; background: #fff; }
.document-preview .file-placeholder { display: grid; place-items: center; gap: 6px; color: #8aa0b6; }
.document-preview .file-placeholder i { font-size: 3rem; }
.document-preview .file-placeholder strong { font-size: 1.7rem; letter-spacing: .03em; }
.document-type-chip, .document-extension, .document-version {
    position: absolute;
    z-index: 2;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: .61rem;
    font-weight: 800;
    line-height: 1.35;
}
.document-type-chip { top: 9px; left: 9px; max-width: calc(100% - 70px); color: #173f6a; background: rgba(255, 255, 255, .92); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-version { top: 9px; right: 9px; color: #174675; background: #dcecfb; }
.document-extension { right: 9px; bottom: 9px; color: #fff; background: #159669; }
.document-extension.pdf { background: #d34b4b; }
.document-body { padding: 12px 13px 13px; }
.document-title { display: block; overflow: hidden; color: #102a43; font-size: .82rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.document-meta { display: block; margin-top: 3px; overflow: hidden; color: #6f859b; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.document-details { margin-top: 9px; padding-top: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #edf1f5; color: #7a8da0; font-size: .64rem; }
.document-actions { display: flex; gap: 5px; }
.document-actions a { display: inline-grid; place-items: center; width: 29px; height: 29px; border: 1px solid #dbe3ed; border-radius: 7px; color: #1f568f; background: #fff; }
.document-actions a:hover { text-decoration: none; background: #edf4fb; }

@media (max-width: 1360px) {
    .sidebar-brand h1 { display: none; }
    .sidebar-brand { padding: 0 10px; }
    .nav-link { padding-inline: 9px; font-size: .72rem; }
    .nav-link.active { padding-left: 9px; }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 0;
        right: auto;
        bottom: 0;
        width: min(86vw, 330px);
        height: 100vh;
        padding: 12px;
        background: #173f6a;
        box-shadow: 15px 0 45px rgba(16, 42, 67, .24);
        transform: translateX(-105%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-frame { height: 100%; display: flex; flex-direction: column; align-items: stretch; }
    .sidebar-brand { height: auto; min-height: 64px; padding: 10px 48px 13px 10px; }
    .sidebar-brand h1 { display: block; font-size: .95rem; }
    .sidebar-brand span { display: block; color: #b8cee4; }
    .sidebar-brand .logo-icon { width: 40px; height: 40px; font-size: 1rem; }
    .nav-close { position: absolute; top: 22px; right: 20px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; color: #fff; background: rgba(255, 255, 255, .10); cursor: pointer; }
    .sidebar-nav { height: auto; padding: 8px 0; display: block; overflow-y: auto; }
    .nav-section { display: block; padding: 15px 11px 5px; color: #89a9c8; }
    .nav-link { width: 100%; height: auto; min-height: 42px; margin: 2px 0; padding: 9px 12px; justify-content: flex-start; border-radius: 8px; font-size: .82rem; }
    .nav-link.active { padding-left: 12px; box-shadow: inset 3px 0 #b8ddff; }
    .nav-link .icon { display: inline-block; color: #b8d6f4; }
    .sidebar-footer { height: auto; margin-top: auto; padding: 12px 8px 3px; justify-content: space-between; border-top: 1px solid rgba(255, 255, 255, .1); }
    .sidebar-user { min-width: 0; display: flex; align-items: center; gap: 8px; color: #fff; font-size: .72rem; }
    .sidebar-user > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .sidebar-footer .logout-link { display: inline-flex; align-items: center; gap: 6px; }
    .sidebar-footer .logout-link span { display: inline; }
    .topbar { top: 0; }
    .hamburger { display: flex; flex: 0 0 38px; }
    .catalog-filter { grid-template-columns: 1fr 1fr; }
    .catalog-filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 660px) {
    .topbar-inner { padding: 0 15px; }
    .topbar-eyebrow, .topbar-user .text-sm { display: none !important; }
    .content { padding: 19px 14px 32px; }
    .catalog-heading { align-items: stretch; flex-direction: column; }
    .catalog-heading .btn { justify-content: center; }
    .catalog-filter { padding: 16px; grid-template-columns: 1fr; }
    .catalog-filter-actions { grid-column: auto; }
    .catalog-filter-actions .btn { flex: 1; justify-content: center; }
    .catalog-metrics { grid-template-columns: 1fr 1fr; }
    .catalog-metric { min-height: 86px; }
    .document-section { padding: 15px; }
    .document-gallery { grid-template-columns: 1fr 1fr; gap: 10px; }
    .document-preview { height: 148px; }
}

@media (max-width: 440px) {
    .document-gallery { grid-template-columns: 1fr; }
    .document-preview { height: 190px; }
}

/* Visualizador imersivo de plantas */
body.viewer-open { overflow: hidden; }
.document-card {
    opacity: 0;
    animation: plantCardReveal .48s cubic-bezier(.2,.75,.2,1) forwards;
    animation-delay: calc(min(var(--card-index, 0), 10) * 55ms);
}
.plant-preview-trigger {
    width: 100%;
    border: 0;
    color: inherit;
    cursor: zoom-in;
}
.plant-preview-trigger::after {
    content: '\f00e';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(23, 70, 117, .88);
    box-shadow: 0 12px 30px rgba(16, 42, 67, .25);
    font: 900 1rem/1 'Font Awesome 6 Free';
    opacity: 0;
    transform: translate(-50%, -42%) scale(.8);
    transition: opacity .18s ease, transform .18s ease;
}
.document-card:hover .plant-preview-trigger::after,
.plant-preview-trigger:focus-visible::after { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.plant-preview-trigger img { transition: transform .42s cubic-bezier(.2,.7,.2,1), filter .25s ease; }
.document-card:hover .plant-preview-trigger img { transform: scale(1.035); filter: saturate(.8) contrast(1.03); }

.plant-viewer { position: fixed; inset: 0; z-index: 1000; display: none; padding: clamp(10px, 2.2vw, 30px); }
.plant-viewer.open { display: grid; place-items: center; }
.plant-viewer-backdrop { position: absolute; inset: 0; border: 0; background: rgba(3, 12, 28, .82); backdrop-filter: blur(12px); cursor: default; animation: viewerFade .2s ease both; }
.plant-viewer-dialog {
    position: relative;
    width: min(1480px, 100%);
    height: min(900px, calc(100vh - clamp(20px, 4.4vw, 60px)));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid rgba(162, 193, 223, .22);
    border-radius: 17px;
    color: #e9f3ff;
    background: #0b1a2c;
    box-shadow: 0 35px 100px rgba(0, 0, 0, .45);
    animation: viewerEnter .35s cubic-bezier(.16,.8,.25,1) both;
}
.plant-viewer-header { min-height: 76px; padding: 13px 16px 13px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid rgba(162,193,223,.15); background: linear-gradient(90deg, #102b4b, #0e223c); }
.plant-viewer-heading { min-width: 0; }
.plant-viewer-kicker { color: #71d9c5; font-size: .63rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.plant-viewer-heading h2 { margin-top: 3px; overflow: hidden; font-size: clamp(1rem, 2vw, 1.32rem); text-overflow: ellipsis; white-space: nowrap; }
.plant-viewer-heading p { margin-top: 2px; overflow: hidden; color: #91aac4; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.plant-viewer-toolbar { display: flex; align-items: center; gap: 6px; }
.plant-viewer-toolbar button, .plant-viewer-toolbar a, .plant-viewer-footer button {
    min-width: 38px; height: 38px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid rgba(162,193,223,.18); border-radius: 9px; color: #dceafb; background: rgba(255,255,255,.06); cursor: pointer;
}
.plant-viewer-toolbar button:hover, .plant-viewer-toolbar a:hover, .plant-viewer-footer button:hover { color: #fff; background: rgba(78,142,205,.22); text-decoration: none; }
.plant-viewer-toolbar button:disabled { opacity: .32; cursor: not-allowed; }
.plant-viewer-stage {
    position: relative;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: auto;
    background-color: #0a1727;
    background-image: linear-gradient(rgba(88,130,170,.09) 1px,transparent 1px),linear-gradient(90deg,rgba(88,130,170,.09) 1px,transparent 1px),radial-gradient(circle at 50% 40%,rgba(38,91,143,.2),transparent 45%);
    background-size: 26px 26px,26px 26px,auto;
}
.plant-viewer-stage::after { content: ''; position: absolute; z-index: 3; top: -10%; left: 0; right: 0; height: 2px; pointer-events: none; opacity: 0; background: linear-gradient(90deg,transparent,#64d8c0,transparent); box-shadow: 0 0 18px #64d8c0; }
.plant-viewer-stage.is-ready::after { animation: blueprintScan 2.2s ease-out .15s 1; }
.plant-viewer-loader { position: absolute; z-index: 5; color: #77b8f5; font-size: 1.7rem; }
.plant-viewer-image, .plant-viewer-frame { width: 100%; height: 100%; border: 0; opacity: 0; }
.plant-viewer-image { padding: clamp(14px, 3vw, 38px); object-fit: contain; transform-origin: center; transition: transform .24s ease; }
.plant-viewer-frame { background: #fff; }
.plant-viewer-stage.is-ready .plant-viewer-image, .plant-viewer-stage.is-ready .plant-viewer-frame { animation: blueprintMaterialize .52s cubic-bezier(.2,.7,.2,1) forwards; }
.plant-viewer-footer { min-height: 60px; padding: 10px 16px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px; border-top: 1px solid rgba(162,193,223,.15); background: #0e223c; }
.plant-viewer-footer p { overflow: hidden; color: #9db2c9; font-size: .72rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

@keyframes plantCardReveal { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes viewerFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes viewerEnter { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes blueprintMaterialize { from { opacity: 0; filter: blur(8px); transform: scale(.97); } to { opacity: 1; filter: blur(0); } }
@keyframes blueprintScan { 0% { top: 4%; opacity: 0; } 15% { opacity: .9; } 80% { opacity: .7; } 100% { top: 96%; opacity: 0; } }

@media (max-width: 700px) {
    .plant-viewer { padding: 0; }
    .plant-viewer-dialog { height: 100vh; border: 0; border-radius: 0; }
    .plant-viewer-header { min-height: 70px; padding: 10px 11px 10px 14px; }
    .plant-viewer-heading p { max-width: 55vw; }
    .plant-viewer-toolbar [data-viewer-zoom-out], .plant-viewer-toolbar [data-viewer-zoom-reset], .plant-viewer-toolbar [data-viewer-zoom-in] { display: none; }
    .plant-viewer-footer { grid-template-columns: auto auto; }
    .plant-viewer-footer p { display: none; }
    .plant-viewer-footer button { min-width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
    .document-card, .plant-viewer-backdrop, .plant-viewer-dialog, .plant-viewer-stage.is-ready .plant-viewer-image, .plant-viewer-stage.is-ready .plant-viewer-frame { animation: none; opacity: 1; }
    .plant-viewer-stage::after { display: none; }
    .plant-preview-trigger img { transition: none; }
}
