:root {
    color-scheme: light;
    font-family: ui-sans-serif, system-ui, sans-serif;
    background: #f4f6f8;
    color: #17202a;
}

body { margin: 0; }
main { width: calc(100% - 32px); max-width: 1800px; margin: 0 auto; padding: 38px 0 80px; }
.page-header { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 32px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 5vw, 48px); letter-spacing: -.04em; }
h2 { margin-bottom: 16px; font-size: 20px; }
.muted { color: #637083; }
.eyebrow { margin-bottom: 8px; color: #176b3a; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.badge { padding: 8px 12px; border-radius: 999px; background: #e6f6ec; color: #176b3a; font-size: 13px; font-weight: 700; }
.account-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px; }
.signed-in { color: #637083; font-size: 13px; }
.text-button { padding: 0; border: 0; background: transparent; color: #1b5fc1; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 32px; }
.card, section { background: white; border: 1px solid #e2e7ec; border-radius: 16px; box-shadow: 0 8px 30px rgb(27 39 51 / 5%); }
.card { padding: 20px; }
.card strong { display: block; font-size: 30px; margin-bottom: 5px; }
.card span { color: #637083; font-size: 13px; }
section { padding: 24px; margin-top: 18px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #eef1f4; font-size: 14px; }
th { color: #637083; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 28px 0; color: #637083; }
.section-heading { display: flex; justify-content: space-between; gap: 20px; }
.section-heading p { margin-bottom: 20px; }
.connection-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.stack-form { display: grid; gap: 18px; }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 700; }
label small { color: #738094; font-size: 12px; font-weight: 400; line-height: 1.45; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"] { width: 100%; box-sizing: border-box; padding: 12px 13px; border: 1px solid #cfd6de; border-radius: 9px; background: #fff; color: #17202a; font: inherit; }
input:focus, select:focus { outline: 3px solid rgb(37 109 206 / 14%); border-color: #256dce; }
.full-width { grid-column: 1 / -1; }
.checkboxes { display: flex; flex-wrap: wrap; gap: 24px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.checkbox-row input { width: 17px; height: 17px; margin: 0; accent-color: #176b3a; }
.form-actions { display: flex; justify-content: flex-start; }
.primary-button { padding: 12px 18px; border: 0; border-radius: 9px; background: #176b3a; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.primary-button:hover { background: #11572f; }
.small-button { white-space: nowrap; padding: 8px 11px; border: 1px solid #b9c9dc; border-radius: 8px; background: #f5f8fc; color: #1b5fc1; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.small-button:hover { background: #eaf1fa; }
.small-button:disabled { opacity: .5; cursor: not-allowed; }
.alert { padding: 14px 16px; border: 1px solid; border-radius: 10px; margin-bottom: 20px; font-size: 14px; }
.alert-success { border-color: #a6d8b7; background: #e9f8ee; color: #145b32; }
.alert-error { border-color: #efb5b5; background: #fff0f0; color: #922828; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.form-error { margin: -8px 0 0; color: #a12626; font-size: 13px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; background: #edf2f0; }
.auth-shell { width: min(440px, calc(100% - 32px)); padding: 32px 0; }
.auth-card { padding: 34px; margin: 0; overflow: visible; }
.auth-card h1 { font-size: 36px; }
.auth-card .muted { margin-bottom: 26px; }
.auth-card .primary-button { width: 100%; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.status-card { padding: 15px; border: 1px solid #dce3ea; border-radius: 11px; background: #f8fafb; }
.status-card strong { display: block; margin-bottom: 4px; font-size: 24px; }
.status-card span { color: #637083; font-size: 12px; }
.status-ready { border-color: #a6d8b7; background: #eef9f2; }
.status-failed { border-color: #efb5b5; background: #fff3f3; }
.status-downloading { border-color: #a9c8ef; background: #f0f6fd; }
.filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 20px; }
.filter-form label { min-width: 170px; }
select { width: 100%; box-sizing: border-box; padding: 9px 34px 9px 11px; border: 1px solid #cfd6de; border-radius: 8px; background: #fff; color: #17202a; font: inherit; }
.reset-link { padding: 8px 0; color: #637083; font-size: 13px; }
.pagination { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-top: 18px; color: #637083; font-size: 13px; }
.pagination a { color: #1b5fc1; font-weight: 700; }
.pagination-pages { display: flex; align-items: center; justify-content: center; gap: 5px; }
.pagination-pages a, .pagination-pages strong, .pagination-pages .disabled { display: grid; min-width: 32px; height: 32px; box-sizing: border-box; place-items: center; padding: 0 7px; border: 1px solid #dbe2e8; border-radius: 8px; background: #fff; text-decoration: none; }
.pagination-pages a:hover { border-color: #7db18f; background: #eff8f2; color: #155f34; }
.pagination-pages strong { border-color: #176b3a; background: #176b3a; color: #fff; }
.pagination-pages .disabled { color: #a5adb7; }
.pagination-current { text-align: right; }

a { color: inherit; }
.app-shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; box-sizing: border-box; height: 100vh; padding: 20px 15px 15px; border-right: 1px solid #dce3e9; background: #fff; box-shadow: 5px 0 25px rgb(20 34 47 / 4%); }
.sidebar .brand { padding: 0 7px 22px; border-bottom: 1px solid #edf0f3; }
.sidebar-nav { display: grid; gap: 4px; margin-top: 18px; }
.sidebar-nav a { display: grid; grid-template-columns: 31px minmax(0, 1fr); align-items: center; min-height: 39px; padding: 0 10px; border-radius: 9px; color: #526174; font-size: 13px; font-weight: 750; text-decoration: none; }
.sidebar-nav a > span { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 7px; background: #f0f3f6; color: #54667a; font-size: 12px; font-weight: 900; }
.sidebar-nav a:hover { background: #f5f8f6; color: #175d34; }
.sidebar-nav a.active { background: #eaf6ee; color: #145c32; }
.sidebar-nav a.active > span { background: #cfead8; color: #145c32; }
.sidebar-nav .nav-wa { font-size: 8px; }
.sidebar-bottom { display: grid; gap: 6px; margin-top: auto; padding: 16px 9px 5px; border-top: 1px solid #edf0f3; }
.sidebar-bottom strong { font-size: 13px; }
.local-state { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; color: #607063; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.local-state i { width: 7px; height: 7px; border-radius: 50%; background: #2da159; box-shadow: 0 0 0 3px #e0f4e7; }
.content-shell { min-width: 0; }
.content-shell .app-main { width: calc(100% - 40px); }
.app-header { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr); align-items: center; gap: 24px; padding: 12px 16px; border-bottom: 1px solid #dfe5eb; background: rgb(255 255 255 / 96%); box-shadow: 0 4px 22px rgb(18 32 47 / 5%); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; background: #176b3a; color: white; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: #758195; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.main-nav { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 11px; background: #f1f4f7; }
.main-nav a { padding: 8px 13px; border-radius: 8px; color: #526073; font-size: 13px; font-weight: 750; text-decoration: none; }
.main-nav a:hover, .main-nav a.active { background: white; color: #164e30; box-shadow: 0 1px 5px rgb(23 32 42 / 10%); }
.app-header .account-actions { justify-self: end; }
.page-title-row { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 26px; }
.page-title-row h1 { margin-bottom: 7px; }
.page-title-row p:last-child { margin-bottom: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; }
.metric-card { padding: 18px 20px; border: 1px solid #e0e6eb; border-radius: 14px; background: white; box-shadow: 0 7px 24px rgb(27 39 51 / 4%); }
.metric-card strong { display: block; margin-bottom: 4px; font-size: clamp(22px, 2vw, 30px); }
.metric-card span { color: #687587; font-size: 12px; }
.compact-metrics { grid-template-columns: repeat(6, minmax(120px, 1fr)); }
.section-heading { align-items: start; }
.section-heading h2 { margin-bottom: 5px; }
.section-heading .muted { margin-bottom: 16px; }
.secondary-button, .primary-button { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; text-decoration: none; }
.secondary-button { white-space: nowrap; padding: 9px 13px; border: 1px solid #c8d2dc; border-radius: 9px; color: #245d9e; background: #f8fafc; font-size: 12px; font-weight: 800; }
.channel-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 14px; }
.channel-card { position: relative; min-height: 112px; padding: 18px; overflow: hidden; border: 1px solid #dce4eb; border-radius: 13px; background: #f8fafc; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.channel-card:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgb(22 35 47 / 9%); }
.channel-card strong, .channel-card > span:not(.channel-icon), .channel-card small { display: block; margin-left: 54px; }
.channel-card strong { font-size: 25px; }
.channel-card > span:not(.channel-icon) { margin-top: 2px; font-weight: 750; }
.channel-card small { margin-top: 11px; color: #657387; }
.channel-icon { position: absolute; display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: #e9eff5; font-size: 14px; font-weight: 900; }
.channel-call .channel-icon { background: #e7effc; color: #235daa; }
.channel-sms .channel-icon { background: #fff2d7; color: #8b5c00; }
.channel-whatsapp .channel-icon { background: #e4f8eb; color: #14783a; }
.channel-numbers .channel-icon { background: #eee9fa; color: #6142a1; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; }
.dashboard-columns > section { min-width: 0; }
.status-list { display: grid; gap: 1px; border: 1px solid #e5e9ed; border-radius: 10px; overflow: hidden; background: #e5e9ed; }
.status-list > div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 13px; background: #fafbfc; font-size: 13px; }
.status-list strong { font-size: 15px; }
.state-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #a8b0ba; }
.state-dot.ok { background: #2e9b58; box-shadow: 0 0 0 3px #e3f5e9; }
.table-scroll { width: 100%; overflow-x: auto; }
.numbers-filter { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(210px, .55fr) 155px auto auto; align-items: end; gap: 12px; margin-bottom: 22px; }
.numbers-filter .primary-button { min-height: 41px; }
.numbers-table { min-width: 1080px; }
.numbers-table td { vertical-align: middle; }
.sortable { display: inline-flex; align-items: center; gap: 6px; color: #526174; text-decoration: none; }
.sortable:hover { color: #176b3a; }
.sortable span { color: #93a0ae; font-size: 11px; }
.line-badges { display: flex; flex-wrap: wrap; gap: 5px; max-width: 390px; }
.line-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 7px; background: #f0f3f6; color: #536174; font-size: 10px; white-space: nowrap; }
.line-badge b { font-size: 8px; text-transform: uppercase; letter-spacing: .03em; }
.line-badge.channel-call { background: #e7effc; color: #235daa; }
.line-badge.channel-sms { background: #fff2d7; color: #825600; }
.line-badge.channel-whatsapp { background: #e4f8eb; color: #14783a; }
.communications-table { min-width: 1060px; }
td small { display: block; margin-top: 3px; color: #778396; font-size: 11px; }
.nowrap { white-space: nowrap; }
.primary-link { color: #175ca9; font-weight: 750; text-decoration: none; }
.primary-link:hover, .row-link:hover { text-decoration: underline; }
.row-link { white-space: nowrap; color: #176b3a; font-size: 12px; font-weight: 800; text-decoration: none; }
.channel-pill { display: inline-flex; align-items: center; width: max-content; padding: 5px 8px; border-radius: 999px; background: #edf1f5; color: #455467; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.channel-pill.channel-call { background: #e7effc; color: #235daa; }
.channel-pill.channel-sms { background: #fff2d7; color: #8b5c00; }
.channel-pill.channel-whatsapp { background: #e4f8eb; color: #14783a; }
.channel-pill.large { padding: 8px 13px; font-size: 12px; }
.tab-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.tab-row a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid #dce3ea; border-radius: 9px; background: white; color: #536174; font-size: 13px; text-decoration: none; }
.tab-row a.active { border-color: #87b59a; background: #eaf6ee; color: #165d33; }
.tab-row strong { font-size: 11px; }
.wide-filter { display: grid; grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(150px, 180px)) auto auto; align-items: end; }
.wide-filter .search-field { min-width: 0; }
.wide-filter .primary-button { min-height: 41px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: #718094; font-size: 12px; }
.breadcrumb a { color: #2866aa; }
.lead-phone { margin: 0; color: #4f5e72; font-size: 18px; }
.number-profile-header { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.number-profile-header h1 { margin-bottom: 4px; }
.number-avatar { display: grid; flex: 0 0 auto; width: 64px; height: 64px; place-items: center; border-radius: 20px; background: linear-gradient(145deg, #197240, #0e512d); color: #fff; box-shadow: 0 9px 24px rgb(23 107 58 / 20%); font-size: 25px; font-weight: 900; }
.number-tabs { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 8px; padding: 7px; border: 1px solid #dfe5ea; border-radius: 14px; background: #fff; box-shadow: 0 7px 24px rgb(27 39 51 / 4%); }
.number-tabs a { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0 14px; border-radius: 9px; color: #596779; font-size: 13px; font-weight: 800; text-decoration: none; transition: background .15s ease, color .15s ease, transform .15s ease; }
.number-tabs a:hover { background: #f1f5f3; color: #175d34; transform: translateY(-1px); }
.number-tabs a.active { background: #176b3a; color: #fff; box-shadow: 0 5px 13px rgb(23 107 58 / 20%); }
.number-tabs strong { display: inline-grid; min-width: 22px; height: 22px; place-items: center; padding: 0 5px; border-radius: 999px; background: rgb(105 121 139 / 11%); font-size: 10px; }
.number-tabs a.active strong { background: rgb(255 255 255 / 20%); }
.profile-contact-section { padding-block: 19px; }
.activity-feed, .call-list { display: grid; border: 1px solid #e3e8ec; border-radius: 13px; overflow: hidden; background: #e3e8ec; gap: 1px; }
.activity-feed-item { display: grid; grid-template-columns: 44px minmax(220px, 1fr) auto 20px; align-items: center; gap: 14px; min-height: 62px; padding: 11px 15px; background: #fff; text-decoration: none; transition: background .14s ease; }
.activity-feed-item:hover, .call-list-item:hover { background: #f7faf8; }
.activity-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: #edf1f5; color: #536274; font-size: 10px; font-weight: 900; }
.activity-icon.channel-call { background: #e7effc; color: #235daa; font-size: 17px; }
.activity-icon.channel-sms { background: #fff2d7; color: #8b5c00; }
.activity-icon.channel-whatsapp { background: #e4f8eb; color: #14783a; }
.activity-main, .activity-details, .call-main, .call-result { display: grid; gap: 4px; min-width: 0; }
.activity-main strong, .call-main strong { font-size: 13px; }
.activity-main > span { overflow: hidden; color: #687587; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.activity-details { justify-items: end; color: #617083; font-size: 12px; }
.activity-details small, .call-main small, .call-result small { color: #7a8797; font-size: 10px; }
.activity-open { color: #8995a3; font-size: 24px; font-weight: 400; }
.call-list-item { display: grid; grid-template-columns: 40px minmax(180px, 1fr) minmax(120px, .5fr) auto auto 20px; align-items: center; gap: 14px; min-height: 60px; padding: 11px 15px; background: #fff; text-decoration: none; }
.call-direction { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: #e8f5ed; color: #17703d; font-size: 19px; font-weight: 900; }
.call-direction.outgoing { background: #e8effa; color: #2861a7; }
.call-result strong { color: #217443; font-size: 12px; }
.call-result strong.missed { color: #a52b2b; }
.call-list-item time { color: #607083; font-size: 12px; white-space: nowrap; }
.recording-ready { padding: 4px 7px; border-radius: 6px; background: #eaf6ee; color: #176b3a; font-size: 9px; font-weight: 900; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.contact-card { display: grid; gap: 4px; padding: 13px 14px; border: 1px solid #e0e6eb; border-radius: 10px; background: #fafbfc; }
.contact-card span { color: #526174; font-size: 13px; }
.contact-card small { color: #7b8797; }
.timeline { position: relative; display: grid; gap: 13px; }
.timeline::before { position: absolute; top: 10px; bottom: 10px; left: 8px; width: 2px; background: #dde4ea; content: ''; }
.timeline-item { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 13px; }
.timeline-marker { z-index: 1; width: 12px; height: 12px; margin-top: 19px; border: 3px solid white; border-radius: 50%; background: #64809f; box-shadow: 0 0 0 1px #cbd5de; }
.timeline-marker.channel-call { background: #3977c8; }
.timeline-marker.channel-sms { background: #d79a19; }
.timeline-marker.channel-whatsapp { background: #28a254; }
.timeline-content { padding: 14px 16px; border: 1px solid #e2e7ec; border-radius: 11px; background: #fbfcfd; }
.timeline-head { display: flex; justify-content: space-between; gap: 20px; }
.timeline-head > div { display: flex; align-items: center; gap: 10px; }
.timeline-head time { white-space: nowrap; color: #707e90; font-size: 12px; }
.timeline-meta { display: flex; flex-wrap: wrap; gap: 7px 18px; margin: 10px 0; color: #677587; font-size: 12px; }
.message-preview { margin: 10px 0; padding: 10px 12px; border-left: 3px solid #a8b7c5; background: white; color: #354256; font-size: 13px; }
.delivery-warning { margin: 10px 0; padding: 9px 11px; border-left: 3px solid #d65050; background: #fff3f3; color: #8d2929; font-size: 12px; font-weight: 700; }
.delivery-state { display: inline-flex; padding: 4px 7px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.delivery-state.failed { background: #ffe4e4; color: #9d2626; }
.delivery-alert { margin-bottom: 17px; padding: 14px 16px; border: 1px solid; border-radius: 10px; }
.delivery-alert p { margin: 5px 0 0; font-size: 13px; line-height: 1.5; }
.delivery-alert.error { border-color: #eab0b0; background: #fff1f1; color: #8b2828; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border: 1px solid #e5e9ee; border-radius: 11px; overflow: hidden; }
.detail-list div { padding: 12px 14px; border-bottom: 1px solid #e8ecf0; }
.detail-list dt { margin-bottom: 4px; color: #748194; font-size: 11px; font-weight: 750; text-transform: uppercase; }
.detail-list dd { margin: 0; font-size: 14px; }
.detail-list a { color: #175ca9; }
.recording-box { display: grid; gap: 9px; margin-top: 18px; padding: 15px; border: 1px solid #b9ddc6; border-radius: 11px; background: #f0faf3; }
.recording-box audio { width: 100%; }
.recording-box small { color: #607269; }
.conversation { display: grid; gap: 10px; max-width: 1050px; }
.conversation-section { overflow: visible; }
.conversation-thread-tabs { display: flex; gap: 10px; margin: 4px 0 20px; padding-bottom: 4px; overflow-x: auto; }
.conversation-thread-tabs > a { display: grid; flex: 0 0 auto; grid-template-columns: auto minmax(180px, 1fr); gap: 4px 10px; min-width: 290px; padding: 12px 14px; border: 1px solid #dce3e9; border-radius: 11px; background: #f8fafb; text-decoration: none; }
.conversation-thread-tabs > a.active { border-color: #70aa85; background: #ecf7f0; box-shadow: 0 0 0 2px rgb(39 132 73 / 10%); }
.conversation-thread-tabs strong { align-self: center; font-size: 13px; }
.conversation-thread-tabs small { grid-column: 1 / -1; color: #6f7d8f; font-size: 11px; }
.conversation-pair-heading { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 20px; padding: 15px; border: 1px solid #e0e6eb; border-radius: 12px; background: #f8fafb; text-align: center; }
.conversation-pair-heading div { display: grid; gap: 3px; }
.conversation-pair-heading span { color: #748194; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.conversation-pair-heading strong { font-size: 16px; }
.conversation-pair-heading b { color: #8190a2; font-size: 20px; }
.phone-conversation { max-width: 1180px; margin: 0 auto; padding: 18px; border-radius: 13px; background: #f4f7f8; }
.message-bubble { max-width: min(720px, 85%); padding: 13px 15px; border: 1px solid #dce3e9; border-radius: 12px 12px 12px 3px; background: #f5f7f9; }
.message-bubble.outgoing { justify-self: end; border-color: #b9dcc6; border-radius: 12px 12px 3px 12px; background: #eaf7ee; }
.message-bubble > div { display: flex; justify-content: space-between; gap: 30px; font-size: 11px; }
.message-bubble time, .message-bubble small { color: #748194; }
.message-status.failed { color: #a52222; font-weight: 850; }
.message-bubble p { margin: 9px 0 4px; white-space: pre-wrap; line-height: 1.5; }
.message-attachments { display: grid; gap: 8px; margin: 10px 0 6px; }
.message-attachments a { display: block; }
.message-attachments img { display: block; max-width: min(520px, 100%); max-height: 520px; border-radius: 9px; object-fit: contain; background: #fff; }
.message-file { padding: 9px 11px; border: 1px solid #cad6df; border-radius: 8px; background: rgb(255 255 255 / 70%); font-size: 12px; font-weight: 800; text-decoration: none; }
.message-file.unavailable { color: #8b5a1f; font-weight: 600; }
.message-activity-link { display: block; margin-top: 7px; color: #637b96; font-size: 10px; text-decoration: none; }
.message-activity-link:hover { text-decoration: underline; }
.conversation-event { justify-self: center; display: grid; gap: 4px; max-width: 760px; padding: 10px 14px; border: 1px solid #d9e0e6; border-radius: 9px; background: #fff; color: #59687b; text-align: center; font-size: 11px; }
.conversation-event.failed { border-color: #e8b2b2; background: #fff0f0; color: #8e2929; }
.phone-conversation .current-activity { box-shadow: 0 0 0 3px rgb(37 109 206 / 18%); }
.conversation-event a { font-weight: 800; }
details summary { cursor: pointer; }
.details-intro { margin: 14px 0; }
code { font-size: 12px; word-break: break-all; }

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 205px minmax(0, 1fr); }
    .metric-grid, .compact-metrics { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
    .channel-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
    .dashboard-columns, .detail-layout { grid-template-columns: 1fr; }
    .wide-filter { grid-template-columns: minmax(250px, 1fr) repeat(2, 160px); }
    .wide-filter .reset-link { grid-column: 1 / -1; }
}

@media (max-width: 650px) {
    .page-header { align-items: start; flex-direction: column; }
    .account-actions { justify-content: flex-start; }
    main { width: calc(100% - 20px); padding-top: 24px; }
    .app-shell { display: block; }
    .sidebar { position: static; display: grid; grid-template-columns: 1fr auto; width: 100%; height: auto; padding: 12px 10px; border-right: 0; border-bottom: 1px solid #dce3e9; }
    .sidebar .brand { padding: 0; border: 0; }
    .sidebar-nav { grid-row: 2; grid-column: 1 / -1; display: flex; margin-top: 11px; overflow-x: auto; }
    .sidebar-nav a { flex: 0 0 auto; grid-template-columns: 24px auto; padding: 0 8px; }
    .sidebar-bottom { align-self: center; margin: 0; padding: 0; border: 0; text-align: right; }
    .sidebar-bottom .local-state, .sidebar-bottom strong { display: none; }
    .content-shell .app-main { width: calc(100% - 20px); }
    .page-title-row { align-items: start; flex-direction: column; }
    .metric-grid, .compact-metrics, .channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-card { padding: 14px; }
    section { padding: 17px; }
    .section-heading { flex-direction: column; }
    .wide-filter { display: grid; grid-template-columns: 1fr; }
    .numbers-filter { grid-template-columns: 1fr; }
    .wide-filter .reset-link { grid-column: auto; }
    .detail-list { grid-template-columns: 1fr; }
    .timeline-head { align-items: start; flex-direction: column; gap: 8px; }
    .number-profile-header { align-items: flex-start; }
    .number-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .activity-feed-item { grid-template-columns: 40px minmax(0, 1fr) 16px; gap: 10px; padding: 10px; }
    .activity-details { grid-column: 2; grid-row: 2; justify-items: start; display: flex; flex-wrap: wrap; }
    .activity-open { grid-column: 3; grid-row: 1 / span 2; }
    .call-list-item { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; padding: 11px; }
    .call-result { grid-column: 2; }
    .call-list-item time { grid-column: 2; }
    .call-list-item .recording-ready { grid-column: 3; grid-row: 2; }
    .call-list-item .activity-open { grid-column: 3; grid-row: 1; }
    .conversation-pair-heading { align-items: stretch; flex-direction: column; gap: 8px; }
    .conversation-pair-heading b { transform: rotate(90deg); }
    .phone-conversation { padding: 12px; }
    .channel-card strong, .channel-card > span:not(.channel-icon), .channel-card small { margin-left: 0; }
    .channel-card .channel-icon { position: static; margin-bottom: 12px; }
    .connection-form { grid-template-columns: 1fr; }
    .full-width { grid-column: auto; }
    .auth-shell { width: min(100% - 24px, 440px); }
    .auth-card { padding: 24px; }
    .pagination { align-items: stretch; flex-direction: column; }
    .pagination-pages { order: -1; flex-wrap: wrap; }
    .pagination-current { text-align: left; }
}
