:root{--app-height:100dvh}
.case-row{border-left:4px solid transparent;transition:background-color .15s}
.case-row.case-urgent{background:#fff0ef;border-left-color:#c85353}
.case-row.case-normal{background:#fff5e8;border-left-color:#c18a39}
.case-row.case-human{background:#edf4fd;border-left-color:#6b91c5}
.case-row.case-ai,.case-row.case-resolved{background:#fff}
.case-row.selected{box-shadow:inset 0 0 0 2px #244874}
.case-row .tags{gap:5px;flex-wrap:wrap}.case-row .assignee{background:#e0ebfa;color:#294e7a;max-width:100%;overflow-wrap:anywhere}
.case-row .needs-response{background:#fff;color:#244874;border:1px solid #a9bfdc}
.sidebar-toggle{padding:7px 11px;margin-right:12px;flex-shrink:0;font-size:19px}
.topbar>div:first-of-type{margin-right:auto}
.sidebar{overflow-y:auto;min-height:0}
.shell.sidebar-collapsed{grid-template-columns:68px minmax(0,1fr)}
.sidebar-collapsed .sidebar{padding:16px 8px}.sidebar-collapsed .sidebar .logo{font-size:0;padding:8px 0 20px;text-align:center}.sidebar-collapsed .sidebar .logo::before{content:'a.';font-size:28px;color:white}
.sidebar-collapsed .sidebar .label,.sidebar-collapsed .sidebar .side-label,.sidebar-collapsed .sidebar .workspace,.sidebar-collapsed .sidebar .workspace-switch{display:none}
.sidebar-collapsed .sidebar .nav{position:relative;justify-content:center;padding:13px 8px}.sidebar-collapsed .sidebar .nav-count{position:absolute;right:0;top:0;padding:0 4px;min-width:16px;font-size:10px}
.mobile-bottom,.mobile-context,.mobile-more,.mobile-details-toggle,.mobile-details-back,.finish-writing{display:none}
.remember-login{display:flex!important;align-items:center;gap:10px;margin:12px 0;font-size:13px}.remember-login input{width:18px!important;height:18px}
.session-retry{max-width:480px;margin:15vh auto;padding:24px}.session-retry p{margin:16px 0}
.compose-area.writing-note{background:#fff9ee;border-top:2px solid #d2ad63}.compose-area:not(.writing-note){border-top:2px solid #8caed2}
.quality-controls{display:flex;gap:12px;flex-wrap:wrap;align-items:end}.quality-controls label{display:grid;gap:5px;flex:1;min-width:180px}.quality-summary{margin:16px 0;color:#687c8d}
.quality-grid{display:grid;grid-template-columns:minmax(220px,34%) minmax(0,1fr);border:1px solid #dce4ed;border-radius:12px;background:#fff;overflow:hidden;min-height:440px}
.quality-list{max-height:70vh;overflow:auto;border-right:1px solid #dce4ed}.quality-list>.case-row{width:100%;display:block;text-align:left}.quality-thread{padding:22px;min-width:0}.quality-thread>h2{margin:14px 0 5px}.quality-messages{display:flex;flex-direction:column;gap:15px;padding:20px 0;max-height:60vh;overflow:auto}.quality-messages .bubble{max-width:94%;overflow-wrap:anywhere}.quality-messages p{white-space:pre-wrap}.quality-messages .out{align-self:flex-end}.quality-messages .event{align-self:center}
@media(max-width:800px){
 html,body{width:100%;max-width:100%}body:has(#app>.shell){height:100%;overflow:hidden;overscroll-behavior:none}#app:has(>.shell){position:fixed;top:var(--app-top,0px);left:0;width:100%;max-width:100%;height:var(--app-height);overflow:hidden}.shell,.shell.sidebar-collapsed{display:flex;flex-direction:column;height:var(--app-height);min-height:0;width:100%;grid-template-columns:none}.shell>.sidebar{display:none!important}
 .shell>.main{flex:1 1 0;height:auto;min-height:0;min-width:0;width:100%;max-width:100%;padding-bottom:calc(62px + env(safe-area-inset-bottom));position:relative}
 .topbar{height:64px;min-height:64px;padding:8px 16px;gap:10px;flex-wrap:nowrap}.topbar h1{font-size:19px;line-height:1.2}.topbar>div:first-of-type>small,.topbar .top-right,.topbar #syncStatus,.sidebar-toggle{display:none}
 .mobile-context{display:block!important;max-width:58%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;background:#f4f7fb;color:#365373;padding:8px 10px}
 .banner{padding:6px 14px;font-size:11px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;min-height:28px;flex-shrink:0}.banner span{overflow:hidden;text-overflow:ellipsis}
 .mobile-bottom{display:grid;grid-template-columns:1fr 1fr;position:absolute;bottom:0;left:0;right:0;height:calc(62px + env(safe-area-inset-bottom));padding:3px 16px env(safe-area-inset-bottom);border-top:1px solid #dce5ef;background:#fff;z-index:30;box-shadow:0 -4px 18px #18345308}
 .mobile-bottom>button{position:relative;border:0;background:none;border-radius:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:#6d7d90;font-size:12px;min-height:52px}.mobile-bottom>button svg{height:22px;width:22px}.mobile-bottom>button.active{color:#244874;background:#edf3fa}.mobile-bottom .nav-count{right:calc(50% - 36px);top:2px}
 .mobile-more{display:block;position:absolute;inset:0 0 calc(62px + env(safe-area-inset-bottom));background:#f5f7fb;z-index:25;overflow:auto;padding:20px 16px}.mobile-more>.row-head{margin-bottom:20px}.mobile-more section{background:white;border:1px solid #e0e7ef;border-radius:12px;padding:8px;margin:16px 0}.mobile-more h3{padding:8px 10px;font-size:12px;color:#687e94;text-transform:uppercase;letter-spacing:.08em}.mobile-more section button{display:flex;align-items:center;gap:12px;text-align:left;width:100%;border:0;background:none;min-height:48px}.mobile-more section button svg{width:20px;height:20px}.mobile-more .nav-count{position:static;margin-left:auto}.mobile-more .workspace-switch{display:block;width:100%;padding:12px;background:#18345c;color:#fff;border-radius:12px}.mobile-more .workspace-switch summary{display:none}.mobile-more .workspace-switch[open] .workspace-switch-fields{display:grid!important;position:static;inset:auto;width:100%;max-width:100%;padding:0;border:0;box-shadow:none;background:transparent;gap:8px;z-index:auto}.mobile-more .workspace-switch-fields select{font-size:16px;width:100%;background:white;color:#19365c}
 .inbox,.inbox.resizable-inbox{display:flex!important;flex-direction:column;grid-template-columns:none!important;flex:1 1 0;min-height:0;min-width:0;overflow:hidden;width:100%;max-width:100%}.inbox-divider,.layout-reset{display:none!important}.inbox>.list{display:block;flex:1 1 0;min-height:0;height:auto;width:100%;max-width:none;overflow-y:auto;overscroll-behavior:contain;padding-bottom:12px}.inbox>.thread,.inbox>.details{display:none!important}
 .inbox.show-thread>.list{display:none}.inbox.show-thread>.thread{display:flex!important;flex:1 1 0;height:auto;width:100%;max-width:100%;min-width:0;min-height:0;flex-direction:column;overflow:hidden}.mobile-thread>.main{padding-bottom:0}.mobile-thread .mobile-bottom{display:none}.mobile-thread .banner{display:none}
 .list-tools{padding:14px 14px 10px;position:static}.list-tools .search{margin:10px 0;font-size:16px;min-height:42px}.list-tools .row-head button{padding:7px 10px;font-size:12px}.primary-filters{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.primary-filters .filter{padding:9px 5px;font-size:13px}.list-options{font-size:12px;gap:8px}.case-row{padding:14px 15px;margin:0;border-radius:0}.case-row p{margin:7px 0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:14px}.case-row .row-head strong{font-size:14px}.case-row time{font-size:11px;white-space:nowrap}.case-row small{font-size:11px}.case-row .badge{font-size:10px}
 .thread-head{padding:12px 14px;flex:0 1 auto;min-height:44px;min-width:0;width:100%;max-width:100%;max-height:34%;overflow-x:hidden;overflow-y:auto;overflow-wrap:anywhere}.thread-head h2{font-size:16px;line-height:1.35;margin-top:8px}.thread-head>p{font-size:12px;margin:3px 0 8px}.mobile-back{display:inline-flex!important;padding:6px 8px;font-size:12px}.mobile-details-toggle{display:block;float:right;padding:6px 8px;font-size:12px}.live-actions{gap:6px;flex-wrap:wrap;margin-top:9px}.live-actions button,.live-actions select{min-height:36px;padding:7px 9px;font-size:12px}.live-actions .primary{flex:1}
 .inbox>.thread>.messages{padding:16px 12px;flex:1 1 0;min-height:0;min-width:0;width:100%;max-width:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;gap:15px}.messages .bubble{max-width:94%;padding:12px 14px;border-radius:14px;font-size:14px;overflow-wrap:anywhere}.messages .bubble small{font-size:10px}.event{font-size:11px}
 .compose-area{flex:0 0 auto;min-width:0;width:100%;max-width:100%;max-height:50%;overflow-x:hidden;overflow-y:auto;padding:8px 12px calc(10px + env(safe-area-inset-bottom));background:white}.compose-status{font-size:10px;margin-bottom:6px}.compose-tabs{margin:0 0 6px;gap:14px}.compose-tabs button{font-size:12px;padding:6px 0}.compose-area textarea{font-size:16px;line-height:1.4;min-width:0;min-height:48px;max-height:96px;resize:none;padding:10px;width:100%;border-radius:12px}.footer-actions,.composer-bottom{gap:8px;align-items:center}.footer-actions small,.composer-bottom small{font-size:10px;max-width:55%}.footer-actions button,.composer-bottom button{font-size:12px;min-height:40px;max-width:55%;padding:8px 12px}
 .mobile-details .inbox>.thread{display:none!important}.mobile-details .inbox>.details{display:block!important;width:100%;height:100%;max-height:none;overflow:auto;padding:18px;background:#fff}.mobile-details-back{display:inline-block;margin-bottom:18px}
 .page{padding:18px 14px;overflow-x:hidden;overflow-y:auto;min-height:0}.page-inner{max-width:100%;min-width:0}.intro{margin-bottom:18px}.intro h1{font-size:24px}.intro p{font-size:14px}.card{padding:16px;min-width:0}.tabs{max-width:100%;overflow-x:auto;flex-wrap:nowrap;white-space:nowrap}.group-tabs{margin-bottom:16px}.form-grid,.platform-grid{grid-template-columns:1fr!important}.form-grid>*{min-width:0}.table-scroll{max-width:100%;overflow-x:auto}.permission-row{flex-wrap:wrap}.page input,.page select,.page textarea{font-size:16px}.page button{min-height:40px}.check-row{gap:10px;flex-wrap:wrap}.quality-controls{display:grid;grid-template-columns:1fr}.quality-grid{display:block;min-height:0}.quality-list{max-height:none;border-right:0}.quality-thread{display:none}.quality-grid.has-selection .quality-list{display:none}.quality-grid.has-selection .quality-thread{display:block;padding:14px}.quality-messages{max-height:none}
}
@media(display-mode:standalone){.shell{padding-top:env(safe-area-inset-top)}.mobile-thread .topbar{height:52px;min-height:52px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

/* iPhone: content width must be bounded at every flex level, not merely clipped. */
@media(max-width:800px){
 .shell{max-width:100%;min-width:0}.topbar{min-width:0;width:100%;max-width:100%}.topbar>div{min-width:0}.topbar .mobile-context{flex:0 1 58%;min-width:0}
 .inbox .thread>*{min-width:0;max-width:100%}.thread-head h2,.thread-head p,.messages .bubble,.messages .event{overflow-wrap:anywhere;word-break:normal}
 .thread-head .live-actions{display:flex;flex-wrap:wrap;min-width:0;max-width:100%}.thread-head .live-actions>*{flex:1 1 120px;min-width:0;max-width:100%;white-space:normal}
 .thread-head .tags .badge{min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
 .compose-area form{min-width:0;max-width:100%}.compose-area .footer-actions,.compose-area .composer-bottom{min-width:0;max-width:100%;flex-wrap:wrap}
 .compose-area .footer-actions>small,.compose-area .composer-bottom>small{min-width:0;flex:1 1 100px;overflow-wrap:anywhere}
 .compose-area .footer-actions>button,.compose-area .composer-bottom>button{flex:0 1 auto;min-width:0;max-width:100%;white-space:normal}
 .compose-area .compose-tabs{min-width:0;gap:14px}.finish-writing{display:none}
 .composer-focused .topbar{display:none}.composer-focused .thread-head{flex:0 0 auto;max-height:none;padding:6px 12px;min-height:40px}
 .composer-focused .thread-head>h2,.composer-focused .thread-head>p,.composer-focused .thread-head>small,.composer-focused .thread-head>.tags,.composer-focused .thread-head>.live-actions{display:none}
 .composer-focused .thread-head .mobile-back{margin:0}.composer-focused .compose-area{max-height:55%;padding:5px 12px 8px}
 .composer-focused .compose-status,.composer-focused .compose-area .footer-actions>small,.composer-focused .compose-area .composer-bottom>small,.composer-focused .compose-area .case-notes,.composer-focused .compose-area .note-scope{display:none}
 .composer-focused .compose-area .footer-actions,.composer-focused .compose-area .composer-bottom{justify-content:flex-end;margin-top:5px}
 .composer-focused .compose-area .compose-tabs{margin-bottom:5px}.composer-focused .finish-writing{display:block;margin-left:auto}
 .composer-focused .compose-area textarea{height:var(--composer-height,48px);max-height:96px}.composer-focused .messages{padding-top:10px;padding-bottom:10px}
 .shell.composer-focused{padding-top:0}
}
