/* Chronyx Domains — design system na identidade do chronyx.com.br (navy + dourado, Inter + Orbitron) */
@font-face { font-family:"Inter"; font-style:normal; font-weight:100 900; font-display:swap; src:url("fonts/Inter.woff2") format("woff2"); }
@font-face { font-family:"Orbitron"; font-style:normal; font-weight:400 900; font-display:swap; src:url("fonts/Orbitron.woff2") format("woff2"); }

:root {
  /* Paleta real do chronyx.com.br */
  --navy:#0a0e1a; --navy-deep:#050810;
  --gold:#c8a24c; --gold-light:#d9b96a; --gold-dark:#9c7e36; --gold-tint:#c8a24c1a; --gold-glow:#c8a24c2e;
  --bg:#fafaf9; --surface:#ffffff; --surface-2:#f5f4f2;
  --fg:#0a0e1a; --muted:#525766; --faint:#95989f;
  --border:#eaeae7; --border-strong:#d4d2cc;
  --ok:#18a572; --warn:#d89614; --err:#dc2626;
  --primary:#0a0e1a; --primary-fg:#ffffff;
  --accent:#c8a24c; --accent-fg:#0a0e1a;
  --ring:#9c7e36;
  --radius:.9rem; --radius-sm:.6rem;
  --shadow-sm:0 1px 2px rgba(10,14,26,.06);
  --shadow:0 1px 2px rgba(10,14,26,.05), 0 12px 32px rgba(10,14,26,.08);
  color-scheme:light;
  font-family:"Inter","Segoe UI",system-ui,sans-serif; font-size:16px; line-height:1.5;
}

* { box-sizing:border-box; }
html,body { margin:0; min-height:100%; }
body { background:var(--bg); color:var(--fg); -webkit-font-smoothing:antialiased; }
h1,h2,h3,.brand,.stat-value,.tile span,.logo-word { font-family:"Orbitron","Inter",sans-serif; letter-spacing:.01em; }

/* Acessibilidade */
.skip-link { position:fixed; left:8px; top:-48px; z-index:60; background:var(--navy); color:#fff; padding:10px 16px; border-radius:var(--radius-sm); transition:top .15s ease; }
.skip-link:focus { top:8px; }
:focus-visible { outline:2px solid var(--ring); outline-offset:2px; border-radius:4px; }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
[hidden] { display:none !important; }
@media (prefers-reduced-motion: reduce) { * { transition:none !important; animation:none !important; } }

/* ---------- LOGIN ---------- */
.login-wrap { min-height:100vh; display:grid; place-items:center; padding:24px;
  background:radial-gradient(1200px 600px at 70% -10%, #11182b, transparent 60%), linear-gradient(160deg,#050810,#0a0e1a 60%,#0d1322); }
.login-card { width:min(420px,100%); background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:32px 30px; }
.login-card .brand { justify-content:center; margin-bottom:8px; color:var(--fg); }
.login-card h1 { font-size:1.35rem; margin:14px 0 4px; text-align:center; }
.login-sub { text-align:center; color:var(--muted); margin:0 0 22px; font-size:.92rem; }
.otp-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:-4px 0 14px; }
.otp-timer { font-variant-numeric:tabular-nums; font-weight:700; }
.otp-timer.warn { color:var(--err); }
.otp-demo { background:var(--surface-2); border:1px dashed var(--border-strong); border-radius:var(--radius-sm); padding:12px 14px; text-align:center; margin-bottom:14px; }
.otp-demo b { font-family:"Orbitron",monospace; font-size:1.5rem; letter-spacing:.3em; color:var(--gold-dark); }

/* ---------- APP SHELL ---------- */
.app-shell { display:grid; grid-template-columns:268px 1fr; min-height:100vh; }
.sidebar { display:flex; flex-direction:column; gap:4px; padding:22px 14px; background:var(--navy-deep); color:#c4cad6; overflow-y:auto; }
.brand { display:flex; align-items:center; gap:11px; font-size:1.05rem; padding:4px 8px 16px; color:#fff; }
.brand .logo-mark { width:36px; height:36px; flex:none; }
.brand .logo-word b { color:#fff; font-weight:700; } .brand .logo-word span { color:var(--gold); }
.nav { display:flex; flex-direction:column; gap:2px; }
.nav-group { margin:16px 8px 4px; font-size:.7rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:#626a7d; }
.nav-item { display:flex; align-items:center; gap:10px; width:100%; text-align:left; border:0; background:transparent; color:#c4cad6; padding:10px 12px; border-radius:var(--radius-sm); cursor:pointer; font-size:.93rem; font-family:inherit; transition:background .15s ease,color .15s ease; }
.nav-item:hover { background:#11182b; color:#fff; }
.nav-item[aria-current="true"] { background:var(--gold-tint); color:#fff; box-shadow:inset 3px 0 0 var(--gold); }
.nav-item .ic { width:18px; height:18px; flex:none; opacity:.85; }
.ic svg, .logo-mark { display:block; width:100%; height:100%; }
.brand .logo-mark { width:36px; height:36px; }
.sidebar-foot { margin-top:auto; padding:14px 8px 4px; color:#5b6478; font-size:.76rem; }

.content { display:flex; flex-direction:column; min-width:0; background:var(--bg); }
.topbar { display:flex; align-items:center; gap:14px; padding:16px 28px; background:var(--surface); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:10; }
.topbar-title { flex:1; min-width:0; }
.topbar h1 { margin:0; font-size:1.4rem; outline:none; }
.topbar-sub { margin:2px 0 0; color:var(--muted); font-size:.88rem; }
.topbar-right { display:flex; align-items:center; gap:12px; }
.avatar { display:grid; place-items:center; width:38px; height:38px; border-radius:50%; background:var(--navy); color:var(--gold); font-weight:700; font-size:.8rem; font-family:"Orbitron",sans-serif; }
.menu-toggle { display:none; font-size:1.2rem; }
main { padding:28px; }

/* Cabeçalho de seção */
.page-head { display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:14px; margin-bottom:22px; }
.page-actions { display:flex; gap:10px; flex-wrap:wrap; }

/* Grid */
.grid { display:grid; gap:18px; }
.grid-2 { grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); }
.grid-3 { grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); }
.grid-4 { grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); }

/* Card */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm); padding:20px; }
.card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:14px; }
.card-title { margin:0; font-size:1rem; }
.card-desc { margin:2px 0 0; color:var(--muted); font-size:.86rem; }
.stat-label { color:var(--muted); font-size:.85rem; }
.stat-value { font-size:1.8rem; font-weight:700; margin:8px 0 2px; }
.stat-foot { color:var(--faint); font-size:.8rem; }
.progress { height:8px; border-radius:99px; background:var(--surface-2); overflow:hidden; margin-top:12px; }
.progress > span { display:block; height:100%; background:linear-gradient(90deg,var(--gold),var(--gold-dark)); }

/* Grade de ferramentas (estilo cPanel) */
.tool-group { margin-top:26px; }
.tool-group h2 { font-size:.82rem; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); margin:0 0 12px; }
.tool-grid { display:grid; gap:12px; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); }
.tile { display:flex; flex-direction:column; align-items:center; gap:10px; text-align:center; padding:18px 12px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); cursor:pointer; font-family:inherit; color:var(--fg); transition:transform .12s ease,border-color .15s ease,box-shadow .15s ease; }
.tile:hover { transform:translateY(-2px); border-color:var(--gold); box-shadow:var(--shadow); }
.tile .ic { width:26px; height:26px; color:var(--gold-dark); }
.tile span { font-size:.85rem; font-weight:600; }

/* Botões */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; border:1px solid transparent; border-radius:999px; padding:10px 18px; font-size:.92rem; font-weight:600; font-family:inherit; cursor:pointer; transition:background .15s ease,border-color .15s ease,filter .15s ease; white-space:nowrap; }
.btn:disabled { opacity:.55; cursor:not-allowed; }
.btn-block { width:100%; }
.btn-primary { background:var(--primary); color:var(--primary-fg); }
.btn-primary:hover:not(:disabled) { background:#171c2b; }
.btn-accent { background:var(--accent); color:var(--accent-fg); }
.btn-accent:hover:not(:disabled) { background:var(--gold-light); }
.btn-secondary { background:var(--surface); color:var(--fg); border-color:var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background:var(--surface-2); }
.btn-ghost { background:transparent; color:var(--fg); }
.btn-ghost:hover:not(:disabled) { background:var(--surface-2); }
.btn-danger { background:var(--err); color:#fff; }
.btn-danger:hover:not(:disabled) { filter:brightness(.94); }
.btn-sm { padding:6px 14px; font-size:.84rem; }

/* Badges */
.badge { display:inline-flex; align-items:center; gap:6px; padding:4px 11px; border-radius:99px; font-size:.78rem; font-weight:600; background:var(--surface-2); color:var(--muted); border:1px solid var(--border); }
.badge-ok { background:rgba(24,165,114,.12); color:#0f7a55; border-color:transparent; }
.badge-warn { background:rgba(216,150,20,.14); color:#9a6a0f; border-color:transparent; }
.badge-danger { background:rgba(220,38,38,.12); color:#b91c1c; border-color:transparent; }
.badge-gold { background:var(--gold-tint); color:var(--gold-dark); border-color:transparent; }

/* Tabela */
.table-wrap { overflow-x:auto; border:1px solid var(--border); border-radius:var(--radius); }
table { width:100%; border-collapse:collapse; font-size:.92rem; background:var(--surface); }
caption { text-align:left; padding:14px 16px; font-weight:700; }
th,td { text-align:left; padding:13px 16px; border-bottom:1px solid var(--border); }
th { color:var(--muted); font-size:.76rem; text-transform:uppercase; letter-spacing:.04em; background:var(--surface-2); }
tbody tr:last-child td { border-bottom:0; }
tbody tr:hover { background:var(--surface-2); }
.row-actions { display:flex; gap:8px; flex-wrap:wrap; }

/* Formulários */
.field { display:grid; gap:6px; margin-bottom:16px; }
.field label { font-weight:600; font-size:.9rem; }
.field .hint { color:var(--muted); font-size:.8rem; }
.field .error { color:var(--err); font-size:.82rem; min-height:1em; }
input,select,textarea { width:100%; font:inherit; color:var(--fg); padding:11px 13px; border:1px solid var(--border-strong); border-radius:var(--radius-sm); background:var(--surface); }
input:focus,select:focus,textarea:focus { outline:2px solid var(--ring); outline-offset:1px; border-color:var(--ring); }
.input-group { display:flex; gap:8px; } .input-group input { flex:1; }
.code-input { letter-spacing:.4em; text-align:center; font-size:1.3rem; font-family:"Orbitron",monospace; }

/* Switch */
.switch { display:inline-flex; align-items:center; gap:10px; cursor:pointer; }
.switch input { position:absolute; opacity:0; width:1px; height:1px; }
.switch .track { width:42px; height:24px; border-radius:99px; background:var(--border-strong); position:relative; transition:background .15s ease; flex:none; }
.switch .track::after { content:""; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:var(--shadow-sm); transition:left .15s ease; }
.switch input:checked + .track { background:var(--gold); }
.switch input:checked + .track::after { left:21px; }
.switch input:focus-visible + .track { outline:2px solid var(--ring); outline-offset:2px; }

/* Diálogo */
.overlay { position:fixed; inset:0; background:rgba(5,8,16,.5); display:grid; place-items:center; padding:20px; z-index:40; }
.dialog { background:var(--surface); border-radius:var(--radius); box-shadow:var(--shadow); width:min(560px,100%); max-height:90vh; overflow:auto; }
.dialog-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:20px 22px 0; }
.dialog-head h3 { margin:0; font-size:1.1rem; }
.dialog-body { padding:18px 22px; }
.dialog-foot { display:flex; justify-content:flex-end; gap:10px; padding:0 22px 22px; }

/* Diversos */
.empty { text-align:center; color:var(--muted); padding:40px 20px; border:1px dashed var(--border-strong); border-radius:var(--radius); }
.code { background:var(--navy-deep); color:#d6e4ff; border-radius:var(--radius-sm); padding:14px 16px; font-family:ui-monospace,Menlo,monospace; font-size:.85rem; white-space:pre-wrap; word-break:break-word; }
.note { background:var(--surface-2); border:1px solid var(--border); border-left:3px solid var(--gold); border-radius:var(--radius-sm); padding:12px 14px; color:var(--muted); font-size:.88rem; }
.list { list-style:none; margin:0; padding:0; display:grid; gap:10px; }
.list li { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 15px; border:1px solid var(--border); border-radius:var(--radius-sm); }
.muted { color:var(--muted); } .mono { font-family:ui-monospace,monospace; font-size:.9em; }

/* Toast */
.toast { position:fixed; right:24px; bottom:24px; min-width:260px; max-width:360px; background:var(--surface); border:1px solid var(--border); border-left:4px solid var(--gold); border-radius:var(--radius-sm); box-shadow:var(--shadow); padding:14px 16px; opacity:0; transform:translateY(12px); transition:opacity .2s ease,transform .2s ease; pointer-events:none; z-index:60; }
.toast.show { opacity:1; transform:translateY(0); }
.toast.ok { border-left-color:var(--ok); } .toast.error { border-left-color:var(--err); }

/* Responsivo */
@media (max-width:960px) {
  .app-shell { grid-template-columns:1fr; }
  .sidebar { position:fixed; inset:0 auto 0 0; width:268px; z-index:30; transform:translateX(-100%); transition:transform .2s ease; box-shadow:var(--shadow); }
  .sidebar.open { transform:translateX(0); }
  .menu-toggle { display:inline-flex; }
}
