/* ──────────────────────────────────────────────────────────────────────────────
   orcamentos-page.css
   ────────────────────────────────────────────────────────────────────────────── */

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 18px 48px;
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */

.hero {
    background: linear-gradient(125deg, #fff9ef 0%, #f5efe3 65%, #efe8da 100%);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.hero h1 {
    margin: 0;
    font-family: "Sora", sans-serif;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    line-height: 1.1;
}

.hero p {
    margin: 6px 0 0;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Panel ──────────────────────────────────────────────────────────────────── */

.panel {
    margin-top: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.panel-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    background: #faf8f5;
}

.counter {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--muted);
}

/* ── Orcamento Card ─────────────────────────────────────────────────────────── */

.list {
    padding: 12px 18px;
    display: grid;
    gap: 10px;
}

.orc-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 16px;
    align-items: start;
    transition: box-shadow 0.15s;
}

.orc-card:hover {
    box-shadow: 0 2px 12px rgba(42, 36, 29, 0.08);
}

.orc-card-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.orc-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.orc-numero {
    font-weight: 800;
    font-size: 0.92rem;
    color: #2a241d;
    font-family: "Sora", sans-serif;
}

.orc-cliente {
    font-size: 0.88rem;
    color: var(--muted);
}

.orc-card-meta {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--muted);
}

.orc-total {
    font-weight: 700;
    color: #2a241d;
    font-size: 0.9rem;
}

.orc-validade {
    font-size: 0.8rem;
}

.orc-validade.expired {
    color: #c0392b;
    font-weight: 600;
}

.orc-pedido-link {
    font-size: 0.8rem;
    color: #8f5221;
    font-weight: 600;
}

/* ── Status badges ──────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-rascunho  { background: #f0f0f0; color: #555; }
.badge-enviado   { background: #e8f0fe; color: #1a56db; }
.badge-aprovado  { background: #e6f9f0; color: #0d7a4e; }
.badge-recusado  { background: #fdecea; color: #c0392b; }
.badge-expirado  { background: #fff3e0; color: #b45309; }

/* ── Actions ────────────────────────────────────────────────────────────────── */

.orc-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-start;
}

/* ── Modal wide ─────────────────────────────────────────────────────────────── */

.modal-card-wide {
    max-width: 760px;
    width: calc(100vw - 32px);
    max-height: 90vh;
    overflow-y: auto;
}

/* ── Form sections ──────────────────────────────────────────────────────────── */

.form-section {
    margin-bottom: 22px;
}

.form-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8f5221;
    margin: 0 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}

/* ── Client toggle ──────────────────────────────────────────────────────────── */

.radio-group {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

/* ── Items table ────────────────────────────────────────────────────────────── */

.items-table-wrap {
    overflow-x: auto;
    margin-bottom: 8px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.items-table th {
    background: #f5f0eb;
    border: 1px solid var(--line);
    padding: 6px 8px;
    text-align: left;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #555;
    white-space: nowrap;
}

.items-table td {
    border: 1px solid var(--line);
    padding: 4px 6px;
    vertical-align: middle;
}

.items-table input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.86rem;
    padding: 2px 4px;
    color: #2a241d;
    outline: none;
    min-width: 60px;
}

.items-table input:focus {
    background: #fff8ed;
    border-radius: 4px;
}

.items-table .col-num { width: 70px; }
.items-table .col-un  { width: 70px; }
.items-table .col-del { width: 36px; text-align: center; }

.item-del-btn {
    background: none;
    border: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.12s;
}

.item-del-btn:hover { background: #fdecea; }

.item-row-total {
    font-weight: 700;
    text-align: right;
    color: #2a241d;
    white-space: nowrap;
}

/* ── Financial grid ─────────────────────────────────────────────────────────── */

.financeiro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.total-display {
    text-align: right;
    font-size: 1rem;
    font-weight: 800;
    color: #8f5221;
    padding: 8px 4px;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.empty-state p {
    margin: 6px 0 0;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .orc-card {
        grid-template-columns: 1fr;
    }

    .orc-actions {
        justify-content: flex-start;
    }
}

/* ── Autocomplete ───────────────────────────────────────────────────────────── */

.autocomplete-wrap {
    position: relative;
}

.autocomplete-wrap input {
    padding-right: 36px;
}

.autocomplete-arrow {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 34px;
    background: none;
    border: none;
    border-radius: 0 10px 10px 0;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
    padding: 0;
}

.autocomplete-arrow:hover {
    background: #f5f0eb;
    color: #8f5221;
}

.autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(42, 36, 29, 0.14);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    z-index: 200;
    max-height: 220px;
    overflow-y: auto;
}

.autocomplete-list li {
    padding: 9px 14px;
    cursor: pointer;
    transition: background 0.1s;
}

.autocomplete-list li:hover,
.autocomplete-list li.ac-active {
    background: #fff8ed;
}

.autocomplete-list .ac-nome {
    font-size: 0.88rem;
    font-weight: 600;
    color: #2a241d;
}

.autocomplete-list .ac-info {
    font-size: 0.77rem;
    color: var(--muted);
    margin-top: 1px;
}

.autocomplete-list .ac-empty {
    padding: 10px 14px;
    font-size: 0.84rem;
    color: var(--muted);
    font-style: italic;
    cursor: default;
}

/* ── Btn link ───────────────────────────────────────────────────────────────── */

.btn-link {
    background: none;
    border: none;
    color: #8f5221;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    display: inline-block;
    margin-top: 6px;
    border-radius: 0;
}

.btn-link:hover { color: #6b3c18; }

/* ── Field hint ─────────────────────────────────────────────────────────────── */

.field-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 4px;
}

/* ── Add item button ────────────────────────────────────────────────────────── */

.btn-add-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 10px 16px;
    width: 100%;
    background: #fff8ed;
    border: 1.5px dashed #c4893e;
    border-radius: 8px;
    color: #8f5221;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-add-item:hover {
    background: #fff0d6;
    border-color: #8f5221;
}

/* ── Items empty state ──────────────────────────────────────────────────────── */

.items-empty {
    text-align: center;
    padding: 22px 16px;
    color: var(--muted);
    font-size: 0.86rem;
    font-style: italic;
    background: #faf8f5;
}

/* ── Item row flash ─────────────────────────────────────────────────────────── */

@keyframes rowFlash {
    0%   { background: #fff3d6; }
    100% { background: transparent; }
}

.item-row-flash td {
    animation: rowFlash 0.7s ease-out;
}

/* ── Resumo financeiro simplificado ─────────────────────────────────────────── */

.financeiro-resumo {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.financeiro-linha {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
    gap: 12px;
}

.financeiro-linha:last-child { border-bottom: none; }

.financeiro-label {
    color: var(--muted);
    font-size: 0.86rem;
}

.financeiro-valor {
    font-weight: 600;
    color: #2a241d;
}

.financeiro-total-linha {
    background: #fff8ed;
}

.financeiro-label-total {
    font-weight: 700;
    font-size: 0.9rem;
    color: #2a241d;
}

.financeiro-total {
    font-weight: 800;
    font-size: 1.05rem;
    color: #8f5221;
}

.desconto-input {
    width: 130px;
    text-align: right;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.88rem;
    font-family: inherit;
    background: #fff;
    color: #2a241d;
    outline: none;
}

.desconto-input:focus {
    border-color: #8f5221;
    box-shadow: 0 0 0 2px rgba(143, 82, 33, 0.12);
}
