/* Painel da plataforma — CSS próprio, sem dependências e sem inline (CSP).
   Paleta: slate (neutros) + indigo (principal); emerald/amber/rose/sky para situações. */

:root {
    --bg: #f8fafc;            /* slate-50 */
    --surface: #ffffff;
    --border: #e2e8f0;        /* slate-200 */
    --text: #0f172a;          /* slate-900 */
    --muted: #64748b;         /* slate-500 */
    --primary: #4f46e5;       /* indigo-600 */
    --primary-hover: #4338ca; /* indigo-700 */
    --primary-text: #ffffff;
    --focus: #818cf8;         /* indigo-400 */
    --ok-bg: #d1fae5; --ok-fg: #065f46;      /* emerald */
    --warn-bg: #fef3c7; --warn-fg: #92400e;  /* amber */
    --bad-bg: #ffe4e6; --bad-fg: #9f1239;    /* rose */
    --info-bg: #e0f2fe; --info-fg: #075985;  /* sky */
    --radius: 12px;
    --shadow: 0 1px 2px rgb(15 23 42 / .05), 0 4px 16px rgb(15 23 42 / .06);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1120;
        --surface: #111827;
        --border: #1f2937;
        --text: #e2e8f0;
        --muted: #94a3b8;
        --primary: #6366f1;
        --primary-hover: #818cf8;
        --focus: #a5b4fc;
        --ok-bg: #064e3b; --ok-fg: #a7f3d0;
        --warn-bg: #78350f; --warn-fg: #fde68a;
        --bad-bg: #881337; --bad-fg: #fecdd3;
        --info-bg: #0c4a6e; --info-fg: #bae6fd;
        --shadow: 0 1px 2px rgb(0 0 0 / .4);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Topo */
.topbar {
    display: flex; align-items: center; gap: 24px;
    padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-lg { font-size: 20px; margin-bottom: 24px; }
.brand-mark {
    display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-weight: 800;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.nav a.is-active { background: var(--bg); color: var(--text); }
.logout { display: flex; align-items: center; gap: 10px; margin: 0; }

.container { max-width: 1100px; margin: 0 auto; padding: 28px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.h2 { font-size: 17px; margin: 0 0 16px; }
.h3 { font-size: 14px; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.back { color: var(--muted); font-size: 14px; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.card.empty { text-align: center; color: var(--muted); padding: 40px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card { margin-top: 20px; }

/* Tabelas */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .15s ease; }
.table tbody tr:hover { background: var(--bg); }
.table-dense th, .table-dense td { padding: 8px 12px; }
.row-link { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.swatch { flex: none; vertical-align: middle; }

/* Situações */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-active { background: var(--ok-bg); color: var(--ok-fg); }
.badge-provisioning { background: var(--info-bg); color: var(--info-fg); }
.badge-suspended { background: var(--warn-bg); color: var(--warn-fg); }
.badge-failed { background: var(--bad-bg); color: var(--bad-fg); }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: var(--ok-bg); color: var(--ok-fg); }
.alert-error { background: var(--bad-bg); color: var(--bad-fg); }
.alert-info { background: var(--info-bg); color: var(--info-fg); }
.alert .inline { margin-left: 8px; }

/* Formulários */
.form { display: grid; gap: 16px; margin: 0; }
.form-narrow { max-width: 560px; }
.form-inline { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.form-inline .grow { flex: 1; min-width: 240px; }
.inline { display: inline; margin: 0; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.field input[type=text], .field input[type=email], .field input[type=password], .field select, .field input[type=file] {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text); font: inherit; font-weight: 400;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(99 102 241 / .25); }
.field input[aria-invalid=true] { border-color: var(--bad-fg); }
.field input[type=color] { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.suffix { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-left: 0; border-radius: 0 10px 10px 0; color: var(--muted); background: var(--bg); white-space: nowrap; }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; }
.field-error { color: var(--bad-fg); margin: 0; font-size: 13px; font-weight: 500; }
.actions { display: flex; gap: 10px; justify-content: flex-end; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }

.logo-box {
    display: grid; place-items: center; height: 120px; margin-bottom: 16px;
    border: 1px dashed var(--border); border-radius: 10px; background: var(--bg);
}
.logo-box img { max-height: 96px; max-width: 90%; }
.list { margin: 0 0 16px; padding-left: 18px; }

/* Login */
.guest { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.guest-box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 32px; }

@media (max-width: 760px) {
    .topbar { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
    .container { padding: 20px 16px 48px; }
    .grid-2 { grid-template-columns: 1fr; }
    .logout .muted { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
