/* MAESTRO — base visual (paleta navy/ciano do layout aprovado). */
:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --background: #0b1120; --surface: #0f172a; --panel: #162235; --primary: #2563eb; --cyan: #06b6d4; --highlight: #22d3ee;
  --text: #eaf2ff; --muted: #94a3b8; --success: #22c55e; --danger: #f87171; --warning: #fbbf24; --line: #33465e;
  background: var(--background); color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; background: radial-gradient(ellipse at 46% 3%, #15233c 0%, var(--background) 65%); min-height: 100vh; }
a, button, select, textarea, input { font: inherit; }
a { color: var(--highlight); }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--highlight); outline-offset: 3px; }
.visually-hidden, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.topbar { min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 8px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(110deg, #15243d 0%, #111b2e 29%, #0d1526 100%); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--cyan), var(--primary)); color: #04121c; font-weight: 800; }
.brand { display: grid; gap: 1px; min-width: 0; }
.brand strong { font-size: 1.0625rem; line-height: 1.2; }
.brand span { color: var(--muted); font-size: .75rem; }
.topbar-context { color: var(--muted); font-size: .8125rem; padding-left: 12px; border-left: 1px solid var(--line); }
.topnav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.topnav a[aria-current="page"] { border-color: var(--highlight); color: var(--highlight); }

.button { min-height: 40px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 7px; background: linear-gradient(#1b2b41, #142238);
  color: var(--text); font-size: .8125rem; font-weight: 620; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.button:not(:disabled):hover { background: #1e3850; border-color: #4d7799; }
.button:disabled { background: #152033; color: var(--muted); }
.button-primary:not(:disabled) { border-color: var(--highlight); background: linear-gradient(var(--highlight), var(--cyan)); color: #071824; }
.button-primary:not(:disabled):hover { border-color: #67e8f9; background: #67e8f9; }
.button-danger { color: #fecaca; border-color: #7f1d1d; }
.icon-button { min-width: 40px; padding: 0 10px; }
.small { min-height: 30px; padding: 3px 9px; font-size: .75rem; }

.field { display: grid; gap: 5px; margin-top: 12px; }
.field label, .label { color: var(--muted); font-size: .75rem; font-weight: 650; }
.input, .field input, .field select { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: #0d1729; color: var(--text); }
.field input:focus, .field select:focus { border-color: var(--highlight); outline: none; }
.hint { color: var(--muted); font-size: .75rem; margin: 4px 0 0; }
.message { min-height: 1.3em; margin: 12px 0 0; font-size: .8125rem; }
.message.error, .auth-message { color: #fca5a5; }
.message.ok { color: #86efac; }

.card { border: 1px solid var(--line); border-radius: 12px; background: rgb(15 23 42 / .85); padding: 22px; }
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { margin: 14px 0 4px; font-size: 1.25rem; }
.auth-card .brand-line { display: flex; align-items: center; gap: 10px; }
.auth-card form .button { width: 100%; margin-top: 16px; }
.link-button { background: none; border: 0; padding: 0; color: var(--highlight); text-decoration: underline; font-size: .8125rem; }

.page { max-width: 1180px; margin: 0 auto; padding: 22px; }
.page h1 { font-size: 1.25rem; margin: 0 0 4px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
th, td { padding: 9px 8px; border-bottom: 1px solid rgb(51 70 94 / .6); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 650; font-size: .6875rem; text-transform: uppercase; letter-spacing: .04em; }
td .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 2px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: .6875rem; }
.chip.ok { border-color: rgb(34 197 94 / .4); color: #86efac; }
.chip.warn { border-color: rgb(251 191 36 / .4); color: #fcd34d; }
.chip.off { border-color: rgb(248 113 113 / .4); color: #fca5a5; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; font-size: .8125rem; color: var(--text); }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } .topbar .topbar-context { display: none; } }
#audit-card { margin-top: 18px; }
#email-card { margin-top: 18px; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; min-height: 0; }
  .brand span { display: none; }
  .topnav { width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; gap: 6px; }
  .topnav .button { min-height: 34px; padding: 4px 10px; white-space: nowrap; }
}
.field input[type="checkbox"], .checks input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--cyan); }
fieldset.field { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 12px; }
td select.input { min-width: 140px; width: auto; min-height: 32px; padding: 4px 8px; font-size: .8125rem; }
.page > .hint { margin-bottom: 16px; }
.card h2 { margin: 0 0 6px; font-size: 1rem; }
.page { max-width: 1480px; }
@media (min-width: 861px) { .grid-2 { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); } }
td .actions .button { white-space: nowrap; }
