/* BRGuard brand identity (docs: website/visual_identity/docs/IDENTIDADE-VISUAL.md).
   Greens are the brand palette (Verde Guardião / Profundo / Fósforo); the
   severity ramp is the canonical vocabulary shared with the PDF reports, so a
   badge here is the same colour as in the deliverable the client receives. */
:root {
    --bg: #0A1410; --bg2: #0F1F17; --bg3: #1B2E22;
    --text: #EAF3EE; --text2: #8FA79A; --accent: #149E4E;
    --accent-bright: #4DF08A;
    --critical: #E5484D; --high: #EF7A34; --medium: #E5B23C;
    --low: #34B368; --info: #5B93C9; --success: #34B368; --danger: #E5484D;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }

.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 240px; background: var(--bg2); border-right: 1px solid var(--bg3); padding: 20px 0; z-index: 10; display: flex; flex-direction: column; overflow-y: auto; }
.main { margin-left: 240px; padding: 24px; min-height: 100vh; }
.logo { padding: 0 20px 20px; font-size: 20px; font-weight: 800; color: var(--accent); border-bottom: 1px solid var(--bg3); margin-bottom: 12px; }
/* Sidebar wordmark: shield + "BR" in bone, "Guard" in phosphor — the same
   lock-up as the login screen and the site nav. */
.logo.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.logo.brand b { color: var(--accent-bright); font-weight: 800; }
.nav-item { padding: 10px 20px; cursor: pointer; color: var(--text2); transition: all 0.2s; display: flex; align-items: center; gap: 10px; }
.nav-item:hover, .nav-item.active { background: var(--bg3); color: var(--text); }
/* Same construction as the shield: stroked, never filled, rounded joins. Colour
   comes from the nav item, so an icon dims and lifts with its label; the active
   one takes Verde Fósforo, the accent the logo's own nodes use. */
.nav-icon {
    width: 17px; height: 17px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}
.nav-item.active .nav-icon { stroke: var(--accent-bright); }
.nav-spacer { flex: 1; }
/* Pushed down by the flex column, not pinned with position:absolute — an absolute
   footer sits on top of the nav once the items no longer fit (short window, or the
   operator group revealed), which put "Sign out" over the last menu entry. */
.nav-bottom { margin-top: auto; padding-top: 12px; }

/* Operator-only nav group (revealed by app.js once an operator route answers). */
.nav-section { margin-top: 14px; border-top: 1px solid var(--bg3); padding-top: 10px; }
.nav-label { padding: 4px 20px 6px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text2); opacity: .7; }
.rpt-group { display: inline-flex; gap: 6px; }

/* Category picker: a fixed set from the API, not free text. */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 14px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); cursor: pointer; }
.check input { width: auto; margin: 0; accent-color: var(--accent); }
.pill { margin-left: auto; margin-right: 4px; min-width: 18px; text-align: center; padding: 1px 6px; border-radius: 9px; font-size: 11px; font-weight: 700; background: var(--accent); color: #fff; }

.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.header h1 { font-size: 24px; font-weight: 700; }
.btn { background: var(--accent); color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: var(--bg3); }
.btn-danger { background: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border-radius: 10px; padding: 20px; border: 1px solid var(--bg3); }
.stat-value { font-size: 32px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--text2); text-transform: uppercase; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--bg2); border-radius: 10px; overflow: hidden; }
th { background: var(--bg3); padding: 12px 16px; text-align: left; font-size: 12px; text-transform: uppercase; color: var(--text2); font-weight: 600; }
td { padding: 12px 16px; border-bottom: 1px solid var(--bg3); font-size: 13px; }
tr:hover td { background: rgba(20, 158, 78, 0.06); }
.clickable { cursor: pointer; }

.badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-critical { background: rgba(229,72,77,0.18); color: var(--critical); }
.badge-high { background: rgba(239,122,52,0.18); color: var(--high); }
.badge-medium { background: rgba(229,178,60,0.18); color: var(--medium); }
.badge-low { background: rgba(52,179,104,0.18); color: var(--low); }
.badge-info { background: rgba(91,147,201,0.18); color: var(--info); }
.badge-completed, .badge-active, .badge-approved, .badge-accepted { background: rgba(52,179,104,0.18); color: var(--success); }
.badge-running, .badge-pending, .badge-cancelling, .badge-draft { background: rgba(77,240,138,0.16); color: var(--accent-bright); }
.badge-failed, .badge-cancelled, .badge-rejected { background: rgba(229,72,77,0.18); color: var(--critical); }

.panel { background: var(--bg2); border-radius: 10px; padding: 20px; border: 1px solid var(--bg3); margin-bottom: 16px; }
.panel h2 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }

input, select, textarea { background: var(--bg3); border: 1px solid rgba(255,255,255,0.1); color: var(--text); padding: 8px 12px; border-radius: 6px; font-size: 13px; width: 100%; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); }
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-group label { font-size: 12px; color: var(--text2); }

.progress { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress-bar { height: 100%; background: var(--accent); transition: width 0.4s; }

.loading { text-align: center; padding: 40px; color: var(--text2); }
.muted { color: var(--text2); font-size: 12px; }
.hidden { display: none !important; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--bg3); border: 1px solid var(--accent); padding: 12px 18px; border-radius: 8px; z-index: 100; max-width: 360px; }
.toast.err { border-color: var(--danger); }

/* Login — keeps its own scoped tokens so the sign-in screen can carry a
   deeper, more graphic treatment than the app shell behind it. */
#login {
    --brg-void: #0A1410; --brg-surface: #0F1F17; --brg-border: #1B2E22;
    --brg-green: #149E4E; --brg-green-light: #4DF08A; --brg-text: #EAF3EE;
    --brg-text2: #8FA79A; --brg-danger: #E5484D;
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background:
        radial-gradient(ellipse 900px 520px at 50% -10%, rgba(77,240,138,.10), transparent 60%),
        var(--brg-void);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#login .login-card {
    background: var(--brg-surface); border: 1px solid var(--brg-border);
    border-radius: 14px; padding: 36px; width: 380px;
}
#login .brg-shield { display: block; margin: 0 auto 18px; }
#login .logo {
    border: none; text-align: center; font-size: 22px; font-weight: 800;
    letter-spacing: -.01em; color: var(--brg-text); margin-bottom: 4px;
}
#login .logo b { color: var(--brg-green-light); font-weight: 800; }
#login .muted { color: var(--brg-text2); }
#login .form-group label { color: var(--brg-text2); font-size: 12.5px; font-weight: 600; }
#login input {
    background: var(--brg-void); border: 1px solid var(--brg-border); color: var(--brg-text);
}
#login input:focus { outline: 2px solid var(--brg-green); border-color: var(--brg-green); }
#login .btn {
    background: var(--brg-green); color: #04140B; font-weight: 700;
    transition: background .15s;
}
#login .btn:hover { background: #12833F; }
#login #loginErr { color: var(--brg-danger) !important; }

/* Entry report: compliance gaps + locked checks */
.small { font-size: 11px; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.f-strong { color: var(--text); font-weight: 600; }
.warn { color: var(--medium); }
/* Domain + CNPJ entry: one field beside its button, not a stacked form. */
.row-form { display: flex; gap: 10px; align-items: center; margin: 14px 0 18px; }
.row-form input { flex: 1; max-width: 340px; margin: 0; }
.row-form .btn { flex: none; }
/* The responsibility term is long legal prose — scroll it rather than letting it
   push the acceptance controls off-screen. */
.term-text {
    white-space: pre-wrap; max-height: 260px; overflow-y: auto;
    background: var(--bg); border: 1px solid var(--bg3); border-radius: 6px;
    padding: 14px; font-size: 12px; line-height: 1.65; color: var(--text2);
}
.badge-current { background: rgba(52,179,104,0.18); color: var(--success); }
/* Value + its copy control travel together; the icon keeps its size while the
   value wraps, so a long TXT record never squeezes the control out of reach. */
/* Category picker: the first and largest decision on the New Scan form, so it
   gets real estate and reads as a choice rather than a dropdown entry. */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cat-card {
    text-align: left; background: var(--bg2); border: 1px solid var(--bg3);
    border-radius: 8px; padding: 12px 14px; cursor: pointer; color: var(--text2);
    font: inherit; transition: border-color .15s, background .15s;
}
.cat-card:hover { border-color: var(--accent); background: var(--bg3); }
.cat-card.sel { border-color: var(--accent-bright); background: var(--bg3); }
.cat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.cat-label { color: var(--text); font-weight: 600; font-size: 13.5px; }
.cat-card.sel .cat-label { color: var(--accent-bright); }
.cat-flag {
    font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
    color: var(--medium); background: rgba(229,178,60,.14); padding: 1px 5px; border-radius: 3px;
}
/* Not on sale yet: visibly present so the client sees what is coming, but not
   pickable, and it must not light up on hover like the ones that work. */
.cat-card.locked { opacity: .55; cursor: not-allowed; }
.cat-card.locked:hover { border-color: var(--bg3); background: var(--bg2); }
.cat-desc { font-size: 12px; line-height: 1.5; margin-bottom: 6px; }
.cat-meta { font-size: 11px; color: var(--text2); opacity: .8; }
.cat-free { font-size: 11px; color: var(--accent-bright); margin-top: 5px; font-weight: 600; }
/* Free vs paid is the decision here, so the two read as cards side by side
   rather than radio labels — the tag carries what actually differs. */
.tier-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.tier-card {
    text-align: left; background: var(--bg2); border: 1px solid var(--bg3);
    border-radius: 8px; padding: 11px 13px; cursor: pointer; color: var(--text2);
    font: inherit; transition: border-color .15s, background .15s;
}
.tier-card:hover { border-color: var(--accent); }
.tier-card.sel { border-color: var(--accent-bright); background: var(--bg3); }
.tier-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.tier-label { color: var(--text); font-weight: 600; font-size: 13px; }
.tier-card.sel .tier-label { color: var(--accent-bright); }
.tier-tag {
    font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em;
    font-weight: 700; padding: 1px 5px; border-radius: 3px;
}
.tier-tag.free { color: var(--success); background: rgba(52,179,104,.16); }
.tier-tag.paid { color: var(--medium); background: rgba(229,178,60,.14); }
.tier-desc { font-size: 11.5px; line-height: 1.5; }
.cat-chosen {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    background: var(--bg3); border: 1px solid var(--accent); border-radius: 8px;
    padding: 11px 14px;
}
.cat-chosen .cat-label { color: var(--accent-bright); margin-right: 10px; }
.cat-chosen .cat-meta { display: inline; }
.step-hint { margin-top: 16px; }
/* The consequence of pressing the button, stated next to the field that decides
   it — so a client is not told "requires authorization" and left to guess how. */
.exec-note { margin-top: 6px; line-height: 1.55; }
.exec-note:empty { display: none; }
/* Which action clears the request. Distinct from the status badge: status is
   where it stands, this is what to do about it. */
.need { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
        padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.need-runner { background: rgba(229,178,60,.16); color: var(--medium); }
.need-authz { background: rgba(91,147,201,.16); color: var(--info); }
.ok-text { color: var(--success); }
.copy-cell { display: inline-flex; align-items: flex-start; gap: 7px; }
.icon-btn {
    flex: none; background: none; border: none; padding: 1px; cursor: pointer;
    color: var(--accent); display: inline-flex; align-items: center;
    border-radius: 4px; line-height: 0;
}
.icon-btn:hover { color: var(--accent-bright); background: var(--bg3); }
ul.tight { margin: 4px 0 0 0; padding-left: 18px; }
ul.tight li { margin: 3px 0; font-size: 13px; }
ul.tight.cols { columns: 2; column-gap: 24px; list-style: none; padding-left: 0; }
.panel.locked { border: 1px solid var(--accent); }
.panel.locked h2 { color: var(--accent); }
.panel.locked .btn { margin-top: 12px; }

/* ── Scoping interview ─────────────────────────────────────────────────────
   The assistant's replies are client-influenced text. They are inserted with
   escaping and styled as plain text — no markdown, no HTML rendering — so the
   worst a crafted reply can do is read oddly. */
.chat { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }
.chat-turn { max-width: 78%; }
.chat-you { align-self: flex-end; text-align: right; }
.chat-who { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.chat-text { background: var(--bg3); border-radius: 10px; padding: 10px 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
/* The client's own turn carries Verde Guardião, the same accent the primary
   button and the logo's "Guard" use — so the eye reads "this side is you"
   from the brand colour rather than a second blue introduced here. */
.chat-you .chat-text { background: rgba(20,158,78,0.16); border: 1px solid rgba(20,158,78,0.42); }
.chat-input { display: flex; gap: 10px; align-items: flex-end; margin-top: 16px; }
.chat-input textarea { flex: 1; resize: vertical; }
.chip { display: inline-block; background: var(--bg3); border-radius: 5px; padding: 3px 9px; margin: 3px 5px 3px 0; font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
/* Proven vs. unproven ownership: Verde Fósforo is the brand's "live signal"
   tone, and the severity ramp's medium carries the "needs attention" one. */
.chip-ok { background: rgba(77,240,138,0.15); color: var(--accent-bright); }
.chip-warn { background: rgba(229,178,60,0.16); color: var(--medium); }

/* MFA enrolment: QR beside the key, both always visible — an authenticator that
   cannot use the camera still accepts a typed key. */
.enrol { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-top: 14px; }
.enrol .qr { flex: none; border: 1px solid var(--bg3); border-radius: 8px; background: #FFFFFF; padding: 4px; }
.enrol-body { flex: 1; min-width: 260px; }
.enrol-body input[readonly] { background: var(--bg); }
.badge-mfa-on { background: rgba(52,179,104,0.18); color: var(--success); }
.badge-mfa-off { background: rgba(229,178,60,0.18); color: var(--medium); }

/* Interview draft: the infrastructure summary reads as a fact sheet, not prose —
   an operator scans it, so label and value line up in columns. */
.env { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; margin: 4px 0 8px; }
.env-row { display: contents; }
.env-row span { color: var(--text2); }
.env-row b { font-weight: 600; }
