* { box-sizing: border-box; }
:root {
  --bg: #f4f6f8; --panel: #ffffff; --line: #e4e8ec; --text: #1f2933;
  --muted: #7b8794; --accent: #128c7e; --accent-ink: #ffffff;
  --in: #ffffff; --out: #d9fdd3; --shadow: 0 1px 3px rgba(0,0,0,.06);
}
html, body { height: 100%; margin: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
.error { color: #c0392b; margin-top: 8px; min-height: 18px; font-size: 13px; }

/* login */
.login { height: 100%; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--panel); padding: 32px; border-radius: 14px; box-shadow: var(--shadow);
  width: 320px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; }
.login-card input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.login-card button, .reply button {
  background: var(--accent); color: var(--accent-ink); border: 0; padding: 11px;
  border-radius: 8px; font-size: 14px; cursor: pointer; }

/* layout */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; }
.spacer { flex: 1; }
.who { color: var(--muted); }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 14px; }
.body { flex: 1; display: flex; min-height: 0; }

/* pill */
.pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-green { background: #e3f6ec; color: #0f7b48; }
.pill-amber { background: #fef3c7; color: #92600a; }
.pill-red { background: #fde8e8; color: #b42318; }
.pill-gray { background: #eceff1; color: #647380; }

/* conversation list */
.list { width: 320px; border-right: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 12px 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
.conv-list { overflow-y: auto; flex: 1; }
.conv { padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.conv:hover { background: #f7f9fa; }
.conv.active { background: #eef6f5; }
.conv-av { flex: none; }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: center; }
.conv-name { font-weight: 600; }
.conv-prev { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }

/* customer avatars */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; background: #dfe7ea; }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 16px; background: var(--accent); }
#thread-title .avatar { width: 28px; height: 28px; margin-right: 8px; font-size: 13px; }
#thread-title { display: flex; align-items: center; }

/* forwarded / deleted / reactions / location bubbles */
.fwd { font-size: 11px; color: var(--muted); font-style: italic; margin-bottom: 3px; }
.deleted { font-style: italic; color: var(--muted); }
.media-pending { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; }
.media-pending .mp-ico { font-size: 15px; }
.media-pending .mp-retry { margin-left: auto; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.media-pending .mp-retry:disabled { opacity: .6; cursor: default; }
.reaction { display: inline-block; margin-top: 4px; margin-left: 2px; font-size: 15px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0 5px; box-shadow: var(--shadow); }
.loc { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.loc-pin { font-size: 22px; }
.loc-txt { display: flex; flex-direction: column; line-height: 1.25; }
.loc-txt small { color: var(--muted); }
.msg-del { border: 0; background: transparent; cursor: pointer; font-size: 12px; opacity: 0; padding: 0 4px; }
.msg:hover .msg-del { opacity: 0.7; }
.msg-del:hover { opacity: 1; }

/* thread */
.thread { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.list { flex-shrink: 0; }
.thread-head { padding: 12px 16px; font-weight: 600; border-bottom: 1px solid var(--line); background: var(--panel); }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.msg { display: flex; flex-direction: column; max-width: 68%; min-width: 0; }
/* Email carries long unbreakable URLs + HTML — needs more width and hard wrapping. */
.msg.email { max-width: 88%; width: 88%; }
.msg.email .bubble { width: 100%; }
.msg.in { align-self: flex-start; align-items: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 8px 12px; border-radius: 10px; box-shadow: var(--shadow); word-wrap: break-word; overflow-wrap: anywhere; min-width: 0; }
/* Rendered HTML email in an inert, width-constrained frame */
.email-frame { width: 100%; border: 0; background: #fff; border-radius: 6px; display: block; }
.email-frame-wrap { width: 100%; max-height: 85vh; overflow: auto; background: #fff; border-radius: 6px; }
.email-text { white-space: pre-wrap; word-break: break-word; }
.msg.in .bubble { background: var(--in); }
.msg.out .bubble { background: var(--out); }
.meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.failed { color: #c0392b; font-weight: 600; cursor: help; }
.tick { color: var(--muted); font-weight: 600; letter-spacing: -1px; }
.tick.read { color: #34b7f1; } /* WhatsApp blue */
.tick.pend { letter-spacing: 0; }
audio { height: 34px; }

/* reply */
.reply { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel); }
/* Email RTF composer */
.email-reply { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.rte-toolbar { display: flex; align-items: center; gap: 4px; }
.rte-btn { min-width: 28px; height: 28px; border: 1px solid var(--line); background: var(--bg); border-radius: 6px; cursor: pointer; font-size: 13px; }
.rte-btn:hover { background: #eef2f1; }
.rte-hint { margin-left: auto; font-size: 11px; color: var(--muted); }
.rte-editor { min-height: 90px; max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; line-height: 1.5; background: #fff; }
.rte-editor:focus { outline: none; border-color: var(--accent); }
.rte-editor:empty:before { content: attr(data-ph); color: var(--muted); }
.rte-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.rte-actions button { padding: 9px 20px; }
.email-sig-toggle { margin-right: auto; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.email-atts { display: flex; flex-wrap: wrap; gap: 6px; }
.email-att { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; color: var(--text); }
.email-att .att-x { cursor: pointer; color: var(--muted); font-weight: 600; }
.email-att .att-x:hover { color: #e24b4a; }
.reply input { flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.reply button[type="submit"] { padding: 11px 20px; }
.icon-btn { background: #eef2f4; border: 1px solid var(--line); border-radius: 8px; width: 42px; font-size: 18px; cursor: pointer; }
.icon-btn:hover { background: #e5eaed; }
.icon-btn.recording { background: #fde8e8; border-color: #f3b4b4; }

/* media in thread */
.media-img { max-width: 240px; max-height: 260px; border-radius: 8px; display: block; cursor: pointer; }
.cap { margin-top: 4px; white-space: pre-wrap; }
/* Auto-transcript of a voice note: distinguish it from a real typed caption. */
.voice-tx { font-style: italic; opacity: 0.85; font-size: 0.92em; }
/* "Message via ad" (Click-to-WhatsApp) context card — mirrors the sender's WhatsApp view. */
.ad-ref { margin: 0 0 6px; padding: 8px; border-radius: 10px; background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.08); max-width: 320px; }
.ad-ref-tag { font-size: 12px; opacity: 0.75; margin-bottom: 6px; }
.ad-ref-media { position: relative; display: block; border-radius: 8px; overflow: hidden; background: rgba(0,0,0,0.35); }
.ad-ref-media img { display: block; width: 100%; max-height: 200px; object-fit: cover; }
.ad-ref-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,0.55);
  color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.ad-ref-fb { position: absolute; right: 6px; bottom: 6px; width: 18px; height: 18px; border-radius: 4px;
  background: #1877f2; color: #fff; font-weight: 700; font-size: 12px; line-height: 18px; text-align: center; font-family: Georgia, serif; }
.ad-ref-headline { font-weight: 600; margin-top: 6px; }
.ad-ref-body { font-size: 13px; opacity: 0.85; margin-top: 2px; white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ad-ref-src { display: block; font-size: 12px; margin-top: 4px; opacity: 0.8; word-break: break-all; }
/* Admin order-edit form (inside the order overlay). */
.oe { display: flex; flex-direction: column; gap: 6px; }
.oe-h { font-weight: 600; font-size: 12px; opacity: 0.85; margin-top: 8px; text-transform: uppercase; letter-spacing: .03em; }
.oe-inp { width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.2); color: inherit; font-size: 13px; box-sizing: border-box; }
.oe-row2 { display: flex; gap: 6px; }
.oe-row2 > * { flex: 1; }
.oe-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px; border-radius: 6px; background: rgba(0,0,0,0.15); }
.oe-item-new { background: rgba(60,120,60,0.18); }
.oe-item-name { flex: 1 1 100%; font-size: 13px; }
.oe-mini { font-size: 11px; opacity: 0.8; display: flex; flex-direction: column; }
.oe-mini input { width: 80px; padding: 4px 6px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.2); color: inherit; }
.oe-rm { font-size: 12px; opacity: 0.8; display: flex; align-items: center; gap: 3px; }
.oe-addbox { position: relative; }
.oe-results { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }
.oe-res { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 6px; background: rgba(0,0,0,0.2); cursor: pointer; font-size: 12px; }
.oe-res:hover { background: rgba(80,140,220,0.25); }
.oe-fee-del, .oe-new-del { flex: 0 0 auto; max-width: 34px; }
.oe-actions { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.oe-review-out { padding: 8px; border-radius: 6px; background: rgba(0,0,0,0.22); font-size: 13px; }
.oe-sum { margin: 4px 0 0; padding-left: 18px; }
.oe-sum li { margin: 2px 0; }
.oe-note { font-size: 12px; padding: 8px; border-radius: 6px; background: rgba(80,140,220,0.12); border: 1px solid rgba(80,140,220,0.25); }
/* Preserve line breaks in plain-text message bubbles (WhatsApp \n → real breaks). */
.msgtext { white-space: pre-wrap; }
/* OCR affordance under an inbound image */
.ocr-row { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ocr-scan { font-size: 12px; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.ocr-scan:hover { border-color: var(--accent); color: var(--accent); }
.ocr-scan.link { border: 0; background: none; padding: 0 4px; text-decoration: underline; }
.ocr-link { font-size: 12px; border: 1px solid #a9e3d4; background: #e7f7f2; color: #0b6d5c; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-weight: 600; }
.ocr-link:hover { background: #d5f0e8; }
.ocr-none { font-size: 12px; color: var(--muted); }
.ocr-pay { font-size: 12px; font-weight: 600; color: #1b5e20; background: #e6f4ea; border: 1px solid #b6e0c2; border-radius: 999px; padding: 3px 10px; }
.agent { font-weight: 600; color: var(--accent); }
.ok { color: #0f7b48; font-size: 13px; margin-top: 6px; }

/* overlays / modals */
.overlay { position: fixed; inset: 0; background: rgba(20,28,34,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--panel); border-radius: 14px; width: 480px; max-width: 92vw; max-height: 86vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.25); padding: 20px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.modal-head .x { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-sub { font-weight: 600; margin: 16px 0 8px; }

.staff-list { display: flex; flex-direction: column; gap: 8px; }
.staff-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; gap: 8px; }
.staff-row.inactive { opacity: .6; }
.staff-name { font-weight: 600; }
.staff-email { color: var(--muted); font-size: 13px; }
.staff-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.staff-actions button { font-size: 12px; padding: 5px 8px; border: 1px solid var(--line); background: #f7f9fa; border-radius: 6px; cursor: pointer; }
.staff-actions button:hover { background: #eef2f4; }
.tag { font-size: 11px; background: #e3f6ec; color: #0f7b48; padding: 1px 6px; border-radius: 999px; font-weight: 600; }
.tag.off { background: #fde8e8; color: #b42318; }

.add-user { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add-user input, .add-user select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.add-user button { grid-column: 1 / -1; background: var(--accent); color: #fff; border: 0; padding: 10px; border-radius: 8px; cursor: pointer; }

.pw-form { display: flex; flex-direction: column; gap: 10px; }
.pw-form input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.pw-form button { background: var(--accent); color: #fff; border: 0; padding: 11px; border-radius: 8px; cursor: pointer; }
.pw-form textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; resize: vertical; }

/* list head + filters */
.list-head { display: flex; align-items: center; justify-content: space-between; }
.mini-btn { font-size: 12px; padding: 4px 9px; border: 1px solid var(--line); background: #f7f9fa; border-radius: 6px; cursor: pointer; }
.mini-btn:hover { background: #eef2f4; }
.filters { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.filter { flex: 1; font-size: 12px; padding: 6px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; color: var(--muted); }
.filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Channel filter strip (icon tabs) — sits above All/Unread/Starred. */
.channel-tabs { display: flex; gap: 4px; padding: 8px 12px 0; overflow-x: auto; }
.channel-tabs::-webkit-scrollbar { height: 0; }
.ch-tab { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1;
  padding: 6px 10px; border: 1px solid var(--line); background: #fff; border-radius: 999px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.ch-tab .ch-ic { display: inline-flex; align-items: center; }
.ch-tab .ch-ic .ch { margin: 0; }
.ch-tab { padding: 6px 9px; }
.ch-tail { font-size: 11px; font-weight: 700; letter-spacing: .2px; color: inherit; }
.ch-tab.ch-tab-all { padding: 6px 12px; }
.ch-tab .ch-all { font-size: 12px; font-weight: 600; }
.ch-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ch-tab-badge { min-width: 16px; text-align: center; background: #e24b4a; color: #fff; border-radius: 999px; font-size: 10px; font-weight: 600; padding: 1px 5px; }
.ch-tab.active .ch-tab-badge { background: rgba(255,255,255,.28); }
.conv-assigned { font-size: 11px; color: var(--accent); margin-top: 3px; }

/* thread action bar */
.thread-bar { display: flex; align-items: center; gap: 10px; padding: 6px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.assigned-label { color: var(--muted); font-size: 13px; flex: 1; }
.star-btn { background: none; border: 0; font-size: 20px; cursor: pointer; color: #c9a227; line-height: 1; }
.star-btn.starred { color: #e8b400; }
/* Pin reuses .star-btn sizing; dim when inactive, full + highlighted when pinned. */
#btn-pin { font-size: 17px; filter: grayscale(1); opacity: 0.45; }
#btn-pin.pinned { filter: none; opacity: 1; }
.kbd-hint { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; white-space: nowrap; }

/* recording status */
.rec-status { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: #fff5f5; border-top: 1px solid #f3d1d1; color: #b42318; font-size: 13px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* canned / saved messages */
.canned-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.canned-row { display: flex; align-items: stretch; gap: 6px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.canned-main { flex: 1; padding: 8px 10px; cursor: pointer; }
.canned-main:hover { background: #f7f9fa; }
.canned-title { font-weight: 600; font-size: 13px; }
.canned-body { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Row action buttons — ALWAYS visible on every row (not hover-only), with a divider. */
.canned-edit, .canned-del { flex: 0 0 auto; border: 0; border-left: 1px solid var(--line); background: #f7f9fa; cursor: pointer; padding: 0 12px; font-size: 15px; line-height: 1; display: flex; align-items: center; }
.canned-edit:hover { background: #eef2f4; }
.canned-del:hover { background: #fde8e8; }
.cn-form-actions { display: flex; gap: 8px; align-items: center; }
.cn-form-actions button { flex: 1; }
#cn-cancel { flex: 0 0 auto; background: #f7f9fa; color: var(--ink); border: 1px solid var(--line); }
.add-canned { display: flex; flex-direction: column; gap: 8px; }
.add-canned input, .add-canned textarea { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.add-canned button { background: var(--accent); color: #fff; border: 0; padding: 10px; border-radius: 8px; cursor: pointer; }
.reply input { min-width: 0; }
a { color: var(--accent); }
/* Shortcode badge on a saved-message row */
.canned-code-badge { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--accent); background: #eef2f4; padding: 1px 6px; border-radius: 6px; margin-right: 6px; }
/* "/" autocomplete popup above the composer */
.canned-ac { margin: 0 8px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card, #fff); max-height: 240px; overflow-y: auto; box-shadow: 0 -3px 14px rgba(0,0,0,.08); }
.canned-ac-item { display: flex; gap: 8px; align-items: baseline; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.canned-ac-item:last-child { border-bottom: 0; }
.canned-ac-item.sel { background: #eef6ff; }
.canned-ac-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--accent); background: #eef2f4; padding: 1px 6px; border-radius: 6px; flex: 0 0 auto; }
.canned-ac-title { font-weight: 600; font-size: 13px; flex: 0 0 auto; }
.canned-ac-body { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Admin "Canned" dashboard subtab */
.cadm-table { width: 100%; border-collapse: collapse; }
.cadm-table th, .cadm-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
.cadm-table th { color: var(--muted); font-weight: 600; }
.cadm-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); white-space: nowrap; }
.cadm-bodycell { color: var(--muted); max-width: 460px; white-space: pre-wrap; }
.cadm-actions { white-space: nowrap; }
.cadm-actions button { margin-right: 6px; }
.msg.out .bubble a { color: #0a6b5f; }

/* who-sent tags (automation / device) */
.tag-auto { color: #8a5a00; font-weight: 600; }
.tag-device { color: #647380; font-weight: 600; }
.tag-bot { color: #7b3fe4; font-weight: 700; }
.tag-payment { color: #0a7d54; font-weight: 600; }

/* thread head with back button */
.thread-head { display: flex; align-items: center; gap: 8px; }
.back-btn { display: none; background: none; border: 0; font-size: 26px; line-height: 1; color: var(--accent); cursor: pointer; padding: 0 2px; }

/* ---- customer profile pane ---- */
.cust-pane { width: 300px; flex-shrink: 0; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.cust-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
.cust-head .x { display: none; background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.cust-body { overflow-y: auto; flex: 1; padding: 12px 16px; }
.cust-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.cust-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.cust-line { font-size: 13px; margin-top: 3px; word-break: break-word; }
.cust-stats { display: flex; gap: 10px; margin: 12px 0 8px; }
.stat { flex: 1; background: #f4f8f7; border-radius: 8px; padding: 8px; text-align: center; }
.stat-v { font-weight: 700; font-size: 15px; color: var(--accent); }
.stat-l { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cust-sub { font-weight: 600; font-size: 13px; margin: 4px 0 8px; color: var(--muted); }
/* Loyalty card — read-only points + tier. Warm gold accent to set it apart. */
.loy-card { border: 1px solid #eadca8; background: linear-gradient(180deg,#fffdf4,#fdf7e3); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.loy-head { font-weight: 700; font-size: 13px; color: #8a6d1a; }
.loy-tier { color: #b8860b; }
.loy-points { margin: 4px 0 6px; display: flex; align-items: baseline; gap: 6px; }
.loy-pts { font-weight: 800; font-size: 22px; color: #a9791b; line-height: 1; }
.loy-unit { font-size: 12px; color: #a9791b; font-weight: 600; }
.loy-pkr { font-size: 12px; color: var(--muted); }
.loy-sub { display: flex; flex-wrap: wrap; gap: 6px; }
.loy-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #fff5d6; color: #8a6d1a; border: 1px solid #eadca8; }
.loy-chip.muted { background: #fff; color: var(--muted); border-color: var(--line); }
.loy-chip.loy-pending { background: #fdecc8; }
.loy-actions { margin-top: 8px; }
.loy-form { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.loy-form.hidden { display: none; }
.loy-frow { display: flex; flex-direction: column; gap: 2px; }
.loy-frow label { font-size: 11px; color: #8a6d1a; font-weight: 600; }
.loy-frow input, .loy-frow select { font-size: 13px; padding: 6px 8px; border: 1px solid #eadca8; border-radius: 6px; background: #fff; }
.loy-frow input:focus, .loy-frow select:focus { outline: none; border-color: var(--accent); }
.loy-fbtns { display: flex; gap: 6px; margin-top: 2px; }
.mini-btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.mini-btn.primary:hover { filter: brightness(1.05); }
.mini-btn:disabled { opacity: .6; cursor: default; }
.loy-fmsg { font-size: 12px; min-height: 14px; }
.loy-fmsg.err { color: #b3261e; }
.loy-fmsg.ok { color: #1a7f37; }
.ord-list { display: flex; flex-direction: column; gap: 8px; }
.ord { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.ord-top { display: flex; justify-content: space-between; align-items: center; }
.ord-no { font-weight: 600; font-size: 13px; }
.ord-total { font-weight: 600; font-size: 13px; }
.ord-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ord-status { text-transform: capitalize; }
.ord-status.s-completed { color: #0f7b48; }
.ord-status.s-processing { color: #8a5a00; }
.ord-status.s-cancelled, .ord-status.s-failed { color: #b42318; }
.ord-items { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ord-click { cursor: pointer; transition: border-color .12s, background .12s; }
.ord-click:hover { border-color: var(--accent); background: #f0faf8; }

/* order detail overlay */
.order-detail { display: flex; flex-direction: column; gap: 14px; }
.od-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.od-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.od-col { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.od-label { font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; margin-right: 4px; }
.oa-name { font-weight: 600; }
.od-pay { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.od-note { background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.od-items { width: 100%; border-collapse: collapse; font-size: 13px; }
.od-items td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.od-items .oi-qty { text-align: center; color: var(--muted); white-space: nowrap; }
.od-items .oi-amt { text-align: right; white-space: nowrap; }
.od-items tfoot td { border-bottom: 0; color: var(--muted); }
.od-items tfoot .od-total td { font-weight: 700; color: var(--text); font-size: 14px; border-top: 2px solid var(--line); }
@media (max-width: 560px) { .od-grid { grid-template-columns: 1fr; } }
.od-logh { margin-top: 4px; }
/* order log (WooCommerce notes) */
.olog { display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow-y: auto; }
.olog-item { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 7px 10px; font-size: 13px; }
.olog-item.olog-sys { border-left-color: #cbd2d9; opacity: .72; }
.olog-item.olog-cust { border-left-color: #8a5a00; }
.olog-item.olog-perm { border-left-color: #f27c5b; background: #fff8f5; }
.olog-item.olog-perm .olog-author { color: #d1512e; }
.olog-meta { display: flex; gap: 8px; align-items: baseline; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.olog-author { font-weight: 600; color: var(--text); }
.olog-item.olog-sys .olog-author { color: var(--muted); font-weight: 500; }
.olog-date { margin-left: auto; }
.olog-tag { background: #fff3e0; color: #8a5a00; border-radius: 999px; padding: 0 6px; font-weight: 600; }
.olog-body { line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
/* admin payment-log writer */
.olog-add { align-self: flex-start; background: var(--accent); color: var(--accent-ink); border: 0; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; margin-bottom: 4px; }
.olog-addrow { display: flex; gap: 8px; flex-wrap: wrap; }
#order-addnote { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.olog-danger { background: transparent; color: var(--danger, #c0392b); border: 1px solid var(--danger, #c0392b); }
.olog-danger-btn { background: var(--danger, #c0392b); color: #fff; }
.paylog-wrap { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--bg); margin-bottom: 4px; }
.paylog-form { display: flex; flex-direction: column; gap: 10px; }
.paylog-row { display: flex; gap: 10px; flex-wrap: wrap; }
.paylog-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 1; min-width: 110px; }
.paylog-form input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; background: var(--panel); }
.paylog-form input:disabled { color: var(--muted); background: #eef1f3; }
.paylog-extra { min-width: 100%; }
.paylog-previewwrap { display: flex; flex-direction: column; gap: 4px; }
.paylog-preview { background: var(--panel); border: 1px dashed var(--line); border-radius: 7px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; min-height: 20px; }
.paylog-actions { display: flex; align-items: center; gap: 10px; }
.paylog-actions .primary { background: var(--accent); color: var(--accent-ink); border: 0; padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.paylog-actions .primary:disabled { opacity: .6; cursor: default; }
.paylog-hint { font-size: 11px; }

/* review-link picker */
.review-orders { display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow-y: auto; }
.review-ord { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line);
  background: var(--panel); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.review-ord:hover { border-color: var(--accent); background: #f0faf8; }
.review-ord .ro-no { font-weight: 600; }
.review-ord .ro-mid { flex: 1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-ord .ro-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.review-result { margin-top: 8px; }
.review-result:empty { margin-top: 0; }
.review-msg { background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.review-warn { color: #b42318; font-size: 13px; margin-bottom: 8px; font-weight: 600; }
.review-fallback { font-size: 12px; color: var(--muted); margin-top: 8px; }
.review-actions { margin-top: 10px; display: flex; gap: 8px; }
.review-actions .primary { background: var(--accent); color: var(--accent-ink); border: 0; padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0; text-decoration: underline; }

/* profile toggle button is desktop-redundant (pane always shown); mobile-only */
#btn-cust { display: none; }

/* integrations panel */
.int-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.int-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.int-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.int-check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 4px; }
.int-check input { width: auto; }
.int-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.int-actions button[type="submit"] { background: var(--accent); color: #fff; border: 0; padding: 10px 18px; border-radius: 8px; cursor: pointer; }
.int-actions .mini-btn { padding: 10px 14px; }

/* integrations tabs */
.int-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.int-tab { border: 0; background: transparent; padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer; border-radius: 6px 6px 0 0; }
.int-tab:hover { background: #f2f5f6; }
.int-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.int-pane { display: block; }
.store-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 12px; }
.store-tab { border: 0; background: transparent; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer; border-radius: 6px 6px 0 0; }
.store-tab:hover { background: var(--panel-2, #f2f5f6); }
.store-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.cat-toggle, .page-row { cursor: pointer; }
.int-pane.hidden { display: none; }
.ch-list { display: flex; flex-direction: column; gap: 12px; }
.ch-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.ch-card.ch-new { border-style: dashed; background: #fafcfc; }
.ch-card input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; width: 100%; }
.ch-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ch-card-head input { flex: 1; font-weight: 700; }
.badge-new { font-size: 10px; font-weight: 700; color: #1d6fb8; background: #e8f2fc; border-radius: 999px; padding: 2px 8px; }
.ch-toggles { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; }
.ch-msg { font-size: 13px; margin-top: 4px; }
.ch-msg.error { color: #b42318; }
.ch-msg.ok { color: #128c7e; }
.mini-btn.danger { color: #b42318; border-color: #f0c8c0; background: #fff5f3; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; background: #f7f9fa; }
.qr-status { font-size: 14px; font-weight: 600; }
.qr-ok { color: #128c7e; }
.qr-bad { color: #b42318; }
.qr-wait { color: #b26a00; }
.qr-image { margin-top: 14px; text-align: center; }
.qr-image img { width: 260px; height: 260px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.qr-hint { font-size: 12px; color: var(--muted, #667); margin-top: 8px; }

/* products */
.prod-search { display: flex; gap: 8px; margin-bottom: 12px; }
.prod-search input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.prod-search button { background: var(--accent); color: #fff; border: 0; padding: 10px 16px; border-radius: 8px; cursor: pointer; }
.product-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; }
.product-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.product-thumb { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 6px; overflow: hidden; background: #f2f4f6; display: flex; align-items: center; justify-content: center; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-info { flex: 1; min-width: 0; }
.product-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-price { font-size: 12px; color: var(--muted); margin-top: 2px; }
.product-price .oos { color: #b42318; }
.product-send { background: var(--accent); color: #fff; border: 0; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.product-send:disabled { opacity: .6; cursor: default; }
/* multi-select product rows */
.product-toggle { cursor: pointer; transition: border-color .12s, background .12s; }
.product-toggle:hover { border-color: var(--accent); }
.product-toggle.selected { border-color: var(--accent); background: #f0faf8; }
.product-check { width: 20px; height: 20px; flex: 0 0 20px; border: 2px solid var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.product-toggle.selected .product-check { background: var(--accent); border-color: var(--accent); }
.product-toggle.selected .product-check:after { content: '✓'; color: #fff; font-size: 13px; font-weight: 700; }
.product-selbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--line); }
.product-selbar .primary { background: var(--accent); color: var(--accent-ink); border: 0; padding: 9px 18px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.product-selbar .primary:disabled { opacity: .6; cursor: default; }

/* video thumbnail in thread */
.media-vid { position: relative; display: inline-block; cursor: pointer; max-width: 240px; }
.media-vid video { max-width: 240px; max-height: 260px; border-radius: 8px; display: block; background: #000; }
.play-badge { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; pointer-events: none; }
.media-img { cursor: pointer; }

/* media lightbox */
.media-overlay { background: rgba(0,0,0,.85); }
.media-stage { max-width: 92vw; max-height: 88vh; display: flex; align-items: center; justify-content: center; }
.media-stage img, .media-stage video { max-width: 92vw; max-height: 88vh; border-radius: 6px; }
.media-x { position: fixed; top: 14px; right: 20px; background: none; border: 0; color: #fff; font-size: 40px; line-height: 1; cursor: pointer; z-index: 60; }

/* ---- channel badge ---- */
.ch { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; margin-right: 5px; }
.ch svg { display: block; }
#thread-title .ch { margin-right: 6px; }

/* ---- high-value pill ---- */
.pill-hv { display: inline-block; font-size: 10px; font-weight: 700; color: #b42318;
  background: #fff0e6; border: 1px solid #f5c6a5; border-radius: 999px; padding: 1px 7px;
  margin-left: 6px; white-space: nowrap; vertical-align: middle; }
#thread-title .pill-hv { font-size: 11px; }

/* New Comer pill — first-time contact */
.pill-nc { display: inline-block; font-size: 10px; font-weight: 700; color: #1d6fb8;
  background: #e8f2fc; border: 1px solid #b8d9f5; border-radius: 999px; padding: 1px 7px;
  margin-left: 6px; white-space: nowrap; vertical-align: middle; }
#thread-title .pill-nc { font-size: 11px; }

/* Lapsed pill — existing customer with no order in 12 months */
.pill-lapsed { display: inline-block; font-size: 10px; font-weight: 700; color: #92600a;
  background: #fdf3e0; border: 1px solid #f0d59a; border-radius: 999px; padding: 1px 7px;
  margin-left: 6px; white-space: nowrap; vertical-align: middle; }
#thread-title .pill-lapsed { font-size: 11px; }
/* WhatsApp COD confirmation chips */
.pill-wa { display: inline-block; font-size: 10px; font-weight: 700; border-radius: 999px;
  padding: 1px 7px; margin-left: 6px; white-space: nowrap; vertical-align: middle; border: 1px solid; }
.pill-wa-ok   { color: #0a7d34; background: #e8f6ec; border-color: #b7e2c2; }
.pill-wa-pend { color: #8a5a00; background: #fff5e0; border-color: #f2d492; }
.pill-wa-chg  { color: #b23c00; background: #fdeee4; border-color: #f2c19a; }
#thread-title .pill-wa { font-size: 11px; }
/* Manual WhatsApp confirmation button (order overlay) */
.wac-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; padding: 10px 12px;
  background: #f0faf4; border: 1px solid #cdebd6; border-radius: 8px; }
.wac-btn { font-size: 13px; font-weight: 600; color: #fff; background: #128c7e; border: 0; border-radius: 7px;
  padding: 7px 13px; cursor: pointer; white-space: nowrap; }
.wac-btn:hover { background: #0e7367; }
.wac-btn:disabled { opacity: .6; cursor: default; }
.wac-hint { font-size: 12px; color: var(--muted); }
.wac-done { font-size: 13px; font-weight: 700; color: #0a7d34; }
.wac-sent { font-size: 13px; color: #0a7d34; }

/* WhatsApp Cloud 24-hour service-window countdown */
.wa-win { display: inline-block; font-size: 10px; font-weight: 700; border-radius: 999px;
  padding: 1px 8px; margin-left: 6px; white-space: nowrap; vertical-align: middle; }
.wa-win-open { color: #1a7d47; background: #e7f6ee; border: 1px solid #b6e2c8; }
.wa-win-soon { color: #92600a; background: #fdf3e0; border: 1px solid #f0d59a; }
.wa-win-closed { color: #b42318; background: #fdeceb; border: 1px solid #f3c0bb; }
#thread-title .wa-win { font-size: 11px; }

/* Manual "marked unread" dot (no real inbound backlog) */
.badge-dot { background: var(--accent); color: #fff; line-height: 1; padding: 2px 6px; }

/* Email channel: badge, ticket pill, subject line, attachment chips */
.ch-email { filter: none; }
.pill-ticket { display: inline-block; font-size: 10px; font-weight: 700; color: #3730a3;
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 999px; padding: 1px 7px;
  margin-left: 6px; white-space: nowrap; vertical-align: middle; }
#thread-title .pill-ticket { font-size: 11px; }
.thread-email { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-left: 6px;
  cursor: pointer; user-select: all; vertical-align: middle; }
.thread-email:hover { color: var(--accent); text-decoration: underline; }
.thread-email.copied { color: #1a7d47; }
.thread-head { flex-wrap: wrap; }
.thread-subject { flex-basis: 100%; width: 100%; font-size: 12px; font-weight: 500; color: var(--muted);
  margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eatts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.eatt { font-size: 12px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); text-decoration: none; color: var(--accent); }
.int-row { display: flex; gap: 12px; align-items: flex-start; }
.int-textarea { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line);
  border-radius: 8px; resize: vertical; box-sizing: border-box; }
.pw-form select { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Cross-channel identity (Phase 2) */
.ident-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin: 10px 12px 0; }
.ident-head { font-size: 14px; margin-bottom: 8px; }
.ident-wc { font-size: 10px; font-weight: 700; color: #128c7e; background: #e7f7f2;
  border: 1px solid #a9e3d4; border-radius: 999px; padding: 1px 6px; }
.ident-chans { display: flex; flex-wrap: wrap; gap: 6px; }
.ident-chan { display: inline-flex; align-items: center; gap: 4px; font-size: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; max-width: 100%; }
.ident-cid { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.ident-unlink { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 0 0 2px; }
.ident-unlink:hover { color: #c0392b; }
.ident-sub { font-size: 11px; font-weight: 700; color: var(--muted); margin: 10px 0 5px; text-transform: uppercase; letter-spacing: .03em; }
.ident-convs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ident-conv { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }
.ident-conv.current { border-color: var(--accent); background: #e7f7f2; }
.ident-unread { background: var(--accent); color: #fff; border-radius: 999px; font-size: 10px; padding: 0 5px; }
/* Collapsed cross-channel thread summary (Option A) — keeps the card short. */
.ident-threads { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 10px;
  font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--text); }
.ident-threads:hover { border-color: var(--accent); }
.ident-chev { color: var(--muted); transition: transform .15s; }
.ident-threads.open .ident-chev { transform: rotate(180deg); }
.ident-actions { display: flex; gap: 6px; margin-top: 10px; }
.thread-crosschan { display: inline-flex; align-items: center; gap: 4px; }
.cc-lbl { font-size: 11px; color: var(--muted); }
.cc-badge { border: none; background: none; cursor: pointer; padding: 0; }
/* Combined timeline */
.tl-list { max-height: 60vh; overflow-y: auto; padding: 4px; }
.tl-row { padding: 7px 10px; border-left: 3px solid var(--line); margin: 6px 0; background: var(--panel); border-radius: 0 8px 8px 0; }
.tl-row.us { border-left-color: var(--accent); }
.tl-meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; display: flex; align-items: center; gap: 4px; }
.tl-body { font-size: 13px; }
/* People search (link modal) */
.pl-list { max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.pl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px; border-bottom: 1px solid var(--line); }
.pl-info { font-size: 13px; min-width: 0; }
.pl-link { flex: none; }

/* courier tracking card (right pane) */
.track-slot { margin: 12px 0; }
.track-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.track-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px;
  background: #f4f8f8; border-bottom: 1px solid var(--line); font-size: 13px; }
.track-head a { color: var(--accent); text-decoration: none; }
.track-refresh { border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; color: var(--muted); }
.track-refresh:hover { color: var(--accent); }
.track-status { text-align: center; font-weight: 700; font-size: 14px; padding: 9px 10px; background: #f6e679; color: #000; }
.track-clickable { cursor: pointer; }
.track-clickable:hover { background: #fafcfc; }
.track-more { padding: 6px 10px; font-size: 12px; color: var(--accent); font-weight: 600; }
.track-note { padding: 10px; font-size: 13px; }
.track-loading { font-size: 13px; padding: 6px 2px; }

/* tracking detail overlay */
.track-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.track-grid .tk { border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; font-size: 13px; }
.track-current { text-align: center; font-weight: 700; font-size: 15px; background: #f6e679; color: #000; padding: 11px; border-radius: 8px; margin: 14px 0; }
.track-full { width: 100%; border-collapse: collapse; font-size: 13px; }
.track-full th, .track-full td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.track-full th { background: #fafcfc; color: var(--muted); font-weight: 600; }
.track-full tr:nth-child(even) td { background: #fafcfc; }
@media (max-width: 640px) { .track-grid { grid-template-columns: 1fr; } }

/* AI training export */
.ai-counts { font-size: 14px; padding: 10px 12px; background: #f4f8f8; border: 1px solid var(--line); border-radius: 8px; }
.ai-dl { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ai-btn { display: flex; flex-direction: column; text-decoration: none; color: #fff; background: var(--accent);
  padding: 12px 14px; border-radius: 8px; font-weight: 600; }
.ai-btn:hover { filter: brightness(0.96); }
.ai-btn small { font-weight: 400; opacity: 0.9; font-size: 12px; margin-top: 2px; }
.ai-btn code { background: rgba(255,255,255,0.2); padding: 0 4px; border-radius: 4px; }

/* CRM high-value threshold row */
.crm-threshold { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
  padding: 8px 10px; background: #fff8e6; border: 1px solid #f2e2b6; border-radius: 8px; font-size: 13px; }
.crm-threshold label { font-weight: 600; }
.crm-threshold input { width: 130px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }

/* ---- label chips ---- */
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.conv-prev + .chips { margin-top: 5px; }
.chip { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); }
.thread-labels { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* label filter chips under the filters row */
.label-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.label-filters:empty { display: none; }
.lf { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  color: var(--c); background: #fff; border: 1px solid color-mix(in srgb, var(--c) 45%, #fff); }
.lf.active { color: #fff; background: var(--c); border-color: var(--c); }
.lf-n { opacity: .7; font-weight: 700; }

/* search row */
.search-row { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.search-row input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }

/* label manager modal */
.labels-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.label-row { display: flex; align-items: center; gap: 6px; }
.label-toggle { flex: 1; display: flex; align-items: center; gap: 8px; text-align: left; font-size: 13px; font-weight: 600;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.label-toggle.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); }
.label-toggle .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; }
.label-del { border: 0; background: #f7f9fa; border-radius: 6px; padding: 6px 9px; cursor: pointer; }
.label-del:hover { background: #fde8e8; }
.add-label { display: flex; gap: 8px; align-items: center; }
.add-label input[type="text"], .add-label input#lb-name { flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.add-label input[type="color"] { width: 40px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.add-label button { background: var(--accent); color: #fff; border: 0; padding: 10px 16px; border-radius: 8px; cursor: pointer; }

/* wide modals (dashboard / crm) */
.modal-wide { width: 900px; }
.dash-range { display: flex; align-items: center; gap: 10px; }
.dash-range select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }

/* dashboard */
.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 14px; }
.kpi { background: #f4f8f7; border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.kpi-v { font-weight: 800; font-size: 18px; color: var(--accent); }
.kpi-l { font-size: 11px; color: var(--muted); margin-top: 3px; }
.kpi-bad { background: #fdecea; border-color: #f3b6ad; }
.kpi-bad .kpi-v { color: #c0392b; }
.dash-err-h { color: #c0392b; }
.dash-err-note { font-size: 12px; color: var(--muted); margin: -2px 0 8px; }
.dash-alert { background: #fdecea; border: 1px solid #e6b0a8; border-left: 5px solid #c0392b; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.dash-alert-title { font-weight: 800; color: #a5281b; font-size: 14px; }
.dash-alert-body { font-size: 13px; color: #7d271d; margin-top: 4px; }
.dash-alert-meta { font-size: 12px; color: #8a4b43; margin-top: 6px; }
.dash-alert-meta a { color: #c0392b; font-weight: 700; }
.dash-hl { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.hl { font-size: 13px; background: #fff8e6; border: 1px solid #f2e2b6; border-radius: 8px; padding: 6px 10px; }
.dash-sub { font-weight: 700; margin: 16px 0 8px; font-size: 14px; }
.dash-tbl, .crm-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-tbl th, .dash-tbl td, .crm-tbl th, .crm-tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.dash-tbl th, .crm-tbl th { color: var(--muted); font-size: 12px; font-weight: 600; }
.dash-tbl .bar { display: inline-block; width: 80px; height: 7px; background: #eceff1; border-radius: 4px; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.dash-tbl .bar span { display: block; height: 100%; background: var(--accent); }
.hchart { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding-top: 6px; }
.hbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.hbar span { width: 70%; min-height: 1px; background: var(--accent); border-radius: 2px 2px 0 0; }
.hbar em { font-size: 8px; color: var(--muted); font-style: normal; margin-top: 2px; }
.dchart { display: flex; align-items: flex-end; gap: 5px; height: 120px; }
.dcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.dstack { display: flex; align-items: flex-end; gap: 2px; height: 100%; width: 100%; justify-content: center; }
.dstack span { width: 42%; min-height: 1px; border-radius: 2px 2px 0 0; }
.din { background: #128c7e; } .dout { background: #9fd8cf; }
.dcol em { font-size: 9px; color: var(--muted); font-style: normal; margin-top: 3px; }
.dlegend { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.dlegend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* dashboard subtabs */
.dash-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 12px; border-bottom: 1px solid var(--line); }
.dtab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted); }
.dtab:hover { border-color: var(--accent); color: var(--accent); }
.dtab.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* metric cards (KPI look) */
.mcard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mcard { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px; box-shadow: var(--shadow); }
.mcard-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mcard-ic { width: 30px; height: 30px; flex: none; border-radius: 8px; display: inline-flex; align-items: center;
  justify-content: center; background: #eaf5f2; font-size: 15px; }
.mcard-lbl { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; line-height: 1.2; }
.mcard-v { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1.1; }
.mcard-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.mcard-good .mcard-v { color: #1a9d5a; }
.mcard-good .mcard-ic { background: #e6f7ee; }
.mcard-bad { background: #fdecea; border-color: #f3b6ad; }
.mcard-bad .mcard-v { color: #c0392b; }
.mcard-bad .mcard-ic { background: #fbddd8; }

/* dashboard section panel */
.dash-panel { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.dash-panel > .dash-sub:first-child { margin-top: 0; }
.dash-empty { text-align: center; color: var(--muted); padding: 28px 16px; font-size: 13px; }

/* CRM */
.crm-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.crm-controls input, .crm-controls select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.crm-controls #crm-q { flex: 1; min-width: 160px; }
.crm-controls input[type="number"] { width: 100px; }
.crm-controls button[type="submit"] { background: var(--accent); color: #fff; border: 0; padding: 8px 16px; border-radius: 8px; cursor: pointer; }
.crm-summary { font-size: 12px; margin-bottom: 8px; }
.crm-body { max-height: 56vh; overflow-y: auto; }

/* auto-reply */
.ar-status { font-size: 12px; margin: 2px 0 4px; }
.ok-dot, .off-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.ok-dot { background: #0f7b48; } .off-dot { background: #b42318; }
.ar-days { display: flex; flex-direction: column; gap: 6px; }
.ar-day { display: flex; align-items: center; gap: 8px; }
.ar-open { display: flex; align-items: center; gap: 6px; width: 84px; font-size: 13px; }
.ar-day input[type="time"] { padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.ar-holidays { display: flex; flex-direction: column; gap: 5px; }
.ar-hol { display: flex; align-items: center; justify-content: space-between; font-size: 13px; background: #f7f9fa; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }
.ar-hdel { border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; line-height: 1; }
.ar-add-holiday { display: flex; gap: 8px; margin-top: 8px; }
.ar-add-holiday input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.ar-add-holiday input[type="date"] { flex: 0 0 auto; }
.ar-add-holiday input#ar-hname { flex: 1; }

/* =========================== mobile =========================== */
@media (max-width: 820px) {
  .modal-wide { width: 96vw; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .mcard-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-tabs { padding: 0 12px 10px; }
  .crm-body, .dash-body { -webkit-overflow-scrolling: touch; }
  .dash-tbl, .crm-tbl { min-width: 520px; }
  .dash-body, .crm-body { overflow-x: auto; }
  .topbar { gap: 8px; padding: 8px 12px; }
  .brand { font-size: 15px; }
  #who { display: none; }
  .topbar .link { font-size: 13px; }

  .body { position: relative; }
  .list { width: 100%; border-right: 0; }
  .thread { display: none; }
  .app.thread-open .list { display: none; }
  .app.thread-open .thread { display: flex; }

  .back-btn { display: inline-block; }
  #btn-cust { display: inline-block; }
  .msg { max-width: 82%; }

  /* customer pane becomes a right slide-over */
  .cust-pane { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 88vw);
    transform: translateX(100%); transition: transform .22s ease; box-shadow: -8px 0 30px rgba(0,0,0,.18); z-index: 30; }
  .app.cust-open .cust-pane { transform: none; }
  .cust-head .x { display: block; }

  .modal { width: 96vw; padding: 16px; }
  .add-user { grid-template-columns: 1fr; }
}

/* ---- WhatsApp automations ---- */
#automations-body { display: flex; flex-direction: column; gap: 16px; }
.auto-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--card, #fff); }
.auto-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.auto-title { font-size: 16px; font-weight: 650; }
.auto-trig { font-size: 12px; margin-left: 6px; }
.auto-grid { display: flex; flex-direction: column; gap: 7px; }
.auto-grid .int-label { margin-top: 6px; }
.auto-grid input[type=number] { width: 90px; }
.auto-grid select, .auto-grid textarea, .a-coupon-code { width: 100%; max-width: 520px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font: inherit; background: #fff; }
.auto-grid textarea { resize: vertical; }
.a-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 2px; }
.a-chip { font-size: 11px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: #f6f7f9; cursor: pointer; color: var(--muted); }
.a-chip:hover { border-color: var(--accent); color: var(--accent); }
.a-map { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.a-map-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.a-map-k { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); min-width: 78px; }
.a-map-row select { width: auto; min-width: 150px; }
.a-preview { margin: 4px 0; }
.a-prev-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
.a-prev-body { font-size: 13.5px; background: #f0f7ff; border: 1px solid #d7e7fb; border-radius: 8px; padding: 9px 12px; line-height: 1.5; }
.auto-adv { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.a-coupon-row { display: flex; align-items: center; gap: 10px; }
.auto-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.auto-actions .a-save { padding: 8px 20px; }
.a-msg { font-size: 13px; }
.a-msg.ok { color: #1a9d5a; } .a-msg.err { color: #d64545; } .a-msg.muted { color: var(--muted); }
.auto-log { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 12.5px; }
.auto-log-sum { margin-bottom: 6px; }
.auto-log-rows { display: flex; flex-direction: column; gap: 3px; }
.alog { display: flex; align-items: center; gap: 8px; }
.alog-st { font-size: 11px; padding: 1px 7px; border-radius: 999px; text-transform: capitalize; }
.alog-sent { background: #e7f6ee; color: #1a9d5a; }
.alog-skipped { background: #eef0f3; color: #6a7686; }
.alog-failed { background: #fdecea; color: #d64545; }
.alog-pending, .alog-processing { background: #fff4e0; color: #b9791a; }
/* toggle switch */
.aswitch { position: relative; display: inline-block; width: 42px; height: 24px; }
.aswitch input { opacity: 0; width: 0; height: 0; }
.aslider { position: absolute; inset: 0; background: #ccd2da; border-radius: 999px; transition: .2s; cursor: pointer; }
.aslider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.aswitch input:checked + .aslider { background: #1a9d5a; }
.aswitch input:checked + .aslider:before { transform: translateX(18px); }

/* automation steps (multi-step + voice) */
.a-steps { display: flex; flex-direction: column; gap: 10px; }
.a-step { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fafbfc; display: flex; flex-direction: column; gap: 6px; }
.a-step-head { display: flex; align-items: center; justify-content: space-between; }
.a-step-n { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.a-step-del { border: 0; background: none; cursor: pointer; color: #d64545; font-size: 14px; }
.a-step-add { align-self: flex-start; background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 13px; padding: 4px 0; }
.a-voice { margin-top: 2px; }
.a-voice-row { display: flex; align-items: center; gap: 10px; }
.a-voice-add { padding: 5px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; font-size: 13px; }
.a-voice-del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; }
.a-voice-status { font-size: 13px; color: var(--muted); }

/* automation dashboard */
#auto-dash { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--card, #fff); margin-bottom: 16px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dash-title { font-weight: 700; font-size: 15px; }
.dash-ranges { display: flex; gap: 4px; }
.dash-range { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 4px 10px; cursor: pointer; font-size: 12px; color: var(--muted); }
.dash-range.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.dash-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fafbfc; }
.dash-card.dash-hi { background: #f0faf5; border-color: #cdeeda; }
.dash-n { font-size: 22px; font-weight: 700; line-height: 1.1; }
.dash-n.ok { color: #1a9d5a; }
.dash-l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dash-sub { display: block; font-size: 10.5px; opacity: .8; }
.dash-rate { margin: 12px 0 6px; font-size: 12.5px; color: var(--text); }
.dash-rate input { width: 64px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; }
.dash-tbl { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12.5px; }
.dash-tbl th, .dash-tbl td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.dash-tbl th:first-child, .dash-tbl td:first-child { text-align: left; }
.dash-tbl th { color: var(--muted); font-weight: 600; }
.dash-tbl td.ok { color: #1a9d5a; }
.dash-note { font-size: 11.5px; margin-top: 8px; }

/* automation tabs + leads list */
.auto-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.auto-tab { border: 0; background: none; padding: 9px 14px; cursor: pointer; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auto-tab.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.lead-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.lead-sum { font-size: 14px; }
.lead-controls { display: flex; gap: 12px; align-items: center; }
.lead-filters, .lead-ranges { display: inline-flex; gap: 4px; }
.lead-filter, .lead-range { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 4px 10px; cursor: pointer; font-size: 12px; color: var(--muted); }
.lead-filter.on, .lead-range.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.lead-tblwrap { overflow-x: auto; }
.lead-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.lead-tbl th, .lead-tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lead-tbl th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.lead-sub { font-size: 11.5px; margin-top: 2px; }
.lead-open { padding: 0; font-size: 13px; font-weight: 600; text-align: left; }
.lead-yes { color: #1a9d5a; font-weight: 700; }
.lead-no { color: var(--muted); }
.lead-rem { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: #eef1f4; color: var(--muted); }
.lead-rem-sent { background: #e7f6ee; color: #1a7d47; }
.lead-rem-scheduled { background: #fef3e0; color: #a86717; }
.lead-rem-failed { background: #fdeaea; color: #c0392b; }

/* ---- Campaigns tab (Phase 1 cart blast) ---- */
.camp-wrap { padding: 16px; }
.camp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; max-width: 620px; box-shadow: var(--shadow); }
.camp-title { font-size: 16px; font-weight: 700; color: var(--text); }
.camp-sub { margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.camp-sub code { background: #eef1f4; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.camp-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.camp-lbl { font-size: 13px; font-weight: 600; color: var(--text); }
.camp-days { display: inline-flex; gap: 6px; }
.camp-day { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.camp-day.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.camp-actions { display: flex; gap: 10px; margin-top: 20px; }
.camp-actions .btn-primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
.camp-actions .btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer; }
.camp-actions button:disabled { opacity: .5; cursor: not-allowed; }
.camp-result { margin-top: 16px; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.camp-result.err { color: #c0392b; }
.camp-result.ok { color: #1a7d47; }
.camp-input { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 14px; color: var(--text); background: var(--panel); font-family: inherit; margin-bottom: 4px; }
textarea.camp-input { resize: vertical; }
.camp-img { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.camp-img-prev { max-height: 90px; max-width: 160px; border-radius: 8px; border: 1px solid var(--line); }
.camp-img-thumbs { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.camp-thumb { position: relative; }
.camp-thumb img { height: 72px; width: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.camp-thumb-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--danger, #c0392b); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; }

/* ---- Vendor Intelligence ---- */
.vend-tab { border: 0; background: transparent; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; border-radius: 6px 6px 0 0; }
.vend-tab:hover { background: var(--panel-2, #f2f5f6); }
.vend-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.vend-pane { display: block; }
.vend-qr-status { font-size: 14px; padding: 10px 0; }
.qr-ok { color: #1f7a4d; } .qr-wait { color: #a4610a; } .qr-bad { color: #c0392b; }
.vend-qr-image img { max-width: 240px; border: 1px solid var(--line); border-radius: 8px; }
.qr-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.vend-group { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.vend-toggle { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.vend-group-main { flex: 1; min-width: 0; }
.vend-group-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vend-group-meta { font-size: 12px; }
.vend-vendor { width: 160px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.vend-filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.vend-filters select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
.vend-msg { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel); }
.vend-msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.vend-msg-vendor { font-weight: 600; font-size: 13px; }
.vend-msg-sender { font-size: 12px; } .vend-msg-time { font-size: 12px; margin-left: auto; }
.vend-msg-body { font-size: 14px; white-space: pre-wrap; }
.vend-media img { max-width: 220px; max-height: 220px; border-radius: 8px; border: 1px solid var(--line); margin: 4px 0; display: block; }
.vend-media a { font-size: 13px; }
.v-doc { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2, #eef1f3); color: var(--ink-2, #4a5464); white-space: nowrap; }
.v-doc-price { background: #e2f1ef; color: #0a5a55; } .v-doc-stock { background: #e7eefb; color: #2f5fa8; }
.v-doc-inv { background: #f3e9fb; color: #7a3ca8; } .v-doc-new { background: #e6f4ec; color: #1f7a4d; }
.v-doc-oos { background: #fbeedd; color: #a4610a; } .v-doc-chat { background: #eef1f3; color: #7c8a9a; }
.v-doc-pending { background: #eef1f3; color: #7c8a9a; }
.vend-items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vend-items-table th, .vend-items-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.vend-items-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.vend-review td { background: rgba(164,97,10,.06); }
.camp-row { flex-wrap: wrap; }
.camp-when { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.camp-when label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); cursor: pointer; }
.camp-at { width: auto; margin-bottom: 0; }
.camp-at:disabled { opacity: .5; }
.camp-list { max-width: 620px; margin: 22px auto 0; }
.camp-list-h { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.camp-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin-bottom: 8px; }
.camp-item-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.camp-item-name { font-weight: 600; color: var(--text); }
.camp-item-when { font-size: 12.5px; }
.camp-item-meta { font-size: 12.5px; grid-column: 1; }
.camp-item-act { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 10px; }
.camp-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.camp-b-draft { background: #eef1f4; color: var(--muted); }
.camp-b-scheduled { background: #fef3e0; color: #a86717; }
.camp-b-running { background: #e2f0fb; color: #1c6fb3; }
.camp-b-done { background: #e7f6ee; color: #1a7d47; }
.camp-b-canceled { background: #fdeaea; color: #c0392b; }

/* ---- Segment (AST) builder + audience toggle ---- */
.camp-aud { display: inline-flex; gap: 6px; margin-bottom: 8px; }
.camp-aud-b { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: 7px 15px; font-size: 13px; cursor: pointer; }
.camp-aud-b.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.camp-row2 { display: flex; align-items: center; gap: 12px; margin: 6px 0 2px; }
.seg-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); margin-bottom: 6px; }
.seg-group .seg-group { background: var(--panel); }
.seg-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.seg-op { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 6px; font-weight: 700; font-size: 12px; padding: 3px 12px; cursor: pointer; }
.seg-op-lbl { font-size: 12.5px; color: var(--muted); }
.seg-kids { display: flex; flex-direction: column; gap: 6px; padding-left: 10px; border-left: 2px solid var(--line); }
.seg-rule { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seg-in { width: auto; margin-bottom: 0; padding: 6px 9px; font-size: 13px; }
.seg-fixed { font-weight: 700; color: var(--muted); padding: 0 2px; }
.seg-rm { color: #c0392b; font-size: 12px; }
.seg-add { display: flex; gap: 12px; margin-top: 8px; padding-left: 10px; }
.dash-scroll { overflow-x: auto; }
.camp-test { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.camp-test-in { width: auto; margin-bottom: 0; }
.camp-test-ok { color: #1a7d47; }
.camp-test-err { color: #c0392b; }

/* Blocked-sender button state */
.mini-btn.blocked { background:#fdecec; color:#c0392b; border-color:#e6b0aa; }

/* ===================== AI Bot addon ===================== */
.ab-tab { padding:8px 14px; border:none; background:transparent; cursor:pointer; font-size:0.95em; border-bottom:2px solid transparent; }
.ab-tab.active { border-bottom-color:#2563eb; font-weight:600; }
.ab-panel { padding:6px 2px; max-height:70vh; overflow-y:auto; }
.ab-pre { background:#0001; padding:10px; border-radius:8px; font-size:12px; white-space:pre-wrap; max-height:220px; overflow:auto; }
.ab-item { border:1px solid #8883; border-radius:10px; padding:10px 12px; margin:8px 0; background:#0000000a; }
.ab-meta { font-size:12px; opacity:0.7; margin-bottom:6px; }
.ab-in { margin:4px 0; }
.ab-out { margin:4px 0; opacity:0.85; white-space:pre-wrap; }
.ab-draft { width:100%; min-height:70px; border:1px solid #8884; border-radius:8px; padding:8px; font:inherit; }
.ab-order pre { background:#0001; padding:8px; border-radius:8px; font-size:11px; }
.ab-actions { display:flex; gap:6px; align-items:center; margin-top:8px; flex-wrap:wrap; }
.ab-actions .ab-corr { flex:1; min-width:180px; }
.mini-btn.on { background:#2563eb; color:#fff; }
.ab-badge { display:inline-block; padding:1px 7px; border-radius:20px; font-size:11px; background:#8883; }
.ab-badge.ab-sent { background:#16a34a33; color:#16a34a; }
.ab-badge.ab-draft { background:#f59e0b33; color:#b45309; }
.ab-badge.ab-skipped { background:#8882; }
.ab-badge.ab-failed, .ab-badge.ab-error { background:#dc262633; color:#dc2626; }
.ab-stats-tbl { width:100%; border-collapse:collapse; font-size:12px; }
.ab-stats-tbl th, .ab-stats-tbl td { text-align:left; padding:4px 8px; border-bottom:1px solid #8882; }
.ab-autosend { display:flex; flex-direction:column; gap:6px; }
.ab-check { display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer; }
.ab-learning { margin:0 0 12px; }
.ab-learn-row { border:1px solid #8883; border-radius:10px; padding:10px 12px; background:#0000000a; font-size:13px; line-height:1.5; }
.ab-q { border-color:#e0a03399; background:#e0a0331a; }
.ab-question { font-size:13px; margin:6px 0; font-weight:600; }
.ab-ans { flex:1; min-width:180px; }
.ab-pb-scope { margin:6px 0 10px; }
.ab-pb-title { font-size:11px; text-transform:uppercase; letter-spacing:.05em; opacity:.7; margin-bottom:4px; }
.ab-pb-rule { display:flex; align-items:center; gap:8px; justify-content:space-between; font-size:13px; padding:5px 8px; border:1px solid #8882; border-radius:8px; margin:4px 0; }
.ab-pb-del { border:none; background:transparent; cursor:pointer; color:#c0392b; font-size:13px; padding:0 4px; }

/* ---- Back-in-stock demand panel ---- */
.wl-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.wl-tile { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.wl-num { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }
.wl-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.wl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wl-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.wl-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.wl-table .wl-c { text-align: center; font-variant-numeric: tabular-nums; }
.wl-prod { display: flex; align-items: center; gap: 10px; }
.wl-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--bg); flex: 0 0 auto; }
.wl-thumb-empty { display: inline-block; border: 1px dashed var(--line); }
.wl-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.wl-badge { display: inline-block; min-width: 26px; padding: 2px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); font-weight: 700; }
.wl-badge.hot { background: #fdecea; color: #c0392b; }
.wl-actions { text-align: right; white-space: nowrap; }
.wl-actions .mini-btn { margin-left: 6px; }
.wl-drill { margin-top: 4px; }
.wl-drill-head { margin: 18px 0 8px; font-size: 13px; color: var(--text); }
.wl-drill-table { background: var(--bg); border-radius: 8px; overflow: hidden; }

/* ---- Number mismatch banner (verified WhatsApp vs order phone) ---- */
.num-mm { margin-top: 10px; border-radius: 10px; padding: 10px 12px; font-size: 13px; border: 1px solid var(--line); }
.num-mm.mm-high { background: #fdecea; border-color: #f5c6c0; }
.num-mm.mm-info { background: #f4f6f8; }
.mm-title { font-weight: 700; margin-bottom: 6px; }
.num-mm.mm-high .mm-title { color: #c0392b; }
.mm-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.mm-k { color: var(--muted); min-width: 78px; }
.mm-ok { color: #1e7e34; font-size: 11px; font-weight: 700; }
.mm-bad { color: #c0392b; font-size: 11px; font-weight: 700; }
.num-mm .mm-flag { margin-top: 8px; }

/* ---- Money dashboard tab ---- */
.mrate { font-size:12px; color:var(--muted); margin:2px 2px 14px; }
.mrate input { width:56px; padding:4px 6px; border:1px solid var(--line); border-radius:6px; background:var(--panel); color:var(--text); font:inherit; font-size:13px; }
.mtiles { display:grid; grid-template-columns:repeat(4,1fr); gap:11px; margin-bottom:14px; }
.mtile { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:12px 13px; }
.mtile .ml { font-size:10.5px; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); font-weight:700; }
.mtile .mv { font-size:23px; font-weight:800; letter-spacing:-.02em; margin-top:6px; font-variant-numeric:tabular-nums; }
.mtile .mv.g { color:#1e7d3a; } .mtile .mv.a { color:var(--accent); } .mtile .mv.b { color:#c0392b; }
.mtile .ms { margin-top:4px; font-size:11.5px; color:var(--muted); font-variant-numeric:tabular-nums; }
.mm-d { font-weight:800; } .mm-d.g { color:#1e7d3a; } .mm-d.b { color:#c0392b; }
.mcallout { display:flex; gap:9px; align-items:flex-start; margin:0 0 14px; padding:11px 13px; border-radius:11px; background:#fbf0dd; border:1px solid #ecd39a; font-size:13px; color:var(--text); }
.mcallout b { color:#b0670a; }
.mgrid2 { display:grid; grid-template-columns:1fr 1fr; gap:11px; margin-bottom:14px; }
.mcard { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:12px 14px; }
.mfull { margin-bottom:14px; }
.mch-h { display:flex; align-items:baseline; justify-content:space-between; margin-bottom:8px; }
.mch-h h4 { margin:0; font-size:13.5px; } .mch-h span { font-size:11.5px; color:var(--muted); }
.mcard svg { display:block; width:100%; height:auto; }
.mbt { display:grid; grid-template-columns:160px 1fr 96px 92px; align-items:center; gap:12px; padding:9px 2px; border-top:1px solid var(--line); }
.mbt:first-of-type { border-top:0; }
.mbt-n { font-weight:600; font-size:13px; } .mbt-n small { display:block; color:var(--muted); font-weight:400; font-size:11px; }
.mbar { position:relative; height:22px; background:var(--bg); border-radius:6px; overflow:hidden; }
.mbar > span { position:absolute; left:0; top:0; bottom:0; border-radius:6px; }
.mbar b { position:absolute; right:8px; top:0; bottom:0; display:flex; align-items:center; font-size:11px; font-weight:700; color:var(--text); font-variant-numeric:tabular-nums; }
.mroas { text-align:right; font-variant-numeric:tabular-nums; font-weight:800; } .mroas small { display:block; font-weight:600; }
.mrev { text-align:right; font-variant-numeric:tabular-nums; font-size:13px; color:var(--muted); }
.mpill { font-size:10px; font-weight:800; padding:2px 7px; border-radius:999px; text-transform:uppercase; }
.mpill.g { color:#1e7d3a; background:#e7f4ec; } .mpill.w { color:#b0670a; background:#fbf0dd; } .mpill.m { color:var(--muted); background:var(--bg); }
.mtbl { width:100%; border-collapse:collapse; font-size:13px; }
.mtbl th, .mtbl td { padding:8px 10px; text-align:right; font-variant-numeric:tabular-nums; border-top:1px solid var(--line); }
.mtbl th { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.03em; font-weight:700; border-top:0; }
.mtbl th:first-child, .mtbl td:first-child { text-align:left; }
.mfoot { font-size:11.5px; color:var(--muted); margin:6px 2px; line-height:1.6; }
@media(max-width:820px){ .mtiles{grid-template-columns:repeat(2,1fr)} .mgrid2{grid-template-columns:1fr} .mbt{grid-template-columns:120px 1fr 74px} .mrev{display:none} }

/* ---- Money: reviews card ---- */
.rv-top { display:grid; grid-template-columns:auto auto auto 1fr; gap:18px; align-items:center; padding:4px 2px 12px; }
.rv-stat .rv-v { font-size:22px; font-weight:800; font-variant-numeric:tabular-nums; letter-spacing:-.02em; }
.rv-stat .rv-v.g { color:#1e7d3a; } .rv-stat .rv-v.a { color:var(--accent); }
.rv-stat .rv-l { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; font-weight:700; margin-top:2px; }
.rv-best { background:var(--bg); border:1px solid var(--line); border-radius:10px; padding:9px 12px; font-size:13px; align-self:stretch; display:flex; flex-direction:column; justify-content:center; }
.rv-best b { color:var(--accent); }
.rv-best small { display:block; color:var(--muted); font-size:11.5px; margin-top:3px; line-height:1.45; }
.rv-hist .rv-ht { font-size:11px; color:var(--muted); margin:2px 2px 2px; }
.rv-hist svg { display:block; width:100%; height:auto; }
@media(max-width:820px){ .rv-top{grid-template-columns:1fr 1fr; } .rv-best{grid-column:1 / -1;} }

/* Two-factor auth */
.twofa-qr { display: block; margin: 8px 0; width: 200px; height: 200px; border: 1px solid #e5e7eb; border-radius: 6px; }
.twofa-codes { background: #f6f8fa; padding: 12px; border-radius: 6px; font-family: ui-monospace, Menlo, monospace; letter-spacing: 1px; line-height: 1.9; white-space: pre; }
.twofa-on { color: #128c7e; font-weight: 600; margin-bottom: 6px; }
#twofa-body .chk, .login-card .chk { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 6px 0; }
#twofa-body code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }
button.danger { background: #b42318; color: #fff; border: none; }

/* ---- Courier Tracker (dashboard → Couriers) ---- */
.ct-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ct-tabs { display: flex; gap: 8px; }
.ct-tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line);
  background: #fff; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); }
.ct-tab.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ct-tab .ct-cnt { font-size: 11px; opacity: .7; font-weight: 600; }
.ct-tab .ct-badge { background: #e02424; color: #fff; border-radius: 999px; font-size: 10px; padding: 1px 6px; font-weight: 700; }
.ct-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; flex-wrap: wrap; }
.ct-pill { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.ct-pill.ct-overdue { background: #fde8e8; color: #b91c1c; }
.ct-pill.ct-due { background: #fef3c7; color: #92620a; }
.ct-note { font-size: 12px; margin-bottom: 8px; }
.ct-list { display: flex; flex-direction: column; gap: 6px; }
.ct-row { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.ct-row.ct-overdue { border-left: 4px solid #e02424; }
.ct-row.ct-due { border-left: 4px solid #f0a30a; }
.ct-row.ct-ok { border-left: 4px solid #16a34a; }
.ct-row.ct-del { border-left: 4px solid #9aa5b1; }
.ct-row.ct-ret { border-left: 4px solid #8b5cf6; }
.ct-row.ct-none { border-left: 4px solid #cbd2d9; }
.ct-main { display: grid; grid-template-columns: 20px 122px 62px minmax(84px,1fr) minmax(116px,1.5fr) 66px 46px 14px; gap: 8px;
  align-items: center; padding: 9px 12px; cursor: pointer; font-size: 13px; }
.ct-main:hover { background: #f9fafb; }
.ct-flag { text-align: center; }
.ct-cn { font-family: ui-monospace, Menlo, monospace; font-size: 12px; font-weight: 600; }
.ct-cn > :first-child, .ct-ord > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-ord { color: var(--muted); font-size: 12px; }
.ct-who { color: var(--text); overflow: hidden; }
.ct-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-age { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.ct-row.ct-overdue .ct-age { color: #b91c1c; }
.ct-row.ct-due .ct-age { color: #92620a; }
.ct-origin { font-size: 12px; }
.ct-caret { color: var(--muted); transition: transform .15s; text-align: center; }
.ct-row.open .ct-caret { transform: rotate(180deg); }
.ct-detail { padding: 4px 14px 12px 48px; border-top: 1px solid var(--line); background: #fafbfc; }
.ct-detail-head { font-size: 12px; color: var(--muted); margin: 8px 0; }
.ct-timeline { display: flex; flex-direction: column; gap: 0; }
.ct-step { display: flex; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.ct-step:last-child { border-bottom: 0; }
.ct-step-t { color: var(--muted); min-width: 130px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.ct-step-s { color: var(--text); }
@media (max-width: 680px) {
  .ct-main { grid-template-columns: 20px 1fr 74px 16px; grid-row-gap: 3px; }
  .ct-ord, .ct-who, .ct-origin { display: none; }
  .ct-status { grid-column: 2 / 5; color: var(--muted); font-size: 12px; }
}

/* ---- Courier Tracker: search, date sublines, shipper advice ---- */
.ct-searchbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ct-searchbar input { flex: 1; max-width: 420px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; background: #fff; }
.ct-count { font-size: 12px; }
.ct-cn, .ct-ord, .ct-who { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; min-width: 0; }
.ct-sub { color: var(--muted); font-size: 10.5px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-who { overflow: hidden; }
.ct-who > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-detail-items { font-size: 12.5px; color: var(--text); margin: 2px 0 10px; }
.ct-advice { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ct-advice-lbl { font-weight: 600; font-size: 12.5px; width: 100%; margin-bottom: 2px; }
.ct-remarks { flex: 1; min-width: 200px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.ct-adv-btn { padding: 7px 12px; border-radius: 7px; border: 1px solid var(--line); cursor: pointer;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.ct-adv-return { background: #fde8e8; color: #b91c1c; border-color: #f5c2c2; }
.ct-adv-retry { background: #e6f4ea; color: #166534; border-color: #bfe3c9; }
.ct-adv-btn:disabled { opacity: .5; cursor: default; }
.ct-adv-msg { font-size: 12.5px; font-weight: 600; }
.ct-adv-msg.ok { color: #166534; }
.ct-adv-msg.err { color: #b91c1c; }

/* ---- Courier Tracker: PostEx "advice needed" highlighting ---- */
.ct-pill.ct-advice-pill { background: #e0edff; color: #1e40af; }
.ct-row.ct-needs-advice { border-left: 4px solid #2563eb; background: #f5f9ff; }
.ct-need-advice { display: inline-block; background: #2563eb; color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px; margin-right: 6px; vertical-align: middle; }
.ct-advice-none { margin-top: 10px; font-size: 12px; font-style: italic; }

/* ---- Courier Tracker: sort dropdown ---- */
.ct-searchbar select#ct-sort { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 12.5px; color: var(--text); cursor: pointer; max-width: 240px; }

/* PostEx COD tab tables */
.cod-table th { font-size: 11px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.cod-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.cod-table tbody tr:hover { background: var(--panel-2, #f4f8f7); }
@media (max-width: 720px) { .cod-cols { grid-template-columns: 1fr !important; } }

/* COD → Shipping Costs subtab */
.cod-subtabs { display: flex; gap: 6px; margin: 2px 0 12px; border-bottom: 1px solid var(--line); }
.cod-subtab { appearance: none; background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; font-size: 13px; color: var(--muted, #667); cursor: pointer; margin-bottom: -1px; }
.cod-subtab:hover { color: var(--text, #223); }
.cod-subtab.on { color: var(--text, #223); font-weight: 600; border-bottom-color: var(--accent, #16a085); }
.cc-table td.mono, .cod-table td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.oc-flag { color: #c0392b; font-weight: 700; cursor: help; }
.cc-table .oc-cell { color: #c0392b; font-weight: 600; }
.cc-row { cursor: pointer; }
.cc-detail > td { background: var(--panel-2, #f4f8f7); padding: 4px 12px 10px !important; }
.cc-contents { font-size: 12.5px; }
.cc-items { margin: 4px 0 0; padding-left: 18px; }
.cc-items li { margin: 2px 0; }
.cc-controls { display: flex; gap: 10px; align-items: center; margin: 16px 0 8px; flex-wrap: wrap; }
.cc-search { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; min-width: 200px; }
.cc-check { font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; color: var(--muted, #667); cursor: pointer; }
.cc-hint { font-size: 12px; }
.cc-note { font-size: 11.5px; margin-top: 8px; line-height: 1.5; }
.cc-brk { font-size: 12px; padding: 2px 0 6px; }
.cc-c2 { font-size: 12.5px; }

/* ---- WhatsApp Groups monitor (admin, read-only) ---- */
.groups-wrap { display: flex; gap: 12px; height: 62vh; min-height: 360px; }
.groups-list { width: 288px; flex: 0 0 288px; overflow-y: auto; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; background: var(--card, #fff); }
.grp-item { padding: 9px 11px; border-bottom: 1px solid var(--line, #eef0f2); cursor: pointer; }
.grp-item:hover { background: var(--hover, #f6f8fa); }
.grp-item.active { background: var(--sel, #eaf2ff); }
.grp-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grp-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-unread { background: #22c55e; color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; flex: 0 0 auto; }
.grp-preview { font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-time { font-size: 11px; margin-top: 2px; }
.groups-thread { flex: 1 1 auto; display: flex; flex-direction: column; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; background: var(--card, #fff); overflow: hidden; }
.groups-thread-head { padding: 10px 13px; border-bottom: 1px solid var(--line, #eef0f2); font-weight: 600; }
.grp-thread-name { font-size: 14px; }
.groups-msgs { flex: 1 1 auto; overflow-y: auto; padding: 12px 13px; display: flex; flex-direction: column; gap: 9px; }
.grp-msg { max-width: 78%; align-self: flex-start; background: var(--bubble-in, #f1f3f5); border-radius: 10px; padding: 6px 10px; }
.grp-msg.out { align-self: flex-end; background: var(--bubble-out, #dcf8c6); }
.grp-msg-meta { display: flex; gap: 8px; align-items: baseline; font-size: 11.5px; margin-bottom: 2px; }
.grp-msg-sender { font-weight: 600; color: var(--accent, #2563eb); }
.grp-msg-num { font-size: 11px; }
.grp-msg-time { margin-left: auto; font-size: 10.5px; }
.grp-msg-body { font-size: 13.5px; line-height: 1.45; word-break: break-word; }
@media (max-width: 640px) { .groups-wrap { flex-direction: column; height: auto; } .groups-list { width: 100%; flex: none; max-height: 30vh; } .groups-thread { min-height: 320px; } }
.grp-media { display: block; margin: 2px 0 4px; }
.grp-img { max-width: 240px; max-height: 260px; border-radius: 8px; display: block; }
.grp-media video { max-width: 260px; max-height: 280px; border-radius: 8px; display: block; }
.grp-audio { display: block; margin: 3px 0; max-width: 240px; height: 34px; }
.grp-doc { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 4px; padding: 7px 11px; background: var(--hover, #f1f3f5); border: 1px solid var(--line, #e5e7eb); border-radius: 8px; font-size: 13px; text-decoration: none; color: inherit; word-break: break-all; }
.grp-doc:hover { background: var(--sel, #eaf2ff); }
.grp-media-note { font-size: 13px; margin: 2px 0 3px; }

/* ================= PWA / iOS standalone polish ================= */
/* Stop iOS Safari from auto-zooming when a sub-16px field gains focus — this was
   the main "zoom in / zoom out" annoyance on the phone. 16px is the threshold. */
@media (max-width: 820px) {
  input, textarea, select, [contenteditable] { font-size: 16px !important; }
}
/* Honour the notch, status bar and home indicator when launched from the Home
   Screen (viewport-fit=cover). Insets are 0 in a normal browser, so desktop is
   unaffected. */
.topbar {
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}
.reply {
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}
.email-reply {
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}
.login { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
/* Fill the whole screen height in standalone (iOS reports it via fill-available). */
@supports (-webkit-touch-callout: none) {
  .app, .login { min-height: 100vh; min-height: -webkit-fill-available; }
}

/* ============ PWA app-feel v2: no horizontal scroll, no zoom drift ============ */
/* Nothing may make the page wider than the screen (off-screen slide-overs, long
   toolbars, wide bubbles). This is what caused the "scroll to the right" + the
   pinch/zoom drift on iOS. */
html, body { overflow-x: hidden; max-width: 100%; }
@media (max-width: 820px) {
  .app { max-width: 100vw; overflow-x: hidden; }
  .body { overflow-x: hidden; }               /* clip the customer slide-over when closed */

  /* Topbar becomes a single horizontally-scrollable toolbar instead of pushing
     the whole page wide. Buttons never wrap or overflow the page. */
  .topbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar .brand, .topbar .link, .topbar .pill, .topbar #who { flex: 0 0 auto; white-space: nowrap; }
  .spacer { display: none; }                    /* don't shove the nav off-screen */

  /* Composer: keep the text field usable next to the icon buttons. */
  .reply { gap: 6px; padding-left: calc(10px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right)); }
  .reply .icon-btn { width: 38px; font-size: 17px; }
  .reply input { min-width: 60px; }
}

/* ============ app-feel v3: hamburger nav + reachable thread actions ============ */
.menu-btn { display: none; }                    /* desktop shows the full inline nav */
.nav-links { display: flex; align-items: center; gap: 8px; }

@media (max-width: 820px) {
  .topbar { overflow: visible; flex-wrap: nowrap; }   /* override the v2 scroll strip */
  .spacer { display: block; }                          /* push the menu button to the right */
  #who { display: none; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; font-size: 22px; line-height: 1; color: var(--text);
    padding: 4px 8px; cursor: pointer; flex: 0 0 auto; }

  /* Nav collapses into a dropdown sheet toggled by the hamburger */
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    position: fixed; top: calc(46px + env(safe-area-inset-top)); right: 8px;
    min-width: 210px; max-height: 76vh; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 14px 44px rgba(0,0,0,.22); padding: 8px; z-index: 60;
  }
  .nav-links.open .link { width: 100%; text-align: left; padding: 12px 14px;
    font-size: 15px; border-radius: 8px; color: var(--text); }
  .nav-links.open .link:active, .nav-links.open .link:hover { background: var(--bg); }

  /* Thread action bar: every action reachable via horizontal scroll (was clipped) */
  .thread-bar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .thread-bar::-webkit-scrollbar { display: none; }
  .thread-bar > * { flex: 0 0 auto; }
}
