/* Mobile viewport, dialog and keyboard layout. */
html{min-width:0}body{min-width:0}main,#content,dialog,#form,#fields{min-width:0}
#content :is(.card,.page-title,.section-title,.button-row,.settings-grid,.settings-side,.settings-fields,.project-grid,.client-grid,.portfolio-grid,.team-grid)>*{min-width:0}
#content :is(h1,h2,h3,p,.project-name,.client-card,.team-card,.message-text,.offer-message){overflow-wrap:anywhere}
input[type=file]{max-width:100%;overflow:hidden}input[type=file]::file-selector-button{max-width:100%;white-space:normal}
#content .metric-chart-labels{flex-wrap:wrap;row-gap:5px}
#content .project-card-finances strong{white-space:normal;overflow-wrap:anywhere}
@media(max-width:1200px){
 #content .client-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr))}
 .client-card-compact .compact-client-bottom{flex-wrap:wrap}
 .client-card-compact .compact-client-bottom>.compact-client-budget{flex:1 0 100%}
 .team-client-card .team-executor-bottom .team-client-finances{flex:1 0 100%}
 .team-executor-bottom .team-client-finances .compact-client-budget small{white-space:normal;overflow-wrap:anywhere}
 .client-card-compact .compact-client-budget strong{white-space:normal;overflow-wrap:anywhere}
}
#sidebar{overflow-y:auto;overscroll-behavior:contain}#sidebar .aside-bottom{flex-shrink:0}
dialog{max-width:calc(100vw - 20px);max-height:calc(var(--app-height,100dvh) - 24px);overscroll-behavior:contain}
#modal #form{max-width:100%}#modal .dialog-head{gap:10px}#modal .dialog-head h2{min-width:0;overflow-wrap:anywhere}#modal .dialog-head button{flex:none}
@media(max-width:700px){
 main{padding-bottom:calc(78px + env(safe-area-inset-bottom))}
 main>header{height:60px;min-height:60px;gap:6px;margin-bottom:16px}
 main>header .workspace-icon,main>header .message-button{display:none!important}
 main>header #menu,main>header .header-actions>.icon-button{width:40px;height:44px;min-width:40px;padding:10px}
 main>header .header-actions{gap:4px;margin-left:0;flex:none}
 main>header .search-wrap{flex:1;min-width:60px;max-width:none;height:40px}
 main>header .search-wrap input{width:100%;min-width:0;padding:8px;font-size:16px}
 main>header .search-wrap>span{padding-left:8px;flex:none}
 main>header .header-actions>#profile{width:40px;max-width:40px;height:44px;min-height:44px;padding:4px;justify-content:center}
 main>header .header-owner-copy{display:none}
 .bottom-nav{height:calc(64px + env(safe-area-inset-bottom));padding-bottom:calc(6px + env(safe-area-inset-bottom))}
 .bottom-nav button{min-height:44px;min-width:0}
 .page-title{align-items:flex-start;flex-wrap:wrap}.page-title>.primary{min-height:44px}
 #content .tabs{flex-wrap:wrap;overflow:visible;height:auto}.tabs button{min-height:36px;white-space:normal}
 #content :is(.stat strong,.project-card-finances strong,.finance-total strong,.finance-metrics strong,.client-budget strong,.task-budget){white-space:normal;overflow-wrap:anywhere}
 #content :is(.button-row,.section-title){flex-wrap:wrap}
 .owner-photo-row{flex-wrap:wrap}.owner-photo-row>div{flex:1;min-width:160px}
 #modal{width:calc(100vw - 20px);margin:auto;padding:16px;border-radius:16px}
 #modal #fields{grid-template-columns:minmax(0,1fr)}#modal label,#modal .field{min-width:0}
 #modal .client-preset-options{grid-template-columns:repeat(auto-fill,minmax(40px,1fr));grid-template-rows:none;grid-auto-flow:row;grid-auto-columns:auto;grid-auto-rows:44px;width:100%;min-width:0;height:auto;max-height:none;gap:6px;overflow:visible}
 #modal .client-preset-options button{width:100%;max-width:48px;min-width:0;height:44px;padding:2px}
 #modal .client-preset-options .client-identity-avatar{width:100%;max-width:40px;height:40px}
 #modal #form>footer{position:sticky;bottom:-16px;background:var(--canvas);padding:12px 0;z-index:2;display:flex;gap:8px;flex-wrap:wrap}
 #modal #form>footer button{min-height:44px;flex:1;min-width:80px}
 .studio-chat{height:calc(var(--app-height,100dvh) - 154px - env(safe-area-inset-bottom));min-height:0;max-height:none}
 .studio-chat .conversation{min-height:0;overflow:hidden}
 .studio-chat .conversation-header{display:grid;grid-template-columns:28px 28px minmax(0,1fr) 88px;gap:6px;min-height:64px;height:64px;margin:0;padding:8px;flex:none}
 .studio-chat .conversation-header .avatar{width:28px;height:28px}.studio-chat .chat-back{width:28px;height:40px;padding:4px}
 .studio-chat .conversation-person{min-width:0}.studio-chat .conversation-person b,.studio-chat .conversation-person small{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
 .studio-chat .chat-side-picker{width:88px;min-width:0;max-width:88px}.studio-chat .chat-side-picker>span{display:none}.studio-chat .chat-side-picker select{width:100%;min-width:0;height:36px;font-size:11px;padding:5px 2px}
 .studio-chat .messages{padding:10px;min-height:0;flex:1 1 0}
 .studio-chat .chat-composer{padding:8px;flex:none;min-width:0}
 .studio-chat .chat-composer form{min-width:0;padding:4px;gap:4px;min-height:44px}
 .studio-chat .chat-composer input{min-width:0;width:0;flex:1;font-size:16px}
 .studio-chat .chat-composer .send-button,.studio-chat #chat-emoji-toggle{width:36px;min-width:36px;height:36px;padding:8px;flex:none}
 .studio-chat .chat-proposal-shortcuts{gap:5px;margin-bottom:6px;flex-wrap:wrap}.studio-chat .chat-proposal-shortcuts button{min-height:32px;padding:5px 7px}
 .studio-chat .chat-composer>small{font-size:9px;line-height:1.35;margin-top:5px}
 .studio-chat .message:has(.file-icon){min-width:0;max-width:100%}.studio-chat .message-gallery{max-width:100%;flex-wrap:wrap}
 .keyboard-visible .bottom-nav{display:none}.keyboard-visible main{padding-bottom:12px}.keyboard-visible .studio-chat{height:calc(var(--app-height,100dvh) - 88px)}
 .keyboard-visible .chat-composer>small,.keyboard-visible .chat-proposal-shortcuts{display:none}
 .keyboard-visible.chat-page{height:var(--app-height,100dvh);min-height:0;overflow:hidden}
 .keyboard-visible.chat-page main{position:fixed;inset:0;display:flex;flex-direction:column;height:var(--app-height,100dvh);min-height:0;padding:0 12px 8px}
 .keyboard-visible.chat-page main>header{flex:none;margin-bottom:8px}
 .keyboard-visible.chat-page #content{width:100%;max-width:100%;flex:1;min-height:0;margin:0}
 .keyboard-visible.chat-page .studio-chat{height:100%;margin:0}
 .keyboard-visible.chat-page #app-download-footer{display:none}
}
@media(max-width:600px){
 #content :is(.client-grid,.team-client-grid,.project-grid,.dashboard-projects){grid-template-columns:minmax(0,1fr);gap:14px}
 #content .client-card-compact{padding:16px}
 .client-card-compact .client-v3-header{display:grid;grid-template-columns:44px minmax(0,1fr) 40px;gap:12px;align-items:center}
 .client-card-compact .client-v3-heading{min-width:0}.client-card-compact .client-v3-heading h3{font-size:16px;line-height:1.4;overflow-wrap:break-word}
 .client-card-compact .client-v3-type{white-space:normal;font-size:10px}
 .client-card-compact .client-v3-header>.icon-button{width:40px;height:40px}
 .client-contact-columns.has-people{grid-template-columns:minmax(0,1fr)}
 .client-card-compact .client-v3-contact{font-size:12px}.client-v3-contact>span{min-width:0;align-items:flex-start}.client-v3-contact>span>span{overflow-wrap:anywhere;min-width:0}
 .client-card-compact .compact-client-bottom{display:flex;flex-wrap:wrap;gap:12px}
 .client-card-compact .compact-client-bottom>.compact-client-budget{flex:1 0 100%}
 .client-card-compact .compact-client-budget strong{white-space:normal;overflow-wrap:anywhere;font-size:18px}
 .client-card-compact .client-v3-metrics{flex:1;justify-content:flex-start;gap:24px;margin:0}
 .client-card-compact .client-open{width:40px;height:40px;min-width:40px;margin-left:auto}
 .team-client-card .team-executor-bottom .team-client-finances{flex:1 0 100%;gap:10px}
 .team-executor-bottom .team-client-finances .compact-client-budget small{white-space:normal;font-size:10px}
 .team-client-finances .compact-client-budget strong{font-size:17px}
 .reports-table-wrap{overflow:visible}.reports-table{display:block;white-space:normal;width:100%}
 .reports-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .reports-table tbody{display:grid;gap:12px}.reports-table tr{display:block;border:1px solid var(--line);border-radius:12px;padding:6px 10px;background:var(--surface)}
 .reports-table td,.compact-ui .reports-table td{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);gap:12px;white-space:normal;overflow-wrap:anywhere;padding:10px 0;min-width:0!important;max-width:none!important;font-size:12px}
 .reports-table td::before{content:attr(data-label);color:var(--muted);font-size:11px;line-height:1.5}.reports-table td:last-child{border-bottom:0}.reports-table td[colspan]{display:block}.reports-table td[colspan]::before{content:none}
 .report-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.report-toolbar,.report-period{flex-wrap:wrap}.report-period>label{min-width:0;flex:1 1 140px}
}
@media(max-width:380px){.finance-tiles{grid-template-columns:minmax(0,1fr)}.studio-chat .conversation-person small{display:none}.stats:has(.illustrated-stat){gap:8px}.illustrated-stat .stat-copy small{overflow-wrap:anywhere}}
@media(max-width:700px) and (max-height:500px){.studio-chat .chat-composer>small{display:none}.studio-chat .conversation-header{height:54px;min-height:54px}.studio-chat .messages{padding:6px}.studio-chat .chat-emoji-panel{max-height:90px}}
.action-confirmation{width:min(420px,calc(100vw - 24px));padding:24px}.action-confirmation p{overflow-wrap:anywhere;margin:16px 0 24px}.action-confirmation footer{display:flex;justify-content:flex-end;gap:12px}.action-confirmation button{min-height:44px}
