/* Real Car — Oficina Mecânica (sem dependências externas) */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --ouro: #f5b301;
    --ouro-claro: #ffd34d;
    --ouro-escuro: #c98a00;
    --preto: #0d0d0f;
    --preto-2: #17171b;
    --grafite: #22232a;
    --verde: #16a34a;
    --vermelho: #dc2626;
    --laranja: #ea580c;
    --azul: #2563eb;
    --roxo: #7c3aed;
    --cinza: #6b7280;
    --fundo: #f3f4f6;
    --card: #ffffff;
    --borda: #e5e7eb;
    --texto: #111318;
    --sombra: 0 1px 3px rgba(15,23,42,.08), 0 6px 18px rgba(15,23,42,.07);
    --raio: 14px;
    --campo: #ffffff;          /* fundo de input e area de destaque */
    --linha-hover: #fff8e6;    /* linha da tabela sob o mouse */
    --texto-suave: #6b7280;    /* textos secundarios */
    --btn-claro-fundo: #f3f4f6;
    --btn-claro-texto: #374151;
    --linha-zebra: #fafafa;   /* faixa alternada da tabela */
    --bloco-suave: #fafafa;   /* fundo dos blocos de item */
}

/* ================= TEMA ESCURO =================
   So troca as cores; a estrutura e a mesma. A barra lateral ja era escura,
   entao ela quase nao muda - o que muda e a area de conteudo. */
html[data-tema="escuro"] {
    --fundo: #101114;
    --card: #191a1f;
    --borda: #2c2e36;
    --texto: #e8e9ec;
    --texto-suave: #a1a5ad;
    --campo: #202128;
    --linha-hover: #26272f;
    --btn-claro-fundo: #2a2c34;
    --btn-claro-texto: #e8e9ec;
    --linha-zebra: #1f2027;
    --bloco-suave: #1f2027;
    --sombra: 0 1px 3px rgba(0,0,0,.5), 0 6px 18px rgba(0,0,0,.45);
}

/* Pecas com cor propria que precisam acompanhar o tema escuro.
   Os selos e avisos sao pastel claro com letra escura: no fundo preto ficam
   berrantes e destoam. Aqui viram o contrario - fundo escuro da mesma cor,
   letra clara - mantendo o significado de cada cor. */
html[data-tema="escuro"] .bloco-destaque { background: #2a2311; }

html[data-tema="escuro"] .badge.verde    { background: #14331f; color: #6ee7a0; }
html[data-tema="escuro"] .badge.vermelho { background: #3a1618; color: #fca5a5; }
html[data-tema="escuro"] .badge.amarelo  { background: #362a10; color: #fcd34d; }
html[data-tema="escuro"] .badge.azul     { background: #16233f; color: #93c5fd; }
html[data-tema="escuro"] .badge.roxo     { background: #251a3d; color: #c4b5fd; }
html[data-tema="escuro"] .badge.cinza    { background: #262a31; color: #b6bcc6; }
html[data-tema="escuro"] .badge.ouro     { background: #362a10; color: #f5c451; }

html[data-tema="escuro"] .alerta.ok   { background: #14331f; color: #8ff0b8; }
html[data-tema="escuro"] .alerta.erro { background: #3a1618; color: #fca5a5; }

html[data-tema="escuro"] .linha-item .rm { background: #3a1618; color: #fca5a5; }
html[data-tema="escuro"] .linha-item .rm:hover { background: #4d1d20; }
html[data-tema="escuro"] input::placeholder,
html[data-tema="escuro"] textarea::placeholder { color: #767b85; }

/* o botao de tema na barra lateral tem que parecer um item de menu */
.nav-botao {
    width: 100%; background: none; border: none; cursor: pointer;
    font-family: inherit; text-align: left;
}

/* botao de trocar o tema flutuante - usado so na tela de login,
   que nao tem barra lateral */
.btn-tema {
    position: fixed; top: 14px; right: 18px; z-index: 50;
    width: 40px; height: 40px; border-radius: 50%;
    border: 1.5px solid var(--borda); background: var(--card); color: var(--texto);
    font-size: 18px; line-height: 1; cursor: pointer;
    box-shadow: var(--sombra);
    display: flex; align-items: center; justify-content: center;
    transition: transform .12s;
}
.btn-tema:hover { transform: scale(1.08); }
@media print { .btn-tema { display: none; } }
@media (max-width: 720px) { .btn-tema { top: 8px; right: 10px; width: 34px; height: 34px; font-size: 15px; } }

body {
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--fundo);
    color: var(--texto);
    font-size: 15px;
}

a { color: var(--ouro-escuro); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================= SIDEBAR ================= */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 240px;
    background: linear-gradient(180deg, #000 0%, #16161a 55%, #1f2026 100%);
    color: #fff;
    padding: 18px 12px;
    overflow-y: auto;
    z-index: 100;
    border-right: 2px solid var(--ouro);
}
.sidebar .logo {
    display: flex; flex-direction: column; align-items: center;
    padding: 6px 8px 16px;
    border-bottom: 1px solid rgba(245,179,1,.28);
    margin-bottom: 14px;
    text-align: center;
}
.sidebar .logo img { width: 92px; height: 92px; border-radius: 50%; object-fit: cover;
    box-shadow: 0 0 0 3px rgba(245,179,1,.35); margin-bottom: 8px; }
.sidebar .logo .crown { font-size: 26px; line-height: 1; }
.sidebar .logo .nome {
    font-size: 22px; font-weight: 800; letter-spacing: .5px;
    font-family: Georgia, 'Times New Roman', serif;
}
.sidebar .logo .nome b { color: var(--ouro); }
.sidebar .logo small {
    display: block; font-weight: 500; font-size: 11px;
    opacity: .7; letter-spacing: 4px; text-transform: lowercase; margin-top: 2px;
}
.sidebar .nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 14px;
    margin-bottom: 2px;
    color: rgba(255,255,255,.75);
    font-size: 14.5px;
    border-radius: 10px;
    transition: background .15s, color .15s, transform .1s;
}
.sidebar .nav-item:hover {
    background: rgba(245,179,1,.12);
    color: #fff;
    text-decoration: none;
    transform: translateX(2px);
}
.sidebar .nav-item.ativo {
    background: linear-gradient(90deg, var(--ouro) 0%, var(--ouro-claro) 100%);
    color: #1a1a1a;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(245,179,1,.35);
}
.sidebar .icone { font-size: 18px; width: 24px; text-align: center; }
.sidebar .sep { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
    color: rgba(245,179,1,.55); padding: 14px 14px 5px; font-weight: 700; }

/* ================= CONTEÚDO ================= */
.conteudo { margin-left: 240px; padding: 26px 30px; min-height: 100vh; }

.topo {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.topo h2 { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.topo h2 small { font-weight: 500; color: var(--cinza); font-size: 15px; }

/* ================= CARDS DE RESUMO ================= */
.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.stat-card {
    flex: 1; min-width: 185px;
    border-radius: var(--raio);
    padding: 18px 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1f2937 0%, #0d0d0f 100%);
    box-shadow: var(--sombra);
}
.stat-card.ouro { background: linear-gradient(135deg, var(--ouro) 0%, var(--ouro-escuro) 100%); color: #1a1a1a; }
.stat-card.verde { background: linear-gradient(135deg, #22c55e 0%, #15803d 100%); }
.stat-card.vermelho { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
.stat-card.azul { background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%); }
.stat-card.roxo { background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); }
.stat-card .rotulo {
    font-size: 11.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; opacity: .85;
}
.stat-card .valor { font-size: 25px; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.stat-card .icone-fundo {
    position: absolute; right: 12px; bottom: 2px;
    font-size: 50px; opacity: .16;
}

/* ================= PAINÉIS ================= */
.painel {
    background: var(--card);
    border-radius: var(--raio);
    padding: 20px 22px;
    box-shadow: var(--sombra);
    margin-bottom: 20px;
    border: 1px solid rgba(229,231,235,.7);
}
.painel h3 {
    font-size: 16px; font-weight: 800; margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--fundo);
    display: flex; align-items: center; gap: 8px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 .painel { margin-bottom: 0; }

/* ================= TABELAS ================= */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; }
th {
    font-size: 11.5px; text-transform: uppercase; color: var(--texto-suave);
    letter-spacing: .8px; font-weight: 700;
    border-bottom: 2px solid var(--borda);
}
td { border-bottom: 1px solid var(--borda); }
tbody tr:nth-child(even) td { background: var(--linha-zebra); }
tr:hover td { background: var(--linha-hover); }
td.num, th.num { text-align: right; }

/* ================= BOTÕES ================= */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    background: linear-gradient(135deg, var(--ouro) 0%, var(--ouro-escuro) 100%);
    color: #1a1a1a;
    box-shadow: 0 2px 6px rgba(245,179,1,.4);
    transition: transform .12s, box-shadow .12s, opacity .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,179,1,.5); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn.escuro { background: linear-gradient(135deg, #2b2c33, #0d0d0f); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.btn.verde { background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; box-shadow: 0 2px 6px rgba(22,163,74,.35); }
.btn.vermelho { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; box-shadow: 0 2px 6px rgba(220,38,38,.35); }
.btn.cinza { background: linear-gradient(135deg, #6b7280, #4b5563); color: #fff; box-shadow: none; }
.btn.claro { background: var(--btn-claro-fundo); color: var(--btn-claro-texto); box-shadow: none; border: 1px solid var(--borda); }
.btn.pequeno { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.grande { padding: 15px 24px; font-size: 17px; width: 100%; justify-content: center; }

/* ================= FORMULÁRIOS ================= */
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; color: var(--texto); }
input, select, textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--borda);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--campo);
    color: var(--texto);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--ouro);
    box-shadow: 0 0 0 3px rgba(245,179,1,.22);
}
textarea { resize: vertical; }
.campo { margin-bottom: 15px; }
.linha-campos { display: flex; gap: 14px; flex-wrap: wrap; }
.linha-campos .campo { flex: 1; min-width: 130px; }

.bloco-destaque {
    background: #fffbeb;
    border: 1.5px dashed var(--ouro);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 15px;
}
.bloco-destaque h4 { font-size: 14px; margin-bottom: 10px; color: #92400e; }

.check-linha { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.check-linha input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--ouro-escuro); }
.check-linha label { margin: 0; font-size: 14.5px; }

/* ================= BADGES ================= */
.badge {
    display: inline-block; padding: 4px 11px; border-radius: 20px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge.verde { background: #dcfce7; color: #166534; }
.badge.vermelho { background: #fee2e2; color: #991b1b; }
.badge.amarelo { background: #fef3c7; color: #92400e; }
.badge.azul { background: #dbeafe; color: #1e40af; }
.badge.roxo { background: #ede9fe; color: #5b21b6; }
.badge.cinza { background: #f1f5f9; color: #475569; }
.badge.ouro { background: #fff3cd; color: #7a5b00; }

.alerta {
    padding: 13px 18px; border-radius: 12px; margin-bottom: 16px;
    font-weight: 600; box-shadow: var(--sombra);
}
.alerta.ok { background: #dcfce7; color: #166534; border-left: 5px solid var(--verde); }
.alerta.erro { background: #fee2e2; color: #991b1b; border-left: 5px solid var(--vermelho); }

/* ================= LINHAS DINÂMICAS (OS / compras) ================= */
.linha-item {
    display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
    background: var(--bloco-suave); padding: 8px; border-radius: 10px; border: 1px solid var(--borda);
    flex-wrap: wrap;
}
.linha-item input, .linha-item select { padding: 8px 10px; font-size: 14px; }

/* botao de remover usado nas tabelas (nas linhas de item ele e maior) */
.rm {
    width: 28px; height: 28px; flex: none;
    border-radius: 8px; border: 1px solid var(--borda);
    background: var(--btn-claro-fundo); color: var(--vermelho);
    cursor: pointer; font-weight: 800; font-size: 15px; line-height: 1;
    transition: background .12s, color .12s;
}
.rm:hover { background: #fee2e2; color: #991b1b; }
html[data-tema="escuro"] .rm:hover { background: #3a1618; color: #fca5a5; }

.linha-item .rm {
    width: 34px; height: 34px; flex: none; border-radius: 8px; border: none;
    background: #fee2e2; color: #991b1b; cursor: pointer; font-weight: 800; font-size: 16px;
}
.linha-item .rm:hover { background: #fecaca; }
.mini { font-size: 12px; color: var(--texto-suave); }

.totais-box {
    background: #0d0d0f; color: #fff; border-radius: 12px; padding: 16px 20px;
    display: flex; flex-direction: column; gap: 6px;
}
.totais-box .tl { display: flex; justify-content: space-between; font-size: 15px; }
.totais-box .tl.grande { font-size: 24px; font-weight: 800; color: var(--ouro);
    border-top: 1px solid rgba(255,255,255,.15); margin-top: 6px; padding-top: 10px; }

/* ================= GRÁFICO DE BARRAS ================= */
.grafico { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.grafico .coluna { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.grafico .valor-barra { font-size: 10.5px; font-weight: 700; color: var(--cinza); margin-bottom: 4px; }
.grafico .barra-area { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.grafico .barra {
    width: 70%; max-width: 46px;
    background: linear-gradient(180deg, var(--ouro-claro), var(--ouro-escuro));
    border-radius: 8px 8px 3px 3px; min-height: 3px; transition: opacity .15s;
}
.grafico .coluna:hover .barra { opacity: .8; }
.grafico .rotulo-dia { font-size: 11.5px; font-weight: 600; color: var(--cinza); margin-top: 6px; }

/* barra horizontal (categorias / rankings) */
.barra-h { margin-bottom: 11px; }
.barra-h .lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.barra-h .lbl b { font-weight: 700; }
.barra-h .trilho { background: var(--fundo); border-radius: 20px; height: 12px; overflow: hidden; }
.barra-h .preench { height: 100%; border-radius: 20px;
    background: linear-gradient(90deg, var(--ouro-claro), var(--ouro-escuro)); }
.barra-h.azul .preench { background: linear-gradient(90deg, #60a5fa, #1e40af); }

/* comparativo serviços x peças */
.comp-bar { display: flex; height: 34px; border-radius: 10px; overflow: hidden; margin: 6px 0 4px; }
.comp-bar .s { background: linear-gradient(90deg, var(--ouro), var(--ouro-escuro)); }
.comp-bar .p { background: linear-gradient(90deg, #60a5fa, #1e40af); }
.legenda { display: flex; gap: 18px; font-size: 13px; }
.legenda span { display: flex; align-items: center; gap: 6px; }
.legenda .bola { width: 12px; height: 12px; border-radius: 3px; }

/* ================= UTILIDADES ================= */
.texto-cinza { color: var(--cinza); font-size: 13px; }
.mt { margin-top: 16px; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vazio { text-align: center; color: var(--cinza); padding: 34px 0; font-size: 14.5px; }
.dinheiro { font-weight: 800; }
.lucro-pos { color: var(--verde); font-weight: 800; }
.lucro-neg { color: var(--vermelho); font-weight: 800; }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filtros .campo { margin: 0; }

@media (max-width: 950px) {
    .grid-2 { grid-template-columns: 1fr; }
    .sidebar { width: 62px; padding: 12px 6px; }
    .sidebar .logo img { width: 44px; height: 44px; }
    .sidebar .logo .nome, .sidebar .logo small, .sidebar .sep { display: none; }
    .sidebar .nav-item { justify-content: center; padding: 12px 0; }
    .sidebar .nav-item .texto { display: none; }
    .conteudo { margin-left: 62px; padding: 16px; }
}

/* ================= IMPRESSÃO (contrato) ================= */
@media print {
    .sidebar, .no-print { display: none !important; }
    .conteudo { margin: 0; padding: 0; }
    body { background: #fff; font-size: 12.5px; }
    .contrato { box-shadow: none !important; border: none !important; }
}

/* ================= TELA DE LOGIN =================
   Fica de fora do layout com barra lateral: e uma tela cheia, centrada,
   com a marca da oficina em destaque. */
body.tela-login {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background:
        radial-gradient(1100px 520px at 50% -8%, rgba(245,179,1,.20), transparent 62%),
        linear-gradient(160deg, #0d0d0f 0%, #16161a 45%, #1f2026 100%);
}

.login-caixa {
    width: 100%; max-width: 380px;
    background: var(--card);
    border: 1px solid var(--borda);
    border-top: 4px solid var(--ouro);
    border-radius: 18px;
    padding: 34px 30px 26px;
    box-shadow: 0 18px 50px rgba(0,0,0,.45);
}

.login-marca { text-align: center; margin-bottom: 24px; }
.login-marca img { max-width: 130px; max-height: 84px; object-fit: contain; }
.login-coroa {
    font-size: 42px; line-height: 1;
    filter: drop-shadow(0 3px 8px rgba(245,179,1,.5));
}
.login-marca h1 {
    font-size: 27px; letter-spacing: .5px; margin-top: 8px; color: var(--texto);
}
.login-marca h1 b { color: var(--ouro); }
.login-marca span {
    display: block; font-size: 12px; text-transform: uppercase;
    letter-spacing: 2.5px; color: var(--texto-suave); margin-top: 3px;
}

.login-caixa .campo { margin-bottom: 15px; }
.login-caixa .btn.grande { margin-top: 6px; }

/* olho para mostrar a senha, encostado na direita do campo */
.campo-senha { position: relative; }
.campo-senha input { padding-right: 44px; }
.campo-senha button {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: 0; cursor: pointer;
    font-size: 16px; opacity: .55; padding: 6px 8px; line-height: 1;
}
.campo-senha button:hover { opacity: 1; }

.login-rodape {
    margin-top: 20px; text-align: center;
    font-size: 12px; color: var(--texto-suave);
}
