/* === Reset & base === */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: #1f2937;
    background: #f3f4f6;
    line-height: 1.4;
}

a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }

button, .btn-primary, .btn-secondary, .btn-sm, .btn-remove {
    font-family: inherit;
    cursor: pointer;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    display: inline-block;
    text-align: center;
}
.btn-primary {
    background: #1e3a8a; color: #fff; font-weight: 600;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-secondary {
    background: #e5e7eb; color: #1f2937; font-weight: 500;
}
.btn-secondary:hover { background: #d1d5db; }
.btn-sm { padding: 5px 10px; font-size: 12px; background: #1e3a8a; color: #fff; }
.btn-remove {
    background: #fee2e2; color: #b91c1c; width: 30px; height: 30px; padding: 0; border-radius: 4px; font-size: 18px; line-height: 1;
}
.btn-remove:hover { background: #fecaca; }

/* === Login === */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
}
.login-box {
    background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
    width: 100%; max-width: 380px;
}
.login-header { text-align: center; margin-bottom: 28px; }
.logo-area .logo-text {
    font-size: 32px; font-weight: 900; color: #1e3a8a; letter-spacing: 2px;
}
.logo-area .logo-sub { font-size: 11px; color: #6b7280; letter-spacing: 4px; }
.login-header h1 { font-size: 18px; color: #1f2937; margin-top: 8px; font-weight: 500; }
.login-box .form-group { margin-bottom: 16px; }
.login-box label { display: block; margin-bottom: 6px; color: #4b5563; font-weight: 500; font-size: 13px; }
.login-box input {
    width: 100%; padding: 12px 14px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.login-box input:focus { outline: none; border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,.15); }
.login-box button { width: 100%; padding: 12px; font-size: 15px; }
.alert.error { background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }

/* === Topbar === */
.topbar { background: #1e3a8a; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-title { font-size: 22px; font-weight: 900; letter-spacing: 1.5px; }
.brand-sub { font-size: 13px; color: #bfdbfe; }
.topbar-nav { display: flex; align-items: center; gap: 16px; }
.topbar-nav .user { font-size: 14px; }
.topbar-nav .btn-secondary { background: rgba(255,255,255,.15); color: #fff; padding: 6px 14px; }
.topbar-nav .btn-secondary:hover { background: rgba(255,255,255,.25); }

/* === Container === */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h1 { font-size: 24px; color: #1f2937; }

/* === Filter bar === */
.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select {
    padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.filter-bar input { flex: 1; min-width: 200px; }

/* === Card === */
.card {
    background: #fff; border-radius: 8px; padding: 20px 24px; margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.section-title {
    font-size: 15px; font-weight: 700; color: #1e3a8a;
    border-bottom: 2px solid #dbeafe; padding-bottom: 8px; margin-bottom: 16px;
    text-transform: uppercase; letter-spacing: .5px;
}

/* === Forms === */
.form-group { margin-bottom: 12px; position: relative; }
.form-group label { display: block; margin-bottom: 4px; color: #4b5563; font-size: 12px; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 14px; font-family: inherit; background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.form-group input[readonly] { background: #f9fafb; color: #6b7280; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }

.autocomplete .sugestoes {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    background: #fff; border: 1px solid #d1d5db; border-top: none; border-radius: 0 0 6px 6px;
    max-height: 250px; overflow-y: auto; display: none; box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.autocomplete .sug {
    padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f3f4f6;
}
.autocomplete .sug:hover { background: #eff6ff; }
.autocomplete .sug small { color: #6b7280; margin-left: 8px; }

/* === Tabelas === */
.data-table, .itens-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
}
.data-table th, .data-table td, .itens-table th, .itens-table td {
    padding: 11px 12px; text-align: left; border-bottom: 1px solid #e5e7eb;
}
.data-table th, .itens-table th {
    background: #f9fafb; color: #4b5563; font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: .5px;
}
.data-table .empty { text-align: center; color: #9ca3af; padding: 30px; }
.data-table .num, .itens-table .num { text-align: right; }
.data-table tbody tr:hover { background: #f9fafb; }

.itens-table input { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px; background: #fff; }
.itens-table input:hover { border-color: #9ca3af; }
.itens-table input:focus { border-color: #1d4ed8; background: #fff; box-shadow: 0 0 0 3px rgba(29,78,216,.12); outline: none; }
.itens-table .item-total { background: #f3f4f6; color: #1f2937; font-weight: 600; border-color: #e5e7eb; }
.itens-table .item-cod { background: #f9fafb; }
.itens-table .item-desc { font-weight: 500; }
.itens-table tbody tr:hover { background: #f9fafb; }
#addItem { margin-top: 14px; padding: 10px 20px; font-weight: 600; }
#addItem:hover { background: #1d4ed8; color: #fff; }

/* === Status badge === */
.status {
    padding: 3px 10px; border-radius: 12px; font-size: 11px;
    text-transform: uppercase; font-weight: 600; letter-spacing: .5px;
}
.status-aberto { background: #dbeafe; color: #1e40af; }
.status-aprovado { background: #d1fae5; color: #065f46; }
.status-rejeitado { background: #fee2e2; color: #991b1b; }
.status-concluido { background: #e0e7ff; color: #3730a3; }

/* Status dropdown no dashboard */
.status-form { margin: 0; }
.status-select {
    padding: 4px 8px; border-radius: 12px; font-size: 11px;
    text-transform: uppercase; font-weight: 600; letter-spacing: .5px;
    border: 1px solid transparent; cursor: pointer; appearance: none;
    -webkit-appearance: none; padding-right: 22px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><path fill='%236b7280' d='M0 2l4 4 4-4z'/></svg>");
    background-repeat: no-repeat; background-position: right 8px center;
}
.status-select.status-aberto { background-color: #dbeafe; color: #1e40af; }
.status-select.status-aprovado { background-color: #d1fae5; color: #065f46; }
.status-select.status-rejeitado { background-color: #fee2e2; color: #991b1b; }
.status-select.status-concluido { background-color: #e0e7ff; color: #3730a3; }

.acoes { display: flex; gap: 6px; align-items: center; }
.btn-sm.btn-danger { background: #dc2626; }
.btn-sm.btn-danger:hover { background: #b91c1c; }
.btn-sm.btn-edit { background: #0891b2; }
.btn-sm.btn-edit:hover { background: #0e7490; }

/* === Totais === */
.totais { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
.totais .form-group input { font-size: 15px; font-weight: 600; }
.totais .total-final input { background: #1e3a8a; color: #fff; font-size: 18px; }

.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* === Visualizar / PDF === */
.visualizar-page { background: #e5e7eb; }
.toolbar {
    max-width: 900px; margin: 0 auto; padding: 16px 24px; display: flex; gap: 12px;
}
.a4-page { max-width: 900px; margin: 0 auto 30px; padding: 0 12px; }
.orcamento-doc { background: #fff; padding: 30px 36px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }

.orc-header { display: grid; grid-template-columns: 130px 1fr 220px; gap: 16px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid #e5e7eb; margin-bottom: 12px; }
.logo-area { text-align: center; }
.logo-img { max-width: 120px; max-height: 80px; }
.logo-svg { width: 130px; height: 85px; display: block; margin: 0 auto; }
.logo-fallback {
    background: #1e3a8a; color: #fff; padding: 14px 6px; border-radius: 4px;
    font-weight: 900; text-align: center; line-height: 1.2; font-size: 14px;
}
.logo-fallback span { font-size: 10px; letter-spacing: 2px; }
.empresa-nome { font-size: 17px; color: #1e3a8a; font-weight: 700; }
.empresa-end, .empresa-doc, .empresa-fone { font-size: 11px; color: #4b5563; margin-top: 2px; }
.orc-meta { font-size: 12px; line-height: 1.7; border: 1px solid #e5e7eb; padding: 8px 10px; background: #fafafa; }
.orc-meta .meta-line strong { display: inline-block; min-width: 100px; }
.red { color: #dc2626; }

.orc-section { margin-bottom: 12px; }
.orc-section .section-title { background: #e5e7eb; padding: 6px 10px; font-size: 12px; margin-bottom: 0; border: 1px solid #d1d5db; }

.cliente-table, .veiculo-table { width: 100%; border-collapse: collapse; }
.cliente-table td, .veiculo-table td { padding: 5px 8px; font-size: 12px; border: 1px solid #d1d5db; }
.cliente-table .lab, .veiculo-table .lab { background: #f3f4f6; font-weight: 600; color: #4b5563; width: 90px; }
.cliente-table .val, .veiculo-table .val { background: #fff; }

.produtos-table { width: 100%; border-collapse: collapse; }
.produtos-table th, .produtos-table td { padding: 5px 8px; font-size: 12px; border: 1px solid #d1d5db; }
.produtos-table th { background: #1e3a8a; color: #fff; text-align: left; font-weight: 600; }
.produtos-table th.num, .produtos-table td.num { text-align: right; }

.orc-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
.assinaturas .section-title { background: #e5e7eb; padding: 6px 10px; font-size: 12px; border: 1px solid #d1d5db; border-bottom: none; }
.assinatura-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 10px; border: 1px solid #d1d5db; }
.ass-box { font-size: 11px; }
.ass-linha { margin-top: 38px; }

.totais-box { font-size: 13px; }
.tot-row { display: flex; justify-content: space-between; padding: 6px 10px; border: 1px solid #d1d5db; border-bottom: none; }
.tot-row.total { background: #1e3a8a; color: #fff; font-weight: 700; border-bottom: 1px solid #d1d5db; }
.tot-row .num { font-weight: 600; }

.page-number { text-align: right; font-size: 11px; color: #6b7280; margin-top: 8px; }
