:root {
  --bg: #eef3f8;
  --bg-2: #f8fafc;
  --panel: #ffffff;
  --text: #101828;
  --text-2: #1f2937;
  --muted: #667085;
  --muted-2: #94a3b8;
  --line: #dbe4ef;
  --primary: #0b4f91;
  --primary-2: #073763;
  --primary-3: #0a66c2;
  --primary-soft: #e9f2ff;
  --cyan: #14b8a6;
  --cyan-2: #2dd4bf;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warning: #b54708;
  --warning-soft: #fff1d6;
  --success: #027a48;
  --success-soft: #dcfae6;
  --info: #026aa2;
  --info-soft: #e0f2fe;
  --dark: #0b1220;
  --dark-2: #101828;
  --shadow: 0 22px 60px rgba(16, 24, 40, 0.12);
  --shadow-soft: 0 12px 28px rgba(16, 24, 40, 0.07);
  --shadow-card: 0 18px 45px rgba(15, 23, 42, 0.10);
  --radius: 20px;
  --radius-lg: 30px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(11, 79, 145, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.12), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--primary); font-weight: 700; text-decoration: none; }
a:hover { text-decoration: underline; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 292px; color: #fff; padding: 24px;
  display: flex; flex-direction: column; gap: 24px; z-index: 20;
  background: radial-gradient(circle at 20% 0%, rgba(45, 212, 191, 0.16), transparent 35%), linear-gradient(180deg, #0b1220 0%, #081933 56%, #071527 100%);
  box-shadow: 20px 0 50px rgba(11, 18, 32, 0.20);
}
.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px; mask-image: linear-gradient(180deg, rgba(0,0,0,0.8), transparent);
}
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2dd4bf 0%, #0a66c2 100%);
  font-weight: 950; letter-spacing: 0.07em; box-shadow: 0 18px 35px rgba(20, 184, 166, 0.24);
}
.brand strong { display: block; font-size: 1.08rem; letter-spacing: -0.02em; }
.brand small { color: #aeb8cc; display: block; margin-top: 3px; }
.menu { position: relative; z-index: 1; display: grid; gap: 8px; }
.menu-item {
  border: 1px solid transparent; background: transparent; color: #cbd5e1; text-align: left;
  padding: 12px 14px; border-radius: 15px; transition: 0.2s ease; display: flex; align-items: center; gap: 10px; font-weight: 760;
}
.menu-item span { color: #7dd3fc; width: 18px; display: inline-grid; place-items: center; }
.menu-item:hover, .menu-item.active { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.14); color: #fff; transform: translateX(2px); }
.sidebar-footer { position: relative; z-index: 1; margin-top: auto; display: grid; gap: 10px; }
.main { margin-left: 292px; padding: 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.topbar h1 { margin: 0 0 7px; font-size: clamp(1.75rem, 2.2vw, 2.45rem); letter-spacing: -0.04em; }
.topbar p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--primary) !important; font-weight: 900; text-transform: uppercase; font-size: 0.76rem; letter-spacing: 0.12em; margin-bottom: 8px !important; }
.top-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: end; justify-content: flex-end; }
body.auth-locked { overflow: hidden; background: radial-gradient(circle at 12% 18%, rgba(20, 184, 166, 0.16), transparent 28%), radial-gradient(circle at 85% 20%, rgba(11, 79, 145, 0.18), transparent 30%), linear-gradient(135deg, #edf4fb 0%, #f8fbff 45%, #eef3f8 100%); }
body.auth-locked .sidebar, body.auth-locked .screen, body.auth-locked .top-actions { display: none !important; }
body.auth-locked .main { margin-left: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
body.auth-locked .topbar { display: none; }
body.auth-locked #loginPanel { display: grid !important; }
.login-shell { width: min(1180px, 100%); }
.login-card {
  width: 100%; min-height: 620px; display: grid; grid-template-columns: 1.05fr 0.95fr;
  background: rgba(255, 255, 255, 0.82); border: 1px solid rgba(148, 163, 184, 0.35); border-radius: 34px; overflow: hidden;
  box-shadow: 0 32px 95px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255,255,255,0.95); backdrop-filter: blur(18px);
}
.login-hero {
  position: relative; isolation: isolate; padding: 42px; color: #fff;
  background: radial-gradient(circle at 18% 18%, rgba(45, 212, 191, 0.35), transparent 30%), radial-gradient(circle at 90% 75%, rgba(14, 165, 233, 0.22), transparent 35%), linear-gradient(145deg, #08111f 0%, #082346 48%, #0b4f91 100%);
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
}
.login-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.26; background-image: linear-gradient(rgba(255,255,255,0.10) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.10) 1px, transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(180deg, rgba(0,0,0,0.95), transparent 85%); }
.login-hero::after { content: ""; position: absolute; width: 380px; height: 380px; right: -160px; bottom: -150px; border-radius: 50%; background: rgba(45, 212, 191, 0.18); filter: blur(2px); z-index: -1; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-logo { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; color: #fff; font-weight: 950; letter-spacing: 0.08em; background: linear-gradient(135deg, #2dd4bf, #38bdf8); box-shadow: 0 18px 40px rgba(45, 212, 191, 0.25); }
.login-brand strong { display: block; font-size: 1.18rem; letter-spacing: -0.02em; }
.login-brand span { display: block; margin-top: 2px; color: rgba(255,255,255,0.68); font-size: 0.92rem; }
.login-hero-content { max-width: 620px; margin: 42px 0; }
.login-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 8px 12px; color: #dffcff; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); font-size: 0.78rem; font-weight: 850; text-transform: uppercase; letter-spacing: 0.09em; }
.login-hero-content h2 { margin: 18px 0 14px; font-size: clamp(2.1rem, 4vw, 4rem); line-height: 0.96; letter-spacing: -0.065em; }
.login-hero-content p { margin: 0; color: rgba(255,255,255,0.78); font-size: 1.03rem; line-height: 1.65; }
.login-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.login-features article { padding: 16px; border-radius: 20px; background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.14); backdrop-filter: blur(10px); }
.login-features strong { display: block; margin-bottom: 6px; }
.login-features span { display: block; color: rgba(255,255,255,0.70); font-size: 0.86rem; line-height: 1.45; }
.login-form-area { padding: 48px; display: flex; flex-direction: column; justify-content: center; background: radial-gradient(circle at top right, rgba(11, 79, 145, 0.08), transparent 34%), #ffffff; }
.login-form-header { margin-bottom: 24px; }
.login-form-header h1 { margin: 16px 0 8px; color: var(--dark); font-size: clamp(2rem, 3vw, 3rem); line-height: 1; letter-spacing: -0.055em; }
.login-form-header p { margin: 0; color: var(--muted); line-height: 1.55; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { color: #475467; font-weight: 800; font-size: 0.9rem; }
.auth-form input { height: 54px; border-radius: 16px; border: 1px solid #cfd9e6; background: #f8fbff; padding: 0 15px; font-size: 0.98rem; font-weight: 650; }
.auth-form input:focus { background: #fff; border-color: var(--primary-3); box-shadow: 0 0 0 5px rgba(10, 102, 194, 0.12); }
.login-btn { height: 54px; border-radius: 16px; margin-top: 4px; font-size: 1rem; }
.login-secondary-btn { height: 50px; border-radius: 16px; }
.login-help { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.login-security { margin-top: 22px; display: flex; gap: 12px; padding: 15px; border-radius: 18px; border: 1px solid #dbeafe; background: #eff6ff; }
.login-security span { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: #dbeafe; }
.login-security p { margin: 0; color: #1e3a8a; font-size: 0.9rem; line-height: 1.5; }
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.22s ease; }
.hidden { display: none !important; }
.mt { margin-top: 18px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.panel { background: rgba(255,255,255,0.96); border: 1px solid rgba(219, 228, 239, 0.95); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 20px; backdrop-filter: blur(10px); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-header h2 { margin: 0; font-size: 1.08rem; letter-spacing: -0.02em; }
.panel-header p { margin: 4px 0 0; color: var(--muted); }
.hero-panel { display: flex; justify-content: space-between; align-items: center; gap: 18px; color: #fff; background: radial-gradient(circle at 85% 20%, rgba(45, 212, 191, 0.26), transparent 30%), linear-gradient(135deg, #073763, #0b4f91 58%, #0f766e); border-radius: 28px; box-shadow: var(--shadow); padding: 26px; margin-bottom: 18px; overflow: hidden; }
.hero-panel h2 { margin: 12px 0 8px; font-size: clamp(1.45rem, 2vw, 2.1rem); letter-spacing: -0.04em; }
.hero-panel p { margin: 0; color: rgba(255,255,255,0.84); max-width: 780px; line-height: 1.55; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-soft); position: relative; overflow: hidden; min-height: 132px; }
.kpi::after { content: ""; position: absolute; inset: auto -25px -28px auto; width: 96px; height: 96px; border-radius: 50%; background: rgba(11,79,145,0.10); }
.kpi span { color: var(--muted); display: block; font-size: 0.88rem; font-weight: 800; }
.kpi strong { display: block; font-size: 2.05rem; margin: 8px 0 4px; letter-spacing: -0.04em; }
.kpi small { color: var(--muted); }
.kpi.danger::after { background: rgba(180,35,24,0.12); }
.kpi.warning::after { background: rgba(181,71,8,0.14); }
.kpi.info::after { background: rgba(2,106,162,0.12); }
.kpi.success::after { background: rgba(2,122,72,0.12); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two-columns.wide-left { grid-template-columns: minmax(420px, 0.92fr) minmax(430px, 1.08fr); }
.report-grid { display: grid; gap: 18px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-form.compact { gap: 10px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 0.88rem; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 11px 12px; background: #fff; color: var(--text); outline: none; transition: 0.18s ease; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(11,79,145,0.12); }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; margin-bottom: 12px; }
.filters input { min-width: 280px; }
.btn, .link-btn { border: 0; border-radius: 14px; padding: 10px 15px; font-weight: 900; transition: 0.2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-3)); color: #fff; box-shadow: 0 12px 24px rgba(11,79,145,0.20); }
.btn.primary:hover { background: linear-gradient(135deg, var(--primary-2), var(--primary)); transform: translateY(-1px); }
.btn.ghost { background: var(--primary-soft); color: var(--primary); }
.btn.ghost:hover { background: #dbeafe; transform: translateY(-1px); }
.btn.white { background: #fff; color: var(--primary); }
.btn.small { padding: 8px 11px; font-size: 0.85rem; background: var(--primary-soft); color: var(--primary); }
.link-btn { background: transparent; color: #cbd5e1; justify-content: flex-start; padding: 4px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; background: var(--primary-soft); color: var(--primary); font-size: 0.78rem; font-weight: 900; width: fit-content; }
.badge.light { color: #fff; background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.22); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.warning { color: #ffd580; background: rgba(181,107,0,0.18); }
.badge.info { color: var(--info); background: var(--info-soft); }
.badge.success { color: var(--success); background: var(--success-soft); }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #475569; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.055em; }
td { color: #334155; }
tr:last-child td { border-bottom: 0; }
.stock-low { color: var(--danger); font-weight: 950; }
.stock-ok { color: var(--success); font-weight: 950; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-btn { border: 1px solid var(--line); background: #fff; color: var(--primary); border-radius: 12px; padding: 8px 10px; font-weight: 850; }
.icon-btn:hover { background: var(--primary-soft); }
.list { display: grid; gap: 10px; }
.list-card { border: 1px solid var(--line); border-radius: 16px; padding: 13px; background: #fff; display: grid; gap: 7px; box-shadow: 0 6px 14px rgba(16,24,40,0.04); }
.list-card strong { color: var(--text); }
.meta { color: var(--muted); font-size: 0.86rem; display: flex; gap: 8px 12px; flex-wrap: wrap; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.timeline { display: grid; gap: 10px; max-height: 660px; overflow: auto; padding-right: 4px; }
.timeline-item { border-left: 4px solid var(--primary); background: #fff; border-radius: 14px; padding: 13px 14px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); box-shadow: 0 6px 14px rgba(16,24,40,0.04); }
.timeline-item.saida, .timeline-item.baixa { border-left-color: var(--danger); }
.timeline-item.entrada, .timeline-item.devolucao { border-left-color: var(--success); }
.timeline-item.ajuste { border-left-color: var(--warning); }
.timeline-item.alerta { border-left-color: var(--info); }
.timeline-item p { color: #475467; line-height: 1.45; margin: 8px 0 0; }
.empty-state { color: var(--muted); font-size: 0.92rem; }
.qr-card { border: 1px solid #b8d8ff; background: linear-gradient(180deg, #f6fbff, #ffffff); border-radius: 18px; padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }
.qr-card p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.qr-card label { margin-top: 4px; }
.qr-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.process-list { display: grid; gap: 10px; }
.process-list article { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.process-list b { color: var(--primary); }
.process-list span { color: var(--muted); }
.restricted-card { margin-top: 14px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 18px; padding: 14px; }
.restricted-card p { color: #7c2d12; margin: 6px 0 0; }
.privacy-note, .info-strip { margin-top: 14px; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 18px; padding: 13px 14px; color: #1e3a8a; line-height: 1.45; }
.inline-check { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; align-self: end; min-height: 44px; }
.inline-check input { width: auto; }
.prose { line-height: 1.65; color: #334155; }
.prose code, code { background: var(--primary-soft); padding: 2px 6px; border-radius: 8px; color: #0f3d84; }
pre { overflow: auto; background: var(--dark); color: #e2e8f0; padding: 16px; border-radius: 16px; }
pre code { background: transparent; color: inherit; padding: 0; }
.modal { position: fixed; inset: 0; background: rgba(11,18,32,0.68); backdrop-filter: blur(8px); z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(720px, 96vw); background: #fff; border-radius: 24px; padding: 20px; box-shadow: 0 30px 90px rgba(0,0,0,0.32); }
.modal-subtitle { margin: 4px 0 0; color: var(--muted); }
.qr-reader { min-height: 300px; border: 1px dashed #9cc4f3; border-radius: 18px; background: #f8fbff; display: grid; place-items: center; overflow: hidden; }
.qr-reader video { border-radius: 14px; }
.manual-qr { margin-top: 14px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.help-text { margin: 12px 0 0; color: var(--muted); font-size: 0.9rem; }
.badge-card-print { width: min(360px, 100%); margin: 8px auto 16px; border: 1px solid #0f172a; border-radius: 24px; padding: 20px; background: linear-gradient(180deg, #fff, #f8fafc); text-align: center; box-shadow: 0 20px 45px rgba(16,24,40,0.10); }
.badge-card-print canvas { width: 260px; height: 260px; max-width: 100%; border: 12px solid #fff; border-radius: 18px; box-shadow: 0 10px 22px rgba(16,24,40,0.08); }
.badge-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: #0f172a; }
.badge-head strong { font-size: 1.35rem; letter-spacing: -0.04em; }
.badge-head span { font-size: 0.82rem; color: var(--muted); }
.badge-card-print h3 { margin: 12px 0 6px; color: #0f172a; }
.badge-card-print p { color: #475467; margin: 0 0 8px; }
.badge-card-print small { color: var(--muted); }
.qr-print-card textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; }
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--dark); color: #fff; padding: 14px 16px; border-radius: 16px; box-shadow: var(--shadow); z-index: 100; opacity: 0; transform: translateY(10px); transition: 0.25s ease; pointer-events: none; max-width: 390px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
.toast.info { background: var(--info); }
body:not(.is-admin) .admin-only, body:not(.is-admin) .admin-only-block { display: none !important; }
.user-card { border-left: 5px solid #0f766e; }
.user-card strong { display: flex; align-items: center; gap: 8px; }
#systemUsers .info-strip { margin-top: 0; }
#systemUserEmail:disabled { background: #f1f5f9; color: #64748b; cursor: not-allowed; }
@media (max-width: 1260px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .login-card { grid-template-columns: 0.95fr 1.05fr; } .login-features { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .sidebar { position: static; width: auto; border-radius: 0 0 24px 24px; } .main { margin-left: 0; padding: 18px; } .menu { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-grid, .two-columns, .two-columns.wide-left { grid-template-columns: 1fr; } .hero-panel { flex-direction: column; align-items: flex-start; } .login-card { min-height: auto; grid-template-columns: 1fr; } .login-hero { min-height: 420px; } body.auth-locked { overflow: auto; } }
@media (max-width: 720px) { body.auth-locked .main { padding: 14px; } .login-card { border-radius: 24px; } .login-hero, .login-form-area { padding: 26px; } .login-hero-content h2 { font-size: 2.35rem; } .login-features { grid-template-columns: 1fr; } .topbar { align-items: flex-start; flex-direction: column; } .top-actions { justify-content: flex-start; } .grid-form, .grid-form.compact, .qr-card, .manual-qr { grid-template-columns: 1fr; } .span-2 { grid-column: span 1; } .filters { flex-direction: column; } .filters input { min-width: 0; } .menu { grid-template-columns: 1fr; } .kpi-grid { grid-template-columns: 1fr; } }
@media print { .sidebar, .top-actions, .filters, .form-actions, #loginPanel, .modal, .btn, .icon-btn { display: none !important; } .main { margin-left: 0; padding: 0; } .panel, .kpi, .hero-panel { box-shadow: none; break-inside: avoid; } body { background: #fff; } body.printing-qr .sidebar, body.printing-qr .main, body.printing-qr #toast { display: none !important; } }
