/* NutreMais — Gestão. Tokens "Linho Claro" + complementos do boot/erro.
   O grosso do estilo vem do MudBlazor (tema em NutreMaisTheme.cs). */
:root {
    --bg: #f1ece3;
    --panel: #ffffff;
    --text: #261d12;
    --dim: #6e6253;
    --accent: #1f9a63;
    --danger: #c0392b;
}

html, body {
    margin: 0;
    font-family: 'Hanken Grotesk', sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* Tela de boot (antes do WASM carregar) */
.boot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: .25rem;
}
.boot-name { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.boot-sub { color: var(--dim); }

/* Código/leito em fonte mono */
.mono { font-family: 'JetBrains Mono', monospace; }

/* Tela de login (sem sidebar) */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg);
}

/* Mini gráfico de barras (pedidos por dia) */
.barchart {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    height: 240px;
    padding-top: 1rem;
}
.barchart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}
.barchart-count { font-size: .8rem; color: var(--dim); margin-bottom: .25rem; }
.barchart-bar {
    width: 70%;
    min-height: 2px;
    background: var(--accent);
    border-radius: 6px 6px 0 0;
    transition: height .3s ease;
}
.barchart-label { font-size: .75rem; color: var(--dim); margin-top: .4rem; }
.barchart-col { position: relative; }

/* Custo por dia: barra empilhada servido + desperdiçado. Duas séries → legenda obrigatória (a cor
   sozinha nunca carrega identidade). O desperdício usa o vermelho de status, não uma "cor 2": ele É
   um estado ruim, e é isso que a cor tem que dizer. */
.costchart { display: flex; align-items: flex-end; gap: .5rem; height: 220px; padding-top: 1rem; }
.costchart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}
.costchart-stack {
    width: 70%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 2px;                       /* respiro entre os segmentos — sem ele viram um bloco só */
    height: 100%;
}
.costchart-served { background: var(--accent); min-height: 2px; transition: height .3s ease; }
.costchart-wasted { background: var(--danger); min-height: 2px; transition: height .3s ease; }

/* Só o topo da pilha é arredondado; a base encosta na linha de base. O desperdício é o primeiro filho
   (vai por cima do servido), então quando não há desperdício o topo arredondado passa a ser o servido. */
.costchart-stack > * { border-radius: 0; }
.costchart-stack > :first-child { border-radius: 6px 6px 0 0; }
.costchart-label { font-size: .75rem; color: var(--dim); margin-top: .4rem; }

.chart-legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--dim); margin-bottom: .5rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-legend i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}
.chart-legend i.served { background: var(--accent); }
.chart-legend i.wasted { background: var(--danger); }

/* Gráfico de pico por hora (24 colunas — mais estreito que o diário) */
.hourchart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 200px;
}
.hourchart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
}
.hourchart-bar {
    width: 100%;
    min-height: 2px;
    background: var(--accent);
    opacity: .85;
    border-radius: 3px 3px 0 0;
    transition: height .3s ease;
}
.hourchart-label { font-size: .65rem; color: var(--dim); margin-top: .35rem; height: 1rem; }

/* Selo de variação nos KPIs */
.kpi-delta, .kpi-hint {
    display: inline-block;
    margin-top: .35rem;
    font-size: .72rem;
    line-height: 1.2;
}
.kpi-delta.good { color: var(--accent); }
.kpi-delta.bad { color: var(--danger); }
.kpi-hint { color: var(--dim); }

/* Tabelas do relatório (leves — sem o peso do MudTable) */
.rtable { width: 100%; border-collapse: collapse; font-size: .875rem; }
.rtable th {
    text-align: left;
    font-weight: 600;
    color: var(--dim);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: .4rem .5rem;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.rtable td {
    padding: .5rem;
    border-bottom: 1px solid rgba(0,0,0,.05);
}
.rtable .num { text-align: right; }
.rtable tr.total td { font-weight: 700; border-top: 1px solid rgba(0,0,0,.12); }
.rtable tr.muted td { color: var(--dim); }
.rtable .warn { color: var(--danger); font-weight: 600; }
.tagline {
    margin-left: .4rem;
    padding: .05rem .4rem;
    border-radius: 999px;
    background: rgba(192,57,43,.1);
    color: var(--danger);
    font-size: .65rem;
    font-weight: 600;
}

/* Cabeçalho que só existe no papel */
.print-header { display: none; }

/* --- Impressão / "Salvar como PDF" ---
   Tira a navegação e os controles: o que sai no papel é o relatório, não o app. */
@media print {
    .mud-appbar,
    .mud-drawer,
    .mud-overlay,
    .report-actions,
    #blazor-error-ui { display: none !important; }

    .mud-main-content { padding: 0 !important; }
    .mud-layout { display: block; }

    html, body { background: #fff; }

    .print-header {
        display: block;
        margin-bottom: 1rem;
        padding-bottom: .5rem;
        border-bottom: 2px solid var(--accent);
    }
    .print-brand { font-size: 1.4rem; font-weight: 800; color: var(--accent); }
    .print-meta { font-size: .75rem; color: var(--dim); }

    /* Um card não pode ser cortado ao meio pela quebra de página. */
    .card, .kpi { break-inside: avoid; page-break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd; }
    .rtable { break-inside: auto; }
    .rtable tr { break-inside: avoid; }

    @page { margin: 12mm; }
}

#blazor-error-ui {
    background: #fdf0d8;
    bottom: 0;
    display: none;
    left: 0;
    padding: .8rem 1.2rem;
    position: fixed;
    width: 100%;
    box-shadow: 0 -1px 2px rgba(0,0,0,.1);
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .8rem; }
