/* ============================================================
   SAC Vénno — design system (tokens do site vennomobiliario.com.br)
   ============================================================ */

:root {
    --terracotta: #a43a1a;
    --terracotta-2: #b3421e;
    --terracotta-soft: #f3e4dc;
    --off-white: #f5f1ea;
    --warm-gray: #d8d8d4;
    --graphite: #2f302e;
    --soft-black: #171816;
    --linen: #cdbba5;
    --olive: #5f684d;
    --stone: #b8b1a5;
    --muted: #6b6a64;
    --line: #e4ddd2;
    --white: #fffdf9;

    --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
    --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --radius: 10px;
    --shadow: 0 1px 2px rgba(23, 24, 22, .04), 0 8px 28px rgba(23, 24, 22, .06);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--off-white);
    color: var(--graphite);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--soft-black);
    margin: 0;
    line-height: 1.05;
}
h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }

a { color: var(--terracotta); }

.eyebrow {
    margin: 0 0 .4rem;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--terracotta);
}

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.t-right { text-align: right; }
.req { color: var(--terracotta); }

/* ---------------- Layout ---------------- */

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

.page-head { margin-bottom: 1.75rem; }
.page-head--row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ---------------- Topbar ---------------- */

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar__inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: .6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.topbar__brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: var(--graphite);
}
.topbar__brand img { height: 40px; width: auto; }
.topbar__brand span {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .18em;
    color: var(--terracotta);
    border-left: 1px solid var(--line);
    padding-left: .6rem;
}
.topbar__nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.topbar__nav a {
    color: var(--graphite);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    padding: .45rem .8rem;
    border-radius: 999px;
}
.topbar__nav a:hover { background: var(--off-white); }
.topbar__nav a.is-active { background: var(--terracotta-soft); color: var(--terracotta); }
.topbar__logout { margin: 0; }
.topbar__logout button {
    background: none;
    border: 0;
    color: var(--muted);
    font: inherit;
    font-size: .85rem;
    cursor: pointer;
    padding: .45rem .6rem;
}
.topbar__logout button:hover { color: var(--terracotta); }

@media (max-width: 640px) {
    .topbar__inner { flex-wrap: wrap; gap: .5rem 1rem; }
    .topbar__nav { order: 3; flex-basis: 100%; }
    .topbar__logout { margin-left: auto; }
}

/* ---------------- Botões ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .7rem 1.25rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
    outline: 2px solid var(--terracotta);
    outline-offset: 2px;
}
.btn--primary { background: var(--terracotta); color: #fff; }
.btn--primary:hover { background: var(--terracotta-2); }
.btn--secondary { background: var(--white); color: var(--graphite); border-color: var(--stone); }
.btn--secondary:hover { border-color: var(--graphite); }
.btn--ghost { background: transparent; color: var(--graphite); }
.btn--ghost:hover { background: rgba(23, 24, 22, .05); }
.btn--danger-ghost { background: transparent; color: #9b2c1a; }
.btn--danger-ghost:hover { background: #fbe9e4; }
.btn--small { padding: .4rem .85rem; font-size: .8rem; }
.btn--block { width: 100%; }

/* ---------------- Campos ---------------- */

.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field--grow { flex: 1; }
.field__label {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

input[type=text], input[type=tel], input[type=date], input[type=search], input[type=password],
select, textarea {
    width: 100%;
    font: inherit;
    font-size: .95rem;
    color: var(--soft-black);
    background: var(--white);
    border: 1px solid var(--warm-gray);
    border-radius: 8px;
    padding: .6rem .75rem;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--terracotta);
    box-shadow: 0 0 0 3px rgba(164, 58, 26, .12);
    outline: none;
}
input[readonly] { background: var(--off-white); color: var(--muted); }
textarea { resize: vertical; min-height: 80px; overflow: hidden; }

.input--line {
    border: 0 !important;
    border-bottom: 1.5px solid var(--stone) !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding-left: 0 !important;
}
.input--destaque { font-weight: 600; }

/* ---------------- Alertas / Toast ---------------- */

.alert { padding: .7rem .9rem; border-radius: 8px; font-size: .9rem; margin: 0 0 1rem; }
.alert--error { background: #fbe9e4; color: #8a2a17; border: 1px solid #f0c7bb; }

.toast {
    position: fixed;
    right: 1.25rem;
    bottom: 6rem;
    z-index: 100;
    padding: .85rem 1.2rem;
    border-radius: 10px;
    background: var(--soft-black);
    color: var(--off-white);
    font-size: .9rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    transform: translateY(12px);
    opacity: 0;
    transition: transform .25s, opacity .25s;
    max-width: calc(100vw - 2.5rem);
}
.toast.is-in { transform: none; opacity: 1; }
.toast--ok { border-left: 4px solid var(--olive); }
.toast--erro { border-left: 4px solid var(--terracotta); background: #3a1a12; }

/* ---------------- Login ---------------- */

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}
.login__card {
    width: 100%;
    max-width: 380px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 2.25rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
}
.login__card .field { text-align: left; }
.login__card h1 { margin-top: -.6rem; margin-bottom: .5rem; }
.login__card .eyebrow { margin-bottom: 0; }
.login__logo { width: 110px; height: auto; margin: 0 auto .5rem; }

/* ---------------- Painel ---------------- */

.modules { display: grid; gap: 1.25rem; }
.module {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 1.75rem;
}
.module__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.module__sub {
    font-family: var(--font-body);
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--muted);
    margin: 1.75rem 0 .75rem;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.stat {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--off-white);
    text-decoration: none;
    color: var(--graphite);
    transition: border-color .15s;
}
.stat:hover { border-color: var(--terracotta); }
.stat__n { font-family: var(--font-display); font-size: 2.3rem; font-weight: 600; line-height: 1; color: var(--soft-black); }
.stat__l { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } }

.agenda { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.agenda li { border-bottom: 1px solid var(--line); }
.agenda a {
    display: grid;
    grid-template-columns: 6.5rem 1fr auto;
    gap: 1rem;
    padding: .7rem .25rem;
    text-decoration: none;
    color: var(--graphite);
    align-items: center;
}
.agenda a:hover { background: var(--off-white); }
.agenda__data { font-weight: 600; color: var(--terracotta); font-size: .9rem; }
.agenda__pedido { font-size: .82rem; color: var(--muted); }
@media (max-width: 520px) {
    .agenda a { grid-template-columns: 1fr; gap: .1rem; }
}
.link-arrow { display: inline-block; margin-top: 1.25rem; font-weight: 600; font-size: .88rem; text-decoration: none; }

/* ---------------- Lista ---------------- */

.filters {
    display: flex;
    gap: .75rem;
    align-items: flex-end;
    flex-wrap: wrap;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.filters .field:not(.field--grow) { min-width: 200px; }
.result-count { font-size: .85rem; margin: 0 0 .5rem; }

.table-wrap {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
    text-align: left;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: .85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbf8f3; }
.actions { white-space: nowrap; }

@media (max-width: 720px) {
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
    .table td { border: 0; padding: .2rem 0; }
    .table td[data-label]::before {
        content: attr(data-label);
        display: inline-block;
        width: 6.5rem;
        font-size: .7rem;
        text-transform: uppercase;
        letter-spacing: .08em;
        color: var(--muted);
    }
    .table td.actions { text-align: left; padding-top: .5rem; }
}

.badge {
    display: inline-block;
    padding: .25rem .65rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--off-white);
}
.badge--aguardando { background: #f6ead2; color: #7a5410; }
.badge--agendado   { background: #e3e8f2; color: #2c4470; }
.badge--finalizado { background: #e4e9dc; color: #3f4a2e; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.25rem; font-size: .88rem; }

.empty {
    background: var(--white);
    border: 1px dashed var(--stone);
    border-radius: 14px;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--muted);
}

/* ---------------- Ficha ---------------- */

.container--ficha { padding-bottom: 7rem; }

.ficha {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.ficha__head {
    display: grid;
    grid-template-columns: auto 1fr minmax(180px, 220px) 170px;
    gap: 1.25rem;
    align-items: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
}
.ficha__logo { height: 72px; width: auto; }
.ficha__title h1 { font-size: 2.1rem; }
.ficha__loja { margin: .2rem 0 0; font-size: .8rem; color: var(--muted); letter-spacing: .04em; }
.ficha__pedido {
    border: 1.5px solid var(--terracotta);
    background: var(--terracotta-soft);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
}
.ficha__pedido span {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--terracotta);
}
.ficha__pedido strong { font-size: 1.4rem; color: var(--soft-black); word-break: break-all; }

.ficha__section { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.ficha__section:last-child { border-bottom: 0; padding-bottom: 0; }
.ficha__h2 {
    font-size: 1.35rem;
    text-align: center;
    margin-bottom: .9rem;
    color: var(--terracotta);
}

.grid { display: grid; gap: .9rem 1rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }

#ambiente-novo { margin-top: .3rem; }
.chips { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .4rem .3rem .8rem;
    border-radius: 999px;
    background: var(--off-white);
    border: 1px solid var(--line);
    font-size: .88rem;
    font-weight: 500;
}
.chip__rm {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
}
.chip__rm:hover { background: var(--terracotta-soft); color: var(--terracotta); }

.declaracao {
    background: var(--off-white);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem !important;
    margin-top: 1.1rem;
}
.declaracao__texto {
    text-align: center;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--graphite);
    margin: 0 0 1.25rem;
}
.sign { display: flex; flex-direction: column; gap: .25rem; }
.sign__line { display: block; height: 1.8rem; border-bottom: 1px solid var(--graphite); }
.sign__label { font-size: .75rem; color: var(--muted); }
.declaracao__checks {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1.5rem;
    align-items: center;
    margin: 1.1rem 0;
    font-size: .85rem;
}
.declaracao__checks .sign__label { flex-basis: 100%; }
.declaracao__checks label { display: inline-flex; align-items: center; gap: .4rem; }
.declaracao__assinatura { display: grid; grid-template-columns: 1fr 3fr; gap: 2rem; }

/* Barra de ações fixa */
.actionbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: rgba(255, 253, 249, .94);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    z-index: 30;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.actionbar__inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: .75rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    flex-wrap: wrap;
}

@media (max-width: 860px) {
    .ficha { padding: 1.25rem; }
    .ficha__head { grid-template-columns: auto 1fr; }
    .ficha__head > .field, .ficha__pedido { grid-column: span 1; }
    .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .ficha__head { grid-template-columns: 1fr; text-align: center; }
    .ficha__logo { margin: 0 auto; }
    .ficha__head > .field { text-align: left; }
    .grid--2, .grid--4, .grid--6 { grid-template-columns: 1fr; }
    .span-2, .span-4 { grid-column: auto; }
    .declaracao__assinatura { grid-template-columns: 1fr; gap: 1rem; }
    .actionbar__inner { justify-content: center; }
}

/* ============================================================
   IMPRESSÃO — uma folha A4, valores em destaque, sem cromo de UI
   ============================================================ */

@media print {
    /* margem 0 tira data/URL que o navegador imprime no cabeçalho/rodapé; o respiro vem do padding da .ficha */
    @page { size: A4; margin: 0; }

    html, body { background: #fff !important; font-size: 9.5pt; color: #000; }
    .no-print, .topbar, .actionbar, .toast { display: none !important; }

    .container, .container--ficha { max-width: none; padding: 0; margin: 0; }

    .ficha {
        border: 0;
        box-shadow: none;
        border-radius: 0;
        padding: 9mm 10mm;
        background: #fff;
    }

    /* Mantém as grades de desktop no papel, mesmo que a janela esteja estreita */
    .ficha__head { grid-template-columns: auto 1fr 46mm 38mm !important; gap: 4mm; padding-bottom: 2.5mm; text-align: left; }
    .ficha__logo { height: 17mm; margin: 0; }
    .ficha__title h1 { font-size: 18pt; }
    .ficha__loja { font-size: 8pt; }
    .ficha__pedido { padding: 1.5mm 2mm; border-color: #000; background: #fff; }
    .ficha__pedido span { color: #000; font-size: 6.5pt; }
    .ficha__pedido strong { font-size: 14pt; }

    .grid { gap: 1.2mm 3mm; }
    .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
    .grid--6 { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
    .span-2 { grid-column: span 2 !important; }
    .span-4 { grid-column: span 4 !important; }

    .ficha__section { padding: 2mm 0; border-bottom: .3mm solid #bbb; break-inside: avoid; }
    .ficha__h2 { font-size: 12pt; margin-bottom: 1.5mm; color: #000; letter-spacing: .04em; text-transform: uppercase; }

    .field { gap: .3mm; }
    .field__label { font-size: 6.8pt; color: #333; letter-spacing: .06em; }

    input[type=text], input[type=tel], input[type=date], select, textarea {
        font-size: 10.5pt;
        font-weight: 700;
        color: #000;
        background: transparent !important;
        border: 0;
        border-bottom: .3mm solid #999;
        border-radius: 0;
        padding: .4mm 0;
        box-shadow: none;
        -webkit-appearance: none;
        appearance: none;
    }
    input[readonly] { color: #000; }
    .input--destaque { font-size: 12.5pt; }
    input[type=date]::-webkit-calendar-picker-indicator { display: none; }

    textarea {
        border: .3mm solid #999;
        padding: 1.2mm 1.5mm;
        min-height: 18mm;
        resize: none;
        overflow: visible;
        white-space: pre-wrap;
    }

    /* Ambientes: lista corrida separada por " – " */
    .chips { display: block; margin: .6mm 0 0; font-size: 10.5pt; font-weight: 700; }
    .chip { display: inline; padding: 0; border: 0; background: none; font-size: inherit; font-weight: inherit; }
    .chip:not(:last-child)::after { content: " – "; }

    .declaracao { background: #fff; border: .3mm solid #999; padding: 3mm 4mm !important; margin-top: 2.5mm; }
    .declaracao__texto { font-size: 8pt; margin-bottom: 3mm; }
    .sign__line { height: 7mm; border-color: #000; }
    .sign__label { font-size: 7.5pt; color: #333; }
    .declaracao__checks { margin: 3mm 0; font-size: 8.5pt; }
    .declaracao__assinatura { grid-template-columns: 1fr 3fr !important; gap: 6mm; }

}
