/* SHINI v4.3.1 — universal responsive, touch and visual-viewport hardening.
   Additive UX-only layer: no financial, vault, ledger or reconciliation semantics. */
:root[data-shini-design="fluent"]{
  --shini-vvh:100dvh;
  --shini-vvw:100vw;
  --shini-hit:40px;
  --shini-gutter:clamp(10px,2vw,24px);
  --shini-bottom-ui:0px;
  --shini-keyboard:0px;
}
html,body{max-width:100%;min-height:100%;overflow-x:clip;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body.shini-fluent{min-height:var(--shini-vvh);overscroll-behavior-x:none;-webkit-tap-highlight-color:transparent}
body.shini-fluent *{box-sizing:border-box}
body.shini-fluent img,body.shini-fluent svg,body.shini-fluent canvas{max-width:100%}
body.shini-fluent button,body.shini-fluent input,body.shini-fluent select,body.shini-fluent textarea{font:inherit}
body.shini-fluent button,body.shini-fluent [role="button"],body.shini-fluent a,body.shini-fluent input,body.shini-fluent select,body.shini-fluent textarea{touch-action:manipulation}
body.shini-fluent input,body.shini-fluent select,body.shini-fluent textarea{max-width:100%;min-width:0}
body.shini-fluent textarea{resize:vertical}
body.shini-fluent .main{width:100%;max-width:100%;overflow:visible}
body.shini-fluent .page-root{min-width:0;overflow:visible}
body.shini-fluent .grid,body.shini-fluent .panel,body.shini-fluent .card,body.shini-fluent .v430-hero-card,body.shini-fluent .v430-ai-card,body.shini-fluent .v430-chart-card,body.shini-fluent .v430-kpi,body.shini-fluent .v430-layer,body.shini-fluent .v430-connector,body.shini-fluent .v430-capability{min-width:0;max-width:100%}

/* Never allow content controls to escape their container. */
body.shini-fluent .topbar,body.shini-fluent .analysis-bar,body.shini-fluent .panel-head,body.shini-fluent .top-actions,body.shini-fluent .v430-card-title,body.shini-fluent .v430-ai-title{min-width:0}
body.shini-fluent .topbar>*,body.shini-fluent .analysis-bar>*,body.shini-fluent .panel-head>*,body.shini-fluent .v430-card-title>*{min-width:0}
body.shini-fluent .top-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
body.shini-fluent .panel-head,body.shini-fluent .v430-card-title{flex-wrap:wrap}
body.shini-fluent h1,body.shini-fluent h2,body.shini-fluent h3,body.shini-fluent p,body.shini-fluent .muted{overflow-wrap:anywhere}

/* Tables remain usable on phones without shrinking columns into unreadability. */
body.shini-fluent .table-wrap{width:100%;max-width:100%;overflow:auto;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
body.shini-fluent .table-wrap table{width:max(100%,720px);border-collapse:collapse}
body.shini-fluent .table-wrap th,body.shini-fluent .table-wrap td{white-space:nowrap}
body.shini-fluent .table-wrap td.wrap,body.shini-fluent .table-wrap .wrap{white-space:normal}

/* Horizontal workspace navigation intentionally scrolls; page itself never should. */
.v430-workspace-strip{max-width:100%;overscroll-behavior-inline:contain;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;touch-action:pan-x}
.v430-workspace-strip button{scroll-snap-align:start;flex:0 0 auto}

/* Touch targets and pointer-mode precision. */
html[data-shini-input="touch"]{--shini-hit:46px}
html[data-shini-input="touch"] body.shini-fluent button,
html[data-shini-input="touch"] body.shini-fluent [role="button"],
html[data-shini-input="touch"] body.shini-fluent input,
html[data-shini-input="touch"] body.shini-fluent select{min-height:var(--shini-hit)}
html[data-shini-input="touch"] body.shini-fluent .icon-btn,
html[data-shini-input="touch"] .v430-suite-icon,
html[data-shini-input="touch"] .v430-app-launcher{min-width:var(--shini-hit);width:var(--shini-hit);min-height:var(--shini-hit);height:var(--shini-hit)}
html[data-shini-input="mouse"] body.shini-fluent .primary,
html[data-shini-input="mouse"] body.shini-fluent .secondary,
html[data-shini-input="mouse"] body.shini-fluent .ghost{min-height:34px}

/* Suitebar: fluid middle column with deterministic truncation. */
.v430-suitebar{width:auto;max-width:none;min-width:0;grid-template-columns:minmax(0,auto) minmax(120px,1fr) minmax(0,auto)}
.v430-suite-left,.v430-suite-right,.v430-search,.v430-wordmark{min-width:0}
.v430-suite-left{overflow:hidden}
.v430-wordmark strong,.v430-workspace{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.v430-search{max-width:560px;justify-self:center}
.v430-suite-right{overflow:hidden}

/* Sticky bars must remain compact when browser chrome or keyboard reduces viewport. */
body.shini-fluent .topbar{height:auto;min-height:var(--command-h);padding-block:8px;gap:10px}
body.shini-fluent .analysis-bar{height:auto;min-height:0;align-items:end}
html[data-shini-keyboard="open"] body.shini-fluent .analysis-bar{position:relative;top:auto}
html[data-shini-keyboard="open"] body.shini-fluent .topbar{position:relative;top:auto}
html[data-shini-keyboard="open"] .v430-suitebar{position:relative}

/* Dialogs and command surfaces obey the visual viewport, including iOS keyboard. */
body.shini-fluent dialog{max-width:100vw;max-height:var(--shini-vvh);padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));overflow:hidden}
body.shini-fluent dialog[open]{display:grid;place-items:center}
body.shini-fluent .modal-shell{width:min(760px,100%);max-width:100%;max-height:calc(var(--shini-vvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));display:flex;flex-direction:column;overflow:hidden}
body.shini-fluent #modalBody{min-height:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-bottom:max(16px,env(safe-area-inset-bottom))}
.v430-command-layer{height:var(--shini-vvh);max-height:var(--shini-vvh);padding:max(12px,6vh) max(10px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));overflow:hidden}
.v430-command{max-height:calc(var(--shini-vvh) - max(24px,12vh));display:flex;flex-direction:column}
.v430-command-list{min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}

/* Navigation drawer + dock gesture safety. */
body.shini-fluent .sidebar{overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y}
body.shini-fluent .nav{overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
body.shini-fluent .nav button{width:100%;text-align:left}
body.shini-fluent .nav-backdrop{touch-action:none}
body.shini-fluent .mobile-dock{padding-bottom:env(safe-area-inset-bottom);height:calc(62px + env(safe-area-inset-bottom));min-height:calc(62px + env(safe-area-inset-bottom));grid-auto-columns:minmax(58px,1fr);overflow-x:auto;overflow-y:hidden;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch;touch-action:pan-x}
body.shini-fluent .mobile-dock button{min-width:58px;min-height:54px;padding:6px 8px;touch-action:manipulation}

/* Forms: fluid columns collapse before labels/controls overlap. */
body.shini-fluent .form-grid,body.shini-fluent .form-row{min-width:0}
body.shini-fluent label{min-width:0}
body.shini-fluent label>input,body.shini-fluent label>select,body.shini-fluent label>textarea{width:100%}
body.shini-fluent .analysis-bar label{min-width:120px}
body.shini-fluent .analysis-bar select,body.shini-fluent .analysis-bar input{width:100%}

/* Adaptive breakpoints based on actual available space. */
@media(max-width:1100px){
  body.shini-fluent .main{padding-inline:var(--shini-gutter)}
  .v430-suitebar{margin-inline:calc(-1 * var(--shini-gutter))}
  .v430-connector-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:900px){
  .v430-suitebar{grid-template-columns:minmax(0,auto) minmax(90px,1fr) minmax(0,auto);gap:6px}
  .v430-search{max-width:none}
  body.shini-fluent .analysis-bar{grid-template-columns:repeat(2,minmax(0,1fr));align-items:end}
  body.shini-fluent .analysis-bar .period-meta,body.shini-fluent .analysis-bar .freshness{min-width:0}
  .v430-overview-hero,.v430-visual-grid{grid-template-columns:1fr}
}
@media(max-width:760px){
  :root[data-shini-design="fluent"]{--suite-h:48px;--command-h:56px}
  body.shini-fluent .main{padding-inline:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right));padding-bottom:calc(80px + env(safe-area-inset-bottom))}
  .v430-suitebar{margin-left:calc(-1 * max(10px,env(safe-area-inset-left)));margin-right:calc(-1 * max(10px,env(safe-area-inset-right)));padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right))}
  .v430-workspace,.v430-status,.v430-wordmark>span{display:none!important}
  .v430-search{height:40px}
  body.shini-fluent .topbar{align-items:center}
  body.shini-fluent .analysis-bar{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px 8px}
  body.shini-fluent .analysis-bar .period-meta,body.shini-fluent .analysis-bar .freshness{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:3px 8px}
  .v430-semantic-grid,.v430-layer-grid,.v430-capability-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .v430-connector-grid{grid-template-columns:1fr 1fr}
  body.shini-fluent .card,body.shini-fluent .panel{padding:14px}
  body.shini-fluent .table-wrap{margin-inline:0}
}
@media(max-width:560px){
  .v430-suitebar{grid-template-columns:auto minmax(0,1fr) auto}
  .v430-app-launcher,.v430-avatar{display:none!important}
  .v430-wordmark{padding-right:4px;border-right:0}.v430-wordmark img{width:22px;height:24px}.v430-wordmark strong{font-size:14px}
  .v430-suite-right{gap:2px}.v430-suite-right .v430-suite-icon:not(#v430ThemeQuick):not(#v430ThemeBtn){display:none!important}
  .v430-search{min-width:0;padding-inline:8px}.v430-search kbd{display:none}
  body.shini-fluent .topbar{display:grid;grid-template-columns:minmax(0,1fr) auto;padding-block:7px}
  body.shini-fluent .topbar h1{font-size:17px;line-height:22px}
  body.shini-fluent .eyebrow{font-size:10px}
  body.shini-fluent .top-actions{gap:5px;flex-wrap:nowrap}
  body.shini-fluent .top-actions .primary,body.shini-fluent .top-actions .secondary{padding-inline:9px;font-size:12px;white-space:nowrap}
  body.shini-fluent .analysis-bar{grid-template-columns:1fr}
  body.shini-fluent .analysis-bar label,body.shini-fluent .analysis-bar .period-meta,body.shini-fluent .analysis-bar .freshness{grid-column:1}
  body.shini-fluent .analysis-bar label{min-width:0}
  .v430-semantic-grid,.v430-layer-grid,.v430-connector-grid,.v430-capability-grid{grid-template-columns:1fr}
  .v430-kpi,.v430-chart-card,.v430-hero-card,.v430-ai-card,.v430-layer,.v430-connector,.v430-capability{padding:12px}
  .v430-ai-form{grid-template-columns:1fr}.v430-ai-form button{width:100%}
  .v430-breakdown-row{grid-template-columns:minmax(0,1fr) 1.1fr auto}
  body.shini-fluent .modal-shell{border-radius:10px;width:100%}
}
@media(max-width:390px){
  .v430-search span{font-size:0}.v430-search span::after{content:"Search";font-size:12px}
  body.shini-fluent .top-actions #exportBtn{display:none!important}
  body.shini-fluent .top-actions .primary{max-width:132px;overflow:hidden;text-overflow:ellipsis}
  .v430-hero-title{font-size:18px;line-height:24px}
}

/* Short-height landscape / split-screen compact mode. */
@media(max-height:620px) and (max-width:1100px){
  :root[data-shini-design="fluent"]{--suite-h:42px;--command-h:48px}
  .v430-suitebar{height:var(--suite-h)}
  body.shini-fluent .topbar{padding-block:4px}
  body.shini-fluent .analysis-bar{position:relative;top:auto;padding-block:5px}
  .v430-workspace-strip{margin-bottom:8px}
  body.shini-fluent .mobile-dock{height:calc(54px + env(safe-area-inset-bottom));min-height:calc(54px + env(safe-area-inset-bottom))}
  body.shini-fluent .mobile-dock button{min-height:48px}
  .v430-command-layer{padding-top:max(8px,env(safe-area-inset-top))}
  .v430-command{max-height:calc(var(--shini-vvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
}

/* Installed PWA: use every safe pixel without allowing controls under system UI. */
@media(display-mode:standalone){
  body.shini-fluent{min-height:var(--shini-vvh);padding-top:env(safe-area-inset-top)}
  .v430-suitebar{padding-top:0}
}

/* Keyboard/open-input mode prevents fixed dock from covering fields. */
html[data-shini-keyboard="open"] body.shini-fluent{padding-bottom:0}
html[data-shini-keyboard="open"] body.shini-fluent .mobile-dock{display:none!important}
html[data-shini-keyboard="open"] body.shini-fluent .main{padding-bottom:16px}

/* Accessibility and motion. */
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto!important}}
@media(forced-colors:active){body.shini-fluent .nav-backdrop{background:Canvas}}
