/* CodeStorm ERP 8.1.4 — Mobile First & Performance Safety Layer
   Loaded last so layout/accessibility invariants win over visual themes.
   Desktop remains intentionally conservative; most structural rules activate below 1024px. */

:root{
  --cs-mobile-inline:clamp(12px,3.4vw,24px);
  --cs-mobile-block:clamp(14px,3vw,22px);
  --cs-mobile-dock-clearance:104px;
  --cs-mobile-touch:44px;
  --cs-mobile-gap:12px;
  --cs-z-sticky:40;
  --cs-z-navigation:900;
  --cs-z-dropdown:1200;
  --cs-z-modal:1800;
  --cs-z-toast:2200;
}

*,*::before,*::after{box-sizing:border-box}
html,body,.app-shell,.main,.content,.workspace-page{min-width:0;max-width:100%}
img,svg,video,canvas{max-width:100%}
.cs-runtime :where(.card,.panel,.data-card,.kpi,.kpi-card,.summary-chip,.simple-metric,.table-wrap,.page-head,.page-hero,.cs-hero,.dialog-panel,form,fieldset){min-width:0;max-width:100%}
.cs-runtime :where(.entity-copy,.data-toolbar-copy,.page-hero-copy,.card-title>div,.top-title,.top-user-copy){min-width:0}
.cs-runtime :where(p,small,b,strong,a,code,.mono,.cs-ref,.entity-copy){overflow-wrap:anywhere}
.cs-runtime .cell-primary{display:grid;min-width:0;gap:2px;align-content:start}
.cs-runtime .cell-primary>b,.cs-runtime .cell-primary>span{display:block;min-width:0}
.cs-runtime .badge{display:inline-flex;width:fit-content;max-width:100%;min-height:24px;align-items:center;justify-content:center;white-space:normal;overflow-wrap:anywhere;text-align:center;line-height:1.25}
.cs-runtime .progress,.cs-runtime .signature-progress{position:relative;width:100%;max-width:100%;overflow:hidden}
.cs-runtime .table-wrap{width:100%;max-width:100%}
.cs-runtime .table{max-width:100%}
.cs-runtime .entity-cell{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:11px;min-width:0;text-align:left}
.cs-runtime .entity-copy{display:block;min-width:0;text-align:left}
.cs-runtime .entity-copy :where(b,strong,small){max-width:100%;white-space:normal;text-overflow:clip;overflow:visible}
.cs-runtime .tenant-metadata{display:flex;min-width:0;flex-wrap:wrap;gap:4px 10px}
.cs-runtime .contract-details{max-width:100%}
.cs-runtime .contract-details code{display:block;max-width:100%;overflow-wrap:anywhere;word-break:break-word}
.cs-runtime .contract-progress-copy,.cs-runtime .contract-date-range{min-width:0}
.cs-runtime .signature-progress{margin:8px 0 5px}
.cs-runtime .cs-copy-card{min-width:0;height:auto;background:var(--cs-surface-raised);border-color:var(--cs-border);color:var(--cs-text)}
.cs-runtime .cs-copy-card :where(h2,h3,p){color:inherit}
.cs-runtime .cs-copy-card p{color:var(--cs-text-2);line-height:1.62}
.cs-runtime .cs-copy-card .btn{margin-top:8px}
.cs-runtime .cs-form :where(input,select,textarea),.cs-runtime :where(input,select,textarea){max-width:100%}
.cs-runtime textarea{resize:vertical}

/* Dark/light semantic completion for legacy components that previously hard-coded white. */
html[data-color-scheme="dark"] .cs-runtime :where(.cs-copy-card,.portal-card,.plan-card,.installment,.acceptance-facts,.support-contact-card){background:var(--cs-surface-raised);border-color:var(--cs-border);color:var(--cs-text)}
html[data-color-scheme="dark"] .cs-runtime .panel{background:var(--cs-surface);border-color:var(--cs-border);color:var(--cs-text)}
html[data-color-scheme="dark"] body.cs-seasonal-theme .cs-runtime :where(.card,.panel,.data-card,.summary-chip,.simple-metric,.kpi,.kpi-card,.table.responsive-enhanced tr){background:var(--cs-surface)!important;border-color:var(--cs-border)!important;color:var(--cs-text)!important}
html[data-color-scheme="dark"] .cs-runtime :where(.cs-copy-card,.portal-card,.plan-card,.installment,.acceptance-facts,.support-contact-card) :where(p,small,li,dt){color:var(--cs-text-2)}
html[data-color-scheme="dark"] .cs-runtime :where(.cs-form input:not([type="checkbox"]),.cs-form select,.cs-form textarea){background:var(--cs-surface-raised);border-color:var(--cs-border-strong);color:var(--cs-text)}
html[data-color-scheme="dark"] .cs-runtime :where(input,textarea)::placeholder{color:var(--cs-text-3);opacity:1}
html[data-color-scheme="light"] .cs-runtime :where(.cs-copy-card,.portal-card,.plan-card,.installment,.support-contact-card){color:var(--cs-text)}

/* Touch targets: enhancement only for coarse pointers, so desktop density is preserved. */
@media (hover:none) and (pointer:coarse){
  .cs-runtime :where(button,.btn,a.btn,.mobile-dock a,.mobile-dock button,summary){min-height:var(--cs-mobile-touch)}
  .cs-runtime :where(.btn,button,.card,.nav-link){transition-duration:90ms}
  .cs-runtime :where(.btn,button,.card,.nav-link):hover{transform:none!important}
}

/* Tablet/mobile shell. */
@media (max-width:1023px){
  html{scroll-padding-bottom:calc(var(--cs-mobile-dock-clearance) + env(safe-area-inset-bottom))}
  .app-body.cs-runtime .main{width:100%;max-width:100%;margin-left:0}
  .app-body.cs-runtime .content{
    width:100%;max-width:100%;
    padding-block:var(--cs-mobile-block) calc(var(--cs-mobile-dock-clearance) + env(safe-area-inset-bottom) + 20px)!important;
    padding-inline:max(var(--cs-mobile-inline),env(safe-area-inset-left)) max(var(--cs-mobile-inline),env(safe-area-inset-right))!important;
    scroll-padding-bottom:calc(var(--cs-mobile-dock-clearance) + env(safe-area-inset-bottom) + 20px);
  }
  .app-body.cs-runtime .content>*{width:100%;max-width:100%;min-width:0}
  .app-body.cs-runtime .topbar{padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right));backdrop-filter:none!important}
  .app-body.cs-runtime .sidebar-backdrop.show{backdrop-filter:none!important}
  .app-body.cs-runtime .row-action-popover.is-portalled{backdrop-filter:none!important}

  .cs-runtime .page-head,.cs-runtime .page-hero,.cs-runtime .cs-hero{height:auto!important;min-height:0!important}
  .cs-runtime .page-head{gap:14px}
  .cs-runtime .page-actions,.cs-runtime .page-hero-actions{max-width:100%;flex-wrap:wrap;gap:8px}
  .cs-runtime .page-actions>.btn,.cs-runtime .page-actions>form,.cs-runtime .page-hero-actions>.btn,.cs-runtime .page-hero-actions>form{min-width:0}

  .cs-runtime .data-toolbar{align-items:stretch;gap:12px}
  .cs-runtime .data-toolbar-actions{width:100%;max-width:100%;min-width:0;flex-wrap:wrap}
  .cs-runtime label.table-search,.cs-runtime .search-control{width:100%!important;max-width:100%!important;min-width:0!important}
  .cs-runtime .search-bar{width:100%;max-width:100%;min-width:0}

  /* The dock uses the actual rendered item count set by the server. */
  .app-body.cs-runtime .mobile-dock{
    z-index:var(--cs-z-navigation);
    left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));
    bottom:max(8px,env(safe-area-inset-bottom));
    display:grid;grid-template-columns:repeat(var(--dock-items,5),minmax(0,1fr));
    width:auto;max-width:720px;margin-inline:auto;
    padding:6px;border:1px solid var(--cs-border);border-radius:20px;
    background:color-mix(in srgb,var(--cs-surface) 97%,transparent);
    box-shadow:0 12px 30px rgba(15,23,42,.16);
    backdrop-filter:none!important;
  }
  .app-body.cs-runtime .mobile-dock>:where(a,button){
    min-width:0;min-height:58px;height:auto;padding:6px 3px;gap:4px;border-radius:14px;
    color:var(--cs-text-3);background:transparent;text-align:center;touch-action:manipulation;
  }
  .app-body.cs-runtime .mobile-dock>:where(a,button)>span{display:grid;place-items:center;width:30px;height:27px;color:inherit}
  .app-body.cs-runtime .mobile-dock .ui-icon{display:block;width:22px;height:22px;color:inherit;stroke:currentColor}
  .app-body.cs-runtime .mobile-dock small{display:block;max-width:100%;overflow:visible;white-space:normal;text-overflow:clip;font-size:9px;line-height:1.08;text-align:center;color:inherit}

  /* Primary dock slot contract.
     This selector intentionally outranks the generic item rule above. Without it,
     the generic background:transparent can erase the highlighted center action while
     legacy CSS still leaves its SVG white, making the icon look missing. */
  .app-body.cs-runtime .mobile-dock>:where(a,button).dock-main{
    color:var(--brand-foreground,#fff)!important;
    background:linear-gradient(135deg,var(--brand-secondary,#2563eb),color-mix(in srgb,var(--brand-secondary,#2563eb) 76%,var(--brand-accent,#0f9f84)))!important;
    border:1px solid color-mix(in srgb,var(--brand-secondary,#2563eb) 68%,transparent)!important;
    transform:translateY(-4px);
    box-shadow:0 8px 18px color-mix(in srgb,var(--brand-secondary,#2563eb) 22%,transparent)!important;
  }
  .app-body.cs-runtime .mobile-dock>:where(a,button).dock-main>span,
  .app-body.cs-runtime .mobile-dock>:where(a,button).dock-main>span .ui-icon,
  .app-body.cs-runtime .mobile-dock>:where(a,button).dock-main>small{color:inherit!important}
  .app-body.cs-runtime .mobile-dock>:where(a,button).dock-main.active{
    box-shadow:0 0 0 2px color-mix(in srgb,var(--cs-surface) 72%,transparent),0 9px 20px color-mix(in srgb,var(--brand-secondary,#2563eb) 28%,transparent)!important;
  }
  .app-body.cs-runtime .mobile-dock .active:not(.dock-main){background:var(--brand-subtle);color:var(--brand)}
  html[data-color-scheme="dark"] .app-body.cs-runtime .mobile-dock{background:color-mix(in srgb,var(--cs-surface) 98%,transparent);border-color:var(--cs-border-strong)}

  /* Expensive visual effects are deliberately reduced below desktop width. */
  .app-body.cs-runtime :where(.card,.panel,.data-card,.summary-chip,.simple-metric,.kpi,.kpi-card){box-shadow:0 4px 14px rgba(15,23,42,.055)}
  .app-body.cs-runtime .global-loader{backdrop-filter:none!important}
  body.cs-seasonal-theme .topbar{backdrop-filter:none!important}
  body.cs-seasonal-theme .cs-seasonal-particle{will-change:auto!important}
  body.cs-seasonal-theme .cs-seasonal-corner{display:none!important}
  body.cs-seasonal-theme .cs-seasonal-bottom-band{opacity:.12!important}
}

/* Tablet: not a shrunken desktop, not a phone either. */
@media (min-width:768px) and (max-width:1023px){
  .cs-runtime .summary-strip{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .cs-runtime .grid:not(.form-grid):not(.dialog-grid):not(.permission-grid){grid-template-columns:repeat(2,minmax(0,1fr))}
  .cs-runtime .grid>[class*="span"]{grid-column:auto}
  .cs-runtime .table.responsive-enhanced,.cs-runtime .table.responsive-enhanced tbody{display:grid;width:100%;gap:12px;min-width:0}
  .cs-runtime .table.responsive-enhanced thead{display:none}
  .cs-runtime .table.responsive-enhanced tr{display:grid;height:auto;overflow:visible;border:1px solid var(--cs-border);border-radius:16px;background:var(--cs-surface);box-shadow:var(--cs-shadow-1)}
  .cs-runtime .table.responsive-enhanced td{display:grid;grid-template-columns:minmax(118px,28%) minmax(0,1fr);align-items:start;gap:12px;width:100%;height:auto;min-height:0;padding:12px 14px;border:0;border-bottom:1px solid var(--cs-border);text-align:left}
  .cs-runtime .table.responsive-enhanced td:last-child{border-bottom:0}
  .cs-runtime .table.responsive-enhanced td::before{display:block;content:attr(data-label);color:var(--cs-text-3);font-size:9px;font-weight:800;letter-spacing:.07em;line-height:1.4;text-transform:uppercase}
  .cs-runtime .table.responsive-enhanced td[colspan]{display:block}
  .cs-runtime .table.responsive-enhanced td[colspan]::before{display:none}
}

/* Phone-first cards and forms. */
@media (max-width:767px){
  :root{--cs-mobile-gap:10px}
  .app-body.cs-runtime .content{padding-top:14px!important}
  .app-body.cs-runtime .topbar{min-height:60px;height:auto;padding-block:8px}
  .app-body.cs-runtime .top-actions{gap:5px}
  .app-body.cs-runtime .top-user,.app-body.cs-runtime .connection-status{display:none}
  .app-body.cs-runtime .cs-help-shortcut span{display:none}
  .app-body.cs-runtime .top-title{max-width:min(58vw,320px)}
  .app-body.cs-runtime .top-title>strong{max-width:34vw}

  .cs-runtime .workspace-page{gap:14px}
  .cs-runtime .page-head,.cs-runtime .page-hero,.cs-runtime .cs-hero{display:grid!important;grid-template-columns:minmax(0,1fr)!important;align-items:start!important;gap:12px!important;padding:16px!important}
  .cs-runtime .page-hero-copy,.cs-runtime .cs-hero>div{width:100%!important;max-width:100%!important;min-width:0!important;padding:0!important;background:transparent!important;box-shadow:none!important;backdrop-filter:none!important}
  .cs-runtime .page-hero-copy h1,.cs-runtime .page-hero-copy h2,.cs-runtime .cs-hero h2{max-width:100%;font-size:clamp(26px,8vw,34px);line-height:1.04;text-wrap:balance}
  .cs-runtime .page-hero-copy p,.cs-runtime .cs-hero p{max-width:100%;font-size:12.5px;line-height:1.55}
  .cs-runtime .page-actions,.cs-runtime .page-hero-actions{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr))!important;width:100%!important;justify-content:stretch!important}
  .cs-runtime .page-actions>:where(.btn,form),.cs-runtime .page-hero-actions>:where(.btn,form){width:100%!important;max-width:100%!important}
  .cs-runtime .page-actions form>.btn,.cs-runtime .page-hero-actions form>.btn{width:100%!important}
  body.cs-seasonal-theme .page-hero::before{opacity:.10!important;background-size:110px auto!important;background-position:right 8px bottom!important}
  body.cs-seasonal-theme .page-hero::after{opacity:.35!important}
  body.cs-seasonal-theme .page-hero .cs-seasonal-hero-art,body.cs-seasonal-theme .cs-hero .cs-seasonal-hero-art{display:none!important}
  body.cs-seasonal-theme .cs-seasonal-route-badge{width:32px!important;height:32px!important;right:10px!important;top:10px!important;opacity:.65!important}
  body.cs-seasonal-theme .cs-seasonal-module-accent{display:none!important}

  .cs-runtime .summary-strip{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .cs-runtime .summary-chip{height:auto!important;min-height:76px!important;padding:11px!important;gap:9px}
  .cs-runtime .summary-chip-copy{min-width:0}
  .cs-runtime .summary-chip-copy small{white-space:normal;overflow-wrap:anywhere;line-height:1.25}

  .cs-runtime :where(.card,.panel,.data-card,.kpi,.kpi-card,.simple-metric,.summary-chip){height:auto!important;max-height:none}
  .cs-runtime .card,.cs-runtime .panel,.cs-runtime .data-card{border-radius:15px}
  .cs-runtime .data-card>.data-toolbar{display:flex;align-items:stretch;flex-direction:column;padding:14px!important}
  .cs-runtime .data-toolbar-copy h3{font-size:15px}
  .cs-runtime .data-toolbar-copy p{font-size:11px;line-height:1.5}
  .cs-runtime .data-toolbar-actions{display:grid!important;grid-template-columns:minmax(0,1fr)!important;align-items:stretch!important}
  .cs-runtime .data-toolbar-actions>:where(.btn,select,label,.badge){width:100%;max-width:100%}
  .cs-runtime .search-bar{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:8px!important}
  .cs-runtime .search-bar>:where(.btn,a.btn){width:100%}

  /* Every server table becomes a semantic record card. No squeezed desktop columns. */
  .cs-runtime .table-wrap{overflow:visible!important;border:0!important;background:transparent!important}
  .cs-runtime .table.responsive-enhanced{display:block!important;width:100%!important;min-width:0!important;table-layout:auto!important}
  .cs-runtime .table.responsive-enhanced thead,.cs-runtime .table.responsive-enhanced colgroup{display:none!important}
  .cs-runtime .table.responsive-enhanced tbody{display:grid!important;width:100%!important;min-width:0!important;gap:12px!important;padding:0!important;background:transparent!important}
  .cs-runtime .table.responsive-enhanced tr{display:block!important;width:100%!important;height:auto!important;min-height:0!important;overflow:visible!important;border:1px solid var(--cs-border)!important;border-radius:16px!important;background:var(--cs-surface)!important;box-shadow:var(--cs-shadow-1)!important}
  .cs-runtime .table.responsive-enhanced td{position:static!important;display:block!important;width:100%!important;height:auto!important;min-width:0!important;min-height:0!important;padding:12px 14px!important;border:0!important;border-bottom:1px solid var(--cs-border)!important;background:transparent!important;text-align:left!important;white-space:normal!important;overflow:visible!important}
  .cs-runtime .table.responsive-enhanced td:last-child{border-bottom:0!important}
  .cs-runtime .table.responsive-enhanced td::before{display:block!important;margin:0 0 7px;color:var(--cs-text-3)!important;content:attr(data-label);font-size:9px;font-weight:850;letter-spacing:.075em;line-height:1.3;text-align:left;text-transform:uppercase}
  .cs-runtime .table.responsive-enhanced td[colspan]{display:block!important;text-align:center!important}
  .cs-runtime .table.responsive-enhanced td[colspan]::before{display:none!important}
  .cs-runtime .table.responsive-enhanced td>*{max-width:100%;min-width:0}

  .cs-runtime .table-actions,.cs-runtime .cell-actions,.cs-runtime .contract-actions,.cs-runtime .tenant-actions{
    display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(132px,100%),1fr))!important;
    width:100%!important;max-width:100%!important;min-width:0!important;gap:8px!important;align-items:stretch!important;justify-content:stretch!important;
  }
  .cs-runtime :where(.table-actions,.cell-actions,.contract-actions,.tenant-actions)>*{width:100%!important;max-width:100%!important;min-width:0!important}
  .cs-runtime :where(.table-actions,.cell-actions,.contract-actions,.tenant-actions) :where(.btn,button,a){width:100%!important;max-width:100%!important;min-height:44px!important;justify-content:center!important;white-space:normal!important;line-height:1.2!important}

  .cs-runtime .tenant-table .entity-cell,.cs-runtime .contract-table .entity-cell{grid-template-columns:48px minmax(0,1fr)}
  .cs-runtime .tenant-table .entity-copy b,.cs-runtime .contract-table .contract-title{font-size:14px;line-height:1.38}
  .cs-runtime .tenant-table .tenant-metadata{margin-top:7px;gap:5px 10px;font-size:10px;line-height:1.4}
  .cs-runtime .tenant-table .tenant-access-link{display:inline-flex;max-width:100%;font-size:12px;overflow-wrap:anywhere}
  .cs-runtime .contract-table .contract-details{margin-top:8px}
  .cs-runtime .contract-table .signature-progress{height:8px;margin-block:10px 6px}
  .cs-runtime .contract-table .contract-date-range{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 12px;align-items:baseline}
  .cs-runtime .contract-table .contract-date-range i{color:var(--cs-text-3);font-style:normal;font-size:10px;text-transform:uppercase;letter-spacing:.06em}
  .cs-runtime .contract-table .contract-date-range b{min-width:0;overflow-wrap:anywhere}

  .cs-runtime .form-grid,.cs-runtime .form-grid.cols3,.cs-runtime .dialog-grid,.cs-runtime .cs-grid,.cs-runtime .permission-grid{grid-template-columns:minmax(0,1fr)!important}
  .cs-runtime .form-grid>*,.cs-runtime .dialog-grid>*,.cs-runtime .cs-grid>*{grid-column:auto!important;min-width:0}
  .cs-runtime :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){width:100%;min-width:0;max-width:100%;font-size:16px}
  .cs-runtime :where(.form-actions,.permission-toolbar-actions){display:grid;grid-template-columns:minmax(0,1fr);gap:8px;width:100%}
  .cs-runtime :where(.form-actions,.permission-toolbar-actions)>.btn{width:100%}

  .cs-runtime dialog.cs-dialog[open],.cs-runtime dialog.dialog[open]{align-items:flex-end!important;justify-content:center!important;padding:0!important}
  .cs-runtime dialog.cs-dialog,.cs-runtime dialog.dialog{width:100vw!important;max-width:100vw!important;height:var(--codestorm-viewport-height,100dvh)!important;max-height:100dvh!important;margin:0!important;padding:0!important}
  .cs-runtime dialog.cs-dialog>.dialog-panel,.cs-runtime dialog.dialog>.dialog-panel,.cs-runtime .app-modal-panel{
    width:100%!important;max-width:100%!important;max-height:calc(var(--codestorm-viewport-height,100dvh) - max(12px,env(safe-area-inset-top)))!important;
    margin:0!important;border-radius:20px 20px 0 0!important;overflow:hidden!important;
  }
  .cs-runtime .dialog-body{min-height:0;overflow-y:auto!important;overscroll-behavior:contain;padding-bottom:22px!important}
  .cs-runtime .dialog-footer,.cs-runtime .dialog-actions{position:sticky;z-index:2;bottom:0;display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(132px,100%),1fr))!important;gap:8px!important;padding-bottom:calc(12px + env(safe-area-inset-bottom))!important;background:var(--cs-surface)!important}
  .cs-runtime .dialog-footer .btn,.cs-runtime .dialog-actions .btn{width:100%!important;min-height:44px!important}

  .cs-runtime .toast{right:12px!important;left:12px!important;width:auto!important;max-width:none!important}
  .cs-runtime .row-action-popover.is-portalled{max-width:calc(100vw - 24px)!important}
  .cs-runtime .structure-save-card{position:static!important;grid-template-columns:minmax(0,1fr)!important}

  /* Marketing/share cards keep real contrast in both schemes. */
  .cs-runtime .cs-copy-card{padding:15px!important;border-radius:14px!important;background:var(--cs-surface-raised)!important;color:var(--cs-text)!important}
  .cs-runtime .cs-copy-card p{color:var(--cs-text-2)!important}
  .cs-runtime .cs-copy-card .btn{width:100%}
}

@media (max-width:479px){
  :root{--cs-mobile-inline:12px;--cs-mobile-dock-clearance:102px}
  .app-body.cs-runtime .content{padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right))!important}
  .cs-runtime .summary-strip{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .cs-runtime .summary-chip{min-height:72px!important;padding:10px!important}
  .cs-runtime .summary-chip-icon{width:32px;height:32px;flex:0 0 32px}
  .cs-runtime .summary-chip-copy b{font-size:18px}
  .cs-runtime .page-head,.cs-runtime .page-hero,.cs-runtime .cs-hero{padding:14px!important}
  .cs-runtime .page-actions,.cs-runtime .page-hero-actions{grid-template-columns:minmax(0,1fr)!important}
  .cs-runtime .table-actions,.cs-runtime .cell-actions,.cs-runtime .contract-actions,.cs-runtime .tenant-actions{grid-template-columns:minmax(0,1fr)!important}
  .app-body.cs-runtime .mobile-dock{left:max(7px,env(safe-area-inset-left));right:max(7px,env(safe-area-inset-right));padding:5px;border-radius:18px}
  .app-body.cs-runtime .mobile-dock>:where(a,button){min-height:56px;padding-inline:2px}
  .app-body.cs-runtime .mobile-dock .ui-icon{width:20px;height:20px}
  .app-body.cs-runtime .mobile-dock small{font-size:8.5px}
}

@media (max-width:359px){
  :root{--cs-mobile-inline:10px}
  .app-body.cs-runtime .mobile-dock small{font-size:8px}
  .app-body.cs-runtime .mobile-dock>:where(a,button){min-height:54px}
  .cs-runtime .summary-strip{grid-template-columns:minmax(0,1fr)!important}
}

/* Landscape phones: use the width without creating tall controls. */
@media (max-width:1023px) and (max-height:600px) and (orientation:landscape){
  :root{--cs-mobile-dock-clearance:82px}
  .app-body.cs-runtime .topbar{min-height:52px;padding-block:5px}
  .app-body.cs-runtime .mobile-dock{max-width:680px;padding:4px}
  .app-body.cs-runtime .mobile-dock>:where(a,button){min-height:48px;flex-direction:row;gap:5px}
  .app-body.cs-runtime .mobile-dock small{font-size:8.5px}
  .cs-runtime .page-head,.cs-runtime .page-hero,.cs-runtime .cs-hero{padding:12px 16px!important}
  .cs-runtime dialog.cs-dialog>.dialog-panel,.cs-runtime dialog.dialog>.dialog-panel{max-height:calc(var(--codestorm-viewport-height,100dvh) - 8px)!important}
}

@media (prefers-reduced-motion:reduce){
  .cs-runtime *,.cs-runtime *::before,.cs-runtime *::after{scroll-behavior:auto!important;animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}
}


/* Performance tier: keep the premium visual language without costly mobile paints. */
html[data-performance-tier="economy"] .cs-runtime :where(.card,.panel,.data-card,.kpi,.kpi-card,.simple-metric,.summary-chip,.page-hero,.hero-card){
  box-shadow:0 4px 14px rgba(15,23,42,.07)!important;
}
html[data-performance-tier="economy"] body.cs-seasonal-theme :where(.cs-seasonal-particle,.cs-seasonal-confetti,.cs-seasonal-balloon){display:none!important}

/* The global loader becomes a cheap progress affordance on touch-sized viewports. */
@media (max-width:1023px){
  .global-loader,.global-loader.active{
    inset:0 0 auto 0!important;
    width:100%!important;
    height:3px!important;
    min-height:0!important;
    display:block!important;
    padding:0!important;
    background:transparent!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
    box-shadow:none!important;
    pointer-events:none!important;
    opacity:0;
    overflow:hidden;
    z-index:var(--cs-z-toast,1400)!important;
  }
  .global-loader.active{opacity:1!important}
  .global-loader span{
    display:block!important;
    width:38%!important;
    height:3px!important;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    background:linear-gradient(90deg,var(--brand-secondary),var(--brand-accent))!important;
    animation:cs-mobile-loading .78s ease-in-out infinite!important;
    transform:translate3d(-115%,0,0);
    will-change:transform;
  }
  @keyframes cs-mobile-loading{
    0%{transform:translate3d(-115%,0,0)}
    100%{transform:translate3d(285%,0,0)}
  }
}

/* Long entity identities must wrap inside mobile record cards; legacy desktop ellipsis has higher specificity. */
@media (max-width:767px){
  .cs-runtime .table.responsive-enhanced .entity-copy>b,
  .cs-runtime .table.responsive-enhanced .entity-copy>strong,
  .cs-runtime .table.responsive-enhanced .entity-copy>small{
    max-width:100%!important;
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
    overflow-wrap:anywhere!important;
    word-break:normal!important;
  }
}

/* One tablet breakpoint for navigation: avoids the legacy 920/992 split-brain zone. */
@media (max-width:1023px){
  .app-body.cs-runtime .sidebar{
    width:min(88vw,314px)!important;
    max-width:calc(100vw - 32px)!important;
    height:var(--codestorm-viewport-height,100dvh)!important;
    max-height:100dvh!important;
    padding-top:max(14px,env(safe-area-inset-top))!important;
    padding-bottom:max(12px,env(safe-area-inset-bottom))!important;
    transform:translate3d(-104%,0,0)!important;
    will-change:transform;
  }
  .app-body.cs-runtime .sidebar.open{transform:translate3d(0,0,0)!important}
  .app-body.cs-runtime .mobile-menu{display:inline-flex!important}
  .app-body.cs-runtime .sidebar-close{display:inline-flex!important}
  .app-body.cs-runtime.sidebar-collapsed .sidebar{width:min(88vw,314px)!important}
}
@media (prefers-reduced-motion:reduce){
  .app-body.cs-runtime .sidebar{transition:none!important}
}

/* Long mobile lists avoid painting off-screen records until they approach the viewport. */
@media (max-width:767px){
  @supports (content-visibility:auto){
    .cs-runtime .table.responsive-enhanced tbody>tr,
    .cs-runtime :where(.ticket-preview,.installment,.plan-card,.activity-card){
      content-visibility:auto;
      contain-intrinsic-size:auto 260px;
    }
  }
}

/* V8.1.4 QR runtime polish — password action must stay anchored inside the input.
   The generic coarse-pointer 44px touch rule must not turn this absolute control
   into a taller element that appears to drop below the password field. */
.auth-body.cs-runtime .input-shell.has-action,
.portal-body.cs-runtime .input-shell.has-action{position:relative!important;display:block!important}
.auth-body.cs-runtime .input-shell.has-action .input-action.password-toggle,
.portal-body.cs-runtime .input-shell.has-action .input-action.password-toggle{
  position:absolute!important;
  z-index:4!important;
  top:50%!important;
  right:7px!important;
  bottom:auto!important;
  left:auto!important;
  width:40px!important;
  min-width:40px!important;
  height:40px!important;
  min-height:40px!important;
  max-height:40px!important;
  margin:0!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
  transform:translateY(-50%)!important;
  flex:none!important;
  align-self:auto!important;
  line-height:1!important;
  touch-action:manipulation;
}
.auth-body.cs-runtime .input-shell.has-action .input-action.password-toggle .ui-icon,
.portal-body.cs-runtime .input-shell.has-action .input-action.password-toggle .ui-icon{
  display:block!important;width:19px!important;height:19px!important;min-width:19px!important;min-height:19px!important;
}
@media(max-width:430px){
  .auth-body.cs-runtime .input-shell.has-action .input-action.password-toggle,
  .portal-body.cs-runtime .input-shell.has-action .input-action.password-toggle{right:6px!important;width:38px!important;min-width:38px!important;height:38px!important;min-height:38px!important;max-height:38px!important}
}
