/* App shell, semantic surfaces and accessible interactions. Loaded last. */
html{scroll-padding-bottom:100px}body{accent-color:var(--accent)}
input,select,textarea,button{font-family:inherit}input,select,textarea{color:var(--text);background:var(--surface)}
input::placeholder,textarea::placeholder{color:var(--text-muted);opacity:1}
:where(a,button,input,select,textarea,summary):focus-visible{outline:3px solid var(--focus);outline-offset:3px}
:where(button,.button,summary){min-height:44px;min-width:44px}
:where(button,.button,a,input,textarea,select){transition:background-color var(--motion),border-color var(--motion),box-shadow var(--motion)}
.button:not(.secondary),button.primary{background:var(--accent);color:var(--on-accent)}
.button.secondary{background:var(--surface);color:var(--link);border:1px solid var(--border)}
:where(button,.button):disabled{cursor:not-allowed;opacity:.65}
.card,.login-card,.summary-panel,.summary-kpis article{border-radius:var(--radius);box-shadow:var(--shadow)}
.login-page{background:radial-gradient(ellipse at top,var(--success-bg),var(--canvas) 65%)}
.login-page>.theme-toggle{position:absolute;inset:12px 16px auto auto}.login-page{padding-top:80px}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-size:12px;line-height:1.4}
.skip-link{position:fixed;left:16px;top:8px;z-index:100;background:var(--surface);color:var(--text);padding:12px;transform:translateY(-160%)}
.skip-link:focus{transform:none}
.shell .menu{display:inline-flex;flex-shrink:0}.shell>main{min-width:0}.header-actions{flex-wrap:wrap;gap:8px}
.shell>aside{background:var(--nav);color:var(--on-accent)}
#sidebar .brand,#sidebar nav a,#sidebar .account-security,#sidebar .account-signout{color:var(--nav-muted)}
#sidebar nav a.active,#sidebar nav a:hover{background:var(--nav-hover);color:var(--on-accent)}
#sidebar nav p,#sidebar .brand small,#sidebar .user-box small{color:var(--nav-muted)}
#sidebar .account-security:hover,#sidebar .account-signout:hover{background:var(--nav-hover)}
.bottom-tabs{display:none}
@media(min-width:1024px){
 .shell.nav-compact>aside{width:88px;padding-inline:10px}
 .shell.nav-compact>main{margin-left:88px;width:calc(100% - 88px)}
 .shell.nav-compact #sidebar .nav-label,.shell.nav-compact #sidebar .brand>span,.shell.nav-compact #sidebar nav p,.shell.nav-compact #sidebar>.service,.shell.nav-compact #sidebar .user-box>span{display:none}
 .shell.nav-compact #sidebar nav a{justify-content:center;padding:12px}
 .shell.nav-compact #sidebar>.brand,.shell.nav-compact #sidebar>.user-box{justify-content:center}
 .shell.nav-compact #sidebar .account-security,.shell.nav-compact #sidebar .account-signout{font-size:0;justify-content:center;gap:0}
 .shell>aside,.shell>main{transition:width var(--motion),margin-left var(--motion)}
}
@media(max-width:1023px){
 .shell>main{padding:20px 16px calc(92px + env(safe-area-inset-bottom,0px))}
 .shell>aside{height:100dvh;padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}
 .bottom-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));position:fixed;inset:auto 0 0;z-index:8;background:var(--surface);border-top:1px solid var(--border);padding:6px max(8px,env(safe-area-inset-right,0px)) calc(6px + env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));box-shadow:var(--shadow)}
 .bottom-tabs a,.bottom-tabs button{min-width:44px;min-height:52px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:0;border-radius:10px;background:transparent;color:var(--text-muted);font:600 12px/1.3 system-ui}
 .bottom-tabs span{font-size:21px}.bottom-tabs a[aria-current="page"]{color:var(--link);background:var(--success-bg)}
 input:not([type="checkbox"]):not([type="radio"]),select,textarea,.form-card input,.form-card select,.form-card textarea,.login-card input{font-size:16px!important;min-height:44px}
 input[type="checkbox"],input[type="radio"]{min-width:24px;min-height:24px}label:has(input[type="checkbox"]),label:has(input[type="radio"]){min-height:44px}
 .shell header{flex-wrap:wrap;gap:12px}.shell header .header-actions{width:100%;margin:0;justify-content:flex-end}
 .shell header>div:first-of-type{flex:1;min-width:0}
 .theme-toggle{min-height:44px}.summary-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:420px){.header-actions .theme-toggle{max-width:145px}.summary-quality-grid{grid-template-columns:1fr}.summary-quality-grid>div+div{border-left:0;border-top:1px solid var(--border);padding:14px 0 0}.summary-kpis strong{font-size:30px}}
.home-summary{gap:20px}.summary-grid{grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);align-items:stretch;gap:20px}
.summary-grid>.summary-panel{height:100%}.summary-secondary{gap:20px}.summary-status-row{min-height:52px}.summary-kpis article{min-width:0}
.summary-kpis .summary-kpi-active{background:var(--info-bg);border-color:var(--border)}.summary-kpis .summary-kpi-done{background:var(--success-bg);border-color:var(--border)}
.summary-kpi-active strong{color:var(--info)}.summary-kpi-done strong{color:var(--success)}
@media(max-width:900px){.summary-grid{grid-template-columns:minmax(0,1fr)}}
.category-dot svg{display:block;width:100%;height:100%}.category-swatches button{min-width:44px;min-height:44px;display:inline-grid;place-items:center;background:var(--surface)}.swatch-color{width:28px;height:28px;pointer-events:none}
.report-bar{width:100%;height:10px;appearance:none;border:0;border-radius:8px;background:var(--surface-soft);color:var(--accent)}
.report-bar::-webkit-progress-bar{background:var(--surface-soft);border-radius:8px}.report-bar::-webkit-progress-value{background:var(--accent);border-radius:8px}.report-bar::-moz-progress-bar{background:var(--accent);border-radius:8px}
.skeleton{display:none;gap:10px;padding:16px 0;pointer-events:none}.skeleton span{display:block;height:14px;border-radius:7px;background:var(--surface-soft);animation:skeleton-pulse 1.4s ease-in-out infinite}.skeleton span:last-child{width:65%}
[aria-busy="true"]>.skeleton,[aria-busy="true"] .skeleton{display:grid}
@keyframes skeleton-pulse{50%{opacity:.4}}
.ai-progress{display:none;color:var(--text-muted);font-size:14px;align-items:center;gap:8px}
[aria-busy="true"] .ai-progress{display:flex}.ai-progress::before{content:"";width:12px;height:12px;border-radius:50%;background:var(--ai);animation:skeleton-pulse 1s ease-in-out infinite}
[data-ai-state="error"] #assistant-status,[data-ai-state="error"] #ai-status{color:var(--danger);border-inline-start:3px solid var(--danger);padding-inline-start:10px}
[data-ai-state="ready"] #assistant-status,[data-ai-state="ready"] #ai-status{color:var(--success)}
.ai-apply-confirm{padding:12px;border:1px solid var(--border);border-radius:12px;background:var(--surface-soft)}
[hidden]{display:none!important}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
@media(forced-colors:active){.skeleton span{border:1px solid CanvasText}.bottom-tabs a[aria-current="page"]{outline:2px solid Highlight}}
#ticket-results[aria-busy="true"]::before,#rrhh-results[aria-busy="true"]::before,#notification-panel[aria-busy="true"]::before{content:"";display:block;height:12px;margin:12px 16px;border-radius:8px;background:var(--surface-soft);animation:skeleton-pulse 1.4s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){#ticket-results[aria-busy="true"]::before,#rrhh-results[aria-busy="true"]::before,#notification-panel[aria-busy="true"]::before{animation:none}}
.brand>b,.login-brand{background:var(--accent);color:var(--on-accent)}
#sidebar>.service{color:var(--nav-muted);background:var(--nav);border-color:var(--nav-hover)}
#sidebar .account-signout::before{content:"↪"}
#logout-dialog,#action-feedback-dialog,#notification-panel{box-shadow:var(--shadow);color:var(--text)}
.offline-page a{color:var(--link)}
.home-summary{color:var(--text)}
@media(max-width:1023px){.shell>aside{transition:transform var(--motion)}}
@media(prefers-reduced-motion:reduce){.shell>aside{transition:none!important}}
@media(max-width:700px){
 .header-actions .theme-toggle{font-size:12px}
 .header-actions .new-ticket-button{font-size:13px}
 .header-actions .theme-toggle::after,.header-actions .new-ticket-button::after{content:none}
}

/* Phase 2 shared responsive components. */
.shell h1{font-size:var(--a2-font-title,1.5rem);overflow-wrap:anywhere}
.shell main{overflow-wrap:anywhere}
.shell .form-card,.shell .settings-card{margin-inline:auto}
.module-switcher{margin:0 0 16px;min-width:0}
.module-switcher label{display:block;font-size:12px;margin-bottom:6px;color:var(--nav-muted)}
.module-switcher select{width:100%;min-height:44px;padding:8px;border:1px solid var(--nav-muted);border-radius:8px;background:var(--nav);color:#fff;font:inherit}
.module-switcher noscript a{display:block;color:var(--nav-muted);padding:8px}
@media(min-width:1024px){.nav-compact .module-switcher{display:none}}
.command-trigger{display:inline-flex;align-items:center;gap:8px}
.command-trigger kbd{font:11px system-ui;border:1px solid var(--border);padding:2px 4px;border-radius:4px}
.a2-dialog{width:min(640px,calc(100% - 24px));max-width:calc(100% - 24px);max-height:calc(100dvh - 24px);padding:24px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);color:var(--text);overflow:auto;box-shadow:var(--shadow)}
.a2-dialog::backdrop{background:var(--overlay)}
.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.dialog-heading h2{margin:0;font-size:1.2rem}.dialog-heading button{flex-shrink:0}
.a2-dialog input{width:100%;min-height:44px;border:1px solid var(--border);padding:12px;border-radius:8px;font-size:16px}
.a2-dialog label{display:block;margin-block:16px 8px}
.a2-dialog ul{list-style:none;margin:12px 0;padding:0}
.a2-dialog li a{display:block;padding:12px;min-height:44px;border-radius:8px;color:var(--link);overflow-wrap:anywhere}
.a2-dialog li a:hover,.a2-dialog li a:focus-visible{background:var(--surface-soft)}
.a2-dialog pre{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%;padding:12px;background:var(--surface-soft);border-radius:8px}
.command-hint{font-size:12px;color:var(--text-muted)}
dialog{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overflow:auto}
.empty-state{padding:32px 20px;text-align:center;color:var(--text-muted)}
.empty-state h2{font-size:1.15rem;color:var(--text)}.empty-state p{margin:8px auto;max-width:42ch}
.empty-state-mark{display:inline-grid;place-items:center;width:44px;height:44px;border-radius:50%;background:var(--surface-soft)}
.validation-summary-valid{display:none}
[data-valmsg-summary] li:empty{display:none}
.audit-badge{display:inline-block;max-width:100%;padding:5px 8px;background:var(--info-bg);color:var(--info);border:1px solid var(--border);border-radius:8px;font-weight:600;overflow-wrap:anywhere}
.ticket-entry-support{display:grid;gap:20px}
.ticket-help{padding:20px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-soft)}
.ticket-help h2{font-size:1.1rem;margin-top:0}.ticket-help ul{padding-inline-start:20px}.ticket-help li{margin-block:12px}
.attachment-drop{min-width:0}.attachment-drop input[type=file]{width:100%;max-width:100%;min-width:0}
.attachment-drop p{overflow-wrap:anywhere}
.a2-cell-label{display:none}
@media(max-width:767px){
 .a2-card-table{display:block;min-width:0;width:100%;border:0}
 .a2-card-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .a2-card-table tbody,.a2-card-table tfoot{display:block;width:100%}
 .a2-card-table tbody tr{display:block;margin:12px;border:1px solid var(--border);border-radius:12px;background:var(--surface);padding:8px;cursor:default}
 .a2-card-table tbody td{display:block;min-width:0;width:auto;max-width:none;padding:8px;border:0;white-space:normal;overflow-wrap:anywhere;color:var(--text)}
 .a2-card-table .a2-cell-label{display:block;font-size:11px;font-weight:650;color:var(--text-muted);margin-bottom:4px}
 .a2-card-table td[colspan]{text-align:center}
 .a2-card-table td a,.a2-card-table td button{min-height:44px;display:inline-flex;align-items:center}
 .a2-card-table tbody td small{white-space:normal}
 .table-wrap:has(.a2-card-table){overflow-x:visible}
 .dialog-heading{align-items:flex-start}.a2-dialog{padding:16px}.command-trigger kbd{display:none}
 .shell .filters{flex-wrap:wrap;min-width:0}.shell .filters>*{min-width:0;max-width:100%}
 .detail-grid{grid-template-columns:minmax(0,1fr)}.detail-grid>aside{min-width:0}
 .ticket-detail dl>div{grid-template-columns:minmax(0,1fr);gap:4px}
 .shell .ticket-title{flex-wrap:wrap}.shell .card-head{flex-wrap:wrap;gap:12px}
}

@media(max-width:767px){.table-wrap .a2-card-table{min-width:0}.header-actions .command-trigger{font-size:13px}.header-actions .command-trigger::after{content:none}.a2-card-table .ticket-assignee-mobile{display:none}.a2-card-table th.ticket-assignee-column,.a2-card-table td.ticket-assignee-column{display:block}}
