/* =========================================================================
   Sistema PDV — Design System (v3)
   Paleta e tipografia alinhadas ao padrao "Metodo Loja Cheia":
   grafite quase-preto (#0f0f0f) + gradiente laranja de marca,
   Syne (display) + DM Sans (corpo) + IBM Plex Mono (precos/codigos).
   ========================================================================= */

:root {
    /* Superficies */
    --bg: #0f0f0f;
    --bg-soft: #141414;
    --surface: #1a1a1a;
    --surface-2: #242424;
    --surface-hover: #2e2e2e;
    --border: #2e2e2e;
    --border-soft: #1f1f1f;

    /* Texto */
    --text: #e5e5e5;
    --text-dim: #a3a3a3;
    --text-faint: #4a4a4a;

    /* Marca (laranja, gradiente) */
    --accent: #f97316;
    --accent-strong: #ea580c;
    --accent-ink: #1a0d03;
    --accent-soft-bg: #431407;

    /* Semantica */
    --money: #22c55e;
    --money-bg: #14532d30;
    --money-text: #86efac;
    --danger: #ef4444;
    --danger-bg: #7f1d1d30;
    --danger-text: #fca5a5;
    --warn-bg: #78350f30;
    --warn-text: #fcd34d;
    --info-bg: #1e3a5f30;
    --info-text: #93c5fd;

    /* Forma */
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 20px 60px rgba(0,0,0,0.5);
    --shadow-accent: 0 4px 12px rgba(249,115,22,0.3);

    --font-display: 'Syne', 'Segoe UI', sans-serif;
    --font-body: 'DM Sans', 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

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

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 16px;
    color: #fff;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; color: var(--text-dim); margin-top: 32px; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.85rem; }

a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; color: var(--accent-strong); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 22px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand-mark {
    width: 32px; height: 32px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-accent);
}
.sidebar-brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: #fff; }

.sidebar-nav { display: flex; flex-direction: column; flex: 1; gap: 2px; padding: 14px 8px 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    color: var(--text-dim);
    padding: 10px 14px;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.87rem;
    font-weight: 500;
    transition: all 0.2s;
}
.sidebar-nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.75; }
.sidebar-nav a:hover { background: var(--surface-2); color: #fff; }
.sidebar-nav a.ativo {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    box-shadow: var(--shadow-accent);
}
.sidebar-nav a.ativo svg, .sidebar-nav a:hover svg { opacity: 1; }

.sidebar-user {
    padding: 14px 20px; margin-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
}
.sidebar-user div { color: var(--text); font-weight: 600; margin-bottom: 2px; }
.sidebar-user a { color: var(--text-faint); font-size: 0.8rem; font-weight: 500; }
.sidebar-user a:hover { color: var(--danger); }

.content { flex: 1; min-width: 0; }
.content-inner { padding: 26px 32px 60px; max-width: 1180px; }

/* ---------------- Cards / KPIs ---------------- */

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 18px 0 28px; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    transition: border-color 0.2s;
}
.card:hover { border-color: var(--accent); }
.card-alerta, .card--danger { border-color: var(--danger); }
.card--money { border-color: var(--money); }
.card--accent { border-color: var(--accent); }
.card-label { font-size: 0.76rem; color: var(--text-faint); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.card-value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }

/* ---------------- Formularios ---------------- */

.form-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin: 16px 0;
}
.form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.form-row label { flex: 1; display: flex; flex-direction: column; font-size: 0.8rem; color: var(--text-dim); font-weight: 500; gap: 6px; min-width: 150px; }

input, select, textarea {
    padding: 10px 13px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s;
}
input::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249,115,22,0.15); }

button, .botao-principal {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    border: none;
    padding: 11px 18px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    box-shadow: var(--shadow-accent);
}
button:hover, .botao-principal:hover { transform: translateY(-1px); text-decoration: none; box-shadow: 0 6px 20px rgba(249,115,22,0.4); }
button:active, .botao-principal:active { transform: translateY(0); }
button:disabled { background: var(--surface-2); color: var(--text-faint); cursor: not-allowed; box-shadow: none; transform: none; }

button.secundario {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}
button.secundario:hover { background: var(--surface-hover); box-shadow: none; }

button.perigo { background: #7f1d1d; color: #fca5a5; box-shadow: none; }
button.perigo:hover { background: #991b1b; box-shadow: none; }

.checkbox { flex-direction: row !important; align-items: center; gap: 8px !important; }
.checkbox input { width: auto; }

.form-busca { display: flex; gap: 10px; margin: 16px 0; max-width: 460px; }
.form-busca input { flex: 1; }

/* ---------------- Tabelas ---------------- */

.tabela { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tabela th, .tabela td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); text-align: left; font-size: 0.87rem; }
.tabela th { color: var(--text-faint); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tabela tbody tr:last-child td { border-bottom: none; }
.tabela tbody tr:hover { background: var(--border-soft); }
.tabela td { font-variant-numeric: tabular-nums; }
.linha-alerta { background: rgba(239,68,68,0.07); }
.linha-alerta:hover { background: rgba(239,68,68,0.12); }

/* ---------------- Badges / pills ---------------- */

.badge-score, .pill {
    display: inline-flex; align-items: center;
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #fff;
}
.pill-neutra { background: var(--surface-2); color: var(--text-dim); font-family: var(--font-body); }
.pill-sucesso { background: var(--money-bg); color: var(--money-text); }
.pill-erro { background: var(--danger-bg); color: var(--danger-text); }
.pill-aviso { background: var(--warn-bg); color: var(--warn-text); }
.pill-info { background: var(--info-bg); color: var(--info-text); }

/* ---------------- Mensagens flash ---------------- */

.flash { padding: 13px 18px; border-radius: var(--radius); margin-bottom: 18px; font-size: 0.88rem; border-left: 4px solid; font-weight: 500; }
.flash-sucesso { background: var(--money-bg); color: var(--money-text); border-color: var(--money); }
.flash-erro { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger); }

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

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px;
    height: 64px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: #fff; }
.topbar-user {
    font-size: 0.8rem; color: var(--text-dim); font-weight: 600;
    background: var(--surface-2); border: 1px solid var(--border);
    padding: 6px 14px; border-radius: 10px;
}

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

.login-page {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background:
        radial-gradient(circle at 15% 15%, rgba(249,115,22,0.10), transparent 40%),
        var(--bg);
}
.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 36px 34px;
    border-radius: 20px;
    width: 340px;
    display: flex; flex-direction: column; gap: 14px;
    box-shadow: var(--shadow);
}
.login-brand-mark {
    width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 6px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 1.4rem;
    box-shadow: var(--shadow-accent);
}
.login-box h1 { text-align: center; font-size: 1.15rem; margin-bottom: 4px; color: #fff; }
.login-box label { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; color: var(--text-dim); font-weight: 500; }

/* =========================================================================
   PDV — terminal de venda / pedido
   ========================================================================= */

.pdv-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    align-items: start;
    margin: -26px -32px -60px;
    min-height: calc(100vh - 65px);
}

.pdv-area-produtos { padding: 22px 26px; }
.pdv-busca-wrap { position: relative; margin-bottom: 16px; }
.pdv-busca-wrap input {
    width: 100%; padding: 14px 16px; font-size: 1rem;
    background: var(--surface); border: 1px solid var(--border);
}

.grade-produtos-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 10px; font-weight: 700; }
.grade-produtos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.produto-tile {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 12px; cursor: pointer; text-align: left;
    display: flex; flex-direction: column; gap: 6px; min-height: 84px;
    transition: all 0.15s;
}
.produto-tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-accent); }
.produto-tile:active { transform: scale(0.98); }
.produto-tile-nome { font-size: 0.85rem; font-weight: 600; line-height: 1.25; color: #fff; }
.produto-tile-preco { font-family: var(--font-mono); color: var(--money-text); font-size: 0.9rem; font-weight: 700; margin-top: auto; }
.produto-tile-estoque { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-faint); }
.sem-resultado { padding: 14px; color: var(--text-faint); font-size: 0.85rem; }

.pdv-ticket {
    background: var(--surface);
    border-left: 1px solid var(--border);
    min-height: calc(100vh - 65px);
    display: flex; flex-direction: column;
    position: sticky; top: 65px;
}
.pdv-ticket-header { padding: 20px 20px 14px; border-bottom: 1px solid var(--border); }
.pdv-ticket-header h2 { margin: 0; color: #fff; }

.pdv-ticket-itens { flex: 1; overflow-y: auto; padding: 8px 20px; max-height: 32vh; }
.ticket-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.ticket-item:last-child { border-bottom: none; }
.ticket-item-nome { flex: 1; font-size: 0.86rem; font-weight: 500; }
.ticket-item-qtd { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.85rem; }
.ticket-item-qtd button { width: 24px; height: 24px; padding: 0; border-radius: 7px; font-size: 0.8rem; background: var(--surface-2); color: var(--text); box-shadow: none; }
.ticket-item-subtotal { font-family: var(--font-mono); font-size: 0.86rem; min-width: 68px; text-align: right; color: #fff; font-weight: 600; }
.ticket-item-remover { background: none; border: none; color: var(--text-faint); font-size: 0.75rem; padding: 2px; box-shadow: none; }
.ticket-item-remover:hover { color: var(--danger); background: none; box-shadow: none; transform: none; }
.ticket-vazio { color: var(--text-faint); font-size: 0.85rem; text-align: center; padding: 30px 10px; }

.pdv-ticket-resumo { padding: 16px 20px; border-top: 1px solid var(--border); }
.linha-resumo { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-dim); padding: 3px 0; }
.linha-resumo input { width: 90px; padding: 5px 9px; text-align: right; font-family: var(--font-mono); font-size: 0.85rem; }

.pdv-display-total {
    background: var(--bg-soft);
    border: 1px solid var(--accent-soft-bg);
    border-radius: var(--radius);
    margin: 12px 0;
    padding: 16px 18px;
    display: flex; justify-content: space-between; align-items: baseline;
}
.pdv-display-total .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 700; }
.pdv-display-total .valor {
    font-family: var(--font-mono); font-weight: 700; font-size: 1.8rem;
    color: var(--accent); font-variant-numeric: tabular-nums;
}

.pdv-ticket-pagamento { padding: 4px 20px 20px; border-top: 1px solid var(--border); }
.metodo-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.metodo-chip {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
    padding: 8px 13px; border-radius: 20px; font-size: 0.78rem; font-weight: 700; cursor: pointer;
    box-shadow: none;
}
.metodo-chip.selecionado {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff; border-color: transparent; box-shadow: var(--shadow-accent);
}

.pdv-valor-input-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.pdv-valor-input-row input { flex: 1; font-family: var(--font-mono); font-size: 1rem; padding: 11px 13px; }
.pdv-valor-atalhos { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.pdv-valor-atalhos button { background: var(--surface-2); color: var(--text-dim); padding: 6px 11px; font-size: 0.76rem; font-weight: 700; box-shadow: none; }
.pdv-valor-atalhos button:hover { background: var(--surface-hover); color: #fff; transform: none; box-shadow: none; }

.lista-pagamentos { margin: 4px 0 12px; }
.linha-pagamento-add {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--surface-2); border-radius: 10px; padding: 9px 13px; margin-bottom: 6px;
    font-size: 0.82rem;
}
.linha-pagamento-add .forma { font-weight: 700; color: #fff; }
.linha-pagamento-add .valor { font-family: var(--font-mono); color: var(--money-text); font-weight: 600; }
.linha-pagamento-add button { background: none; color: var(--text-faint); padding: 2px 6px; font-size: 0.75rem; box-shadow: none; }
.linha-pagamento-add button:hover { color: var(--danger); background: none; transform: none; box-shadow: none; }

.pdv-resumo-pagamento { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 10px 0; border-top: 1px dashed var(--border); margin-top: 4px; }
.pdv-resumo-pagamento .saldo { color: var(--danger); font-family: var(--font-mono); font-weight: 700; }
.pdv-resumo-pagamento .saldo.zerado { color: var(--money); }
.pdv-resumo-pagamento .troco { font-family: var(--font-mono); color: var(--accent); font-weight: 700; }

#btnFinalizar { width: 100%; padding: 15px; font-size: 0.95rem; margin-top: 8px; }

@media (max-width: 980px) {
    .pdv-layout { grid-template-columns: 1fr; }
    .pdv-ticket { position: static; border-left: none; border-top: 1px solid var(--border); }
    .sidebar { position: fixed; z-index: 20; transform: translateX(-100%); }
    .content-inner { padding: 18px 16px 50px; }
}
