:root {
  --navy-950: #0b1a2e;
  --navy-900: #10233d;
  --navy-800: #1a3455;
  --navy-700: #24466f;
  --navy-600: #3a5f8f;
  --gold: #dca500;
  --gold-hover: #f0b800;
  --ink: #e8eef6;
  --muted: #9fb2c9;
  --line: rgba(255, 255, 255, .09);
  --card: rgba(255, 255, 255, .04);
  --ok: #4cc38a;
  --err: #ff6b6b;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); line-height: 1.6;
  background: var(--navy-950);
}
a { color: inherit; }
img { max-width: 100%; display: block; }
.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }

/* ---------- topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 26, 46, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand img { height: 44px; border-radius: 6px; }
.nav { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.linklike {
  color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px;
  font-size: .95rem; background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav button.linklike:hover { color: #fff; background: var(--card); }
.nav a.active { color: #fff; }

/* logomarca da home: PNG transparente, centralizada sobre o fundo do hero */
.hero-logo { position: relative; z-index: 1; text-align: center; padding: 0 20px 36px; }
.hero-logo a { display: inline-block; }
.hero-logo img { width: min(460px, 80vw); height: auto; margin-inline: auto; }

/* ---------- cabeçalho do painel: logo SAF grande + logo do cliente ---------- */
.topbar.tall .wrap { height: 104px; }
.brand-lg img { height: 76px; width: auto; border-radius: 0; }
.client-logo { display: inline-flex; align-items: center; margin-left: 14px; padding: 7px 14px; background: #fff; border-radius: 12px; }
.client-logo img { height: 44px; width: auto; max-width: 220px; object-fit: contain; }
.logo-preview { display: inline-block; background: #fff; border-radius: 10px; padding: 8px 14px; margin-bottom: 10px; }
.logo-preview img { height: 48px; width: auto; }
input[type=file] { color: var(--muted); font: .9rem var(--font); }
@media (max-width: 700px) {
  .topbar.tall .wrap { height: auto; flex-wrap: wrap; padding: 10px 0; gap: 8px 16px; }
  .brand-lg img { height: 56px; }
  .client-logo img { height: 34px; }
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px; border: 1px solid transparent;
  font: 600 .95rem var(--font); text-decoration: none; cursor: pointer;
  background: var(--gold); color: var(--navy-900); transition: .2s;
}
.btn:hover { background: var(--gold-hover); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: rgba(255, 255, 255, .25); }
.btn.ghost:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.btn.small { padding: 7px 14px; font-size: .85rem; border-radius: 8px; }
.btn.danger { background: transparent; color: var(--err); border-color: rgba(255, 107, 107, .4); }
.btn.danger:hover { background: rgba(255, 107, 107, .1); }
.btn.block { width: 100%; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; padding: 44px 0 110px;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(220, 165, 0, .16), transparent 60%),
    radial-gradient(800px 500px at 0% 0%, rgba(58, 95, 143, .45), transparent 60%),
    linear-gradient(180deg, var(--navy-800), var(--navy-950));
}
.hero::after { /* grade técnica sutil */
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.eyebrow { color: var(--gold); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.1; margin: 14px 0 20px; letter-spacing: -.02em; }
h1 em { font-style: normal; color: var(--gold); }
.lead { color: var(--muted); font-size: 1.12rem; max-width: 56ch; }
.cta { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }

.hero-login {
  border: 1px solid var(--navy-600); border-radius: 18px; padding: 32px;
  background: rgba(11, 26, 46, .92); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6);
  scroll-margin-top: 90px;
}
.hero-login h2 { margin: 0 0 4px; font-size: 1.4rem; }
.hero-login .hint { margin: 0 0 22px; font-size: .9rem; }
.hero-card {
  border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6);
}
.hero-card header { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .8rem; margin-bottom: 14px; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(76, 195, 138, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(76, 195, 138, 0); } 100% { box-shadow: 0 0 0 0 rgba(76, 195, 138, 0); } }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: rgba(0, 0, 0, .22); border-radius: 10px; padding: 10px 12px; }
.kpi small { color: var(--muted); display: block; font-size: .72rem; }
.kpi b { font-size: 1.15rem; }
.kpi b span { color: var(--muted); font-weight: 400; font-size: .75rem; }
.hero-card svg.chart { width: 100%; height: 120px; }

/* ---------- seções ---------- */
section { padding: 88px 0; }
section.alt { background: var(--navy-900); border-block: 1px solid var(--line); }
.sec-head { max-width: 640px; margin-bottom: 44px; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 10px 0 12px; letter-spacing: -.01em; line-height: 1.2; }
.sec-head p { color: var(--muted); margin: 0; }

.grid { display: grid; gap: 20px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; transition: .25s;
}
.card:hover { border-color: rgba(220, 165, 0, .5); transform: translateY(-3px); background: rgba(255, 255, 255, .06); }
.card h3 { margin: 16px 0 8px; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.ico {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(220, 165, 0, .12); color: var(--gold);
}
.ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; text-align: center; }
.stat b { display: block; font-size: 2.2rem; color: var(--gold); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .9rem; }

.steps { counter-reset: s; }
.step { position: relative; padding-left: 62px; }
.step::before {
  counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: var(--navy-900); background: var(--gold);
}
.step h3 { margin: 0 0 6px; font-size: 1.05rem; }
.step p { margin: 0; color: var(--muted); font-size: .95rem; }

.contact-box {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; align-items: center;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-800));
  border: 1px solid var(--line); border-radius: 20px; padding: 44px;
}
.contact-box h2 { margin-top: 0; }
.contact-box p { color: var(--muted); }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.contact-list a { text-decoration: none; }
.contact-list a:hover { color: var(--gold); }

footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .88rem; }
footer a { text-decoration: none; }
footer a:hover { color: var(--gold); }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- login ---------- */
.center-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(800px 500px at 50% -10%, rgba(58, 95, 143, .5), transparent 60%), var(--navy-800);
}
.login-box {
  width: min(420px, 100%); background: rgba(11, 26, 46, .92); border: 1px solid var(--navy-600);
  border-radius: 16px; padding: 36px; box-shadow: 0 25px 60px rgba(0, 0, 0, .5);
}
.login-box .logo { width: 260px; margin: 0 auto 8px; border-radius: 8px; }
.login-box h1 { font-size: 1.2rem; font-weight: 400; text-align: center; margin: 14px 0 26px; letter-spacing: 0; }
.back { display: block; text-align: center; margin-top: 18px; color: var(--muted); font-size: .88rem; text-decoration: none; }
.back:hover { color: var(--gold); }

/* ---------- formulários ---------- */
.field { margin-bottom: 18px; }
label { display: block; font-size: .86rem; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 9px; border: 1px solid var(--navy-600);
  background: #eaf0fd; color: #0b1a2e; font: 1rem var(--font);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { min-height: 84px; resize: vertical; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 5px; }
.checkrow { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: .95rem; cursor: pointer; margin: 0; }
.checkrow input { width: 18px; height: 18px; accent-color: var(--gold); }

.flash { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; font-size: .92rem; border: 1px solid; }
.flash.error { color: var(--err); background: rgba(255, 107, 107, .08); border-color: rgba(255, 107, 107, .35); }
.flash.ok { color: var(--ok); background: rgba(76, 195, 138, .08); border-color: rgba(76, 195, 138, .35); }

/* ---------- painel do cliente ---------- */
.page { padding: 48px 0 80px; min-height: calc(100vh - 68px - 90px); }
.page h1 { font-size: 1.9rem; margin: 0 0 6px; }
.page .sub { color: var(--muted); margin: 0 0 32px; }
.app-card { text-decoration: none; display: block; }
.app-card .go { margin-top: 18px; color: var(--gold); font-size: .88rem; font-weight: 600; }
.empty { text-align: center; padding: 56px 24px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* ---------- admin ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: #fff; border-color: var(--gold); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; background: rgba(255, 255, 255, .03); }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; }
td.actions form { display: inline; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge.on { color: var(--ok); background: rgba(76, 195, 138, .12); }
.badge.off { color: var(--muted); background: rgba(255, 255, 255, .08); }
.badge.adm { color: var(--gold); background: rgba(220, 165, 0, .14); }

.form-card { max-width: 860px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-card h3 { margin: 12px 0 14px; font-size: 1rem; color: var(--gold); }
.perm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
.perm {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .15); transition: .2s;
}
.perm:hover { border-color: rgba(220, 165, 0, .5); }
.perm input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold); flex: none; }
.perm b { display: block; }
.perm small { color: var(--muted); }
.form-actions { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .hero .wrap, .contact-box { grid-template-columns: 1fr; }
  .hero { padding: 24px 0 70px; }
  .grid.cols-3, .grid.cols-4, .stats { grid-template-columns: 1fr 1fr; }
  .nav .hide-sm { display: none; }
}
@media (max-width: 600px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid, .perm-grid { grid-template-columns: 1fr; }
  section { padding: 60px 0; }
  .contact-box { padding: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
