<?php
// Layout HTML compartilhado — inclua no topo de cada página admin
// Defina $page_title antes de incluir este arquivo

header('X-Frame-Options: DENY');
header('X-Content-Type-Options: nosniff');
header('Referrer-Policy: strict-origin');
header("Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'none'; frame-ancestors 'none'");
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title><?= h($page_title ?? 'Admin') ?> — MonitorPing Licenças</title>
<style>
* { box-sizing:border-box; margin:0; padding:0; }
body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; background:#0f172a; color:#e2e8f0; min-height:100vh; }
a { color:#38bdf8; text-decoration:none; }
a:hover { text-decoration:underline; }

/* Topbar */
.topbar { background:#1e293b; border-bottom:1px solid #334155; padding:.75rem 1.5rem; display:flex; align-items:center; justify-content:space-between; }
.topbar .logo { font-weight:700; color:#38bdf8; font-size:1.1rem; }
.topbar nav a { color:#94a3b8; margin-left:1.2rem; font-size:.9rem; }
.topbar nav a:hover, .topbar nav a.active { color:#e2e8f0; }
.topbar .user { font-size:.85rem; color:#64748b; }

/* Container */
.wrap { max-width:1100px; margin:0 auto; padding:1.5rem; }
h1 { font-size:1.4rem; margin-bottom:1.25rem; }
h2 { font-size:1.1rem; margin-bottom:1rem; }

/* Cards */
.card { background:#1e293b; border-radius:8px; padding:1.25rem 1.5rem; margin-bottom:1.5rem; border:1px solid #1e293b; }

/* Botões */
.btn { display:inline-block; padding:.4rem .85rem; border-radius:4px; border:none; cursor:pointer; font-size:.85rem; font-family:inherit; }
.btn-blue  { background:#0ea5e9; color:#fff; }
.btn-green { background:#22c55e; color:#fff; }
.btn-red   { background:#ef4444; color:#fff; }
.btn-gray  { background:#475569; color:#fff; }
.btn-sm    { padding:.25rem .6rem; font-size:.78rem; }

/* Formulários */
label { display:block; font-size:.82rem; color:#94a3b8; margin-bottom:.3rem; margin-top:.8rem; }
label:first-child { margin-top:0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=tel], select, textarea {
  width:100%; padding:.5rem .7rem; border:1px solid #334155; border-radius:4px;
  background:#0f172a; color:#e2e8f0; font-size:.9rem; font-family:inherit; }
textarea { resize:vertical; }
.form-row { display:flex; gap:1rem; flex-wrap:wrap; }
.form-row > div { flex:1; min-width:180px; }
.form-actions { margin-top:1.2rem; display:flex; gap:.5rem; }

/* Tabela */
table { width:100%; border-collapse:collapse; font-size:.85rem; }
th { background:#0f172a; padding:.55rem .75rem; text-align:left; color:#94a3b8; font-weight:600; white-space:nowrap; }
td { padding:.55rem .75rem; border-bottom:1px solid #1e293b; vertical-align:middle; }
tr:hover td { background:#1a2540; }

/* Badges */
.badge { padding:.2rem .55rem; border-radius:10px; font-size:.75rem; font-weight:700; white-space:nowrap; }
.badge-ok      { background:#166534; color:#bbf7d0; }
.badge-grace   { background:#92400e; color:#fde68a; }
.badge-expired { background:#7f1d1d; color:#fecaca; }
.badge-revoked { background:#374151; color:#9ca3af; }

/* Alertas */
.alert { padding:.65rem 1rem; border-radius:5px; margin-bottom:1rem; font-size:.9rem; }
.alert-ok  { background:#166534; color:#bbf7d0; }
.alert-err { background:#7f1d1d; color:#fecaca; }

/* Key monospace */
.key { font-family:monospace; font-size:.9rem; background:#0f172a; padding:.15rem .4rem; border-radius:3px; color:#fbbf24; }

/* Empty state */
.empty { text-align:center; padding:2rem; color:#475569; }
</style>
</head>
<body>
<div class="topbar">
  <span class="logo">MonitorPing Licenças</span>
  <nav>
    <a href="index.php" <?= (($current_nav??'')===''||($current_nav??'')==='customers')?'class="active"':'' ?>>Clientes</a>
    <a href="admins.php" <?= (($current_nav??'')==='admins')?'class="active"':'' ?>>Admins</a>
  </nav>
  <span class="user"><?= h($admin_name) ?> &nbsp;|&nbsp; <a href="logout.php" style="color:#64748b">Sair</a></span>
</div>
<div class="wrap">
