/* FCX Connect — navy #001837, white and grey. */
:root {
  --navy: #001837;
  --navy-2: #0b2a55;
  --navy-3: #18406f;
  --accent: #2f6fed;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --line: #e1e6ee;
  --line-2: #cfd6e0;
  --text: #1f2933;
  --muted: #667085;
  --soft: #f7f9fc;
  --hover: #eef2f8;
  --sel: #e3ecfb;
  --ok: #1a7f4b;
  --warn: #b26b00;
  --err: #c0362c;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14.5px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { color: var(--navy); margin: 0; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.boot { padding: 40px; color: var(--muted); }
[hidden] { display: none !important; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.sep { height: 1px; background: var(--line); margin: 12px 0; }

/* ---------- shell ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { width: 220px; flex: 0 0 220px; background: var(--navy); color: #dbe4f3; display: flex; flex-direction: column; padding: 12px 10px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.logo-mark { background: #fff; color: var(--navy); font-weight: 800; letter-spacing: .5px; border-radius: 7px; padding: 6px 7px; font-size: 13px; }
.logo-mark.big { font-size: 22px; padding: 10px 12px; display: inline-block; margin-bottom: 10px; background: var(--navy); color: #fff; }
.brand-name { color: #fff; font-weight: 700; font-size: 15.5px; }
.brand-sub { color: #9fb2cf; font-size: 12px; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-items a { display: flex; align-items: center; gap: 12px; color: #dbe4f3; text-decoration: none; padding: 9px 10px; border-radius: 7px; font-weight: 500; }
.nav-items a:hover { background: var(--navy-2); color: #fff; }
.nav-items a.active { background: #fff; color: var(--navy); }
.nav-badge { margin-left: auto; background: #e8a33a; color: var(--navy); border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.status-box { margin-top: auto; padding: 10px 6px; border-top: 1px solid var(--navy-3); font-size: 12px; display: flex; flex-direction: column; gap: 5px; }
.st-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 7px; align-items: center; color: #c5d2e6; text-decoration: none; }
.st-row b { font-weight: 600; color: #fff; }
.st-row.warn b { color: #ffcf7a; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #8a94a6; display: inline-block; }
.dot.connected { background: #36c37a; }
.dot.reconnecting, .dot.unknown { background: #e8a33a; }
.dot.offline { background: #8a94a6; box-shadow: inset 0 0 0 2px #c0362c; }
.dot.action_required { background: #ef5a4f; }
.dot.manual { background: #6b8fd6; }
.nav-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #9fb2cf; padding: 8px 6px 2px; border-top: 1px solid var(--navy-3); }
.nav-foot .link { color: #fff; background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 0; margin-left: auto; }
.view { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.nav-scrim { display: none; }
.menu-btn { display: none !important; }

/* ---------- page header / toolbar ---------- */
.page-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 58px; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; }
.toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.page-body { flex: 1; overflow: auto; padding: 16px; }
.page-body.narrow > * { max-width: 980px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); background: var(--panel); padding: 0 12px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 11px 14px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs button.active { color: var(--navy); border-bottom-color: var(--navy); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; border-radius: 7px; padding: 7px 12px; cursor: pointer; font-weight: 600; color: var(--navy); line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { color: var(--err); border-color: #efc2be; }
.btn.danger.solid { background: var(--err); color: #fff; border-color: var(--err); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.icon-btn { border: 0; background: transparent; border-radius: 6px; padding: 6px; cursor: pointer; color: var(--navy); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--hover); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], input[type=date], input[type=datetime-local], input[type=tel], select, textarea {
  border: 1px solid var(--line-2); border-radius: 7px; padding: 8px 10px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus, [contenteditable]:focus { outline: 2px solid #9db7e8; outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field .lbl { font-weight: 600; font-size: 13px; color: var(--navy); }
.field .help { color: var(--muted); font-size: 12.5px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; cursor: pointer; }
.check input { margin-top: 3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.form-error { color: var(--err); font-weight: 600; min-height: 1em; margin: 6px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card + .card { margin-top: 14px; }
.card h2 { margin-bottom: 10px; }
.notice { border-radius: 8px; padding: 10px 12px; background: #eef4ff; border: 1px solid #cfdcf7; color: #1c3e7a; font-size: 13.5px; line-height: 1.5; }
.notice.warn { background: #fff7e8; border-color: #f2d49b; color: #6b4300; }
.notice.err { background: #fdeeed; border-color: #f2c2bd; color: #8b231b; }
.notice.ok { background: #eaf7f0; border-color: #b9e3cb; color: #135c36; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #e9edf3; color: #3b4a5f; white-space: nowrap; }
.badge.ok { background: #dff3e8; color: var(--ok); } .badge.warn { background: #fff0d6; color: var(--warn); } .badge.err { background: #fbe1df; color: var(--err); } .badge.info { background: #e3ecfb; color: #1c4fb0; } .badge.navy { background: var(--navy); color: #fff; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px; }
.spin { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty-title { font-weight: 700; color: var(--navy); font-size: 16px; margin-bottom: 6px; }
table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--soft); position: sticky; top: 0; }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--hover); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.kpi .v { font-size: 22px; font-weight: 800; color: var(--navy); }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.progress { height: 8px; background: #e9edf3; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--navy); }

/* ---------- toasts & dialogs ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18); transition: opacity .3s; line-height: 1.45; }
.toast.error { background: #8b231b; } .toast.ok { background: #135c36; } .toast.warn { background: #6b4300; }
.toast.hide { opacity: 0; }
.dlg-back { position: fixed; inset: 0; background: rgba(0, 24, 55, .35); z-index: 900; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { background: #fff; border-radius: 12px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dlg.wide { width: min(980px, 100%); }
.dlg-head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { flex: 1; }
.dlg-body { padding: 16px; overflow: auto; line-height: 1.5; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, #001837 0%, #0b2a55 55%, #f3f5f8 55%); }
.auth-card { background: #fff; padding: 28px; border-radius: 14px; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand p { color: var(--muted); }

/* ---------- three-pane mail layout ---------- */
.mail { flex: 1; display: grid; grid-template-columns: 230px minmax(280px, 380px) 1fr; min-height: 0; }
.mail.with-panel { grid-template-columns: 230px minmax(280px, 360px) 1fr 290px; }
.mail:not(.with-panel) .side-panel { display: none; }
.composer .c-head h2 { white-space: nowrap; }
.pane { min-height: 0; overflow: auto; background: var(--panel); border-right: 1px solid var(--line); }
.folders { background: var(--soft); padding: 10px 8px; }
.folders .acc { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 12px 8px 4px; display: flex; align-items: center; gap: 6px; }
.folders a { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); padding: 7px 10px; border-radius: 6px; }
.folders a:hover { background: var(--hover); }
.folders a.active { background: var(--sel); color: var(--navy); font-weight: 700; }
.folders .cnt { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--navy); }
.list-head { position: sticky; top: 0; background: #fff; z-index: 2; border-bottom: 1px solid var(--line); padding: 8px; display: flex; gap: 6px; align-items: center; }
.msg-item { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; text-decoration: none; color: var(--text); border-left: 3px solid transparent; }
.msg-item:hover { background: var(--hover); }
.msg-item.active { background: var(--sel); border-left-color: var(--navy); }
.msg-item.unread { border-left-color: var(--accent); }
.msg-item.unread .from, .msg-item.unread .subj { font-weight: 700; color: var(--navy); }
.msg-item .top { display: flex; gap: 8px; align-items: baseline; }
.msg-item .from { flex: 1; min-width: 0; }
.msg-item .date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.msg-item .subj { font-size: 13.5px; margin-top: 2px; }
.msg-item .snip { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg-item .acct { font-size: 11px; color: var(--muted); }
.reader { background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.reader-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.reader-head h2 { font-size: 19px; margin-bottom: 8px; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.thread-msg { border-bottom: 1px solid var(--line); }
.thread-msg .meta { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; padding: 12px 18px; cursor: pointer; align-items: start; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.avatar.out { background: #6b8fd6; }
.thread-msg .who { font-weight: 700; color: var(--navy); }
.thread-msg .addr { font-size: 12.5px; color: var(--muted); line-height: 1.5; word-break: break-word; }
.thread-msg .bcc-line { font-size: 12.5px; color: #7a4a00; background: #fff6e2; display: inline-block; padding: 1px 6px; border-radius: 4px; margin-top: 3px; }
.thread-msg .body { padding: 0 18px 16px 66px; }
.thread-msg.collapsed .body { display: none; }
.mail-frame { width: 100%; border: 0; min-height: 120px; display: block; background: #fff; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.att { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 10px; font-size: 13px; background: var(--soft); text-decoration: none; color: var(--navy); cursor: pointer; }
.side-panel { background: var(--soft); padding: 14px; border-left: 1px solid var(--line); overflow: auto; }
.side-panel h3 { margin: 4px 0 8px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 4px 8px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.back-btn { display: none !important; }

/* ---------- composer ---------- */
.composer { display: flex; flex-direction: column; min-height: 0; flex: 1; background: #fff; }
.composer .c-head { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.c-fields { padding: 4px 16px; border-bottom: 1px solid var(--line); }
.c-row { display: grid; grid-template-columns: 74px 1fr auto; align-items: start; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f0f2f6; }
.c-row:last-child { border-bottom: 0; }
.c-row > .lbl { font-weight: 700; color: var(--navy); padding-top: 7px; font-size: 13.5px; }
.c-row .hint { font-size: 11.5px; color: var(--muted); font-weight: 500; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; border: 1px solid transparent; border-radius: 7px; padding: 2px; min-height: 34px; position: relative; }
.chips:focus-within { border-color: var(--line-2); }
.chips input { border: 0 !important; outline: 0 !important; flex: 1; min-width: 160px; padding: 6px 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #e9eef7; border: 1px solid #d4dcea; border-radius: 14px; padding: 2px 4px 2px 10px; font-size: 13px; max-width: 100%; }
.chip.bad { background: #fde6e4; border-color: #f1b9b3; color: #8b231b; }
.chip.dup { background: #fff2d9; border-color: #f2d49b; }
.chip .x, .chip .mv { border: 0; background: transparent; cursor: pointer; font-size: 12px; color: var(--muted); padding: 1px 4px; border-radius: 8px; }
.chip .mv:hover, .chip .x:hover { background: #fff; color: var(--navy); }
.chip-menu { position: absolute; z-index: 30; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; }
.chip-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 10px; cursor: pointer; border-radius: 5px; }
.chip-menu button:hover { background: var(--hover); }
.suggest { position: absolute; left: 0; top: 100%; z-index: 40; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); width: min(420px, 100%); max-height: 260px; overflow: auto; }
.suggest div { padding: 7px 10px; cursor: pointer; font-size: 13px; }
.suggest div:hover, .suggest div.on { background: var(--sel); }
.subject-input { border: 0 !important; font-size: 15px; font-weight: 600; padding: 7px 4px !important; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--soft); align-items: center; }
.rte-bar button { border: 0; background: transparent; padding: 5px 8px; border-radius: 5px; cursor: pointer; min-width: 30px; font-weight: 600; color: var(--navy); }
.rte-bar button:hover, .rte-bar button.on { background: #dfe6f1; }
.rte-bar select { width: auto; padding: 4px 6px; font-size: 13px; }
.rte-bar .sepv { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }
.rte { flex: 1; min-height: 220px; padding: 14px 16px; overflow: auto; line-height: 1.55; font-family: Arial, Helvetica, "Noto Sans Arabic", sans-serif; font-size: 14px; }
.rte:empty::before { content: attr(data-placeholder); color: #9aa5b5; }
.rte img { max-width: 100%; height: auto; }
.rte blockquote { margin: 0 0 0 .8ex; border-left: 2px solid #ccc; padding-left: 1ex; color: #555; }
.c-foot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--soft); }
.review { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; background: #fff; }
.review .counts { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.review .counts div { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; text-align: center; }
.review .counts b { display: block; font-size: 20px; color: var(--navy); }
.att-list { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 16px; }
.att-list:empty { display: none; }
.explain { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---------- media ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; position: relative; }
.media-tile:hover { border-color: var(--accent); }
.media-tile.sel { outline: 3px solid var(--accent); }
.media-tile .thumb { aspect-ratio: 4/3; background: #eef1f5 center/contain no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; font-size: 18px; }
.media-tile .nm { padding: 6px 8px 2px; font-size: 12.5px; }
.media-tile .meta { padding: 0 8px 8px; font-size: 11.5px; color: var(--muted); }
.dropzone { border: 2px dashed var(--line-2); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); background: #fff; }
.dropzone.over { border-color: var(--accent); background: #eef4ff; }

/* ---------- designer ---------- */
.designer { flex: 1; display: grid; grid-template-columns: 190px 1fr 300px; min-height: 0; }
.palette { background: var(--soft); border-right: 1px solid var(--line); padding: 10px; overflow: auto; }
.palette h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; margin: 10px 0 6px; }
.pal-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 8px 10px; margin-bottom: 6px; cursor: grab; font-weight: 600; color: var(--navy); text-align: left; }
.pal-item:hover { border-color: var(--accent); }
.canvas-wrap { background: #e6eaf0; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 16px; min-height: 0; }
.canvas-tools { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; justify-content: center; }
.canvas-frame { border: 0; background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.08); transition: width .2s; min-height: 400px; }
.outline { margin-top: 12px; width: 100%; max-width: 640px; }
.ol-item { display: flex; gap: 6px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; margin-bottom: 5px; font-size: 13px; cursor: pointer; }
.ol-item.sel { border-color: var(--accent); background: #eef4ff; }
.ol-item.drag-over { border-top: 3px solid var(--accent); }
.ol-item .grip { cursor: grab; color: var(--muted); }
.ol-item.child { margin-left: 22px; }
.props { background: #fff; border-left: 1px solid var(--line); padding: 12px; overflow: auto; }
.props h3 { margin-bottom: 10px; }
.mini-rte { border: 1px solid var(--line-2); border-radius: 7px; min-height: 120px; padding: 8px; background: #fff; overflow: auto; max-height: 340px; }
.color-row { display: flex; gap: 6px; align-items: center; }
.color-row input[type=color] { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; }

/* ---------- WhatsApp ---------- */
.wa { flex: 1; display: grid; grid-template-columns: 300px 1fr 300px; min-height: 0; }
.wa-chat { display: flex; flex-direction: column; min-height: 0; background: #efeae2; }
.wa-history { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: min(420px, 85%); background: #fff; border-radius: 10px; padding: 6px 8px 4px; box-shadow: 0 1px 1px rgba(0,0,0,.08); align-self: flex-start; font-size: 14px; }
.bubble.out { background: #d9fdd3; align-self: flex-end; }
.bubble.sys { align-self: center; background: #fff7d6; color: #6b5300; font-size: 12px; max-width: 90%; text-align: center; }
.bubble img { display: block; max-width: 100%; max-height: 300px; object-fit: contain; border-radius: 7px; margin-bottom: 4px; }
.bubble .cap { white-space: pre-wrap; word-break: break-word; padding: 2px 2px 0; line-height: 1.4; }
.bubble .tm { font-size: 11px; color: #667781; text-align: right; margin-top: 2px; }
.bubble .lbl { font-size: 11px; font-weight: 700; color: #1a7f4b; }
.wa-compose { background: #f0f2f5; padding: 10px; border-top: 1px solid var(--line); }
.wa-preview { background: #efeae2; border-radius: 10px; padding: 12px; }

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.tl-item { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; cursor: default; }
.tl-item.click { cursor: pointer; }
.tl-item.click:hover { border-color: var(--accent); }
.chan { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 9px; text-transform: uppercase; letter-spacing: .3px; }
.chan.email { background: #e3ecfb; color: #1c4fb0; } .chan.whatsapp { background: #dff3e8; color: #1a7f4b; } .chan.note { background: #f0eafa; color: #5b3aa3; } .chan.campaign { background: #fff0d6; color: #8a5a00; } .chan.system { background: #e9edf3; color: #3b4a5f; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .mail.with-panel { grid-template-columns: 210px minmax(260px, 330px) 1fr; }
  .mail.with-panel .side-panel { display: none; }
  .wa { grid-template-columns: 280px 1fr; }
  .wa .side-panel { display: none; }
}
@media (max-width: 1080px) {
  .designer { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; overflow: auto; }
  .palette { display: flex; flex-wrap: wrap; gap: 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .palette h3 { width: 100%; margin: 2px 0; }
  .pal-item { width: auto; margin: 0; }
  .props { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 800; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 700; }
  .menu-btn { display: inline-flex !important; }
  .mail, .mail.with-panel { grid-template-columns: 1fr; }
  .mail .folders { display: none; }
  .mail.show-folders .folders { display: block; }
  .mail.show-folders .msglist, .mail.show-folders .reader { display: none; }
  .mail.reading .msglist { display: none; }
  .mail:not(.reading) .reader { display: none; }
  .back-btn { display: inline-flex !important; }
  .wa { grid-template-columns: 1fr; }
  .wa.reading .wa-list { display: none; }
  .wa:not(.reading) .wa-chat { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .c-row { grid-template-columns: 56px 1fr; }
  .c-row > :nth-child(3) { grid-column: 2; }
  .thread-msg .body { padding: 0 12px 14px; }
  .page-body { padding: 10px; }
  .hide-mobile { display: none !important; }
}
@media print { .sidebar, .reader-actions, .page-head .toolbar { display: none !important; } }
