/* ===== Livro de Orçamento — Família Rockefeller =====
   Tema: pergaminho claro + ouro escuro (documento de cartório)
   Layout: livro aberto de duas páginas em telas largas */

:root {
    /* Fundos */
    --bg-deep: #c4b08a;
    --bg-mid: #d4c39c;
    --bg-frame: #8b6f23;

    /* Página (pergaminho creme) */
    --page: #f5ecd0;
    --page-2: #faf3dc;
    --page-edge: #e8d5a8;
    --page-shadow: #d4c39c;

    /* Ouro */
    --ouro-claro: #d4ab4d;
    --ouro-vivo: #b8923a;
    --ouro: #8b6f23;
    --ouro-medio: #6e5418;
    --ouro-escuro: #5a4313;
    --ouro-prof: #3d2e0e;

    /* Texto (tinta sobre pergaminho) */
    --tinta: #2a1f10;
    --tinta-soft: #4a3520;
    --tinta-fade: #6e5418;
    --tinta-mute: #8b7a4a;

    /* Estado */
    --aviso: #9a4316;
    --vermelho-selo: #7a1f15;
    --vermelho-escuro: #5a1410;
    --sucesso: #5a7d2a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

*:focus-visible {
    outline: 2.5px solid var(--ouro-vivo);
    outline-offset: 2px;
    border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

html, body {
    min-height: 100vh;
    font-family: 'Cormorant Garamond', 'IM Fell English', Georgia, serif;
    color: var(--tinta);
    background: var(--bg-deep);
    background-image:
        radial-gradient(ellipse at 50% 20%, #d4c39c 0%, #c4b08a 50%, #a89868 100%),
        repeating-linear-gradient(45deg, transparent 0 3px, rgba(94,71,22,0.03) 3px 6px);
    background-attachment: fixed;
    padding: 16px 10px;
    font-size: 15px;
    line-height: 1.4;
}

::selection {
    background: var(--ouro);
    color: var(--page);
}

/* ====== Skip link a11y ====== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 8px;
    padding: 10px 16px;
    background: var(--ouro);
    color: var(--page);
    font-family: 'Cinzel', serif;
    font-weight: 700;
    text-decoration: none;
    border-radius: 2px;
    z-index: 1000;
    transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============ FRAME (moldura externa dourada) ============ */
.book-frame {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
    background:
        linear-gradient(135deg, #c89530 0%, #8b6f23 30%, #d4ab4d 50%, #8b6f23 70%, #c89530 100%);
    border-radius: 4px;
    box-shadow:
        0 20px 60px rgba(74,53,32,0.5),
        0 0 0 1px var(--ouro-prof),
        inset 0 0 20px rgba(94,71,22,0.3);
}

.corner {
    position: absolute;
    width: 42px;
    height: 42px;
    color: var(--ouro-prof);
    z-index: 5;
    pointer-events: none;
}
.corner-tl { top: 4px; left: 4px; }
.corner-tr { top: 4px; right: 4px; transform: scaleX(-1); }
.corner-bl { bottom: 4px; left: 4px; transform: scaleY(-1); }
.corner-br { bottom: 4px; right: 4px; transform: scale(-1, -1); }

/* ============ HEADER ============ */
.book-header {
    background: var(--page);
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(184,146,58,0.18) 0%, transparent 70%);
    padding: 12px 22px 10px;
    text-align: center;
    border-radius: 1px 1px 0 0;
    box-shadow:
        inset 0 0 0 1px var(--ouro),
        inset 0 0 0 5px var(--page),
        inset 0 0 0 6px var(--ouro-medio),
        inset 0 0 30px rgba(184,146,58,0.15);
    border-bottom: 1px solid var(--ouro-medio);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.crest {
    width: 28px;
    height: 28px;
    color: var(--ouro);
    flex: 0 0 auto;
    filter: drop-shadow(0 1px 2px rgba(94,71,22,0.4));
}
.crest svg { width: 100%; height: 100%; display: block; }

.book-header h1 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: clamp(18px, 2.4vw, 24px);
    line-height: 1;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    background: linear-gradient(180deg, #b8923a 0%, #8b6f23 50%, #5a4313 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--ouro);
    margin: 0;
}

.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 6px auto 0;
    max-width: 420px;
}

.divider .line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ouro) 30%, var(--ouro-vivo) 50%, var(--ouro) 70%, transparent);
}

.divider .badge {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    font-size: 10px;
    color: var(--ouro-escuro);
    background: transparent;
    padding: 1px 8px;
    border: none;
    box-shadow: none;
    white-space: nowrap;
}

/* ============ SPREAD ============ */
.book-spread {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--page);
    position: relative;
}

@media (min-width: 980px) {
    .book-spread {
        grid-template-columns: 1fr 22px 1fr;
    }
}

.page {
    background: var(--page);
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(184,146,58,0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(184,146,58,0.08) 0%, transparent 50%),
        radial-gradient(circle at 20% 40%, rgba(122,94,31,0.08) 0%, transparent 35%),
        radial-gradient(circle at 80% 60%, rgba(122,94,31,0.06) 0%, transparent 35%);
    padding: 22px 24px 26px;
    box-shadow:
        inset 0 0 60px rgba(184,146,58,0.12);
    position: relative;
}

@media (min-width: 980px) {
    .page-left {
        box-shadow:
            inset -8px 0 18px rgba(122,94,31,0.20),
            inset 0 0 40px rgba(184,146,58,0.15);
        align-self: start;
        position: sticky;
        top: 12px;
    }
    .page-right {
        box-shadow:
            inset 8px 0 18px rgba(122,94,31,0.20),
            inset 0 0 40px rgba(184,146,58,0.15);
    }
}

/* Lombada do livro */
.spine {
    background:
        linear-gradient(90deg,
            #6e5418 0%, #5a4313 8%,
            #8b6f23 25%, #b8923a 50%, #8b6f23 75%,
            #5a4313 92%, #6e5418 100%);
    box-shadow:
        inset 0 0 12px rgba(58,42,12,0.7),
        0 0 20px rgba(94,71,22,0.3);
    display: none;
}
@media (min-width: 980px) {
    .spine { display: block; }
}

@media (max-width: 979px) {
    .page-left {
        border-bottom: 1px solid var(--ouro-medio);
        box-shadow:
            inset 0 0 40px rgba(184,146,58,0.15),
            0 4px 12px rgba(94,71,22,0.2);
    }
}

/* ============ SEÇÕES ============ */
section {
    margin-bottom: 16px;
    padding-bottom: 14px;
    position: relative;
}

section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

section + section::before {
    content: "";
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ouro-medio) 25%, var(--ouro) 50%, var(--ouro-medio) 75%, transparent);
    margin-bottom: 14px;
    opacity: 0.55;
}

h3 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--ouro-escuro);
    margin-bottom: 10px;
    letter-spacing: 3px;
    text-align: center;
    text-transform: uppercase;
}

h3::before, h3::after {
    content: " ✦ ";
    color: var(--ouro);
    font-size: 11px;
    margin: 0 8px;
    opacity: 0.85;
}

/* ============ CAMPOS ============ */
.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field > span, .field > label, label.field {
    display: block;
}

.field > span,
label[for] {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 10px;
    color: var(--ouro-escuro);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    margin-bottom: 4px;
}

select, input[type="number"], input[type="text"] {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    font-weight: 600;
    padding: 7px 10px;
    border: 1.5px solid var(--ouro-medio);
    background: var(--page-2);
    color: var(--tinta);
    border-radius: 1px;
    box-shadow:
        inset 0 1px 3px rgba(94,71,22,0.15),
        0 1px 0 rgba(255,255,255,0.4);
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder {
    color: var(--tinta-mute);
    font-style: italic;
    opacity: 0.7;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--ouro-vivo);
    box-shadow:
        inset 0 1px 3px rgba(94,71,22,0.15),
        0 0 0 2px rgba(184,146,58,0.35);
}

.hint {
    margin-top: 8px;
    font-style: italic;
    color: var(--tinta-fade);
    font-size: 13px;
    min-height: 18px;
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
}

.atalhos-hint {
    margin-top: 10px;
    text-align: center;
    font-size: 10px;
    color: var(--tinta-mute);
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
}

kbd {
    font-family: 'Special Elite', monospace;
    background: var(--page-edge);
    color: var(--ouro-prof);
    padding: 1px 6px;
    border-radius: 2px;
    border: 1px solid var(--ouro-medio);
    font-size: 11px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

/* ============ CLIENTE ============ */
.cliente-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(122,94,31,0.4);
}

.cliente-bar label {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    color: var(--ouro-escuro);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    margin: 0;
    white-space: nowrap;
    flex: 0 0 auto;
}

.cliente-bar input {
    flex: 1;
    min-width: 0;
}

/* ============ COMBOBOX ============ */
.combobox { position: relative; }

.combobox-input-wrap {
    position: relative;
}

.combobox input[type="text"] {
    padding-right: 42px;
}

.combobox-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    background: transparent;
    border: none;
    color: var(--ouro-escuro);
    font-size: 14px;
    cursor: pointer;
    border-radius: 1px;
    transition: background 0.15s, color 0.15s, transform 0.2s;
}

.combobox-toggle:hover {
    background: rgba(184,146,58,0.18);
    color: var(--ouro-prof);
}

.combobox.aberto .combobox-toggle {
    transform: translateY(-50%) rotate(180deg);
}

.combobox-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 360px;
    overflow-y: auto;
    background: var(--page-2);
    border: 1.5px solid var(--ouro);
    border-radius: 1px;
    list-style: none;
    padding: 4px 0;
    z-index: 30;
    box-shadow:
        0 12px 30px rgba(94,71,22,0.35),
        inset 0 0 0 4px var(--page-2),
        inset 0 0 0 5px rgba(184,146,58,0.25);
}

.combobox-list::-webkit-scrollbar { width: 10px; }
.combobox-list::-webkit-scrollbar-track { background: var(--page-edge); }
.combobox-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--ouro), var(--ouro-escuro));
    border-radius: 2px;
}

.combo-cat {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 9px;
    color: var(--ouro-prof);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    padding: 6px 12px 2px;
    border-top: 1px solid rgba(184,146,58,0.4);
    background: rgba(184,146,58,0.12);
}

.combo-cat:first-child { border-top: none; }

.combo-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-left: 3px solid transparent;
}

.combo-item:hover {
    background: rgba(184,146,58,0.18);
}

.combo-item.ativo {
    background: linear-gradient(90deg, rgba(184,146,58,0.30), rgba(184,146,58,0.10));
    border-left-color: var(--ouro-vivo);
}

.combo-nome {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--tinta);
}

.combo-preco {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 11px;
    color: var(--ouro-escuro);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.combo-vazio {
    padding: 18px;
    text-align: center;
    font-style: italic;
    color: var(--tinta-fade);
    font-family: 'Cormorant Garamond', serif;
}

/* ============ QUANTIDADE + QTD RÁPIDA ============ */
.qtd-bloco {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qtd-rapida {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.chip-qtd {
    flex: 1 0 auto;
    min-width: 52px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--ouro-prof);
    background: linear-gradient(180deg, rgba(184,146,58,0.18), rgba(184,146,58,0.08));
    border: 1px solid var(--ouro-medio);
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 1px;
    transition: all 0.12s;
}

.chip-qtd:hover {
    background: linear-gradient(180deg, var(--ouro-claro), var(--ouro));
    border-color: var(--ouro-escuro);
    color: var(--page);
    transform: translateY(-1px);
}

.chip-qtd:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(94,71,22,0.3);
}

/* ============ BOTÕES ============ */
.btn {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 2.5px;
    padding: 8px 18px;
    border-radius: 1px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    border: 1.5px solid var(--ouro-prof);
    line-height: 1.2;
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

.btn-sm {
    font-size: 10px;
    padding: 5px 10px;
    letter-spacing: 1.5px;
}

.btn-primary {
    background: linear-gradient(180deg, var(--ouro-claro) 0%, var(--ouro-vivo) 50%, var(--ouro-escuro) 100%);
    color: var(--page);
    text-shadow: 1px 1px 0 rgba(94,71,22,0.4);
    box-shadow:
        inset 0 1px 0 rgba(255,235,180,0.4),
        inset 0 -2px 4px rgba(94,71,22,0.2),
        0 2px 4px rgba(94,71,22,0.3);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #e7c060 0%, var(--ouro-claro) 50%, var(--ouro-vivo) 100%);
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255,235,180,0.5),
        inset 0 -2px 4px rgba(94,71,22,0.2),
        0 4px 8px rgba(94,71,22,0.4);
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow:
        inset 0 2px 5px rgba(94,71,22,0.3),
        0 1px 2px rgba(94,71,22,0.2);
}

.btn-secondary {
    background: linear-gradient(180deg, var(--page-2), var(--page-edge));
    color: var(--ouro-prof);
    border-color: var(--ouro-medio);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.5),
        0 2px 3px rgba(94,71,22,0.2);
}

.btn-secondary:hover {
    background: linear-gradient(180deg, var(--page), var(--page-2));
    border-color: var(--ouro);
    color: var(--ouro-escuro);
}

/* ============ RECENTES ============ */
.recentes-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip-recente {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--ouro-prof);
    background: linear-gradient(180deg, var(--page-2), var(--page-edge));
    border: 1px solid var(--ouro-medio);
    padding: 3px 10px;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.12s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.chip-recente .star {
    color: var(--ouro-vivo);
    font-size: 10px;
}

.chip-recente:hover {
    background: linear-gradient(180deg, var(--ouro-claro), var(--ouro));
    border-color: var(--ouro-escuro);
    color: var(--page);
    transform: translateY(-1px);
}

.chip-recente:hover .star { color: var(--page); }

/* ============ LISTA DE ITENS ============ */
.itens-lista {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vazio {
    text-align: center;
    font-style: italic;
    font-size: 14px;
    color: var(--tinta-fade);
    padding: 18px 12px;
    border: 1.5px dashed var(--ouro-medio);
    border-radius: 1px;
    background: rgba(184,146,58,0.08);
    font-family: 'Cormorant Garamond', serif;
}

.item-row {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.45), rgba(184,146,58,0.10));
    border: 1px solid var(--ouro-medio);
    border-left: 3px solid var(--ouro);
    border-radius: 1px;
    padding: 6px 10px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.5),
        0 1px 2px rgba(94,71,22,0.15);
    display: grid;
    grid-template-columns: minmax(110px, 1.4fr) 56px 60px minmax(120px, 1.8fr) 80px 26px;
    grid-template-areas: "nome qtd preco slider subtotal remover";
    column-gap: 10px;
    align-items: center;
}

.item-row .nome {
    grid-area: nome;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--ouro-prof);
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-remover {
    grid-area: remover;
    background: transparent;
    border: 1.5px solid var(--vermelho-selo);
    color: var(--vermelho-selo);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.15s;
    padding: 0;
}

.btn-remover:hover {
    background: var(--vermelho-selo);
    color: var(--page);
    box-shadow: 0 0 0 2px rgba(122,31,21,0.2);
}

.item-row .col-qtd     { grid-area: qtd; }
.item-row .col-preco   { grid-area: preco; }
.item-row .col-slider  { grid-area: slider; min-width: 0; }
.item-row .subtotal    { grid-area: subtotal; }

.item-row input[type="number"] {
    padding: 4px 6px;
    font-size: 13px;
    text-align: right;
    background: var(--page-2);
}

.item-row .col-qtd input { text-align: center; }

.col-slider {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.col-slider input[type="range"] {
    flex: 1;
    min-width: 0;
}

.preco-meta-min, .preco-meta-max {
    font-family: 'Cinzel', serif;
    font-size: 9px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.preco-meta-min { color: var(--tinta-mute); }
.preco-meta-max { color: var(--ouro-escuro); }

/* Slider de preço */
input[type="range"].preco-slider {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 18px;
    background: transparent;
    cursor: pointer;
    padding: 0;
    margin: 0;
    border: none;
    box-shadow: none;
}

input[type="range"].preco-slider::-webkit-slider-runnable-track {
    height: 4px;
    background: linear-gradient(90deg, var(--ouro-medio), var(--ouro), var(--ouro-vivo));
    border-radius: 3px;
    border: 1px solid var(--ouro-escuro);
    box-shadow: inset 0 1px 2px rgba(94,71,22,0.3);
}

input[type="range"].preco-slider::-moz-range-track {
    height: 4px;
    background: linear-gradient(90deg, var(--ouro-medio), var(--ouro), var(--ouro-vivo));
    border-radius: 3px;
    border: 1px solid var(--ouro-escuro);
}

input[type="range"].preco-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at 30% 30%, var(--ouro-claro), var(--ouro-escuro));
    border: 1.5px solid var(--ouro-prof);
    border-radius: 50%;
    margin-top: -6px;
    box-shadow: 0 2px 3px rgba(94,71,22,0.4), inset 0 1px 0 rgba(255,235,180,0.4);
    cursor: grab;
}

input[type="range"].preco-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at 30% 30%, var(--ouro-claro), var(--ouro-escuro));
    border: 1.5px solid var(--ouro-prof);
    border-radius: 50%;
    box-shadow: 0 2px 3px rgba(94,71,22,0.4);
    cursor: grab;
}

input[type="range"].preco-slider:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(184,146,58,0.45), 0 2px 3px rgba(94,71,22,0.4);
}

.item-row .subtotal {
    text-align: right;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--ouro-prof);
    white-space: nowrap;
}

.preco-warning {
    border-color: var(--aviso) !important;
    background: rgba(154,67,22,0.10) !important;
}

@media (max-width: 760px) {
    .item-row {
        grid-template-columns: 1fr auto auto;
        grid-template-areas:
            "nome subtotal remover"
            "qtd preco preco"
            "slider slider slider";
        row-gap: 6px;
    }
    .item-row .col-slider {
        padding-top: 2px;
    }
}

/* ============ TOTAIS ============ */
.totais-section {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.5), rgba(184,146,58,0.15));
    padding: 14px 16px;
    border-radius: 1px;
    border: 1.5px solid var(--ouro);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.5),
        inset 0 0 0 3px var(--page),
        inset 0 0 0 4px var(--ouro-medio),
        0 2px 6px rgba(94,71,22,0.2);
}

.linha-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    flex-wrap: wrap;
    gap: 8px;
}

.linha-total .label {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--tinta);
}

.linha-total .valor {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--ouro-prof);
}

.linha-desconto { align-items: center; }

.desconto-field {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.desconto-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.desconto-field input {
    width: 80px;
    padding: 4px 8px;
    font-size: 13px;
}

.desconto-field .percent {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--ouro-escuro);
}

.desconto-hint {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 12px;
    color: var(--tinta-fade);
}

.total-final {
    border-top: 2px solid var(--ouro);
    padding-top: 8px;
    margin-top: 6px;
    position: relative;
}

.total-final::after {
    content: "";
    position: absolute;
    top: 2px; left: 0; right: 0;
    height: 1px;
    background: var(--ouro);
    opacity: 0.5;
}

.total-final .label {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 13px;
    color: var(--ouro-escuro);
    letter-spacing: 3.5px;
}

.total-final .valor {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 22px;
    background: linear-gradient(180deg, var(--ouro-vivo), var(--ouro-escuro));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--ouro-escuro);
}

.aviso {
    margin-top: 8px;
    color: var(--aviso);
    font-style: italic;
    font-size: 13px;
    text-align: center;
    min-height: 18px;
    font-family: 'Cormorant Garamond', serif;
}

/* ============ AÇÕES ============ */
.acoes-section {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.copy-feedback {
    width: 100%;
    text-align: center;
    color: var(--ouro-escuro);
    font-style: italic;
    min-height: 18px;
    margin-top: 4px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
}

/* ============ FOOTER ============ */
.book-footer {
    background: var(--page);
    background-image:
        radial-gradient(ellipse at 50% 100%, rgba(184,146,58,0.12) 0%, transparent 60%);
    text-align: center;
    padding: 14px 20px 16px;
    border-top: 1px solid var(--ouro-medio);
    box-shadow:
        inset 0 0 0 1px var(--ouro),
        inset 0 0 0 5px var(--page),
        inset 0 0 0 6px var(--ouro-medio);
}

.book-footer .flourish {
    width: 180px;
    height: 18px;
    color: var(--ouro);
    margin-bottom: 8px;
}

.virtudes {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 10px;
    color: var(--ouro-escuro);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
}

.virtudes .dot { color: var(--ouro); }

.assinatura {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: var(--tinta-fade);
    font-size: 12px;
    letter-spacing: 0.8px;
}

/* ============ ANOTAÇÕES ============ */
.anotacoes-section {
    margin-bottom: 16px;
    padding-bottom: 14px;
}

.anotacoes-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 4px;
}

.anotacoes-label > span {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 10px;
    color: var(--ouro-escuro);
    text-transform: uppercase;
    letter-spacing: 2.5px;
}

.anotacoes-label > small {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 11px;
    color: var(--tinta-fade);
}

#anotacoes-input {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border: 1.5px solid var(--ouro-medio);
    background: var(--page-2);
    color: var(--tinta);
    border-radius: 1px;
    box-shadow: inset 0 1px 3px rgba(94,71,22,0.15);
    width: 100%;
    resize: vertical;
    min-height: 48px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

#anotacoes-input:focus {
    outline: none;
    border-color: var(--ouro-vivo);
    box-shadow:
        inset 0 1px 3px rgba(94,71,22,0.15),
        0 0 0 2px rgba(184,146,58,0.35);
}

#anotacoes-input::placeholder {
    color: var(--tinta-mute);
    font-style: italic;
    opacity: 0.7;
}

/* ============ MARGEM + CATEGORIAS ============ */
.categorias-info {
    font-family: 'Cormorant Garamond', serif;
    font-size: 12px;
    color: var(--tinta-fade);
    text-align: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(122,94,31,0.3);
    line-height: 1.4;
}

.categorias-info:empty {
    display: none;
}

.categorias-info .cat {
    display: inline-block;
    margin: 0 4px;
    white-space: nowrap;
}

.categorias-info .cat-nome {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--ouro-escuro);
    margin-right: 3px;
}

.categorias-info .cat-val {
    font-weight: 700;
    color: var(--ouro-prof);
}

.margem-info {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(122,94,31,0.3);
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 12px;
    font-style: italic;
    color: var(--sucesso);
    min-height: 18px;
}

.margem-info:empty {
    display: none;
    border: none;
    padding: 0;
    margin: 0;
}

.margem-info .pct {
    font-weight: 700;
    font-style: normal;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* ============ HISTÓRICO ============ */
.historico-section {
    margin-top: 4px;
}

.historico-vazio {
    text-align: center;
    font-style: italic;
    color: var(--tinta-fade);
    padding: 16px 12px;
    border: 1px dashed var(--ouro-medio);
    background: rgba(184,146,58,0.06);
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    border-radius: 1px;
}

.historico-lista {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.historico-lista::-webkit-scrollbar { width: 8px; }
.historico-lista::-webkit-scrollbar-track { background: var(--page-edge); }
.historico-lista::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--ouro), var(--ouro-escuro));
    border-radius: 2px;
}

.historico-row {
    display: grid;
    grid-template-columns: 1fr 24px;
    gap: 4px;
    align-items: stretch;
}

.historico-load {
    display: grid;
    grid-template-columns: 60px 1fr 70px 75px;
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(184,146,58,0.08));
    border: 1px solid var(--ouro-medio);
    border-left: 3px solid var(--ouro);
    color: var(--tinta);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    border-radius: 1px;
    transition: all 0.12s;
}

.historico-load:hover {
    background: linear-gradient(180deg, rgba(184,146,58,0.20), rgba(184,146,58,0.05));
    border-left-color: var(--ouro-vivo);
}

.historico-load .h-num {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 11px;
    color: var(--ouro-prof);
    letter-spacing: 1px;
}

.historico-load .h-cli {
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    color: var(--tinta);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.historico-load .h-cli em {
    color: var(--tinta-fade);
    font-weight: 400;
}

.historico-load .h-data {
    font-family: 'Special Elite', monospace;
    font-size: 10px;
    color: var(--tinta-fade);
    text-align: right;
    letter-spacing: 0.5px;
}

.historico-load .h-total {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--ouro-prof);
    text-align: right;
}

.historico-del {
    background: transparent;
    border: 1px solid var(--vermelho-selo);
    color: var(--vermelho-selo);
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    border-radius: 1px;
    transition: all 0.15s;
    padding: 0;
}

.historico-del:hover {
    background: var(--vermelho-selo);
    color: var(--page);
}

@media (max-width: 760px) {
    .historico-load {
        grid-template-columns: 50px 1fr 70px;
        grid-template-areas:
            "num cli total"
            "data data total";
        row-gap: 2px;
    }
    .historico-load .h-num { grid-area: num; }
    .historico-load .h-cli { grid-area: cli; }
    .historico-load .h-data { grid-area: data; text-align: left; }
    .historico-load .h-total { grid-area: total; }
}

/* ============ TOTAL FLUTUANTE ============ */
.floating-summary {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: linear-gradient(180deg, var(--page-2), var(--page-edge));
    border: 1.5px solid var(--ouro);
    border-radius: 4px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow:
        0 8px 24px rgba(94,71,22,0.35),
        inset 0 1px 0 rgba(255,255,255,0.5);
    z-index: 50;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    max-width: calc(100vw - 24px);
}

.floating-summary[data-visible="true"] {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.floating-summary .fs-label {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    color: var(--ouro-escuro);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.floating-summary .fs-valor {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 17px;
    color: var(--ouro-prof);
}

/* ============ RESPONSIVO ============ */
@media (max-width: 979px) {
    body { padding: 14px 6px; font-size: 16px; }
    .book-frame { padding: 10px; }
    .corner { width: 36px; height: 36px; }
    .book-header { padding: 10px 16px; }
    .page { padding: 18px 16px 22px; }

    .book-header h1 { letter-spacing: 2px; }

    .acoes-section .btn { width: 100%; }

    .virtudes { font-size: 10px; letter-spacing: 2px; gap: 8px; }
    .virtudes .dot { display: none; }

    .floating-summary { padding: 8px 12px; gap: 8px; }
    .floating-summary .fs-valor { font-size: 16px; }

    .chip-qtd { font-size: 11px; min-width: 48px; padding: 5px 6px; }
}

@media (max-width: 480px) {
    .book-header h1 { font-size: 18px; letter-spacing: 1px; }
    .total-final .valor { font-size: 20px; }
    .qtd-rapida { gap: 4px; }
    .chip-qtd { min-width: 0; flex: 1 1 30%; }
}

/* ============ PÁGINA DE VISUALIZAÇÃO (pedido.html) ============ */

.view-container {
    max-width: 640px;
    margin: 32px auto;
    padding: 0 16px;
}

.view-nota {
    background: var(--page);
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(184,146,58,0.10) 0%, transparent 50%),
        radial-gradient(circle at 20% 60%, rgba(122,94,31,0.08) 0%, transparent 35%);
    padding: 36px 32px 28px;
    border-radius: 2px;
    box-shadow:
        inset 0 0 0 1px var(--ouro),
        inset 0 0 0 5px var(--page),
        inset 0 0 0 6px var(--ouro-medio),
        0 18px 50px rgba(74,53,32,0.55),
        inset 0 0 60px rgba(184,146,58,0.10);
    color: var(--tinta);
    position: relative;
}

.view-loading {
    text-align: center;
    padding: 30px 12px;
    color: var(--tinta-fade);
    font-style: italic;
}

.view-vazio {
    text-align: center;
    padding: 24px 12px;
    font-family: 'Cormorant Garamond', serif;
    color: var(--tinta);
}

.view-vazio a {
    color: var(--ouro-escuro);
    text-decoration: underline;
    font-weight: 600;
}

/* === Cabeçalho da nota === */
.nt-header {
    text-align: center;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--ouro);
    margin-bottom: 18px;
}

.nt-crest {
    width: 36px;
    height: 36px;
    margin: 0 auto 8px;
    color: var(--ouro);
    filter: drop-shadow(0 1px 2px rgba(94,71,22,0.4));
}
.nt-crest svg { width: 100%; height: 100%; display: block; }

.nt-header h1 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: linear-gradient(180deg, #b8923a 0%, #8b6f23 50%, #5a4313 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--ouro);
    margin: 0 0 4px;
}

.nt-razao {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 1.5px;
    color: var(--ouro-escuro);
    text-transform: uppercase;
    margin: 0;
}

.nt-endereco {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 13px;
    color: var(--tinta-fade);
    margin: 4px 0 0;
}

/* === Meta (Nº, data, cliente) === */
.nt-meta {
    text-align: center;
    margin-bottom: 18px;
}

.nt-numero {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 2.5px;
    color: var(--ouro-prof);
    text-transform: uppercase;
    margin: 0;
}

.nt-data {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 14px;
    color: var(--tinta-soft);
    margin: 4px 0 10px;
}

.nt-cliente {
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px;
    color: var(--tinta);
    margin: 8px 0 0;
    padding: 6px 12px;
    background: rgba(184,146,58,0.10);
    border-left: 3px solid var(--ouro);
    text-align: left;
    display: inline-block;
}

.nt-cliente .lbl {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ouro-escuro);
    margin-right: 6px;
}

/* === Tabela de itens === */
.nt-itens {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
}

.nt-itens thead th {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ouro-escuro);
    padding: 6px 4px;
    border-bottom: 1px solid var(--ouro);
    text-align: left;
}

.nt-itens thead th.nt-qtd,
.nt-itens thead th.nt-unit,
.nt-itens thead th.nt-sub { text-align: right; }

.nt-itens tbody td {
    padding: 6px 4px;
    border-bottom: 1px dashed rgba(122,94,31,0.25);
    color: var(--tinta);
}

.nt-itens tbody td.nt-nome {
    font-weight: 600;
}

.nt-itens tbody td.nt-qtd,
.nt-itens tbody td.nt-unit,
.nt-itens tbody td.nt-sub {
    text-align: right;
    font-family: 'Special Elite', monospace;
    font-size: 13px;
}

.nt-itens tbody td.nt-sub {
    font-weight: 700;
    color: var(--ouro-prof);
}

.nt-itens tfoot td {
    padding: 4px 4px;
    font-family: 'Cinzel', serif;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.nt-itens tfoot tr.nt-tot-sub td:first-child,
.nt-itens tfoot tr.nt-tot-desc td:first-child {
    font-size: 11px;
    color: var(--tinta-soft);
}

.nt-itens tfoot tr.nt-tot-sub td:last-child,
.nt-itens tfoot tr.nt-tot-desc td:last-child {
    font-size: 14px;
    color: var(--tinta);
    font-weight: 700;
    font-family: 'Special Elite', monospace;
}

.nt-itens tfoot tr.nt-tot-final td {
    border-top: 2px solid var(--ouro);
    padding-top: 10px;
    padding-bottom: 4px;
}

.nt-itens tfoot tr.nt-tot-final td:first-child {
    font-size: 13px;
    letter-spacing: 3px;
    font-weight: 900;
    color: var(--ouro-escuro);
}

.nt-itens tfoot tr.nt-tot-final td:last-child {
    font-size: 20px;
    font-weight: 900;
    background: linear-gradient(180deg, var(--ouro-vivo), var(--ouro-escuro));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--ouro-escuro);
}

.nt-resumo {
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 12px;
    color: var(--tinta-fade);
    margin: 0 0 16px;
}

/* === Observações === */
.nt-observacoes {
    background: rgba(184,146,58,0.08);
    border: 1px dashed var(--ouro-medio);
    padding: 10px 14px;
    margin-bottom: 18px;
    border-radius: 1px;
}

.nt-observacoes h4 {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ouro-escuro);
    margin: 0 0 4px;
}

.nt-observacoes p {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    color: var(--tinta);
    margin: 0;
    line-height: 1.4;
    white-space: pre-wrap;
}

/* === Assinaturas === */
.nt-assinaturas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 14px;
}

.nt-sig {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.nt-sig-label {
    font-family: 'Cinzel', serif;
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ouro-escuro);
    margin-bottom: 18px;
}

.nt-sig-line {
    height: 1px;
    background: var(--tinta-soft);
}

/* === Rodapé da nota === */
.nt-footer {
    text-align: center;
    padding-top: 14px;
    border-top: 1px solid var(--ouro);
}

.nt-virtudes {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--ouro);
    margin: 0 0 4px;
}

.nt-razao-foot {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 12px;
    color: var(--tinta-fade);
    margin: 0;
}

/* === Ações abaixo da nota === */
.view-actions {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.view-actions .copy-feedback {
    width: 100%;
    text-align: center;
    margin-top: 6px;
    color: var(--ouro-claro);
    font-style: italic;
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    min-height: 18px;
}

.view-footer-link {
    text-align: center;
    margin-top: 14px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 13px;
}

.view-footer-link a {
    color: var(--ouro-vivo);
    text-decoration: none;
    border-bottom: 1px dashed var(--ouro-medio);
}

.view-footer-link a:hover {
    color: var(--ouro-claro);
    border-bottom-color: var(--ouro-vivo);
}

/* Mobile view */
@media (max-width: 520px) {
    .view-container { margin: 16px auto; padding: 0 10px; }
    .view-nota { padding: 24px 18px 22px; }
    .nt-itens { font-size: 13px; }
    .nt-itens tbody td.nt-qtd,
    .nt-itens tbody td.nt-unit,
    .nt-itens tbody td.nt-sub { font-size: 12px; }
    .nt-assinaturas { grid-template-columns: 1fr; }
    .view-actions .btn { width: 100%; }
}

/* Impressão */
@media print {
    body { background: white !important; padding: 0; }
    .view-actions, .view-footer-link, .skip-link { display: none !important; }
    .view-nota {
        box-shadow: none !important;
        border: 1px solid #888;
    }
}
