﻿/* Nitro Sistemas — layout, componentes e tema claro/escuro.
   Escuro: <html data-tema="escuro"> (localStorage "nitroTema").
   Menu recolhido: <html class="menu-recolhido"> (localStorage "nitroMenu"); no celular, "menu-aberto". */

:root {
    --bg: #f4f6f9;
    --sf: #ffffff;
    --sf2: #f7f9fb;
    --tx: #1d2733;
    --mu: #6b7785;
    --bd: #e3e8ee;
    --pri: #1366d6;
    --pri-hv: #0f56b6;
    --pri-bg: #eaf2fd;
    --ok: #1f8a4c;
    --ok-bg: #e5f4eb;
    --at: #b45309;
    --at-bg: #fdecd7;
    --er: #c0392b;
    --er-bg: #fdecea;
    --in: #4b4fc4;
    --in-bg: #eceefc;
    --msg-agente: #e8f0fd;
    --msg-agente-bd: #c9dcf8;
    --msg-atend: #e6f4ea;
    --msg-atend-bd: #bfe3cb;
    --sombra: 0 1px 2px rgba(16, 24, 40, .04);
}

html[data-tema="escuro"] {
    --bg: #111827;
    --sf: #303b4b;
    --sf2: #1c2532;
    --campo-bg: #141c27;
    --tx: #f8fafc;
    --mu: #aebdce;
    --bd: #465264;
    --pri: #93c5fd;
    --pri-hv: #1d4ed8;
    --pri-bg: #253f66;
    --ok: #86efac;
    --ok-bg: #254538;
    --at: #fcd49a;
    --at-bg: #493824;
    --er: #fca5a5;
    --er-bg: #492e33;
    --in: #c7d2fe;
    --in-bg: #383b60;
    --msg-agente: #253f66;
    --msg-agente-bd: #47658a;
    --msg-atend: #254538;
    --msg-atend-bd: #47745e;
    --sombra: none;
    color-scheme: dark;
}

html[data-tema="escuro"] .botao-pri,
html[data-tema="escuro"] .marca-sigla {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
html[data-tema="escuro"] .botao-pri:hover { background: var(--pri-hv); }
html[data-tema="escuro"] input[type="text"],
html[data-tema="escuro"] input[type="password"],
html[data-tema="escuro"] input[type="search"],
html[data-tema="escuro"] select,
html[data-tema="escuro"] textarea {
    background: var(--campo-bg);
}
html[data-tema="escuro"] input::placeholder,
html[data-tema="escuro"] textarea::placeholder {
    color: #8494a7;
    opacity: 1;
}

html[data-tema="escuro"] .lateral,
html[data-tema="escuro"] .topo {
    background: var(--sf2);
}
html[data-tema="escuro"] .cartao {
    border-color: transparent;
}
html[data-tema="escuro"] .tabela th {
    background: var(--sf2);
}
html[data-tema="escuro"] input[type="checkbox"] {
    accent-color: #60a5fa;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: var(--bg);
    color: var(--tx);
    font: 14px/1.45 "Segoe UI", Inter, system-ui, -apple-system, Arial, sans-serif;
}
a { color: var(--pri); }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }

/* ---------- estrutura ---------- */
.app { display: flex; min-height: 100vh; }

.lateral {
    width: 232px; flex: 0 0 232px;
    position: sticky; top: 0; height: 100vh;
    background: var(--sf); border-right: 1px solid var(--bd);
    display: flex; flex-direction: column; overflow: hidden;
    transition: width .2s, flex-basis .2s;
}
.marca {
    display: flex; align-items: center; gap: 10px;
    height: 56px; padding: 0 16px; border-bottom: 1px solid var(--bd);
    font-weight: 600; white-space: nowrap;
}
.marca-sigla {
    flex: none; width: 28px; height: 28px; border-radius: 7px;
    display: grid; place-items: center;
    background: var(--pri); color: #fff; font-weight: 700;
}
.lateral nav { padding: 8px 0; }
.lateral nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 18px; white-space: nowrap;
    color: var(--mu); text-decoration: none; border-left: 3px solid transparent;
}
.lateral nav a:hover { background: var(--sf2); color: var(--tx); }
.lateral nav a.ativo { color: var(--pri); background: var(--pri-bg); border-left-color: var(--pri); font-weight: 600; }
.lateral svg { width: 18px; height: 18px; flex: none; }

html.menu-recolhido .lateral { width: 60px; flex-basis: 60px; }
html.menu-recolhido .lateral .rot,
html.menu-recolhido .lateral .marca-nome { display: none; }

.fundo-menu { display: none; }

.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topo {
    position: sticky; top: 0; z-index: 5;
    height: 56px; padding: 0 20px;
    display: flex; align-items: center; gap: 12px;
    background: var(--sf); border-bottom: 1px solid var(--bd);
}
.topo h1 { flex: 1; margin: 0; font-size: 16px; font-weight: 600; }
main { padding: 20px; }

@media (max-width: 900px) {
    .lateral {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 30;
        width: 240px; transform: translateX(-100%); transition: transform .2s;
    }
    html.menu-recolhido .lateral { width: 240px; }
    html.menu-recolhido .lateral .rot,
    html.menu-recolhido .lateral .marca-nome { display: inline; }
    html.menu-aberto .lateral { transform: none; }
    html.menu-aberto .fundo-menu { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .35); }
    .topo { padding: 0 12px; }
    main { padding: 12px; }
}

/* ---------- blocos ---------- */
.cartao {
    background: var(--sf); border: 1px solid var(--bd); border-radius: 8px;
    padding: 16px; margin-bottom: 16px; box-shadow: var(--sombra);
}
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--sf); border: 1px solid var(--bd); border-radius: 8px; padding: 14px 16px; box-shadow: var(--sombra); }
.kpi span { display: block; font-size: 13px; color: var(--mu); }
.kpi strong { display: block; font-size: 26px; font-weight: 500; margin-top: 4px; }
.kpi strong.alerta { color: var(--er); }
.dica { color: var(--mu); font-size: 12px; }

/* ---------- botões ---------- */
.botao {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--bd); background: var(--sf); color: var(--tx);
    font: inherit; font-weight: 500; text-decoration: none;
}
.botao:hover { background: var(--sf2); }
.botao:disabled { opacity: .55; cursor: default; }
.botao-pri { background: var(--pri); border-color: var(--pri); color: #fff; font-weight: 600; }
.botao-pri:hover { background: var(--pri-hv); }
.botao-perigo { color: var(--er); border-color: var(--er); }
.botao-perigo:hover { background: var(--er-bg); }
.botao-peq { padding: 5px 12px; font-size: 12px; border-radius: 14px; }
.botao-icone {
    width: 36px; height: 36px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--bd); background: var(--sf); color: var(--tx); font-size: 16px;
}
.acoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- etiquetas ---------- */
.etiqueta {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
    background: var(--sf2); color: var(--mu);
}
.etiqueta-ok { background: var(--ok-bg); color: var(--ok); }
.etiqueta-at { background: var(--at-bg); color: var(--at); }
.etiqueta-er { background: var(--er-bg); color: var(--er); }
.etiqueta-in { background: var(--in-bg); color: var(--in); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 12px; border: 1px solid var(--bd); background: var(--sf2); font-size: 12px; font-weight: 600; }
.contador { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700; text-align: center; }

/* ---------- formulários ---------- */
.form-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin-bottom: 14px; }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--mu); }
.campo-check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding-top: 22px; }
input[type="text"], input[type="password"], input[type="search"], select, textarea {
    width: 100%; padding: 9px 11px; border-radius: 6px;
    border: 1px solid var(--bd); background: var(--sf); color: var(--tx); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri-bg); border-color: var(--pri); }

/* ---------- tabelas ---------- */
.tabela-rolagem { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th, .tabela td { padding: 9px 10px; border-bottom: 1px solid var(--bd); text-align: left; vertical-align: middle; }
.tabela th { font-size: 12px; font-weight: 600; color: var(--mu); background: var(--sf2); }
.tabela tr:hover td { background: var(--sf2); }

/* ---------- avisos ---------- */
.aviso { display: block; padding: 10px 12px; border-radius: 6px; margin: 0 0 14px; border: 1px solid var(--bd); background: var(--sf2); }
.aviso-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.aviso-er { background: var(--er-bg); color: var(--er); border-color: transparent; }
.aviso:empty { display: none; }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; background: var(--sf2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--bd); }
