.inbox-page{max-width:1500px;margin:0 auto;padding-bottom:20px}.inbox-heading-row{margin-bottom:16px}.inbox-heading-row h1{margin:5px 0 7px;font-size:24px;color:var(--text)}.inbox-heading-row p{margin:0;color:var(--text-secondary);font-size:12px}.inbox-toolbar-card{background:#fff;border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-sm);padding:8px;margin-bottom:12px;overflow-x:auto}.attention-tabs{display:flex;gap:4px;min-width:max-content}.attention-tab{height:34px;border:1px solid transparent;border-radius:8px;background:transparent;padding:0 11px;color:var(--text-secondary);font-size:11px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;gap:6px}.attention-tab:hover{background:#f6f8fb;color:var(--text)}.attention-tab.active{background:var(--brand-gold-soft);border-color:#f0df9b;color:var(--brand-navy-dark)}.attention-dot{width:7px;height:7px;border-radius:50%;display:inline-block}.attention-dot.red{background:#d9534f}.attention-dot.yellow{background:#e0a800}.attention-dot.green{background:#2e8b57}.attention-dot.blue{background:#2d6cdf}.inbox-shell-card{height:calc(100vh - 255px);min-height:620px;display:grid;grid-template-columns:345px minmax(0,1fr);background:#fff;border:1px solid var(--border);border-radius:14px;overflow:hidden;box-shadow:var(--shadow-sm)}.conversation-panel{min-width:0;border-right:1px solid var(--border);display:flex;flex-direction:column;background:#fff}.conversation-toolbar{height:58px;padding:0 15px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border-light)}.conversation-title{font-size:13px;font-weight:800}.icon-button{width:33px;height:33px;border:1px solid var(--border);border-radius:8px;background:#fff;color:var(--text-secondary);cursor:pointer}.icon-button:hover{background:#f6f8fb}.conversation-search-wrap{padding:10px;border-bottom:1px solid var(--border-light)}.conversation-search-wrap input{width:100%;height:36px;border:1px solid var(--border);border-radius:8px;background:#f8fafc;padding:0 11px;font-size:11px;outline:none}.conversation-search-wrap input:focus{background:#fff;border-color:#bdcadd;box-shadow:0 0 0 3px rgba(23,58,112,.06)}.conversation-list{overflow-y:auto;min-height:0;flex:1}.conversation-item{position:relative;display:flex;gap:10px;padding:11px 12px;border-bottom:1px solid #f0f2f5;cursor:pointer}.conversation-item:hover{background:#f8fafc}.conversation-item.active{background:var(--brand-gold-soft)}.conversation-avatar,.chat-avatar{width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:800;background:#edf2f7;color:var(--brand-navy);flex:0 0 auto}.conversation-main{min-width:0;flex:1}.conversation-row{display:flex;gap:8px;justify-content:space-between;align-items:center}.conversation-name{font-size:12px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conversation-time{font-size:9px;color:var(--text-muted);white-space:nowrap}.conversation-preview{margin-top:3px;font-size:10px;color:var(--text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conversation-task{margin-top:4px;font-size:9px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conversation-statuses{margin-top:5px;display:flex;gap:4px;flex-wrap:wrap}.mini-status{font-size:8px;font-weight:800;padding:2px 5px;border-radius:999px;background:#eef1f5;color:var(--text-secondary)}.mini-status.red{background:#fde9e8;color:#a53632}.mini-status.yellow{background:#fff4d1;color:#8b6a00}.mini-status.green{background:#e8f5ed;color:#257044}.mini-status.blue{background:#e9f0ff;color:#2758a7}.chat-panel{min-width:0;display:flex;flex-direction:column;background:#fbfcfe}.chat-empty{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:30px;text-align:center;color:var(--text-muted)}.chat-empty-icon{width:56px;height:56px;border-radius:16px;background:#f0f3f7;display:flex;align-items:center;justify-content:center;font-size:28px;margin-bottom:12px;color:var(--brand-navy)}.chat-empty h2{margin:0 0 6px;color:var(--text);font-size:18px}.chat-empty p{max-width:380px;font-size:12px;line-height:1.6;margin:0}.chat-content{height:100%;min-height:0;display:grid;grid-template-rows:72px auto minmax(220px,1fr) auto auto}.chat-header{background:#fff;border-bottom:1px solid var(--border);padding:0 18px;display:flex;align-items:center;justify-content:space-between;min-width:0}.chat-identity{display:flex;align-items:center;gap:10px;min-width:0}.chat-avatar{width:38px;height:38px}.chat-name{font-size:13px;font-weight:800;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-phone{font-size:10px;color:var(--text-muted);margin-top:2px}.chat-header-actions{display:flex;align-items:center;gap:7px}.reply-window-badge{height:28px;padding:0 9px;border-radius:999px;display:inline-flex;align-items:center;border:1px solid var(--border);font-size:9px;font-weight:800;white-space:nowrap}.reply-window-badge.open{background:#e8f5ed;border-color:#b8dec7;color:#257044}.reply-window-badge.closed{background:#f4f6f8;color:#6f7c8d}.secondary-button{height:32px;padding:0 10px;border:1px solid var(--border);border-radius:8px;background:#fff;color:var(--text-secondary);font-size:10px;font-weight:700;display:inline-flex;align-items:center}.conversation-alert{margin:9px 15px 0;padding:8px 10px;border:1px solid #f0df9b;background:#fff9e8;color:#705c18;border-radius:8px;font-size:10px}.chat-task-strip{margin:9px 15px 0;padding:9px 11px;border:1px solid #e8edf3;border-radius:9px;background:#fff;font-size:10px}.message-list{min-height:0;overflow-y:auto;padding:18px 22px 14px;display:flex;flex-direction:column;gap:10px}.message-row{display:flex}.message-row.inbound{justify-content:flex-start}.message-row.outbound{justify-content:flex-end}.message-bubble{max-width:min(680px,78%);padding:9px 11px;border-radius:12px;border:1px solid var(--border);background:#fff;box-shadow:0 1px 2px rgba(17,32,55,.03)}.message-row.outbound .message-bubble{background:#fff7d9;border-color:#ecd67a}.message-body{font-size:11px;line-height:1.58;color:var(--text);white-space:pre-wrap;word-break:break-word}.message-media{margin-top:6px;padding:7px;border-radius:7px;background:#f6f8fb;font-size:10px;color:var(--text-secondary)}.message-task-link{margin-top:6px;font-size:9px;color:var(--brand-navy);font-weight:800}.message-meta{margin-top:5px;font-size:8px;color:var(--text-muted);display:flex;gap:6px;justify-content:flex-end}.message-reply-tag{margin-bottom:5px;font-size:8px;color:#6d7b8e}.conversation-meta{border-top:1px solid var(--border);background:#fff;padding:10px 14px;max-height:135px;overflow-y:auto}.meta-title{font-size:9px;font-weight:900;text-transform:uppercase;letter-spacing:.08em;color:var(--text-muted);margin-bottom:6px}.attention-badges{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:6px}.attention-badge{font-size:8px;font-weight:800;padding:3px 6px;border-radius:999px}.attention-badge.red{background:#fde9e8;color:#a53632}.attention-badge.yellow{background:#fff4d1;color:#8b6a00}.attention-badge.green{background:#e8f5ed;color:#257044}.attention-badge.blue{background:#e9f0ff;color:#2758a7}.task-context-list{display:flex;gap:6px;flex-wrap:wrap}.task-chip{border:1px solid var(--border);border-radius:8px;padding:6px 8px;background:#fafbfd;min-width:170px}.task-chip a{font-size:10px;font-weight:800;color:var(--text);display:block}.task-chip span{display:block;font-size:8px;color:var(--text-muted);margin-top:2px}.message-composer{background:#fff;border-top:1px solid var(--border);padding:9px 12px}.composer-hint{font-size:9px;color:var(--text-muted);margin-bottom:6px}.composer-row{display:flex;gap:8px;align-items:flex-end}.composer-row textarea{flex:1;resize:none;min-height:42px;max-height:120px;border:1px solid var(--border);border-radius:9px;padding:9px 10px;font-size:11px;line-height:1.4;outline:none;background:#f8fafc}.composer-row textarea:focus{background:#fff;border-color:#bdcadd;box-shadow:0 0 0 3px rgba(23,58,112,.06)}.composer-row textarea:disabled{background:#f4f6f8;color:#a0a9b4;cursor:not-allowed}.composer-row .button{height:42px;padding:0 16px}.inbox-empty{padding:22px 16px;color:var(--text-muted);font-size:10px;text-align:center}.inbox-message{margin-bottom:10px;padding:9px 11px;border-radius:8px;border:1px solid #e5eaf0;background:#fff;font-size:10px}.inbox-message.error{border-color:#f0caca;background:#fff6f6;color:#9e3737}@media(max-width:1000px){.inbox-shell-card{grid-template-columns:300px minmax(0,1fr);height:calc(100vh - 265px)}}@media(max-width:760px){.inbox-shell-card{height:auto;min-height:0;grid-template-columns:1fr}.conversation-panel{height:330px;border-right:0;border-bottom:1px solid var(--border)}.chat-panel{height:720px}.chat-header{padding:0 12px}.chat-header-actions{gap:4px}.reply-window-badge{display:none}.message-list{padding:14px}.message-bubble{max-width:90%}.conversation-meta{max-height:150px}}

/* v3 layout stabilization */
.inbox-page{min-height:calc(100vh - 90px);display:flex;flex-direction:column}.inbox-shell-card{flex:1;min-height:0;height:calc(100vh - 250px)}.chat-content{min-height:0;overflow:hidden}.message-list{overscroll-behavior:contain}.message-composer{position:relative;z-index:2}.composer-context-row{display:flex;align-items:center;gap:8px;margin-bottom:6px}.composer-context-row label{font-size:9px;font-weight:800;color:var(--text-muted);white-space:nowrap}.composer-context-row select{height:28px;max-width:520px;flex:1;border:1px solid var(--border);border-radius:7px;background:#f8fafc;padding:0 8px;font-size:10px;color:var(--text);outline:none}.composer-context-row select:focus{background:#fff;border-color:#bdcadd;box-shadow:0 0 0 3px rgba(23,58,112,.06)}@media(max-width:760px){.inbox-page{min-height:0}.inbox-shell-card{height:calc(100vh - 220px);min-height:620px}.chat-panel{height:100%;min-height:0}.composer-context-row select{max-width:none}}


/* v5 message scrolling fix */
html,body{min-height:100%;}
.inbox-page{min-height:0;height:calc(100vh - var(--topbar-height,70px));}
.inbox-shell-card{height:auto;min-height:0;flex:1;overflow:hidden;}
.chat-panel{min-height:0;height:100%;overflow:hidden;}
.chat-content{height:100%;min-height:0;overflow:hidden;grid-template-rows:72px auto auto minmax(0,1fr) auto;}
.message-list{min-height:0;height:auto;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;}
.conversation-meta{min-height:0;}
@media(max-width:760px){.inbox-page{height:auto;min-height:0}.inbox-shell-card{height:calc(100vh - 220px);min-height:620px}.chat-panel{height:100%;min-height:0}.chat-content{height:100%;min-height:0;grid-template-rows:72px auto auto minmax(0,1fr) auto;}.message-list{min-height:0;height:auto;overflow-y:auto;}}

/* V6: keep the composer permanently visible and let only the message history scroll. */
html,body{height:100%;}
.inbox-page{height:calc(100vh - var(--topbar-height,70px));min-height:0;display:flex;flex-direction:column;box-sizing:border-box;overflow:hidden;}
.inbox-shell-card{flex:1 1 auto;height:auto;min-height:0;overflow:hidden;box-sizing:border-box;}
.chat-panel{height:100%;min-height:0;overflow:hidden;display:flex;flex-direction:column;}
.chat-content{height:100%;min-height:0;overflow:hidden;display:flex;flex-direction:column;}
.chat-header{flex:0 0 72px;}
.conversation-alert,.chat-task-strip{flex:0 0 auto;}
.message-list{flex:1 1 auto;min-height:0;height:auto;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;}
.conversation-meta{flex:0 0 auto;max-height:105px;min-height:0;overflow-y:auto;}
.message-composer{flex:0 0 auto;min-height:0;position:relative;z-index:3;box-shadow:0 -2px 7px rgba(17,32,55,.04);}
.composer-row textarea{min-height:42px;max-height:92px;}
@media(max-width:760px){
  .inbox-page{height:auto;min-height:0;overflow:visible;}
  .inbox-shell-card{height:auto;min-height:620px;}
  .chat-panel{height:720px;min-height:0;}
  .chat-content{height:100%;min-height:0;}
  .conversation-meta{max-height:120px;}
}

/* V7: account for dashboard-content padding so the inbox workspace fits exactly in the viewport. */
.inbox-page{height:calc(100vh - var(--topbar-height,70px) - 76px);min-height:0;max-height:calc(100vh - var(--topbar-height,70px) - 76px);overflow:hidden;}
.inbox-shell-card{min-height:0;height:auto;flex:1 1 auto;}
@media(max-width:1000px){
  .inbox-page{height:calc(100vh - var(--topbar-height,70px) - 48px);max-height:calc(100vh - var(--topbar-height,70px) - 48px);}
}
@media(max-width:760px){
  .inbox-page{height:auto;max-height:none;overflow:visible;}
}

/* =========================================================
   V8 — viewport-safe inbox shell
   The dashboard shell owns the viewport. The inbox itself uses
   a bounded height, and the message composer is docked inside
   the chat panel so it can never be pushed below the fold.
   ========================================================= */
html, body { overflow-x: hidden; }

.dashboard-content { overflow-x: hidden; }

.inbox-page {
    height: calc(100vh - var(--topbar-height) - 76px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.inbox-heading-row {
    flex: 0 0 auto;
    margin-bottom: 14px;
}

.inbox-toolbar-card {
    flex: 0 0 auto;
    margin-bottom: 12px;
    overflow-x: auto;
    overflow-y: hidden;
}

.inbox-shell-card {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    display: grid;
    grid-template-columns: 345px minmax(0, 1fr);
    overflow: hidden;
}

.conversation-panel,
.chat-panel,
.chat-content { min-height: 0; }

.chat-panel { position: relative; overflow: hidden; }

.chat-content {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #fbfcfe;
}

.chat-header {
    flex: 0 0 72px;
}

.conversation-alert,
.chat-task-strip {
    flex: 0 0 auto;
    box-sizing: border-box;
}

.message-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 22px 170px;
    scrollbar-gutter: stable;
}

.conversation-meta {
    flex: 0 0 auto;
    max-height: 88px;
    overflow-y: auto;
}

.message-composer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    box-sizing: border-box;
    box-shadow: 0 -4px 14px rgba(17,32,55,.05);
}

/* Keep the task context readable without stealing the chat height. */
.task-context-list {
    max-height: 44px;
    overflow-y: auto;
}

.task-chip {
    min-width: 150px;
    padding: 5px 7px;
}

/* The attention toolbar should never collapse into a thin strip. */
.attention-tabs { align-items: center; }
.attention-tab { flex: 0 0 auto; white-space: nowrap; }

@media (max-width: 1000px) {
    .inbox-page {
        height: calc(100vh - var(--topbar-height) - 60px);
    }
    .inbox-shell-card {
        grid-template-columns: 300px minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .inbox-page {
        height: auto;
        min-height: 0;
        overflow: visible;
    }
    .inbox-shell-card {
        height: calc(100vh - 220px) !important;
        min-height: 560px;
        grid-template-columns: 1fr;
    }
    .conversation-panel {
        min-height: 0;
        height: 260px;
    }
    .chat-panel { min-height: 0; height: calc(100% - 260px); }
}
