:root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --card: #ffffff;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #16a34a;
    --primary-dark: #0f7a35;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #2563eb;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}
a { color: inherit; text-decoration: none; }
.shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 250px;
    background: var(--bg-soft);
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.brand-title { font-size: 20px; font-weight: 800; }
.brand-sub { color: #9ca3af; font-size: 14px; margin-top: 4px; }
.nav { display: grid; gap: 8px; }
.nav a {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.12); }
.wa-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.04);
    font-size: 13px;
    color: #e5e7eb;
}
.wa-status-pill .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f59e0b;
    flex: 0 0 10px;
}
.wa-status-pill.is-on .dot { background: #22c55e; }
.wa-status-pill.is-off .dot { background: #f59e0b; }
.sidebar-foot {
    margin-top: auto;
    color: #d1d5db;
    font-size: 13px;
}
.main {
    flex: 1;
    padding: 24px;
}
.card {
    background: var(--card);
    border-radius: 18px;
    padding: 20px;
    border: 1px solid var(--line);
    box-shadow: 0 10px 25px rgba(0,0,0,.04);
}
.grid {
    display: grid;
    gap: 18px;
}
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
h1, h2, h3 { margin: 0 0 12px; }
p.muted, .muted { color: var(--muted); }
.kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}
.kpi {
    background: white;
    border-radius: 18px;
    border: 1px solid var(--line);
    padding: 18px;
}
.kpi strong { display: block; font-size: 28px; margin-top: 8px; }
.table-wrap {
    overflow: auto;
    background: white;
    border-radius: 18px;
    border: 1px solid var(--line);
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th {
    background: #f9fafb;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.badge-cold { background: #e0f2fe; color: #075985; }
.badge-warm { background: #fef3c7; color: #92400e; }
.badge-hot { background: #fee2e2; color: #991b1b; }
.badge-open { background: #dcfce7; color: #166534; }
.badge-pending_human { background: #ede9fe; color: #5b21b6; }
.badge-closed { background: #e5e7eb; color: #374151; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.message-list { display: grid; gap: 14px; }
.msg {
    max-width: 78%;
    padding: 14px;
    border-radius: 16px;
    line-height: 1.45;
}
.msg-in { background: white; border: 1px solid var(--line); }
.msg-out { background: #dcfce7; margin-left: auto; }
.msg small {
    display: block;
    color: var(--muted);
    margin-top: 8px;
}
label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], textarea, select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    outline: none;
    background: white;
}
textarea { min-height: 120px; resize: vertical; }
.form-row {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}
.btn, button {
    border: 0;
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
}
.btn:hover, button:hover { background: var(--primary-dark); }
.btn-secondary {
    background: #111827;
}
.btn-secondary:hover { background: #030712; }
.btn-warning {
    background: var(--warning);
}
.btn-danger {
    background: var(--danger);
}
.btn-light {
    background: #f3f4f6;
    color: #111827;
    border: 1px solid var(--line);
}
.btn-light:hover { background: #e5e7eb; }
.flash {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-weight: 700;
}
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-info { background: #dbeafe; color: #1d4ed8; }
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f172a, #111827);
}
.login-card {
    width: min(440px, 92vw);
    background: white;
    border-radius: 20px;
    padding: 26px;
}
.flex {
    display: flex;
    gap: 12px;
    align-items: center;
}
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hr {
    height: 1px;
    background: var(--line);
    margin: 18px 0;
}
.suggestion {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    background: #fff;
}
.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #f9fafb;
    border-radius: 12px;
    padding: 12px;
    overflow: auto;
    white-space: pre-wrap;
}
.note {
    padding: 14px 16px;
    border-radius: 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}
.meta-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 12px;
}
.meta-step strong.step {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    display: inline-grid;
    place-items: center;
    font-size: 14px;
    flex: 0 0 28px;
}
.kv-grid {
    display: grid;
    gap: 10px;
}
.kv-item {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
}
.kv-item small {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}
.status-box {
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}
.status-box.is-on {
    border-color: #86efac;
    background: #f0fdf4;
}
.status-box.is-off {
    border-color: #fde68a;
    background: #fffbeb;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
@media (max-width: 980px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .kpis, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .msg { max-width: 100%; }
}
