/* Inbox: three columns (conversations · thread · Dialpad), two on tablets, one on phones. */
.ib-page{display:flex;flex-direction:column;min-height:calc(100vh - 140px)}
.ib-heading{margin-bottom:12px}
.ib-setup{margin-bottom:12px;align-items:center}
.ib-setup .text-button{display:inline;font:inherit;font-weight:700;color:inherit;text-decoration:underline;background:none;border:0;padding:0;cursor:pointer}
.ib-layout{flex:1;display:grid;grid-template-columns:220px 340px minmax(0,1fr);gap:0;border:1px solid var(--line,#e5e2d8);border-radius:16px;background:var(--surface,#fff);overflow:hidden;min-height:620px;height:calc(100vh - 230px)}
.ib-pad{padding:14px}
/* list */
.ib-list{display:flex;flex-direction:column;border-right:1px solid var(--line,#e5e2d8);min-height:0;background:var(--paper,#faf9f6)}
.ib-unread{min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#1f6b36;color:#fff;font-size:11px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;font-style:normal}
.ib-list-tools{display:flex;gap:8px;padding:10px;align-items:center}
.ib-search{flex:1;display:flex;align-items:center;gap:6px;padding:0 10px;border:1px solid var(--line,#e5e2d8);border-radius:10px;background:#fff}
.ib-search svg{width:16px;height:16px;color:var(--muted,#6b7280);flex:none}
.ib-search input{flex:1;border:0;background:none;padding:9px 0;font:inherit;font-size:14px;min-width:0;outline:none}
.ib-items{flex:1;overflow-y:auto;min-height:0}
.ib-item{display:flex;gap:10px;align-items:flex-start;width:100%;padding:12px 14px;border:0;border-bottom:1px solid var(--line,#e5e2d8);background:none;text-align:left;font:inherit;cursor:pointer;color:inherit}
.ib-item:hover{background:var(--hover,#f1efe9)}
.ib-item.active{background:#fff;box-shadow:inset 3px 0 0 var(--ink,#111)}
.ib-item.unread strong,.ib-item.unread .ib-preview{color:var(--ink,#111);font-weight:700}
.ib-item-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.ib-item-top{display:flex;justify-content:space-between;gap:8px;align-items:baseline}
.ib-item-top strong{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ib-item-top time{font-size:11px;color:var(--muted,#6b7280);flex:none}
.ib-subject{font-size:12px;font-weight:600;color:var(--ink,#111);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ib-preview{font-size:13px;color:var(--muted,#6b7280);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ib-preview em{font-style:normal;color:var(--muted,#6b7280)}
.ib-item .ib-unread{align-self:center}
.ib-empty-list{padding:28px 18px;text-align:center}
.ib-avatar{position:relative;flex:none;width:40px;height:40px;border-radius:50%;background:#e9e6dd;color:#1f2a44;display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;letter-spacing:.02em}
.ib-avatar i{position:absolute;right:-3px;bottom:-3px;width:18px;height:18px;border-radius:50%;background:#fff;display:inline-flex;align-items:center;justify-content:center;box-shadow:0 0 0 1px var(--line,#e5e2d8)}
.ib-avatar i svg{width:11px;height:11px}
.ib-chat i{color:#2457c5}.ib-whatsapp i{color:#1faa5a}.ib-email i{color:#b4541f}
/* thread */
.ib-thread{display:flex;flex-direction:column;min-width:0;min-height:0;background:#fff}
.ib-thread-empty{align-items:center;justify-content:center}
.ib-empty{max-width:380px;text-align:center;padding:24px}
.ib-empty-icon{display:inline-flex;width:56px;height:56px;border-radius:50%;background:var(--paper,#faf9f6);align-items:center;justify-content:center;margin-bottom:10px}
.ib-empty-icon svg{width:26px;height:26px}
.ib-thread-head{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--line,#e5e2d8)}
.ib-thread-head strong{font-size:15px}
.ib-thread-head p{margin:0}
.ib-thread-head .pill.green{background:#e4f4e8;color:#1f6b36;font-size:11px;padding:1px 7px;border-radius:9px}
.ib-thread-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.ib-back{display:none}
.ib-thread-subject{display:flex;gap:8px;align-items:center;padding:8px 16px;font-size:13px;font-weight:600;background:var(--paper,#faf9f6);border-bottom:1px solid var(--line,#e5e2d8)}
.ib-thread-subject svg{width:14px;height:14px;color:var(--muted,#6b7280)}
.ib-messages{flex:1;overflow-y:auto;padding:18px 16px;display:flex;flex-direction:column;gap:10px;background:#f6f5f1}
.ib-msg{display:flex;flex-direction:column;max-width:76%;align-self:flex-start}
.ib-msg.out{align-self:flex-end;align-items:flex-end}
.ib-bubble{padding:10px 14px;border-radius:16px 16px 16px 4px;background:#fff;box-shadow:0 1px 1px rgba(16,24,40,.06);font-size:14px;line-height:1.5;word-break:break-word;white-space:normal}
.ib-msg.out .ib-bubble{background:#1f2a44;color:#fff;border-radius:16px 16px 4px 16px}
.ib-msg.failed .ib-bubble{background:#fff1f0;color:#8a1c1c;box-shadow:inset 0 0 0 1px #f3b4b4}
.ib-meta{font-size:11px;color:var(--muted,#6b7280);margin:4px 6px 0}
.ib-error{display:inline-flex;align-items:center;gap:4px;color:#b42318;margin-left:6px}
.ib-error svg{width:12px;height:12px}
.ib-composer{display:grid;grid-template-columns:1fr auto;gap:10px;padding:12px 16px;border-top:1px solid var(--line,#e5e2d8);align-items:end}
.ib-composer textarea{resize:none;border:1px solid var(--line,#e5e2d8);border-radius:12px;padding:10px 12px;font:inherit;font-size:14px;min-height:44px;max-height:160px}
.ib-composer textarea:focus{outline:2px solid #1f2a44;outline-offset:1px}
.ib-composer .btn{height:44px}
.ib-hint{grid-column:1/-1;margin:0}
.ib-hint.warn{color:#9a5b00}
/* dialer: a floating dock that survives page changes so Dialpad stays signed in */
#ibDialerDock{position:fixed;right:18px;bottom:18px;z-index:120;width:380px;height:min(640px,calc(100vh - 36px));display:flex;flex-direction:column;border:1px solid var(--line,#e5e2d8);border-radius:16px;background:var(--paper,#faf9f6);box-shadow:0 24px 60px rgba(16,24,40,.22);overflow:hidden}
#ibDialerDock[hidden]{display:none}
#ibDialerDock.large{width:min(560px,calc(100vw - 36px));height:calc(100vh - 36px)}
.ib-dialer-head{display:flex;align-items:center;gap:8px;padding:8px 8px 8px 14px;border-bottom:1px solid var(--line,#e5e2d8);background:#fff}
.ib-dialer-head strong{display:inline-flex;align-items:center;gap:6px;flex:1}
.ib-dialer-head svg{width:16px;height:16px}
#ibDialerDock iframe{width:100%;flex:1;min-height:0;border:0;background:#fff}
#ibDialerDock .ib-pad{padding:8px 14px;margin:0;background:#fff;border-top:1px solid var(--line,#e5e2d8)}
body.ib-dialer-on .toast{right:420px}
@media (max-width:760px){#ibDialerDock,#ibDialerDock.large{right:0;left:0;bottom:0;width:auto;height:min(78vh,640px);border-radius:16px 16px 0 0}}
/* settings */
.ib-settings{display:grid;gap:14px}
.ib-stabs{display:flex;gap:6px;border-bottom:1px solid var(--line,#e5e2d8)}
.ib-stab{padding:8px 12px;border:0;border-bottom:2px solid transparent;background:none;font:inherit;font-weight:600;color:var(--muted,#6b7280);cursor:pointer}
.ib-stab.active{color:var(--ink,#111);border-bottom-color:var(--ink,#111)}
.ib-status{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border-radius:10px;background:#fff6e5;color:#7a4b00;font-size:13px}
.ib-status.ok{background:#e4f4e8;color:#1f6b36}
.ib-status svg{width:16px;height:16px;flex:none;margin-top:1px}
.ib-check{flex-direction:row;align-items:center;gap:8px}
.ib-check input{width:18px;height:18px}
.ib-new textarea{resize:vertical}
/* responsive */
@media (max-width:760px){
  .ib-layout{grid-template-columns:minmax(0,1fr);height:auto;min-height:calc(100vh - 190px);border-radius:12px}
  .ib-list{border-right:0}
  .ib-rail{flex-direction:row;overflow-x:auto;border-right:0;border-bottom:1px solid var(--line,#e5e2d8);padding:8px;gap:4px;scrollbar-width:none}
  .ib-rail-h,.ib-rail-foot,.ib-tab small{display:none}
  .ib-tab{flex:none;padding:8px 10px;border-radius:99px}
  .ib-tab.active{box-shadow:none;background:var(--ink,#111);color:#fff}
  .ib-page.has-open .ib-list,.ib-page.has-open .ib-rail{display:none}
  .ib-page:not(.has-open) .ib-thread{display:none}
  .ib-back{display:inline-flex}
  .ib-msg{max-width:88%}
  .ib-thread-actions .btn span{display:none}
  .ib-messages{min-height:50vh}
}

/* WhatsApp test wizard */
.wz-card{border:1px solid var(--line,#e5e2d8);border-radius:14px;padding:14px 16px;margin-bottom:14px;display:grid;gap:10px}
.wz-card h3{margin:0;font-size:15px}
.wz-card code{font-size:12px;word-break:break-all;background:#f4f3ee;padding:2px 6px;border-radius:6px}
.wz-step{margin:0}
.ib-status.wz-step:not(.ok){background:#fde8e8;color:#8a1f1f}
/* ----- Calls tab ----- */
.ib-chips{display:flex;gap:6px;flex-wrap:wrap;padding:0 12px 10px}
.ib-chip{border:1px solid var(--line,#e5e2d8);background:#fff;border-radius:99px;padding:5px 11px;font:inherit;font-size:12px;font-weight:600;color:var(--muted,#6b7280);cursor:pointer}
.ib-chip b{font-weight:700;color:inherit;opacity:.8}
.ib-chip.active{background:var(--ink,#111);border-color:var(--ink,#111);color:#fff}
.ib-avatar.ib-call-inbound{background:#e6f6ec;color:#1b6b3a}
.ib-avatar.ib-call-outbound{background:#e8eefb;color:#1f3f99}
.ib-avatar.ib-call-missed{background:#fde8e8;color:#b42318}
.ib-avatar.ib-call-inbound svg,.ib-avatar.ib-call-outbound svg,.ib-avatar.ib-call-missed svg{width:18px;height:18px}
.ib-item.missed strong{color:#b42318}
.ib-item.live strong::after{content:'LIVE';margin-left:8px;font-size:9px;letter-spacing:1px;background:#e6f6ec;color:#1b6b3a;padding:2px 6px;border-radius:99px;vertical-align:middle}
.ib-call-body{padding:18px}
.ib-call-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px;margin-bottom:18px}
.ib-call-facts div{background:#fff;border:1px solid var(--line,#e5e2d8);border-radius:12px;padding:10px 12px;display:grid;gap:2px}
.ib-call-facts span{font-size:11px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted,#6b7280);font-weight:700}
.ib-call-facts strong{font-size:14px}
.ib-red{color:#b42318}
.ib-call-form{display:grid;gap:10px;background:#fff;border:1px solid var(--line,#e5e2d8);border-radius:12px;padding:14px}
.ib-call-h{margin:22px 0 8px;font-size:13px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted,#6b7280)}
.ib-call-row{display:flex;gap:10px;align-items:center;padding:9px 0;border-bottom:1px solid var(--line,#e5e2d8);font-size:13px}
.ib-call-row svg{width:16px;height:16px;flex:none;color:var(--muted,#6b7280)}
.ib-call-row time{color:var(--muted,#6b7280);font-size:12px}
/* ----- channel rail ----- */
.ib-rail{display:flex;flex-direction:column;gap:2px;padding:14px 10px;border-right:1px solid var(--line,#e5e2d8);background:#f3f1ea;min-height:0;overflow-y:auto}
.ib-rail-h{margin:8px 10px 6px;font-size:11px;font-weight:700;letter-spacing:.8px;text-transform:uppercase;color:var(--muted,#6b7280)}
.ib-rail-h:first-child{margin-top:0}
.ib-tab{display:flex;align-items:center;gap:10px;width:100%;padding:9px 10px;border:0;border-radius:12px;background:none;font:inherit;text-align:left;color:var(--ink,#111);cursor:pointer}
.ib-tab:hover{background:rgba(0,0,0,.05)}
.ib-tab.active{background:#fff;box-shadow:0 1px 2px rgba(16,24,40,.08),0 0 0 1px var(--line,#e5e2d8)}
.ib-tab.off{color:var(--muted,#6b7280)}
.ib-tab.off .ib-tab-ico{opacity:.5}
.ib-tab-ico{flex:none;width:32px;height:32px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;background:#e9e6dd;color:#1f2a44}
.ib-tab-ico svg{width:16px;height:16px}
.ib-tab[data-channel="chat"] .ib-tab-ico{background:#e4ecfb;color:#2457c5}
.ib-tab[data-channel="whatsapp"] .ib-tab-ico{background:#e2f5e8;color:#1faa5a}
.ib-tab[data-channel="email"] .ib-tab-ico{background:#fbeadf;color:#b4541f}
.ib-tab[data-channel="calls"] .ib-tab-ico{background:#1f2a44;color:#fff}
.ib-tab-text{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.2}
.ib-tab-label{font-size:13.5px;font-weight:600;white-space:nowrap}
.ib-tab small{font-size:11px;color:var(--muted,#6b7280);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ib-tab .ib-unread{flex:none}
.ib-tab[data-channel="calls"] .ib-unread{background:#b42318}
.ib-rail-foot{margin-top:auto;padding:12px 4px 0}
.ib-rail-foot .btn{width:100%;justify-content:center}
.ib-list-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px;padding:16px 14px 4px}
.ib-list-head h2{margin:0;font-size:16px}
/* richer empty state */
.ib-empty{max-width:560px}
.ib-empty h2{margin:0 0 4px}
.ib-empty-actions{display:flex;gap:8px;justify-content:center;margin:14px 0 22px;flex-wrap:wrap}
.ib-empty-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;text-align:left}
.ib-empty-grid div{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;padding:12px;border:1px solid var(--line,#e5e2d8);border-radius:12px;background:var(--paper,#faf9f6)}
.ib-empty-grid div i{grid-row:span 2}
.ib-empty-grid strong{font-size:13px}
.ib-empty-grid span{font-size:12px;color:var(--muted,#6b7280)}
.ib-dot{width:30px;height:30px;border-radius:9px;display:inline-flex;align-items:center;justify-content:center;background:#e9e6dd}
.ib-dot svg{width:15px;height:15px}
.ib-dot.ib-chat{background:#e4ecfb;color:#2457c5}.ib-dot.ib-whatsapp{background:#e2f5e8;color:#1faa5a}.ib-dot.ib-email{background:#fbeadf;color:#b4541f}.ib-dot.ib-calls{background:#1f2a44;color:#fff}
@media (max-width:1100px){
  .ib-layout{grid-template-columns:64px 300px minmax(0,1fr)}
  .ib-rail{padding:12px 8px}
  .ib-rail-h,.ib-tab-text,.ib-rail-foot .btn span{display:none}
  .ib-tab{justify-content:center;padding:6px;position:relative}
  .ib-tab .ib-unread{position:absolute;top:2px;right:2px}
}
@media (max-width:760px){.ib-tab-text{display:flex}.ib-tab .ib-unread{position:static}}
/* ----- full-screen inbox: the workspace fills everything under the top bar ----- */
.content:has(.ib-page){display:flex;flex-direction:column;padding:0;overflow:hidden}
.content:has(.ib-page)>.content-footer{display:none}
.content:has(.ib-page)>.ib-page{animation:none;flex:1;min-height:0}
.ib-page{min-height:0}
.ib-heading{margin:0;padding:14px 24px 10px;border-bottom:0}
.ib-heading h1{font-size:20px;margin-bottom:2px}
.ib-setup{margin:0 24px 10px}
.ib-layout{height:auto;min-height:0;flex:1;border-radius:0;border-left:0;border-right:0;border-bottom:0}
@media (max-width:760px){
  .content:has(.ib-page){overflow:auto}
  .ib-layout{height:auto;min-height:calc(100dvh - 200px)}
}
