:root {
    --wa-green: #25d366;
    --wa-teal: #075e54;
    --ink: #111b21;
    --muted: #667781;
    --line: #e9edef;
    --bg: #f0f2f5;
    --card: #ffffff;
    --danger: #d33;
    --warn: #b26a00;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 20px;
    height: 56px;
    background: var(--wa-teal);
    color: #fff;
}
.topbar .brand { font-weight: 700; }
.topbar nav { display: flex; gap: 4px; }
.topbar .account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .account .who { color: #d9f2ea; font-size: 13px; }
.topbar .account .logout {
    color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
    border: 1px solid rgba(255,255,255,.35); padding: 5px 12px; border-radius: 6px;
}
.topbar .account .logout:hover { background: rgba(255,255,255,.12); }

.login-shell {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; padding: 20px;
    background: linear-gradient(160deg, #075e54 0%, #0a7d6e 45%, #128c7e 100%);
}
.login-card {
    width: 100%; max-width: 400px; margin: 0;
    padding: 30px 30px 26px;
    border: none;
    box-shadow: 0 24px 60px rgba(0,0,0,.32);
    text-align: center;
}
.login-card h1 { font-size: 22px; margin: 4px 0 2px; }
.login-card form { text-align: left; margin-top: 18px; }
.login-lede { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.login-badge {
    width: 66px; height: 66px; margin: 0 auto 10px;
    border-radius: 50%; background: #e8f8ee;
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(37,211,102,.25);
}
.login-badge .wa-glyph { width: 34px; height: 34px; }
.login-foot { color: rgba(255,255,255,.75); font-size: 12px; margin: 0; }
.topbar nav a {
    color: #d9f2ea;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); }
.topbar nav a.active { background: rgba(255,255,255,.22); color: #fff; }

main { max-width: 760px; margin: 24px auto; padding: 0 16px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=tel], textarea, input[type=search] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}
textarea { min-height: 90px; resize: vertical; }

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    background: var(--wa-green);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 9px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    transition: filter .15s ease, background .15s ease;
}
button:hover, .btn:hover { filter: brightness(.96); }
button.green, .btn.green { background: var(--wa-green); }
button.secondary, .btn.secondary { background: #e9edef; color: var(--ink); box-shadow: none; }
button.danger, .btn.danger { background: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn .ico { width: 17px; height: 17px; flex-shrink: 0; }
.actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

/* --- WhatsApp glyph --- */
.wa-glyph { width: 26px; height: 26px; color: var(--wa-green); }
.wa-glyph.sm { width: 20px; height: 20px; }

/* --- Section card with icon heading (Filament-style) --- */
.wa-grid { display: flex; flex-direction: column; gap: 20px; }
.wa-section .section-head {
    display: flex; align-items: center; gap: 10px;
    font-size: 16px; font-weight: 700; color: var(--ink);
    padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--line);
}
.wa-section .section-head .muted { font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err-text { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 1em; }

/* --- Status row + animated dot --- */
.status-row { display: flex; align-items: flex-start; gap: 12px; }
.status-title { font-weight: 600; margin: 0; }
.status-sub { color: var(--muted); font-size: 13.5px; margin: 3px 0 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--muted); }
.dot.ready { background: var(--wa-green); box-shadow: 0 0 0 4px rgba(37,211,102,.16); }
.dot.wait  { background: #f5a623; animation: pulse 1.4s ease-in-out infinite; }
.dot.busy  { background: #2f9be0; animation: pulse 1.4s ease-in-out infinite; }
.dot.off   { background: var(--danger); }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,166,35,.5); }
    50%      { box-shadow: 0 0 0 6px rgba(245,166,35,0); }
}

/* --- Create form field row --- */
.inline-field { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-field input { flex: 1; min-width: 200px; }
.picker-wrap { margin-top: 18px; }
.picker-wrap select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 8px; font-size: 15px; background: #fff;
}

/* --- QR: green frame, white inner, centered WA badge --- */
.qr-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 4px 0 2px; }
.qr-frame { background: var(--wa-green); border-radius: 20px; padding: 12px; box-shadow: 0 10px 24px rgba(37,211,102,.28); }
.qr-inner { position: relative; background: #fff; border-radius: 14px; padding: 12px; }
.qr-inner img { display: block; width: 250px; height: 250px; image-rendering: pixelated; }
.qr-badge {
    position: absolute; inset: 0; margin: auto;
    width: 50px; height: 50px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18);
    display: flex; align-items: center; justify-content: center;
}
.qr-badge .wa-glyph { width: 30px; height: 30px; }
.steps { margin: 0; padding-left: 20px; color: #4b5a63; font-size: 14px; line-height: 1.9; align-self: stretch; max-width: 340px; }
.steps strong { color: var(--ink); }

.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.pill.ready { background: #d8f5e3; color: #0a7a3d; }
.pill.wait  { background: #fff2d6; color: var(--warn); }
.pill.off   { background: #f1d6d6; color: var(--danger); }

.qr-wrap { text-align: center; padding: 16px; }
.qr-wrap img { width: 260px; height: 260px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 8px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 8px; }

.banner { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.banner.warn { background: #fff2d6; color: var(--warn); }
.banner.ok   { background: #d8f5e3; color: #0a7a3d; }
.banner.err  { background: #f8d7da; color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.status-sent { color: #0a7a3d; font-weight: 600; }
.status-failed { color: var(--danger); font-weight: 600; }

code { background: #eef1f2; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
