/* P2V WhatsApp panel. Light and dark follow the system. */
:root {
  --bg: #eef1f4; --rail: #f7f8fa; --panel: #ffffff; --panel-2: #f5f6f8; --hover: #f0f2f5; --sel: #e7f6f1;
  --line: #e4e7eb; --text: #111b21; --muted: #667781; --faint: #8696a0;
  --accent: #00a884; --accent-2: #008069; --accent-soft: #d9fdd3; --danger: #e5484d; --warn: #b7791f;
  --me: #d9fdd3; --them: #ffffff; --chat-bg: #efeae2; --shadow: 0 8px 30px rgba(17, 27, 33, .12);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b141a; --rail: #111b21; --panel: #111b21; --panel-2: #1a252c; --hover: #1f2c34; --sel: #233138;
    --line: #222e35; --text: #e9edef; --muted: #8696a0; --faint: #667781;
    --accent: #00a884; --accent-2: #06cf9c; --accent-soft: #103529; --danger: #f15c6d; --warn: #ffbc38;
    --me: #005c4b; --them: #202c33; --chat-bg: #0b141a; --shadow: 0 10px 34px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); }
svg { width: 22px; height: 22px; flex: none; }

/* ---------- login (kept neutral on purpose) */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); background: var(--panel); padding: 28px; border-radius: 16px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login .brand { font-size: 22px; font-weight: 700; }
.login label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.login input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.login button { padding: 11px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; }
.login .err { color: var(--danger); min-height: 1em; margin: 0; }

/* ---------- shell */
.app { height: 100dvh; display: grid; grid-template-columns: 68px 380px 1fr auto; grid-template-rows: minmax(0, 100%); overflow: hidden; }
.app > * { min-height: 0; }
.rail { background: var(--rail); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0; }
.logo { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(135deg, #00a884, #53bdeb); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; margin-bottom: 10px; letter-spacing: .3px; }
.rail-btn { position: relative; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.on { background: var(--sel); color: var(--accent-2); }
.pip { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--rail); }
.pip.down { background: var(--danger); }
.grow { flex: 1; }
.me-av { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }

/* ---------- chat list */
.list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; }
.list-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.line-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; color: var(--muted); }
.line-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.line-pill.down { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.line-pill.down .dot { background: var(--danger); }
.banner { margin: 0 14px 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 12%, var(--panel)); color: var(--text); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.banner span { flex: 1; }
.banner button { border: 0; border-radius: 8px; padding: 6px 10px; background: var(--danger); color: #fff; font-weight: 600; font-size: 12.5px; }
.search { margin: 0 14px 10px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--panel-2); border-radius: 12px; color: var(--faint); }
.search svg { width: 18px; height: 18px; }
.search input { flex: 1; border: 0; background: transparent; padding: 10px 0; outline: none; color: var(--text); }
.filters { display: flex; gap: 6px; padding: 0 14px 8px; margin-bottom: 4px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: transparent transparent; cursor: grab; }
.filters:hover { scrollbar-color: var(--line) transparent; }
.filters::-webkit-scrollbar { height: 6px; }
.filters::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.filters:hover::-webkit-scrollbar-thumb { background: var(--line); }
.filters.drag { cursor: grabbing; user-select: none; }
.chip { flex: none; border: 0; border-radius: 999px; padding: 6px 12px; background: var(--panel-2); color: var(--muted); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--hover); }
.chip.on { background: var(--accent-soft); color: var(--accent-2); }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; }
.chip .n { font-size: 11.5px; opacity: .75; }
.chats { list-style: none; margin: 0; padding: 0 6px 12px; overflow-y: auto; flex: 1; min-height: 0; }
.chat { display: flex; gap: 12px; padding: 10px 10px; border-radius: 12px; cursor: pointer; align-items: center; }
.chat:hover { background: var(--hover); }
.chat.sel { background: var(--sel); }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; flex: none; font-size: 15px; }
.chat .mid { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.chat .t { font-size: 12px; color: var(--faint); flex: none; }
.chat.unread .t { color: var(--accent); font-weight: 600; }
.chat .last { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.tags { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; margin-top: 2px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; font-weight: 500; }
.tag.user { background: var(--panel-2); color: var(--muted); }
.lab { color: #fff; }
.stage { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-2); }
.stage.paid { background: color-mix(in srgb, #ffbc38 22%, transparent); color: var(--warn); }

/* ---------- conversation */
.pane { display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); position: relative; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 360px; padding: 24px; }
.empty-art { width: 84px; height: 84px; border-radius: 24px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--panel); box-shadow: var(--shadow); color: var(--accent); }
.empty-art svg { width: 40px; height: 40px; }
.empty h2 { color: var(--text); margin: 0 0 6px; font-size: 20px; }
.pane-head { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 64px; }
.peer { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; text-align: left; padding: 2px 4px; border-radius: 10px; min-width: 0; flex: 1; }
.peer .avatar { width: 40px; height: 40px; font-size: 14px; }
.peer-txt { min-width: 0; }
.peer-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peer-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-labels { display: flex; gap: 4px; overflow: hidden; max-width: 34%; }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; text-decoration: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.back { display: none; }
/* Plain block layout: in a flex column Chrome sized long bubbles (the welcome message) narrow and
   short, so their text spilled over the next ones. Blocks with fit-content width do not. */
.msgs { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 7% 10px; display: block; }
.day { display: block; width: fit-content; margin: 12px auto; background: var(--panel); color: var(--muted); font-size: 12px; padding: 4px 12px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.m { display: block; width: fit-content; max-width: min(560px, 78%); margin: 0 auto 4px 0; background: var(--them); padding: 7px 10px 6px; border-radius: 10px 10px 10px 3px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); position: relative; overflow-wrap: break-word; white-space: pre-wrap; }
.m::after { content: ""; display: block; clear: both; }
.m.me { margin: 0 0 4px auto; background: var(--me); border-radius: 10px 10px 3px 10px; }
.m.pending { opacity: .7; }
.m.failed { outline: 2px solid var(--danger); }
.m .by { display: block; font-size: 11.5px; font-weight: 600; color: var(--accent-2); margin-bottom: 2px; }
.m .meta { float: right; margin: 6px 0 -4px 10px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.m .kind { color: var(--muted); font-style: italic; }
.m img.thumb { display: block; max-width: 100%; max-height: 340px; border-radius: 8px; cursor: zoom-in; margin-bottom: 4px; }
.m video { display: block; max-width: 100%; max-height: 340px; border-radius: 8px; margin-bottom: 4px; }
.m audio { display: block; width: 280px; max-width: 100%; margin: 2px 0 4px; }
.m .doc { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; background: color-mix(in srgb, var(--text) 6%, transparent); text-decoration: none; color: var(--text); margin-bottom: 4px; }
.more { display: block; margin: 6px auto; }

/* ---------- composer */
.composer { position: relative; background: var(--panel); border-top: 1px solid var(--line); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
.bar { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { flex: 1; resize: none; border: 0; outline: none; background: var(--panel-2); border-radius: 22px; padding: 10px 16px; max-height: 160px; line-height: 1.4; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.round:hover { background: var(--accent-2); }
.round svg { width: 20px; height: 20px; }
.rec { align-items: center; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; margin-left: 6px; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-hint { flex: 1; color: var(--muted); }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- popovers */
.pop { position: absolute; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.emoji-pop { bottom: calc(100% + 6px); left: 10px; overflow: hidden; }
.emoji-pop emoji-picker { --border-size: 0; --background: var(--panel); width: min(360px, 92vw); height: 360px; }
.attach-pop { bottom: calc(100% + 6px); left: 52px; padding: 8px; display: grid; gap: 2px; min-width: 210px; }
.attach-pop button { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 8px 10px; border-radius: 10px; text-align: left; font-weight: 500; }
.attach-pop button:hover { background: var(--hover); }
.ai { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.ai svg { width: 18px; height: 18px; }
.c1 { background: #7f66ff; } .c2 { background: #ff2e74; } .c3 { background: #5157ae; } .c4 { background: #ff7f3e; }
.label-pop { position: fixed; padding: 8px; min-width: 230px; max-height: 360px; overflow-y: auto; }
.label-pop .lp-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.label-pop .lp-row:hover { background: var(--hover); }
.label-pop .sw { width: 12px; height: 12px; border-radius: 50%; }
.label-pop .lp-name { flex: 1; }
.label-pop .lp-row svg { width: 18px; height: 18px; color: var(--accent); }
.label-pop .lp-manage { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.label-pop button.lp-link { width: 100%; border: 0; background: transparent; color: var(--accent-2); text-align: left; padding: 8px 10px; border-radius: 10px; font-weight: 500; }

/* ---------- drawer */
.drawer { width: 360px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 64px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-body { overflow-y: auto; padding: 0 0 24px; flex: 1; min-height: 0; }
.who { text-align: center; padding: 22px 16px 16px; border-bottom: 8px solid var(--panel-2); }
.who .avatar { width: 88px; height: 88px; font-size: 28px; margin: 0 auto 12px; }
.who .nm { font-size: 19px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.who .ph { color: var(--muted); margin-top: 2px; }
.sec { padding: 14px 18px; border-bottom: 8px solid var(--panel-2); }
.sec h4 { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; display: flex; justify-content: space-between; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.acct { background: var(--panel-2); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.acct .top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; }
.lab-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-toggle { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.lab-toggle .sw { width: 9px; height: 9px; border-radius: 50%; }
.lab-toggle.on { color: #fff; border-color: transparent; }
.note-add { display: grid; gap: 8px; margin-bottom: 12px; }
.note-add textarea { resize: vertical; min-height: 64px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: var(--panel-2); outline: none; }
.btn { border: 0; border-radius: 10px; padding: 8px 14px; background: var(--accent); color: #fff; font-weight: 600; justify-self: end; }
.btn.ghost { background: var(--panel-2); color: var(--text); }
.btn.danger { background: var(--danger); }
.note { background: color-mix(in srgb, #ffbc38 14%, var(--panel)); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; position: relative; white-space: pre-wrap; font-size: 13.5px; }
.note .nm { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; }
.note button { border: 0; background: transparent; color: var(--muted); padding: 0; font-size: 11.5px; }
.muted { color: var(--muted); }

/* ---------- modals */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(11, 20, 26, .55); display: grid; place-items: center; padding: 16px; }
.sheet { width: min(560px, 100%); max-height: 90dvh; display: flex; flex-direction: column; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.sheet.narrow { width: min(440px, 100%); }
.sheet > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.sheet h3 { margin: 0; font-size: 17px; }
.file-list { padding: 16px; overflow-y: auto; display: grid; gap: 10px; }
.file-item { display: flex; gap: 12px; align-items: center; background: var(--panel-2); border-radius: 12px; padding: 10px; }
.file-item img, .file-item video { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.file-item .fi { width: 72px; height: 72px; border-radius: 8px; display: grid; place-items: center; background: var(--hover); color: var(--muted); }
.file-item .fn { font-weight: 500; overflow-wrap: anywhere; }
.file-item .fs { color: var(--muted); font-size: 12.5px; }
.file-cap { display: flex; gap: 8px; padding: 12px 16px 16px; }
.file-cap input { flex: 1; border: 0; background: var(--panel-2); border-radius: 22px; padding: 10px 16px; outline: none; }
.line-body { padding: 20px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.line-body img { width: 264px; height: 264px; border-radius: 12px; background: #fff; padding: 8px; }
.line-body .state { font-weight: 600; font-size: 16px; }
.line-body .ok { color: var(--accent-2); }
.line-body .bad { color: var(--danger); }
.line-body ol { text-align: left; margin: 0; padding-left: 20px; color: var(--muted); font-size: 13.5px; }
.line-body .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.labels-body { padding: 16px; overflow-y: auto; }
.label-new { display: flex; gap: 8px; margin-bottom: 14px; }
.label-new input:not([type=color]), .label-rows input:not([type=color]) { flex: 1; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 8px 10px; outline: none; min-width: 0; }
input[type=color] { width: 38px; height: 38px; border: 0; padding: 0; background: transparent; border-radius: 8px; }
.label-new button { border: 0; border-radius: 10px; padding: 0 14px; background: var(--accent); color: #fff; font-weight: 600; }
.label-rows { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.label-rows li { display: flex; gap: 8px; align-items: center; }
.label-rows .n { color: var(--muted); font-size: 12.5px; width: 42px; text-align: right; }
.label-rows .auto { font-size: 10.5px; color: var(--muted); }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .85); display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 13.5px; max-width: 90vw; }

/* ---------- broadcasts */
.bview { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--panel-2); }
.bv-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 64px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bv-head h2 { margin: 0; font-size: 18px; }
.bv-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; display: grid; gap: 14px; align-content: start; }
.bv-body.editor { max-width: 860px; width: 100%; margin: 0 auto; }
.bv-card { background: var(--panel); border-radius: 16px; padding: 16px 18px; display: grid; gap: 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.bv-card h3 { margin: 0; font-size: 15px; }
.bv-card .small, .small { font-size: 12.5px; white-space: pre-line; }
.bv-empty { text-align: center; padding: 40px 16px; display: grid; gap: 10px; justify-items: center; max-width: 480px; margin: 0 auto; }
.bv-empty h3 { margin: 0; }
.fld { display: grid; gap: 6px; font-size: 13px; }
.fld > span { color: var(--muted); font-weight: 500; }
.fld input:not([type=checkbox]):not([type=radio]), .fld textarea, .fld select, .bv-card textarea, .row-gap input, .nc-body input, .nc-body textarea {
  width: 100%; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 9px 11px; outline: none; color: var(--text); }
.fld textarea, .bv-card textarea { resize: vertical; line-height: 1.45; }
.fld input:focus, .fld textarea:focus, .fld select:focus { border-color: var(--accent); }
.fld-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tags-row, .chipset { display: flex; flex-wrap: wrap; gap: 6px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; flex-wrap: wrap; }
.chk input[type=datetime-local] { border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 5px 8px; color: var(--text); }
.row-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-gap input { flex: 1; min-width: 180px; width: auto; }
.rc-pick { max-height: 300px; overflow-y: auto; display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.rc-pick:empty { display: none; }
.chk.rc { padding: 4px 2px; font-size: 13px; flex-wrap: nowrap; }
.chk.rc .rc-name { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.prev .prev-b { margin: 0 0 0 auto; }
.bc-list { display: grid; gap: 10px; }
.bc-row { text-align: left; border: 0; background: var(--panel); border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.bc-row:hover { background: var(--hover); }
.bc-top { display: flex; align-items: center; gap: 10px; }
.bc-name { font-weight: 600; flex: 1; }
.bc-meta { font-size: 12.5px; }
.bar-bg { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.bar-bg.big { height: 10px; border-radius: 5px; }
.bar-fill { height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s; }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.st-running, .rs-sent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-2); }
.st-scheduled { background: color-mix(in srgb, #53bdeb 20%, transparent); color: #3aa0d0; }
.st-paused, .rs-pending { background: color-mix(in srgb, #ffbc38 20%, transparent); color: var(--warn); }
.st-cancelled, .rs-failed { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border-radius: 14px; padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 2px; }
.bc-msg { white-space: pre-wrap; background: var(--panel-2); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.sec-t { margin: 6px 0 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.rc-list { background: var(--panel); border-radius: 14px; overflow: hidden; }
.rc-row { display: grid; grid-template-columns: 1.3fr 1fr auto 120px; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.rc-row:last-child { border-bottom: 0; }
.rc-row .rc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.rc-row .rc-err { grid-column: 1 / -1; color: var(--danger); font-size: 12px; }
.nc-body { padding: 16px 20px 20px; display: grid; gap: 12px; }
.nc-body label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.nc-body textarea { resize: vertical; }
.nc-body .btn { justify-self: end; }
.empty-art svg { width: 40px; height: 40px; }
@media (max-width: 760px) {
  .rc-row { grid-template-columns: 1fr auto; }
  .rc-row .rc-phone, .rc-row .rc-time { display: none; }
  .bv-body { padding: 12px; }
}

.only-m { display: none; }
.list-head h1 { flex: 1; }
.list-head { gap: 6px; }

/* ---------- narrower screens */
@media (max-width: 1180px) {
  .drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; box-shadow: var(--shadow); width: min(380px, 100vw); }
  .app { grid-template-columns: 68px 340px 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .list { border-right: 0; }
  .pane { display: none; }
  .app.open .list { display: none; }
  .app.open .pane { display: flex; }
  .back { display: grid; }
  .only-m { display: grid; }
  .head-labels { display: none; }
  .msgs { padding: 14px 10px 8px; }
  .m { max-width: 86%; }
  .drawer { width: 100vw; }
  .list-head { padding-top: calc(14px + env(safe-area-inset-top)); }
}
