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

.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: grid;
    gap: 18px;
}

.hero-top {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
}

.hero h1 {
    margin: 8px 0 0;
    font-family: "Sora", sans-serif;
    font-size: clamp(1.4rem, 2.5vw, 1.95rem);
}

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

/* ── Tabs de visualização ─────────────────────────────────────────────────── */

.tabs-nav {
    display: flex;
    gap: 2px;
    margin-top: 20px;
    border-bottom: 2px solid var(--line);
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 8px 8px 0 0;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.tab:hover {
    color: var(--text);
    background: rgba(180, 106, 43, 0.06);
}

.tab-active {
    color: var(--primary-strong);
    border-bottom-color: var(--primary);
    background: rgba(180, 106, 43, 0.04);
}

/* ── Panel e filtros ──────────────────────────────────────────────────────── */

.panel {
    margin-top: 10px;
}

.panel-head {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.panel-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.panel-filters-row .search {
    flex: 1;
    min-width: 150px;
    width: auto;
}

.panel-filters-row .status-filter {
    width: 190px;
}

.panel-filters-row .counter {
    margin-left: auto;
    white-space: nowrap;
}

/* ── Date toggle button ───────────────────────────────────────────────────── */

.btn-date-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    transition: 0.15s ease;
}

.btn-date-filter:hover {
    background: #fff8ed;
    border-color: var(--primary);
}

.btn-date-filter.active {
    background: #fff1dd;
    border-color: var(--primary);
    color: var(--primary-strong);
}

.date-filter-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    display: none;
}

.btn-date-filter.active .date-filter-dot {
    display: block;
}

/* ── Date filter panel ────────────────────────────────────────────────────── */

.date-filter-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #fffbf5;
    border: 1px solid var(--line);
    border-radius: 10px;
    animation: dateSlideIn 0.18s ease;
}

@keyframes dateSlideIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

.date-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
}

.btn-clear-dates {
    background: none;
    border: 1px solid rgba(180, 106, 43, 0.35);
    color: var(--primary-strong);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    font-family: inherit;
    transition: background 0.15s;
}

.btn-clear-dates:hover {
    background: rgba(180, 106, 43, 0.08);
}

.list {
    max-height: 64vh;
    overflow: auto;
}

.pedido-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    display: grid;
    gap: 10px;
    background: #fff;
}

.pedido-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.pedido-title {
    margin: 0;
    font-size: 1rem;
    font-family: "Sora", sans-serif;
}

.pedido-meta {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.totals {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 8px;
}

.total-box {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
    background: #fffcf6;
}

.total-box .label {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.total-box strong {
    font-size: 0.95rem;
}

.pedido-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Histórico: lista de clientes ────────────────────────────────────────── */

.cliente-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.cliente-card:hover {
    border-color: var(--primary);
    background: #fffbf6;
    box-shadow: 0 2px 12px rgba(180, 106, 43, 0.1);
}

.cliente-card-nome {
    font-family: "Sora", sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.cliente-card-hint {
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.historico-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 6px 4px;
    margin-bottom: 4px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    border-radius: 8px;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
    width: 100%;
    text-align: left;
}

.historico-back-btn:hover {
    color: var(--primary-strong);
    background: rgba(180, 106, 43, 0.06);
}

/* ── Pedido card clicável (histórico) ────────────────────────────────────── */

.pedido-card-clicavel {
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.pedido-card-clicavel:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 14px rgba(180, 106, 43, 0.1);
}

/* ── Modal de detalhes ────────────────────────────────────────────────────── */

.modal-card-detalhes {
    width: min(640px, 100%);
    border-top: 3px solid var(--primary);
}

.modal.open .modal-card-detalhes {
    animation: detalhesCardIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes detalhesCardIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card-detalhes .close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(100, 80, 50, 0.07);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.modal-card-detalhes .close:hover {
    background: rgba(180, 106, 43, 0.14);
    color: var(--primary-strong);
}

#modalDetalhesConteudo {
    display: grid;
    gap: 10px;
    padding-top: 4px;
}

.drawer-section {
    background: #fffcf8;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 4px rgba(77, 59, 34, 0.05);
    display: grid;
    gap: 0;
}

.drawer-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary-strong);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.drawer-section-title::before {
    content: "";
    width: 3px;
    height: 12px;
    background: var(--primary);
    border-radius: 2px;
    flex-shrink: 0;
}

.drawer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    padding: 7px 0;
    border-bottom: 1px solid rgba(222, 213, 201, 0.6);
}

.drawer-row:last-child {
    border-bottom: none;
}

.drawer-row-label {
    color: var(--muted);
    font-weight: 500;
    flex-shrink: 0;
}

.drawer-row-value {
    font-weight: 700;
    color: var(--text);
    text-align: right;
}

.drawer-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text);
}

.drawer-text-muted {
    margin: 8px 0 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--muted);
}

/* ── Valores: grid de boxes + total em destaque ───────────────────────────── */

.detalhes-valores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.detalhes-valor-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detalhes-valor-label {
    font-size: 0.73rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detalhes-valor-num {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text);
}

.detalhes-total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #fff8ed, #fef0d8);
    border: 1px solid rgba(180, 106, 43, 0.25);
    border-radius: 10px;
    padding: 11px 14px;
}

.detalhes-total-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary-strong);
}

.detalhes-total-num {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-strong);
}

/* ── Consumos ─────────────────────────────────────────────────────────────── */

.consumo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(222, 213, 201, 0.5);
    font-size: 0.88rem;
}

.consumo-item:last-child {
    border-bottom: none;
}

.consumo-tipo {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.consumo-tipo-madeira {
    background: rgba(62, 140, 64, 0.12);
    color: #2e7a30;
}

.consumo-tipo-produto {
    background: rgba(43, 100, 180, 0.12);
    color: #1a5fa8;
}

.consumo-desc {
    flex: 1;
    color: var(--text);
}

.consumo-qtd {
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Media queries ────────────────────────────────────────────────────────── */

@media (max-width: 920px) {
    .panel-head {
        grid-template-columns: 1fr;
    }

    .counter {
        justify-self: start;
    }

    .totals {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

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

    .detalhes-valores-grid {
        grid-template-columns: 1fr 1fr;
    }
}

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