/* ==========================================================================
   EstoqueMadeira — tema corporativo
   ========================================================================== */
:root {
  --ink: #0f172a; --muted: #64748b; --line: #e2e8f0; --bg: #f1f5f9; --surface: #fff;
  --navy: #0f2540; --navy-2: #173456; --primary: #1d4ed8; --primary-d: #1e40af; --accent: #d97706;
  --green: #15803d; --green-s: #16a34a; --green-bg: #dcfce7;
  --red: #b91c1c; --red-s: #dc2626; --red-bg: #fee2e2;
  --amber: #b45309; --amber-bg: #fef3c7; --blue-bg: #dbeafe;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 15px; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.hidden, [hidden] { display: none !important; }
.inline { display: inline; margin: 0; }
.muted { color: var(--muted); }
.nw { white-space: nowrap; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--primary); color: #fff; transition: .15s; text-decoration: none; }
.btn:hover { background: var(--primary-d); text-decoration: none; }
.btn:focus-visible { outline: 3px solid rgba(29,78,216,.35); outline-offset: 2px; }
.btn-outline { background: #fff; color: var(--primary); border-color: #bfdbfe; }
.btn-outline:hover { background: var(--blue-bg); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { background: #fff; color: var(--ink); }
.btn-success { background: var(--green-s); } .btn-success:hover { background: var(--green); }
.btn-danger { background: var(--red-s); } .btn-danger:hover { background: var(--red); }
.btn-warning { background: var(--amber-bg); color: var(--amber); border-color: #fde68a; } .btn-warning:hover { background: #fde68a; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; padding: 12px 18px; }
.btn-lg { padding: 14px 26px; font-size: 16px; }

/* ---------- Alertas (success / error / warning / info) ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 10px;
  margin: 0 0 18px; border: 1px solid; font-weight: 500; }
.alert .icon { margin-top: 2px; }
.alert-success { background: var(--green-bg); border-color: #86efac; color: #14532d; }
.alert-error { background: var(--red-bg); border-color: #fca5a5; color: #7f1d1d; }
.alert-warning { background: var(--amber-bg); border-color: #fcd34d; color: #78350f; }
.alert-info { background: var(--blue-bg); border-color: #93c5fd; color: #1e3a8a; }

/* ---------- Cartões, estatísticas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px; }
.card h2 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-bg); color: var(--primary); }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-icon.green { background: var(--green-bg); color: var(--green); } .stat-icon.amber { background: var(--amber-bg); color: var(--amber); } .stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat strong { display: block; font-size: 22px; line-height: 1.1; } .stat span { color: var(--muted); font-size: 13px; }

/* ---------- Layout do sistema (menu lateral) ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--navy), #0b1c33); color: #cbd5e1; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.2px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand .icon { width: 26px; height: 26px; color: #fbbf24; }
.brand-dark { color: var(--navy); } .brand-dark .icon { color: var(--accent); }
.empresa-chip { display: flex; align-items: center; gap: 12px; padding: 12px; background: rgba(255,255,255,.07); border-radius: 12px; }
.empresa-chip img, .avatar { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #fff; flex: none; }
.avatar { display: grid; place-items: center; font-weight: 800; font-size: 18px; color: var(--navy); background: #fbbf24; text-transform: uppercase; }
.empresa-chip strong { display: block; color: #fff; font-size: 14px; line-height: 1.25; word-break: break-word; }
.empresa-chip small { color: #94a3b8; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-titulo { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: 14px 10px 4px; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #cbd5e1; font-weight: 500; text-decoration: none; }
.menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.menu a.ativo { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 #fbbf24; }
.menu a.m-entrada .icon { color: #4ade80; } .menu a.m-saida .icon { color: #f87171; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 32px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar h1 { font-size: 22px; } .topbar p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--bg); border-radius: 999px; font-weight: 600; font-size: 14px; }
main.main { padding: 28px 32px 40px; width: 100%; max-width: 1240px; }
.app-footer { margin-top: auto; padding: 16px 32px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); background: #fff; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
table.data th { text-align: left; background: #f8fafc; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
table.data tbody tr:hover { background: #f8fafc; } table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data .empty { text-align: center; color: var(--muted); padding: 28px; }
table.data .acoes { white-space: nowrap; text-align: right; }
.row-entrada td:first-child { box-shadow: inset 5px 0 0 var(--green-s); }
.row-saida td:first-child { box-shadow: inset 5px 0 0 var(--red-s); }
.row-inativo { opacity: .6; }

/* ---------- Selos (ENTRADA / SAÍDA em destaque) ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge .icon { width: 14px; height: 14px; }
.badge-entrada, .badge-saida { text-transform: uppercase; letter-spacing: .05em; padding: 5px 12px; font-size: 12px; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.badge-entrada { background: var(--green-s); } .badge-saida { background: var(--red-s); }
.badge-ok { background: var(--green-bg); color: var(--green); } .badge-baixo { background: var(--amber-bg); color: var(--amber); }
.badge-zerado { background: var(--red-bg); color: var(--red); } .badge-inativo { background: #e2e8f0; color: #475569; }
.badge-gerente { background: var(--blue-bg); color: var(--primary-d); } .badge-func { background: #f1f5f9; color: #334155; }
.qtd-entrada { color: var(--green-s); font-size: 15px; } .qtd-saida { color: var(--red-s); font-size: 15px; }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-grid .field { margin-bottom: 0; }
.field.full { grid-column: 1 / -1; }
label, .label { font-weight: 600; font-size: 14px; }
label .opt { color: var(--muted); font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], input[type=email], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; background: #fff; color: var(--ink); transition: .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(29,78,216,.15); }
input.invalid, select.invalid { border-color: var(--red-s); }
.hint { color: var(--muted); font-size: 12.5px; }
.field-error { color: var(--red); font-size: 13px; font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 6px; margin: 0 0 18px; }
legend { font-weight: 700; padding: 0 8px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.filtros { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.filtros .field { margin: 0; min-width: 160px; }
.logo-prev { width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---------- Entrada / Saída: identificação visual ---------- */
.banner { display: flex; align-items: center; gap: 18px; padding: 22px 26px; border-radius: var(--radius); color: #fff; margin-bottom: 22px; box-shadow: var(--shadow); }
.banner .icon { width: 44px; height: 44px; }
.banner h2 { font-size: 22px; letter-spacing: .06em; text-transform: uppercase; margin: 0; } .banner p { margin: 4px 0 0; opacity: .92; }
.banner-entrada { background: linear-gradient(135deg, #166534, #16a34a); } .banner-saida { background: linear-gradient(135deg, #991b1b, #dc2626); }
.card-entrada { border-top: 5px solid var(--green-s); } .card-saida { border-top: 5px solid var(--red-s); }
.acoes-rapidas { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-bottom: 22px; }
.acao { display: flex; flex-direction: column; gap: 8px; padding: 26px; border-radius: var(--radius); color: #fff; box-shadow: var(--shadow); text-decoration: none; transition: .15s; }
.acao:hover { transform: translateY(-2px); text-decoration: none; }
.acao .icon { width: 40px; height: 40px; } .acao strong { font-size: 22px; text-transform: uppercase; letter-spacing: .05em; } .acao span { opacity: .92; }
.acao-entrada { background: linear-gradient(135deg, #166534, #16a34a); } .acao-saida { background: linear-gradient(135deg, #991b1b, #dc2626); } .acao-neutra { background: linear-gradient(135deg, var(--navy), var(--navy-2)); }

/* ---------- Páginas públicas ---------- */
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 32px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.site-header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-header .brand { margin-right: 10px; }
.site-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.hero { background: radial-gradient(1200px 500px at 85% -10%, #1e4a7a 0, transparent 60%), linear-gradient(135deg, var(--navy), #0b1c33); color: #fff; padding: 84px 0 96px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); letter-spacing: -.02em; max-width: 780px; }
.hero h1 em { font-style: normal; color: #fbbf24; }
.hero p { font-size: 18px; color: #cbd5e1; max-width: 640px; margin: 18px 0 30px; }
.hero .btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); } .hero .btn-outline:hover { background: rgba(255,255,255,.1); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.section { padding: 64px 0; } .section.alt { background: #fff; border-block: 1px solid var(--line); }
.section h2 { font-size: 28px; margin-bottom: 8px; } .section .lead { color: var(--muted); max-width: 680px; margin: 0 0 32px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.feature .stat-icon { margin-bottom: 14px; } .feature h3 { font-size: 17px; margin-bottom: 6px; } .feature p { margin: 0; color: var(--muted); }
.steps { counter-reset: passo; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.step { position: relative; padding: 22px 22px 22px 70px; background: var(--bg); border-radius: var(--radius); }
.step::before { counter-increment: passo; content: counter(passo); position: absolute; left: 20px; top: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; }
.step h3 { font-size: 16px; margin-bottom: 4px; } .step p { margin: 0; color: var(--muted); font-size: 14px; }
.site-footer { background: var(--navy); color: #94a3b8; padding: 28px 0; font-size: 14px; }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: #cbd5e1; }

/* ---------- Telas de acesso (login / cadastro) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1.1fr; }
.auth-aside { background: radial-gradient(900px 500px at 0% 0%, #1e4a7a 0, transparent 60%), linear-gradient(160deg, var(--navy), #0b1c33); color: #e2e8f0; padding: 48px; display: flex; flex-direction: column; gap: 28px; justify-content: center; }
.auth-aside h2 { font-size: 30px; color: #fff; letter-spacing: -.01em; } .auth-aside p { color: #cbd5e1; margin: 0; }
.auth-aside ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; } .auth-aside li { display: flex; gap: 10px; align-items: flex-start; } .auth-aside li .icon { color: #4ade80; margin-top: 3px; }
.auth-main { padding: 40px 24px; display: flex; justify-content: center; align-items: flex-start; }
.auth-card { width: min(560px, 100%); margin: auto; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; } .auth-card > p { color: var(--muted); margin: 0 0 22px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; font-size: 14px; }
.empresa-hero { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 20px; background: #f8fafc; }
.empresa-hero img, .empresa-hero .avatar { width: 56px; height: 56px; }
.empresa-hero strong { font-size: 17px; display: block; } .empresa-hero small { color: var(--muted); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.tile { position: relative; cursor: pointer; }
.tile input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tile-body { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 16px; border: 2px solid var(--line); border-radius: 12px; background: #fff; transition: .15s; height: 100%; }
.tile-body .icon { width: 26px; height: 26px; color: var(--muted); } .tile-body strong { font-size: 16px; } .tile-body small { color: var(--muted); font-size: 12.5px; line-height: 1.35; font-weight: 400; }
.tile input:checked + .tile-body { border-color: var(--primary); background: var(--blue-bg); box-shadow: 0 0 0 4px rgba(29,78,216,.12); }
.tile input:checked + .tile-body .icon { color: var(--primary); }
.tile input:focus-visible + .tile-body { outline: 3px solid rgba(29,78,216,.4); outline-offset: 2px; }

/* ---------- Documentos (termos / privacidade) e erro ---------- */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px; margin: 36px auto; max-width: 860px; }
.doc h1 { font-size: 30px; margin-bottom: 6px; } .doc h2 { font-size: 18px; margin: 26px 0 6px; } .doc p, .doc li { color: #334155; } .doc .meta { color: var(--muted); font-size: 14px; }
.doc .nota { margin-top: 28px; }
.erro-box { max-width: 520px; margin: 14vh auto; text-align: center; padding: 0 20px; }
.erro-box .codigo { font-size: 72px; font-weight: 800; color: var(--navy); line-height: 1; }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 10px; }
  .empresa-chip { padding: 6px 10px; } .empresa-chip small { display: none; }
  .menu { flex-direction: row; overflow-x: auto; width: 100%; padding-bottom: 4px; } .menu-titulo { display: none; }
  .menu a { white-space: nowrap; padding: 8px 12px; } .menu a.ativo { box-shadow: inset 0 -3px 0 #fbbf24; }
  .topbar, main.main, .app-footer { padding-left: 16px; padding-right: 16px; }
  .auth { grid-template-columns: 1fr; } .auth-aside { display: none; }
  .site-header { padding: 12px 16px; } .hero { padding: 56px 0 64px; } .doc { padding: 24px; margin: 16px; }
}
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr; } }
