:root { color-scheme: light; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #172033; background: #f4f6f9; }
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 7px; padding: 9px 15px; background: #2f66f6; color: #fff; transition: .15s ease; }
button:hover { filter: brightness(.96); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { color: #344054; background: #eef1f5; }
button.ghost { color: #536176; background: transparent; border: 1px solid #d8dee8; }
button.danger, .danger-text { color: #c43232; }
.ok-text { color: #1a9c5b; }
.media-message { display: grid; gap: 4px; }
.media-message small { color: #667085; font-size: 12px; }
.media-message .media-backfill { justify-self: start; margin-top: 4px; padding: 6px 10px; font-size: 12px; }
.media-preview { display: block; max-width: min(420px, 70vw); max-height: 360px; border-radius: 8px; background: #eef1f5; }
audio.media-preview { width: min(360px, 65vw); }
video.media-preview { width: min(420px, 70vw); }
.media-download { width: fit-content; font-weight: 600; }
button.danger:not(.ghost) { color: #fff; background: #d63c3c; }
.text-button { padding: 3px 5px; color: #2f66f6; background: transparent; }
.icon-button { width: 28px; height: 28px; padding: 0; color: #758196; background: transparent; font-size: 21px; }
.muted, small { color: #7a8699; }
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 50% 10%, #e7efff, #f6f8fb 50%); }
.login-card, .panel { background: #fff; border: 1px solid #e1e6ee; border-radius: 12px; box-shadow: 0 6px 24px #1720330a; }
.login-card { width: min(410px, calc(100% - 32px)); padding: 34px; text-align: center; }
.login-mark { display: grid; width: 46px; height: 46px; place-items: center; margin: 0 auto 12px; border-radius: 13px; background: #2f66f6; color: #fff; font-weight: 800; }
.login-card h1 { margin: 0; }
.login-card .field { text-align: left; }
.login-card > button { width: 100%; }
.error, .notice { border-radius: 8px; padding: 11px 14px; }
.error { color: #b42318; background: #fff1f0; }
.field { display: grid; gap: 6px; margin: 16px 0; }
input, textarea, select { width: 100%; border: 1px solid #cfd7e3; border-radius: 7px; padding: 10px 11px; color: #253047; background: #fff; outline: none; }
input:focus, textarea:focus, select:focus { border-color: #6790ff; box-shadow: 0 0 0 3px #2f66f613; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 13px; background: #152033; color: #d9e2f2; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 26px; font-weight: 750; }
.brand > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: #fff; background: #3972ff; font-size: 13px; }
.brand small { display: block; margin-top: 2px; color: #8291a9; font-size: 10px; font-weight: 500; }
.nav { display: grid; gap: 4px; }
.nav button { display: flex; align-items: center; gap: 11px; text-align: left; color: #aebbd0; background: transparent; }
.nav button i { width: 19px; text-align: center; font-style: normal; }
.nav button.active, .nav button:hover { color: #fff; background: #24324a; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid #2b3950; color: #8795aa; font-size: 12px; }
.health-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #31ba72; box-shadow: 0 0 0 3px #31ba7220; }
.main { min-width: 0; width: 100%; max-width: 1540px; margin: 0 auto; padding: 22px 26px 34px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.topbar h1 { margin: 0 0 4px; font-size: 24px; }
.topbar p { margin: 0; color: #7a8699; font-size: 13px; }
.actions { display: flex; align-items: center; gap: 9px; }
.user-chip { padding: 7px 11px; border-radius: 999px; background: #eaf0ff; color: #315ebd; font-size: 13px; }
.panel { min-width: 0; padding: 18px; overflow: hidden; }
.panel h2 { margin: 0; font-size: 17px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.section-head p { margin: 4px 0 0; color: #7a8699; font-size: 12px; }
.page-section-head { margin: 2px 0 14px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 17px; }
.stat { display: flex; align-items: center; gap: 14px; }
.stat-icon { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 10px; font-weight: 800; }
.stat-icon.blue { color: #2f66f6; background: #eaf0ff; } .stat-icon.green { color: #138a52; background: #e5f8ee; }
.stat-icon.amber { color: #b26a00; background: #fff4d8; } .stat-icon.red { color: #c43232; background: #ffeded; }
.stat span:not(.stat-icon) { display: block; color: #7a8699; font-size: 12px; }
.stat strong { display: block; margin-top: 3px; font-size: 25px; }
.stat strong small { font-size: 13px; font-weight: 500; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.notice { display: flex; gap: 10px; margin-bottom: 14px; font-size: 13px; }
.notice.warning { border: 1px solid #f0dca2; color: #7c5b08; background: #fff9e9; }
.notice.success { border: 1px solid #b8e6cb; color: #176c42; background: #e8f7ef; }
.table-wrap { max-width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 8px; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: top; font-size: 13px; overflow-wrap: anywhere; }
.table th { color: #8994a6; font-size: 11px; font-weight: 650; text-transform: uppercase; }
.table td strong { color: #2b3548; }
.task-suggestion { color: #8b5a00; }
.scope-line { display: block; margin-bottom: 3px; color: #536176; font-size: 12px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; color: #596579; background: #edf1f6; font-size: 11px; font-style: normal; white-space: nowrap; }
.badge.online, .badge.succeeded { color: #14703f; background: #e7f7ee; }
.badge.running, .badge.assigned, .badge.queued { color: #2257b4; background: #e9f0ff; }
.badge.paused { color: #96610b; background: #fff4d8; }
.badge.failed, .badge.unknown, .badge.partially_succeeded, .badge.revoked { color: #b32e2e; background: #ffeded; }
.badge.cancelled, .badge.cancelling, .badge.offline { color: #626c7d; background: #edf0f4; }
.empty { padding: 34px 10px; color: #8490a3; text-align: center; }
.empty.compact { padding: 22px 5px; }
.toast { position: fixed; z-index: 10; right: 22px; bottom: 22px; max-width: min(430px, calc(100vw - 44px)); padding: 12px 17px; border-radius: 8px; color: #fff; background: #172033; box-shadow: 0 10px 28px #0004; }

.broadcast-steps { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 3px auto 18px; color: #909bad; font-size: 12px; }
.broadcast-steps span { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.broadcast-steps i { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; background: #e4e8ef; font-style: normal; }
.broadcast-steps span.active { color: #2f66f6; }
.broadcast-steps span.active i { color: #fff; background: #2f66f6; }
.broadcast-steps b { width: 74px; height: 1px; background: #d9dfe8; }
.scope-bar { display: grid; grid-template-columns: minmax(240px, 360px) minmax(200px, 1fr) auto; align-items: center; gap: 18px; margin-bottom: 14px; padding: 13px 16px; border: 1px solid #dfe5ed; border-radius: 10px; background: #fff; }
.scope-bar label { display: flex; align-items: center; gap: 10px; color: #657186; font-size: 12px; }
.scope-bar select { min-width: 210px; padding: 8px 10px; }
.scope-meta strong, .scope-meta span { display: block; }
.scope-meta strong { font-size: 13px; }
.scope-meta span { margin-top: 3px; color: #8490a3; font-size: 11px; }
.device-state { font-size: 12px; color: #657186; }
.broadcast-layout { display: grid; grid-template-columns: minmax(300px, 1.05fr) minmax(240px, .78fr) minmax(330px, 1.2fr); gap: 14px; align-items: stretch; }
.recipient-panel, .selected-panel, .composer-panel { height: min(700px, calc(100vh - 195px)); min-height: 560px; display: flex; flex-direction: column; }
.segment { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 8px; background: #eef1f5; }
.segment button { color: #667286; background: transparent; }
.segment button.active { color: #2557c7; background: #fff; box-shadow: 0 2px 7px #17203314; }
.search { position: relative; margin: 13px 0 10px; }
.search span { position: absolute; left: 11px; top: 8px; color: #8994a6; font-size: 19px; }
.search input { padding-left: 34px; }
.tag-toolbar { padding: 10px; border: 1px solid #e4e8ef; border-radius: 8px; background: #fafbfc; }
.tag-toolbar > div:first-child { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 76px; overflow: auto; }
.tag-filter { padding: 5px 8px; color: #5e6a7e; background: #fff; border: 1px solid #dce2ea; font-size: 11px; }
.tag-filter.active { color: #245bcf; border-color: #7da0f9; background: #edf3ff; }
.tag-filter small { color: inherit; }
.match-mode select { margin-top: 8px; padding: 6px 8px; font-size: 11px; }
.recipient-list-head { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 0 4px 8px; color: #697589; font-size: 12px; }
.recipient-list-head label { display: flex; align-items: center; gap: 7px; }
input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: #2f66f6; }
.recipient-list, .selected-list { min-height: 0; overflow: auto; border-top: 1px solid #edf0f4; }
.recipient-row { display: flex; align-items: center; gap: 9px; padding: 10px 4px; border-bottom: 1px solid #f0f2f5; cursor: pointer; }
.recipient-row > span:not(.avatar), .selected-row > span { min-width: 0; flex: 1; }
.recipient-row strong, .recipient-row small, .selected-row strong, .selected-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipient-row strong, .selected-row strong { font-size: 13px; }
.recipient-row small, .selected-row small { margin-top: 3px; font-size: 10px; }
.recipient-row em { color: #8b96a8; font-size: 10px; font-style: normal; white-space: nowrap; }
.count-pill { display: grid; min-width: 28px; height: 28px; place-items: center; padding: 0 8px; border-radius: 999px; color: #2f66f6; background: #eaf0ff; font-size: 12px; }
.selected-row { display: flex; align-items: center; gap: 9px; padding: 10px 3px; border-bottom: 1px solid #eff2f5; }
.clear-selected { margin: auto auto 0; }
.composer-panel textarea { min-height: 180px; resize: vertical; line-height: 1.6; }
.character-count { margin: 5px 2px 12px; color: #8994a6; text-align: right; font-size: 11px; }
.schedule-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 10px; }
.schedule-grid label { color: #697589; font-size: 11px; }
.schedule-grid input { margin-top: 5px; }
.safety-note { display: grid; gap: 4px; margin-top: 13px; padding: 10px 12px; border-radius: 8px; color: #42627a; background: #edf7fb; font-size: 11px; }
.preview-result { display: grid; gap: 3px; margin-top: 10px; padding: 9px 11px; border-radius: 8px; font-size: 11px; }
.preview-result.ready { color: #176c42; background: #e8f7ef; }
.preview-result.blocked { color: #a12d2d; background: #ffeded; }
.confirm-line { display: flex; align-items: flex-start; gap: 8px; margin: auto 0 11px; padding-top: 13px; color: #5e6a7e; font-size: 11px; }
.composer-actions { display: flex; justify-content: flex-end; gap: 8px; }

.batch-list { display: grid; gap: 12px; margin-bottom: 16px; }
.batch-card { padding: 17px 19px; border: 1px solid #e0e5ed; border-radius: 11px; background: #fff; box-shadow: 0 5px 18px #17203308; }
.batch-main { display: flex; align-items: center; gap: 12px; }
.batch-icon { display: grid; flex: 0 0 39px; width: 39px; height: 39px; place-items: center; border-radius: 9px; color: #2f66f6; background: #eaf0ff; }
.batch-main > div:last-child { min-width: 0; }
.batch-title { display: flex; align-items: center; gap: 9px; }
.batch-main p { margin: 4px 0 2px; color: #667286; font-size: 12px; }
.progress-head { display: flex; justify-content: space-between; margin: 15px 0 6px; color: #677386; font-size: 11px; }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: #e8ecf2; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3972ff, #31a874); }
.batch-stats { display: flex; gap: 23px; margin-top: 11px; color: #7a8699; font-size: 11px; }
.batch-stats strong { margin-right: 4px; color: #344054; }
.batch-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid #edf0f4; }

.conversation-panel { padding: 0; }
.conversation-layout { display: grid; grid-template-columns: minmax(285px, 340px) minmax(0, 1fr); height: min(740px, calc(100vh - 112px)); min-height: 560px; }
.conversation-list { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid #e8ecf1; }
.conversation-filters { display: grid; gap: 7px; padding: 12px; border-bottom: 1px solid #e8ecf1; }
.conversation-filters select, .conversation-filters input { padding: 8px 9px; }
.conversation-scroll { min-height: 0; overflow: auto; padding: 6px; }
.conversation-item { display: flex; width: 100%; align-items: center; gap: 9px; padding: 9px; color: #263249; text-align: left; background: transparent; }
.conversation-item:hover, .conversation-item.selected { background: #edf3ff; }
.conversation-summary { min-width: 0; flex: 1; }
.conversation-name-row { display: flex; gap: 8px; }
.conversation-name-row strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-name-row time { color: #8994a6; font-size: 10px; }
.conversation-subtitle { display: block; margin: 4px 0; overflow: hidden; color: #7a8699; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-collection { display: inline-block; margin-top: 3px; color: #667085; font-size: 10px; }
.conversation-collection.has_messages, .collection-status-line.success { color: #1a9c5b; }
.conversation-collection.syncing, .collection-status-line.syncing { color: #245bcf; }
.conversation-collection.error, .collection-status-line.error { color: #c43232; }
.conversation-collection.synced_empty, .collection-status-line.empty-result { color: #667085; }
.collection-empty { display: flex; min-height: 160px; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.collection-empty strong { color: #344054; }
.collection-empty span { max-width: 420px; }
.collection-empty.syncing strong { color: #245bcf; }
.collection-empty.error strong { color: #c43232; }
.collection-status-line { display: grid; gap: 2px; margin: 7px 0 0; font-size: 11px; }
.collection-status-line strong { font-size: 12px; }
.collection-status-line span { color: #7a8699; }
.collection-status-line.pending { color: #9a6700; }
.avatar { display: inline-flex; flex: 0 0 39px; width: 39px; height: 39px; align-items: center; justify-content: center; overflow: hidden; border-radius: 10px; color: #fff; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-small { flex-basis: 31px; width: 31px; height: 31px; border-radius: 8px; font-size: 12px; }
.avatar-tone-0 { background: #4f7cff; } .avatar-tone-1 { background: #16a085; } .avatar-tone-2 { background: #8b5cf6; } .avatar-tone-3 { background: #e67e22; } .avatar-tone-4 { background: #d95671; } .avatar-tone-5 { background: #397b9e; }
.conversation-detail { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.conversation-header { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid #e8ecf1; }
.conversation-heading { min-width: 0; flex: 1; }
.conversation-heading h2, .conversation-heading p { margin: 0 0 4px; }
.conversation-heading p { color: #7a8699; font-size: 11px; }
.message-list { min-height: 0; overflow: auto; padding: 15px 18px; background: #f8fafc; }
.message-row { display: flex; align-items: flex-start; gap: 8px; margin: 11px 0; }
.message-row.outbound { flex-direction: row-reverse; }
.message-stack { max-width: 76%; }
.message-meta { display: flex; gap: 7px; margin-bottom: 3px; color: #788499; font-size: 10px; }
.message-row.outbound .message-meta { justify-content: flex-end; }
.message { padding: 9px 11px; border: 1px solid #e4e8ef; border-radius: 4px 10px 10px; background: #fff; }
.message-row.outbound .message { border-radius: 10px 4px 10px 10px; background: #dff4da; }
.message-content { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.send-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 15px; border-top: 1px solid #e8ecf1; }
.send-form textarea { min-height: 56px; resize: vertical; }
.profile-sync { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0 20px; padding: 14px; border: 1px solid #dfe6ef; border-radius: 9px; background: #f8faff; }
.profile-sync p { margin: 4px 0 0; color: #718096; font-size: 12px; }
.backfill-panel { display: grid; gap: 12px; margin: 16px 0; }
.backfill-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 10px; }
.backfill-grid label, .backfill-ids { display: grid; gap: 5px; color: #596579; font-size: 11px; }
.backfill-ids textarea { min-height: 64px; resize: vertical; }
.backfill-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #7a8699; font-size: 11px; }
.backfill-preview { display: grid; gap: 4px; padding: 10px 12px; border-radius: 8px; color: #667286; background: #f5f7fa; font-size: 11px; }
.backfill-preview.ready { color: #176c42; background: #e8f7ef; }
.backfill-preview.blocked { color: #a12d2d; background: #ffeded; }
.backfill-preview strong { font-size: 12px; }
.backfill-planned { display: grid; gap: 5px; margin: 4px 0 0; padding-left: 24px; color: #344054; }
.backfill-planned li { padding-left: 2px; }
.backfill-planned li span { display: block; color: #718096; font-size: 10px; }
.backfill-panel > button { justify-self: end; }

.security-layout { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 17px; align-items: start; }
.security-layout.single { grid-template-columns: minmax(300px, 540px); }
.security-card { position: sticky; top: 20px; }
.identity-card { display: flex; align-items: center; gap: 12px; margin: 2px 0 18px; padding: 13px; border-radius: 10px; background: #f5f8fd; }
.identity-avatar { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #3972ff, #7158d8); font-weight: 750; }
.identity-card strong, .identity-card span { display: block; }
.identity-card span { margin-top: 3px; color: #7a8699; font-size: 12px; }
.security-form { display: grid; gap: 13px; }
.security-form label, .create-user label { display: grid; gap: 6px; color: #596579; font-size: 12px; }
.security-form input, .create-user input, .create-user select { margin-top: 0; }
.security-form button { justify-self: start; margin-top: 4px; }
.role-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-bottom: 14px; }
.role-guide span { padding: 9px 10px; border: 1px solid #e3e8ef; border-radius: 8px; color: #7a8699; background: #fafbfc; font-size: 10px; }
.role-guide strong { display: block; margin-bottom: 2px; color: #344054; font-size: 11px; }
.user-table select { min-width: 92px; padding: 7px 8px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button { padding: 7px 9px; font-size: 11px; white-space: nowrap; }
.create-user { display: grid; grid-template-columns: 1.1fr repeat(4, minmax(120px, 1fr)) auto; align-items: end; gap: 10px; margin-top: 18px; padding-top: 17px; border-top: 1px solid #e6eaf0; }
.create-user h3, .create-user p { margin: 0; }
.create-user h3 { font-size: 14px; }
.create-user p { margin-top: 4px; color: #7a8699; font-size: 10px; }
.create-user button { white-space: nowrap; }

@media (max-width: 1180px) { .broadcast-layout { grid-template-columns: 1fr 1fr; } .composer-panel { grid-column: 1 / -1; height: auto; min-height: 480px; } .recipient-panel, .selected-panel { height: 590px; } .scope-bar { grid-template-columns: 1fr 1fr; } .device-state { grid-column: 1 / -1; } .security-layout { grid-template-columns: 1fr; } .security-card { position: static; } .create-user { grid-template-columns: repeat(2, minmax(0, 1fr)); } .create-user > div, .create-user button { grid-column: 1 / -1; } .backfill-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; padding: 12px; } .brand { padding-bottom: 12px; } .nav { grid-template-columns: repeat(3, 1fr); } .sidebar-foot { display: none; } .main { padding: 17px; } .cards, .grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 650px) { .nav { grid-template-columns: repeat(2, 1fr); } .topbar { align-items: flex-start; } .topbar p, .user-chip { display: none; } .cards, .grid, .broadcast-layout, .scope-bar, .conversation-layout, .create-user { grid-template-columns: 1fr; } .broadcast-steps b { width: 20px; } .scope-bar label { display: grid; } .scope-bar select { min-width: 0; } .recipient-panel, .selected-panel, .composer-panel { grid-column: auto; height: auto; min-height: 500px; } .selected-panel { min-height: 360px; } .schedule-grid { grid-template-columns: 1fr; } .conversation-layout { height: auto; } .conversation-list { max-height: 430px; border-right: 0; border-bottom: 1px solid #e8ecf1; } .conversation-detail { min-height: 540px; } .batch-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; } .batch-actions { flex-wrap: wrap; } .role-guide { grid-template-columns: 1fr 1fr; } .create-user > div, .create-user button { grid-column: auto; } }
.collection-history-meta { display: block; margin-top: 4px; color: var(--muted, #788399); }
.collection-events { margin-top: 12px; max-height: 280px; overflow: auto; }
.customer-management { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; }
.customer-management .panel { margin: 0; }
