/* Touch and responsive layout additions. Existing desktop design is preserved. */
#iconicaPhoneSettings{position:fixed;left:16px;bottom:calc(16px + env(safe-area-inset-bottom));z-index:950;border:1px solid #b99a5f;border-radius:24px;background:#101824;color:#e8ce96;padding:11px 16px;min-height:44px;font:600 14px/1.4 sans-serif;cursor:pointer}
#iconicaPhoneSettings[hidden]{display:none!important}
#iconicaPhoneDialog{width:min(480px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;padding:24px;border:1px solid #c7ab70;border-radius:18px;background:#101824;color:#f5f5f5;box-sizing:border-box;font:16px/1.6 sans-serif}
#iconicaPhoneDialog::backdrop{background:#000b}#iconicaPhoneDialog h2{margin:0 0 12px;color:#e8ce96;font-size:22px}.phone-actions{display:flex;flex-wrap:wrap;gap:10px}.phone-actions button,.phone-viewer-tools button{min-height:44px;padding:10px 14px;border:1px solid #c7ab70;background:#202630;color:#e8ce96;border-radius:10px;font:600 14px/1.4 sans-serif;cursor:pointer}.phone-actions button:disabled{opacity:.5}.phone-status{min-height:48px;overflow-wrap:anywhere}
.phone-viewer-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.phone-viewer-hint{font-size:12px}.phone-viewer-tools [hidden]{display:none!important}
#fileViewer.phone-expanded{inset:0!important;margin:0!important;width:100vw!important;height:100dvh!important;max-height:100dvh!important;max-width:100vw!important;border-radius:0;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);box-sizing:border-box}
#fileViewer.phone-expanded .viewer-layout{display:block}#fileViewer.phone-expanded #fileViewerComments,#fileViewer.phone-expanded #fileViewerPages{display:none}
#fileViewer.phone-expanded .pdf-surface{max-height:none!important}#fileViewer.phone-expanded #fileViewerStage video,#fileViewer.phone-expanded #fileViewerStage img{max-height:75dvh}
@media(pointer:coarse){button,.btn,.btn-action,.nav-item{min-height:44px}input,select,textarea{font-size:16px!important}input[type=checkbox]{min-width:22px;min-height:22px}}
@media(max-width:1024px){
 html,body{max-width:100%;overflow-x:clip}body{padding-bottom:76px}
 *,*::before,*::after{box-sizing:border-box}
 .dashboard-container{width:100%!important;max-width:100%!important;padding:12px!important;gap:16px!important}
 .main-column,.side-column,.card,.panel,.client-controls,.top-nav>div{min-width:0;max-width:100%}
 .top-nav{padding:16px!important;gap:12px!important}.client-controls{display:flex;flex-wrap:wrap;gap:8px;width:100%}
 .client-controls>*{max-width:100%;min-width:0}.project-selector{width:100%!important}
 .proj-title,.hero-title,#projName{overflow-wrap:anywhere}
 .viewer-header{flex-wrap:wrap;gap:12px!important;padding:12px!important}.viewer-header>div{min-width:0;max-width:100%}.viewer-header h2{font-size:18px!important}
 #fileViewer{width:calc(100vw - 12px)!important;max-height:calc(100dvh - 12px)!important;max-width:100vw!important}
 .viewer-main{padding:10px!important}#fileViewerStage{padding:6px!important;min-height:180px!important}.pdf-toolbar{gap:6px!important}.pdf-toolbar button{padding:8px!important}.pdf-toolbar input{width:56px!important}
 #fileViewerActions{position:relative!important;padding:12px!important;gap:8px!important}#fileViewerActions>*{max-width:100%}
 dialog{max-width:calc(100vw - 16px)!important;max-height:calc(100dvh - 16px)!important;overflow:auto;overscroll-behavior:contain}
 .file-group>summary{padding:14px!important;gap:10px!important}.subject-label{min-width:0;overflow-wrap:anywhere}
 #admin-app .sidebar{display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;overflow-x:auto;align-items:center;width:100%!important;margin:0!important;padding:10px!important;border-radius:0;gap:8px!important}
 #admin-app .sidebar .brand,#admin-app .sidebar .logo,#admin-app .sidebar .nav-label{display:none!important}
 #admin-app .sidebar .nav-item{flex:0 0 auto;white-space:nowrap;padding:12px!important}#admin-app .sidebar .admin-logout{flex:0 0 auto}
 #admin-app .main-content{padding:12px!important;padding-bottom:84px!important}
 #admin-app .header{display:flex!important;flex-wrap:wrap!important;gap:12px!important}#admin-app .header h1{font-size:24px!important}
 #admin-app .form-grid{grid-template-columns:minmax(0,1fr)!important}.file-tools{gap:10px!important}.file-tools label{min-width:0!important;flex-basis:100%}
 #admin-app .data-table{display:block;overflow-x:auto;max-width:100%;-webkit-overflow-scrolling:touch}
 #admin-app .data-table td,#admin-app .data-table th{padding:10px!important}
 #admin-app .card{padding:14px!important}#admin-app input:not([type=checkbox]):not([type=radio]),#admin-app select,#admin-app textarea{max-width:100%}
}
@media(max-width:380px){.phone-actions{display:grid;grid-template-columns:1fr}.phone-viewer-tools button{font-size:12px;padding:8px}.subject-cover{width:46px!important}.metric-grid{grid-template-columns:1fr!important}}
@media print{#iconicaPhoneSettings,#iconicaPhoneDialog,.phone-viewer-tools{display:none!important}}
#iconicaPhoneSettings{position:static;flex-shrink:0;margin:0;box-shadow:none}.sidebar #iconicaPhoneSettings{margin:8px 18px}#iconicaMobileMenu{display:none}
@media(max-width:1024px){
 #admin-app .sidebar{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;overflow:visible;align-items:center!important;padding:12px!important}
 #admin-app .sidebar .brand-badge{grid-column:1;grid-row:1;padding:0!important;border:0!important;min-width:0;margin:0!important}.brand-badge .brand-icon{display:none}.brand-badge .brand-title{font-size:18px}.brand-badge .brand-subtitle{font-size:10px}
 #iconicaMobileMenu{display:block;grid-column:2;grid-row:1;padding:10px 16px;min-height:44px;background:#202630;color:#e8ce96;border:1px solid #b99a5f;border-radius:10px;font:600 14px sans-serif}
 #admin-app .sidebar .sidebar-nav{display:none;grid-column:1/-1;width:100%;max-height:55dvh;overflow:auto}
 #admin-app .sidebar.mobile-menu-open .sidebar-nav{display:block}#admin-app .sidebar .admin-logout{display:none;grid-column:1/-1}#admin-app .sidebar.mobile-menu-open .admin-logout{display:block}
 #admin-app .sidebar #commentAlertBell{grid-column:1;grid-row:2;margin:0!important;padding:10px!important;font-size:13px!important}
 #admin-app .sidebar #iconicaPhoneSettings{grid-column:2;grid-row:2;margin:0;padding:10px;font-size:13px}
 .client-controls #iconicaPhoneSettings{width:auto!important}
}

@media(max-width:1024px){button,.btn,.btn-action,.nav-item{min-height:44px!important}input,select,textarea{font-size:16px!important}input[type=checkbox]{min-width:22px;min-height:22px}}
@media(max-width:1024px){#admin-app{flex-direction:column!important}#admin-app .sidebar{height:auto!important;min-height:0!important;flex:0 0 auto!important;align-content:start!important}#admin-app .main-content{margin-left:0!important;flex:1 1 auto!important;width:100%!important;min-width:0!important}}

#iconicaNotificationInvitation{position:fixed;inset:0;margin:auto;width:min(440px,calc(100vw - 32px));max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 32px);overflow:auto;box-sizing:border-box;padding:24px;background:#101824;color:#eef0f5;border:1px solid #c7ab70;border-radius:18px;font:16px/1.55 system-ui,sans-serif}
#iconicaNotificationInvitation::backdrop{background:#000b}
#iconicaNotificationInvitation h2{margin:0 0 14px;font-size:22px;color:#e8ce96}
#iconicaNotificationInvitation .invite-actions{display:grid;gap:12px;margin-top:20px}
#iconicaNotificationInvitation button{min-height:48px;padding:12px;border:1px solid #c7ab70;border-radius:10px;background:#c7ab70;color:#101824;font:600 15px/1.4 system-ui;cursor:pointer}
#iconicaNotificationInvitation button:last-child{background:transparent;color:#e8ce96}
@media(max-width:768px){
 html body .client-controls{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;align-items:stretch!important}
 html body .client-controls .project-selector,html body .client-controls .live-status{grid-column:1/-1!important;width:100%!important}
 html body .client-controls>.btn-action,html body .client-controls>#iconicaPhoneSettings{position:static!important;width:100%!important;min-width:0!important;min-height:48px!important;height:100%;margin:0!important;padding:10px!important;display:flex;align-items:center;justify-content:center;border-radius:12px!important;font-size:14px!important;line-height:1.35!important;white-space:normal;word-break:normal;overflow-wrap:normal}
 html body .client-controls>.btn-action.danger{color:#f28b8b;border-color:#a14d55}
 html body #vaultFiles .vault-category-title,html body .archive-library .vault-category-title{display:block;flex:1 1 auto;min-width:0;font-size:15px;letter-spacing:normal;word-break:normal;overflow-wrap:normal;hyphens:none}
 html body .vault-category-count{flex:0 0 auto}
 html body .metric-label{font-size:13px;letter-spacing:normal;word-break:normal;overflow-wrap:normal;hyphens:none}
}
@media print{#iconicaNotificationInvitation{display:none!important}}

/* Balanced client action rows on phones/tablets; desktop styling stays intact. */
@media(max-width:1024px){
 html body .client-navigation,
 html body #clientUpdates .update-links,
 html body #clientUpcoming .upcoming-event-actions,
 html body #clientDocumentTabs,
 html body #libraryLayout{
  display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px!important;align-items:stretch!important;justify-content:stretch!important;
  width:100%;min-width:0;max-width:100%;
 }
 html body .client-navigation{padding:12px!important}
 html body #clientUpdates .update-links{margin-top:18px}
 html body .client-navigation>button,
 html body #clientUpdates .update-links>button,
 html body #clientUpcoming .upcoming-event-actions>button,
 html body #clientDocumentTabs>button,
 html body #libraryLayout>button{
  display:flex!important;align-items:center;justify-content:center;
  width:100%!important;min-width:0!important;max-width:100%!important;
  min-height:48px!important;height:100%;margin:0!important;padding:10px 12px!important;
  border-radius:12px!important;font-size:14px!important;line-height:1.35!important;
  text-align:center;white-space:normal!important;word-break:normal!important;
  overflow-wrap:break-word;letter-spacing:normal;box-sizing:border-box;
 }
 html body .client-navigation>button:last-child:nth-child(odd),
 html body #clientUpdates .update-links>button:last-child:nth-child(odd),
 html body #clientUpcoming .upcoming-event-actions>button:last-child:nth-child(odd){grid-column:1/-1}
 html body #clientUpcoming .upcoming-event-actions{margin-top:18px!important;margin-bottom:8px!important}
}
@media(min-width:600px) and (max-width:1024px){
 html body .client-navigation{grid-template-columns:repeat(3,minmax(0,1fr))}
 html body .client-navigation>button:last-child:nth-child(odd){grid-column:auto}
 html body .client-navigation>button:last-child:nth-child(3n+1){grid-column:1/-1}
 html body .client-navigation>button:last-child:nth-child(3n+2){grid-column:span 2}
 html body #clientUpcoming .upcoming-event-actions{grid-template-columns:repeat(3,minmax(0,1fr))}
 html body #clientUpcoming .upcoming-event-actions>button:last-child:nth-child(odd){grid-column:auto}
 html body #clientDocumentTabs{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media(max-width:359px){
 html body #clientUpdates .update-links,
 html body #clientUpcoming .upcoming-event-actions{grid-template-columns:minmax(0,1fr)}
 html body .client-navigation>button,
 html body #clientDocumentTabs>button{padding:10px 8px!important;font-size:13px!important}
}
