:root {
    --brand: #00a651;
    --brand-dark: #007a3d;
    --brand-ink: #0b1f14;
    --surface: #f3f7f4;
    --panel: #ffffff;
    --accent: #1a6b3c;
    --warn: #c45c26;
    --line: #d5e4da;
    --font-display: "Segoe UI", "Trebuchet MS", sans-serif;
    --font-body: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body.app-body {
    margin: 0;
    font-family: var(--font-body);
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(0,166,81,.12), transparent 60%),
        linear-gradient(180deg, #eef5f0 0%, var(--surface) 40%, #e8f0ea 100%);
    color: var(--brand-ink);
    min-height: 100vh;
}

.auth-page {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(0,122,61,.92), rgba(11,31,20,.95)),
        url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 30h60M30 0v60' stroke='%23ffffff11' stroke-width='1'/%3E%3C/svg%3E");
    background-size: cover, 60px 60px;
}

.brand-mark {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: .18em;
    color: var(--brand);
    font-size: .95rem;
}

.app-nav {
    background: linear-gradient(90deg, #0b1f14, #0f3a24 55%, #0b1f14);
    border-bottom: 3px solid var(--brand);
}

.app-nav .navbar-brand {
    font-weight: 700;
    letter-spacing: .02em;
}

.app-nav .nav-link.active {
    color: #fff !important;
    border-bottom: 2px solid var(--brand);
}

.btn-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
}
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.card, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .75rem;
}

.stat-card {
    padding: 1.1rem 1.25rem;
    border-left: 4px solid var(--brand);
    background: var(--panel);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(11,31,20,.04);
}
.stat-card .stat-label { color: #5a6f62; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--brand-ink); }

.alert-row-critico, tr.alerta-critico td { background: #ffe8e5 !important; }
.alert-row-aviso, tr.alerta-aviso td { background: #fff4e5 !important; }
.acima-media { background: #ffe8e5 !important; font-weight: 600; }

.timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.25rem;
    border-left: 3px solid var(--brand);
}
.timeline li {
    position: relative;
    padding: 0 0 1.25rem 1rem;
}
.timeline li::before {
    content: "";
    position: absolute;
    left: -1.45rem;
    top: .35rem;
    width: .75rem;
    height: .75rem;
    border-radius: 50%;
    background: var(--brand);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--brand);
}
.timeline .tl-date { font-size: .8rem; color: #678074; }
.timeline .tl-title { font-weight: 700; }

/* Página pública devolução */
.public-hero {
    background: linear-gradient(120deg, #0b1f14 0%, #146c3a 55%, #00a651 100%);
    color: #fff;
    padding: 2.5rem 0 2rem;
    margin-bottom: 1.5rem;
}
.public-hero h1 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -.02em;
}

/* Comprovante impressão */
@media print {
    body * { visibility: hidden; }
    .comprovante-print, .comprovante-print * { visibility: visible; }
    .comprovante-print {
        position: absolute;
        left: 0; top: 0; width: 100%;
        padding: 1.5rem;
    }
    .no-print { display: none !important; }
}

.comprovante-box {
    border: 2px solid #0b1f14;
    padding: 1.5rem;
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
}
.comprovante-box h2 { color: var(--brand-dark); }
.comprovante-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem 1.5rem;
    margin: 1.25rem 0;
}
.comprovante-grid dt { font-size: .75rem; text-transform: uppercase; color: #678074; margin: 0; }
.comprovante-grid dd { margin: 0; font-weight: 600; font-size: 1.05rem; }

.app-footer { color: #6b7f73; }

.db-update-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem 1rem;
    padding: .55rem .9rem;
    border-radius: .5rem;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.72);
    font-size: .85rem;
}
.db-update-label {
    color: #5a6f62;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .72rem;
    font-weight: 700;
}
.db-update-value {
    font-weight: 700;
    color: var(--brand-ink);
    font-variant-numeric: tabular-nums;
}
.db-update-inline {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .45rem .65rem;
    margin-top: .35rem;
    border-radius: .4rem;
    background: #eef6f1;
    border: 1px solid var(--line);
    font-size: .8rem;
}
.db-update-inline .db-update-label {
    color: #5a6f62;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .68rem;
    font-weight: 700;
}
.db-update-inline .db-update-value {
    font-size: .9rem;
}

.chart-wrap { position: relative; height: 280px; }

.consumo-tecnicos .consumo-grupo-inicio td {
    border-top: 2px solid var(--line);
}
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.85rem;
    height: 1.85rem;
    padding: 0 .4rem;
    border-radius: .4rem;
    background: #e8f0ea;
    color: var(--brand-ink);
    font-weight: 700;
    font-size: .85rem;
}
.rank-badge.rank-top {
    background: var(--brand);
    color: #fff;
}
.consumo-tecnicos .produto-codigo {
    font-size: .9rem;
    color: var(--brand-dark);
    background: #eef6f1;
    padding: .15rem .4rem;
    border-radius: .3rem;
}

.install-card { background: rgba(255,255,255,.97); }

.login-card { background: rgba(255,255,255,.97); }

.geo-bar {
    height: .65rem;
    background: #dde8e1;
    border-radius: 99px;
    overflow: hidden;
}
.geo-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #3fd483);
}

.table thead th { white-space: nowrap; }

.produtos-os {
    display: inline-block;
    max-width: 420px;
    white-space: normal;
    font-size: .85rem;
    line-height: 1.35;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    color: var(--brand-ink);
}
