:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --text: #111827;
    --muted: #64748b;
    --bg: #f4f7fb;
    --card: #ffffff;
    --border: #e5e7eb;
    --radius: 8px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: #111827; color: #fff; padding: 24px; }
.brand { font-weight: 800; font-size: 1.1rem; margin-bottom: 28px; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav a { color: #cbd5e1; padding: 10px 12px; border-radius: var(--radius); }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.content { padding: 28px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 24px; }
.topbar h1 { margin: 0; font-size: 1.7rem; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: 0 18px 40px -28px rgba(15,23,42,.45); }
.auth { max-width: 460px; margin: 48px auto; padding: 0 16px; }
.auth .brand { color: var(--text); text-align: center; margin-bottom: 18px; }
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 12px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
.form-row { margin-bottom: 14px; }
.check-label { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.check-label input { width: auto; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
    background: #fff;
    min-height: 40px;
    line-height: 1.15;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 12px 22px -16px rgba(37,99,235,.8); transform: translateY(-1px); }
.btn-muted { border-color: var(--border); color: var(--text); background: #fff; }
.btn-muted:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-danger { background: var(--error); color: #fff; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .8rem; color: var(--muted); text-transform: uppercase; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; font-size: .82rem; font-weight: 800; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-online { color: var(--success); background: #ecfdf5; }
.status-offline, .status-erro_ssl, .status-porta_fechada, .status-endpoint_invalido { color: var(--error); background: #fef2f2; }
.status-pendente, .status-aguardando_validacao { color: var(--warning); background: #fffbeb; }
.status-desativado, .status-reprovado { color: #475569; background: #f1f5f9; }
.pill { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: .78rem; font-weight: 900; }
.pill-ok { color: #166534; background: #dcfce7; }
.pill-muted { color: #475569; background: #f1f5f9; }
.muted { color: var(--muted); }
.notice { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid var(--border); background: #fff; }
.notice-ok { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.notice-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.code {
    background: #0f172a;
    color: #e2e8f0;
    padding: 14px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.kpi { font-size: 1.8rem; font-weight: 900; }
.inline-form { display: inline-flex; }
.onboarding-card { margin-bottom: 18px; border-color: #dbeafe; background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); }
.onboarding-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.onboarding-head h2 { margin: 0; font-size: 1.25rem; }
.progress-number { font-size: 2rem; font-weight: 900; color: var(--primary); }
.progress-track { height: 12px; border-radius: 999px; background: #e5e7eb; overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #0891b2); }
.onboarding-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.onboarding-step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: #fff; min-height: 90px; }
.step-state { width: 30px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; font-weight: 900; font-size: .9rem; }
.onboarding-done .step-state { background: #dcfce7; color: var(--success); }
.onboarding-attention .step-state { background: #fef3c7; color: var(--warning); }
.onboarding-pending .step-state { background: #e5e7eb; color: #64748b; }
.step-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.step-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-copy strong { font-size: .98rem; line-height: 1.3; overflow-wrap: anywhere; }
.step-copy span { color: var(--muted); font-size: .84rem; font-weight: 700; }
.step-action { align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #bfdbfe; background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: 7px 11px; font-size: .84rem; font-weight: 900; }
.step-action:hover { background: #dbeafe; }
.direct-link-box { margin-top: 16px; padding: 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 8px; }
.onboarding-actions { margin-top: 16px; }
.dashboard-actions { margin: 0 0 18px; }
.admin-kpis { margin-bottom: 18px; }
.filters { margin-bottom: 16px; }
.filter-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }
.admin-actions { align-items: flex-start; }
.admin-actions .btn { min-height: 34px; padding: 8px 10px; font-size: .82rem; }
.admin-detail { flex-basis: 100%; color: var(--muted); font-size: .82rem; margin-top: 6px; }
.ticket-thread { display: grid; gap: 10px; min-width: 260px; }
.ticket-thread p { margin: 0; }
.ticket-message { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: #f8fafc; }
.ticket-message strong { display: block; }
.ticket-message span { color: var(--muted); font-size: .8rem; }
.reply-form { display: grid; gap: 10px; margin-top: 8px; }
.reply-form textarea { min-height: 82px; }
@media (max-width: 820px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .content { padding: 18px; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .table { display: block; overflow-x: auto; }
    .onboarding-head { flex-direction: column; }
    .onboarding-steps { grid-template-columns: 1fr; }
    .copy-row { grid-template-columns: 1fr; }
    .filter-form { grid-template-columns: 1fr; }
    .actions, .admin-actions { align-items: stretch; }
    .actions .btn, .actions a, .inline-form, .inline-form .btn { width: 100%; }
}
