/* Shared markup, with the compact desktop form kept at larger widths. */
[hidden]{display:none!important}
.skip-link{position:fixed;left:12px;top:-100px;z-index:100;background:white;padding:12px}
.skip-link:focus{top:12px}
.brand{min-width:0}
.brand small{display:block;overflow-wrap:anywhere}
#menu-toggle,.mobile-label{display:none}
#nav button[aria-current="page"]{background:#ffffff18;box-shadow:inset 3px 0 #c6d8d1}
#app{min-width:0}
#app:focus{outline:none}
h2,h3,p,.card>strong{overflow-wrap:anywhere}
.toolbar>input,.toolbar>select{flex:1 1 230px;width:auto;max-width:100%}
.toolbar>.field{flex:1 1 280px;min-width:0}
.cell-value{min-width:0}
.cell-value>.toolbar{margin:0}
.cell-value>input,.cell-value>select{min-width:100px}
.field.check-field{flex-direction:row-reverse;justify-content:flex-end}
.field.check-field>span{width:auto;flex:1}
input[type="checkbox"],input[type="radio"]{width:20px;height:20px;flex:none;accent-color:#18443f}
button:disabled{opacity:.6;cursor:wait}
.case-topics{min-width:0}
.case-topics-toggle{width:100%;text-align:left;margin-bottom:8px;font-weight:600}
.case-count{margin:8px 0}
.case-list .tablewrap{max-height:70vh}
.case-list thead th{position:sticky;top:0;z-index:1}
.pagination{justify-content:space-between;align-items:center}
dialog{overscroll-behavior:contain}
dialog>.toolbar:first-of-type{position:sticky;top:0;background:white;z-index:2;padding:6px 0}
dialog>.toolbar:last-child{position:sticky;bottom:0;background:white;padding:10px 0;border-top:1px solid #e0e8e2}
pre{white-space:pre-wrap;overflow-wrap:anywhere}

@media(max-width:850px){
 :root{--savebar-height:0px;scroll-padding-top:100px;scroll-padding-bottom:calc(var(--savebar-height) + 24px)}
 body{display:block;min-height:100dvh}
 #sidebar{position:sticky;top:0;z-index:30;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:6px 12px;padding:12px max(14px,env(safe-area-inset-right)) 12px max(14px,env(safe-area-inset-left));box-shadow:0 1px 6px #183c3918}
 .brand h1{font-size:21px;line-height:1.25;margin:0 0 3px}
 .brand small{font-size:11px;line-height:1.35;max-width:100%;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
 #menu-toggle{display:flex;align-items:center;justify-content:center;gap:8px;color:white;background:transparent;border-color:#ffffff50;min-height:44px}
 #nav{display:none;grid-column:1/-1;margin:4px 0 0;max-height:65vh;max-height:65dvh;overflow-y:auto;gap:4px;grid-template-columns:repeat(2,minmax(0,1fr))}
 .menu-open #nav{display:grid}
 #nav button{padding:10px 12px;min-height:44px;border-radius:5px}
 #sidebar .edition{display:none}
 main{padding:16px max(14px,env(safe-area-inset-right)) 24px max(14px,env(safe-area-inset-left))}
 main>header{gap:12px;align-items:start;font-size:11px}
 #account{text-align:right;overflow-wrap:anywhere}
 #message{margin:12px 0;font-size:13px;overflow-wrap:anywhere}
 #message:empty{display:none}
 h2{font-size:23px;line-height:1.25;margin:18px 0 14px}
 h3{font-size:18px;line-height:1.35}
 button,input,select,textarea{min-height:44px;font-size:16px;padding:9px 10px;max-width:100%}
 button{touch-action:manipulation;line-height:1.3}
 input,select,textarea{scroll-margin:110px 0 calc(var(--savebar-height) + 20px)}
 input[type="checkbox"],input[type="radio"]{min-height:22px;width:22px;height:22px}
 .card{padding:14px;margin:12px 0;border-radius:8px;min-width:0}
 .login{margin:22px auto;max-width:460px}
 .login .primary{width:100%}
 .toolbar{gap:8px;align-items:stretch}
 .toolbar>button{flex:0 1 auto}
 .toolbar>input,.toolbar>select,.toolbar>.field{flex:1 1 100%;width:100%}
 .formrow{grid-template-columns:minmax(0,1fr);gap:12px;margin:12px 0;max-width:100%}
 .field{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:5px 4px;width:100%;min-width:0}
 .field>span{grid-column:1/-1;width:auto;font-size:13px;color:#526c65;line-height:1.4}
 .field>input,.field>select,.field>textarea{grid-column:1;min-width:0;width:100%}
 .field>input:only-of-type:last-child,.field>select:last-child,.field>textarea:last-child{grid-column:1/-1}
 .field>.lookup{grid-column:2;grid-row:2;min-width:44px;min-height:44px;padding:6px;margin:0}
 .card>.field{margin:12px 0}
 .check-field{display:flex;flex-direction:row-reverse;min-height:44px;gap:10px}
 .field.check-field>span{font-size:14px;color:inherit}
 .tabs{flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-inline:contain;gap:5px;padding:3px 0 8px;scroll-padding:8px;margin:12px 0}
 .tabs button{flex:0 0 auto;white-space:nowrap;font-size:14px;min-height:44px}
 .tabs .selected{box-shadow:inset 0 -3px #18443f;font-weight:600}
 .overview{display:flex;flex-direction:column;gap:0}
 .case-topics{order:-1;scroll-margin-top:100px;background:#e7eee8;border-radius:8px;padding:10px;margin:0 0 12px}
 .case-topics-toggle{margin:0;display:block;background:white;font-size:14px;white-space:normal;overflow-wrap:anywhere}
 .case-topics-toggle::after{content:' ▾'}
 .case-topics-toggle[aria-expanded="true"]::after{content:' ▴'}
 .case-topics .topics{display:none;margin-top:10px;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 .case-topics.expanded .topics{display:grid}
 .topics button{font-size:14px;min-height:44px;overflow-wrap:anywhere}
 .case-list .tablewrap{max-height:none;overflow:visible}
 .summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 14px;font-size:12px}
 .summary>div{min-width:0;overflow-wrap:anywhere}
 .summary strong{font-size:19px;line-height:1.35;margin:4px 0;overflow-wrap:anywhere}
 .savebar{position:fixed;bottom:0;left:0;right:0;z-index:40;margin:0;padding:10px max(14px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));gap:8px;box-shadow:0 -3px 12px #183c3910;background:#f4f6f3}
 .savebar>button{flex:1 1 auto;font-size:14px}
 .savebar>span{flex-basis:100%;font-size:11px;line-height:1.3}
 body.has-savebar main{padding-bottom:calc(var(--savebar-height) + 28px)}
 dialog{width:calc(100vw - 20px);max-width:900px;max-height:calc(100dvh - 20px);padding:14px;margin:auto;border-radius:10px}
 dialog h3{margin-top:4px}
 dialog .toolbar>button{flex:1 1 auto}
 dialog .card{padding:12px}
 .rowactions{flex-wrap:wrap;gap:8px}
 details>summary{cursor:pointer;min-height:44px;padding:10px 0;line-height:1.4}
 .statusfield{max-width:none;margin-left:0}
}

/* A row becomes a labelled card; no values or editing controls are omitted. */
@media(max-width:600px){
 .tablewrap{overflow:visible;min-width:0}
 .tablewrap table,.tablewrap tbody{display:block;width:100%;white-space:normal;font-size:14px}
 .tablewrap thead{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
 .tablewrap tbody>tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;border:1px solid #dde6df;border-radius:8px;padding:14px;margin:10px 0;background:white;min-width:0}
 .tablewrap tbody>tr.selected{background:#edf5f0;border-color:#72a18d;box-shadow:inset 3px 0 #36786b}
 .tablewrap td{display:flex;flex-direction:column;gap:4px;border:0;padding:0;min-width:0;text-align:left;overflow-wrap:anywhere}
 .tablewrap td.wide-cell,.tablewrap td.actions-cell{grid-column:1/-1}
 .tablewrap .mobile-label{display:block;font-size:12px;line-height:1.35;color:#647874}
 .tablewrap .cell-value{white-space:normal;overflow-wrap:anywhere}
 .tablewrap .cell-value>input,.tablewrap .cell-value>select{min-width:0;width:100%;max-width:100%}
 .tablewrap .actions-cell .cell-value{display:flex;gap:8px;flex-wrap:wrap}
 .tablewrap .actions-cell button,.tablewrap .actions-cell a{min-height:44px;min-width:44px}
 .tablewrap .actions-cell a{display:inline-flex;align-items:center}
 .tablewrap .actions-cell .toolbar{width:100%}
 .tablewrap .actions-cell .toolbar>button{flex:1}
 .card>.tablewrap tr{padding:12px}
 .tablewrap .empty-row{display:block}
 dialog{width:100%;height:100dvh;max-height:100dvh;max-width:100%;margin:0;border:0;border-radius:0;padding:16px max(14px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left))}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
@media print{#sidebar,.savebar,.skip-link{display:none!important}.tablewrap{overflow:visible}main{padding:0!important}.mobile-label{display:none}}
