/* B-Connect (Laravel + Livewire edition): WhatsApp's palette, written by hand (no build step on the server). */
:root {
    --ink: #008069;          /* WhatsApp teal: buttons, active menu, links */
    --brand: #25d366;        /* WhatsApp green: unread, loading */
    --logo: #0e8f5e;
    --bg: #f0f2f5;
    --surface: #ffffff;
    --line: #e9edef;
    --field: #d1d7db;
    --heading: #111b21;
    --body: #3b4a54;
    --muted: #667781;
    --danger: #ea0038;
    --danger-soft: #ffe1e7;
    --ok-soft: #e7fce8;
    --warn-soft: #fef3c7;
    --warn: #b45309;
    --info-soft: #e0f2fe;
    --chat-bg: #efeae2;
    --out: #d9fdd3;
    --read: #53bdeb;
    --shadow: 0 1px 3px rgb(11 20 26 / .08);
    --pop: 0 12px 32px rgb(11 20 26 / .18);
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--body); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--heading); margin: 0; }
h1 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 16px; margin-bottom: 12px; }
p { margin: 0 0 10px; }
[x-cloak] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; }
.logo { width: 36px; height: 36px; border-radius: 9px; display: block; flex: none; }
.logo.sm { width: 28px; height: 28px; }
.logo.xl { width: 84px; height: 84px; border-radius: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; color: var(--muted); line-height: 1.45; }
.block { display: block; }
.center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.neg { color: var(--danger); }
.pos { color: var(--ink); }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- the shell: sidebar, top bar, page */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--heading); padding: 4px 6px 18px; }
.brand:hover { text-decoration: none; }
.brand b { font-size: 18px; display: block; }
.brand small { display: block; color: var(--muted); font-size: 12px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); padding: 6px 10px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--body); font-weight: 500; }
.nav-link:hover { background: var(--bg); text-decoration: none; }
.nav-link.on { background: var(--ink); color: #fff; }
.nav-link .count { margin-left: auto; background: var(--brand); color: #fff; border-radius: 99px; font-size: 12px; font-weight: 700; padding: 0 8px; }
.side-prices { margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #f7f8fa; font-size: 13px; }
.side-prices small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 4px; }
.side-prices div { display: flex; justify-content: space-between; gap: 8px; }
.side-legal { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.legal { font-size: 12px; color: var(--muted); line-height: 1.7; }
.legal a { color: var(--muted); }
.legal a:hover { color: var(--ink); }
.main { display: flex; flex-direction: column; min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-brand { display: none; align-items: center; gap: 8px; color: var(--heading); min-width: 0; }
.top-brand b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--ok-soft); color: var(--ink); border-radius: 99px; padding: 6px 12px; font-weight: 700; font-size: 14px; }
.pill:hover { text-decoration: none; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.banner { padding: 10px 20px; font-weight: 500; font-size: 14px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--danger-soft); color: var(--danger); }
.guide { background: #f7f8fa; border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: var(--body); }
.guide ul { margin: 6px 0 0; padding-left: 18px; }
.guide li { margin: 2px 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--heading); color: #fff; font-weight: 700; cursor: pointer; }
.panel { flex: 1; padding: 20px; min-width: 0; }
.dock { display: none; }

/* ---------- menus, toasts */
.menu { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px; background: var(--surface); border-radius: 12px; box-shadow: var(--pop); padding: 6px 0; }
.dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; border: 0; background: none; font: inherit; color: var(--heading); cursor: pointer; text-align: left; white-space: nowrap; }
.dropdown button:hover { background: var(--bg); }
.dropdown .danger { color: var(--danger); }
.dropdown-head { padding: 6px 16px 10px; border-bottom: 1px solid var(--line); }
.dropdown-head b, .dropdown-head small { display: block; }
.dropdown-head small { color: var(--muted); }
.dropdown-legal { border-top: 1px solid var(--line); margin-top: 6px; padding: 8px 16px 2px; font-size: 11px; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; border-radius: 10px; color: #fff; font-weight: 500; box-shadow: var(--pop); background: var(--ink); }
.toast-error { background: var(--danger); }
.toast-info { background: #027eb5; }

/* ---------- pages, cards, tables, forms */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .back { color: var(--muted); display: inline-flex; }
.head-actions, .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card { background: var(--surface); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); color: var(--body); }
.stat:hover { text-decoration: none; }
.stat small { color: var(--muted); font-weight: 500; }
.stat b { font-size: 26px; color: var(--heading); }
.stat.green { background: var(--ink); color: #fff; }
.stat.green small, .stat.green b { color: #fff; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid3 .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.grid3 .col .card, .grid3 .col .stat { margin-bottom: 0; }
.grid3 .span2 { grid-column: span 2; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters .input { width: auto; min-width: 150px; flex: 1 1 160px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .end { text-align: right; }
.table tr.link-row { cursor: pointer; }
.table tr.link-row:hover td { background: #f7f8fa; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef0f1; color: var(--muted); white-space: nowrap; }
.s-sent, .s-delivered, .s-read { background: var(--ok-soft); color: var(--ink); }
.s-failed { background: var(--danger-soft); color: var(--danger); }
.s-pending { background: var(--warn-soft); color: var(--warn); }
.s-received { background: var(--info-soft); color: #0369a1; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0 0 12px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; color: var(--heading); overflow-wrap: anywhere; }
.note { background: #f7f8fa; border-radius: 8px; padding: 10px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.alert { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.alert code { display: block; margin-top: 6px; padding: 8px; background: #fff; border-radius: 6px; color: var(--heading); word-break: break-all; }
.form { display: flex; flex-direction: column; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-weight: 600; font-size: 13px; color: var(--heading); }
.hint { color: var(--muted); font-size: 12px; }
.error { color: var(--danger); font-size: 12px; font-style: normal; }
.input { width: 100%; padding: 9px 12px; border: 1px solid var(--field); border-radius: 8px; font: inherit; color: var(--heading); background: #fff; }
.input:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
textarea.input { resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--body); margin-bottom: 8px; }
.check input { margin-top: 3px; accent-color: var(--ink); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 4px 0 8px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--field); background: #fff; color: var(--heading); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #006b58; }
.btn-danger, .btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; padding: 11px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: rgb(11 20 26 / .06); }
.link { border: 0; background: none; padding: 0; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgb(11 20 26 / .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 16px; padding: 18px 20px; box-shadow: var(--pop); }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; }
.preview { background: var(--out); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.preview small { color: var(--muted); }
.preview p { white-space: pre-wrap; margin: 4px 0 0; color: var(--heading); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 200px; padding-top: 10px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.bar i { display: block; width: 100%; min-height: 2px; background: var(--brand); border-radius: 4px 4px 0 0; }
.bar small { font-size: 10px; color: var(--muted); height: 16px; white-space: nowrap; }

/* ---------- the chat screen (as WhatsApp Web) */
.wa { display: flex; height: calc(100vh - 60px); margin: -20px; background: var(--surface); }
.wa-side { width: 380px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fff; min-height: 0; }
.wa-bar { height: 60px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px; background: var(--bg); }
.wa-title { font-size: 20px; color: var(--heading); flex: 1; }
.wa-search { padding: 8px 12px; }
.wa-search .input { background: var(--bg); border-color: transparent; border-radius: 10px; }
.wa-chips { display: flex; gap: 8px; padding: 0 12px 8px; }
.chip { border: 0; border-radius: 99px; padding: 5px 14px; background: var(--bg); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.chip.on { background: #d9fdd3; color: #008069; font-weight: 600; }
.wa-list { flex: 1; overflow-y: auto; }
.wa-row { display: flex; gap: 12px; width: 100%; padding: 10px 14px; border: 0; background: none; text-align: left; font: inherit; cursor: pointer; align-items: center; }
.wa-row:hover { background: #f5f6f6; }
.wa-row.on { background: var(--bg); }
.wa-avatar { width: 48px; height: 48px; border-radius: 50%; background: #dfe5e7; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex: none; }
.wa-avatar.sm { width: 40px; height: 40px; font-size: 16px; }
.wa-row-body { flex: 1; min-width: 0; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.wa-row-top, .wa-row-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wa-row-name { color: var(--heading); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-row-time { font-size: 12px; color: var(--muted); flex: none; }
.wa-row-time.unread { color: var(--brand); font-weight: 600; }
.wa-row-text { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 14px; min-width: 0; }
.wa-row-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-unread { background: var(--brand); color: #fff; border-radius: 99px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon.neg { color: var(--danger); width: 16px; height: 16px; }
.wa-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); }
.wa-head { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wa-head b { color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-head small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 12px; }
.win { display: inline-flex; align-items: center; gap: 3px; }
.win .icon { width: 14px; height: 14px; }
.win.open { color: var(--ink); }
.win.closed { color: #c2410c; }
.icon-btn.back { display: none; }
.wa-messages { flex: 1; overflow-y: auto; padding: 16px 7%; display: flex; flex-direction: column; gap: 2px; }
.wa-older, .wa-note, .wa-day { display: flex; justify-content: center; margin: 8px 0; }
.wa-older button { border: 0; border-radius: 99px; padding: 5px 14px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow); }
.wa-note span { background: #ffeecd; color: #54656f; border-radius: 8px; padding: 6px 12px; font-size: 13px; text-align: center; }
.wa-day span { background: #fff; color: var(--muted); border-radius: 8px; padding: 5px 12px; font-size: 12.5px; box-shadow: var(--shadow); }
.wa-line { display: flex; margin: 2px 0; }
.wa-line.out { justify-content: flex-end; }
.bubble { max-width: min(65%, 560px); background: #fff; border-radius: 8px; padding: 6px 8px 4px 9px; box-shadow: 0 1px .5px rgb(11 20 26 / .13); color: #111b21; font-size: 14.5px; }
.wa-line.out .bubble { background: var(--out); }
.bubble .tag { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.bubble .tag .icon { width: 14px; height: 14px; }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 0 10px; font-size: 11px; color: var(--muted); }
.ticks { color: #8696a0; }
.ticks.read { color: var(--read); }
.ticks.failed { color: var(--danger); }
.bubble .failed { clear: both; display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 12px; color: var(--danger); }
.wa-img { display: block; max-width: 300px; max-height: 320px; width: 100%; object-fit: cover; border-radius: 6px; margin-bottom: 4px; }
.bubble .file { display: flex; align-items: center; gap: 8px; background: rgb(11 20 26 / .05); border-radius: 6px; padding: 8px 10px; color: var(--heading); margin-bottom: 4px; }
.bubble .file b, .bubble .file small { display: block; }
.bubble .file small { color: var(--muted); font-size: 12px; }
.bubble .file.muted { color: var(--muted); }
.wa-closed { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: #fff; border-top: 1px solid var(--line); font-size: 14px; color: var(--body); flex-wrap: wrap; }
.wa-attach { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: #fff; border-top: 1px solid var(--line); font-size: 14px; }
.wa-attach span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-compose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; background: var(--bg); }
.wa-compose textarea { flex: 1; min-height: 42px; max-height: 140px; resize: none; border: 0; border-radius: 10px; padding: 10px 12px; }
.wa-compose .send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.wa-compose .send:disabled { opacity: .5; }
.wa-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; background: #f7f8fa; color: var(--muted); }
.wa-empty h2 { font-size: 28px; font-weight: 300; }

/* ---------- sign-in */
body.guest { background: var(--chat-bg); }
.login { display: grid; grid-template-columns: 46% 1fr; min-height: 100vh; }
.login-show { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; background: var(--logo); color: #fff; }
.login-show::after { content: ''; position: absolute; right: -96px; bottom: -96px; width: 320px; height: 320px; border-radius: 50%; background: rgb(143 212 63 / .25); }
.login-show h1 { display: block; font-size: 36px; line-height: 1.2; color: #fff; max-width: 460px; margin-bottom: 20px; }
.login-show ul { margin: 0; padding-left: 20px; color: rgb(255 255 255 / .88); line-height: 2; }
.login-show small, .login-show small a { color: rgb(255 255 255 / .65); }
.brand.light { color: #fff; padding: 0; }
.brand.light b { font-size: 20px; }
.login-form { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 16px; }
.login-card { width: min(400px, 100%); margin: 0; padding: 26px 28px; display: flex; flex-direction: column; }
.login-card h2 { font-size: 24px; }
.login-card .muted { margin-bottom: 16px; }
.login-foot { width: min(400px, 100%); text-align: center; }
.login-foot .tiny { margin-top: 10px; }
.mobile-only { display: none; }

/* ---------- phones and tablets */
@media (max-width: 960px) {
    .grid3 { grid-template-columns: 1fr; }
    .grid3 .span2 { grid-column: auto; }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .side { display: none; }
    .top { padding: 0 12px; }
    .top-brand { display: flex; }
    .panel { padding: 12px 12px 80px; }
    .dock { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
    .dock a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); position: relative; padding: 4px 0; }
    .dock a.on { color: var(--ink); font-weight: 700; }
    .dock a:hover { text-decoration: none; }
    .dock .dot { position: absolute; top: 2px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
    .wa { margin: -12px -12px -80px; height: calc(100vh - 60px - 62px); }
    .wa-side { width: 100%; }
    .wa.has-chat .wa-side { display: none; }
    .wa:not(.has-chat) .wa-main { display: none; }
    .icon-btn.back { display: inline-flex; }
    .wa-messages { padding: 12px; }
    .bubble { max-width: 85%; }
    .grid2 { grid-template-columns: 1fr; }
    .login { grid-template-columns: 1fr; }
    .login-show { display: none; }
    .mobile-only { display: flex; padding: 0 0 12px; }
    .toasts { right: 12px; left: 12px; bottom: 84px; max-width: none; }
}
