/* H-Control 9.10 — shared interaction and accessibility rules.
   Palette tokens are defined in ui.css/theme-light.css; specialised layouts stay local. */
:root{
  --ds-control-height:40px;
  --ds-space:12px;
  --ds-modal-duration:180ms;
  --ds-page-duration:150ms;
  --ds-toast-bg:#1a1919;
  --ds-toast-fg:#f4f1ee;
  --ds-toast-muted:#c4bdb7;
  --ds-toast-success:#68d6a7;
  --ds-toast-info:#7cd4fa;
  --ds-toast-warning:#ffc66b;
  --ds-toast-error:#ff9390;
  --ds-toast-system:#c8afff;
}
html[data-scheme="light"]{
  --ds-toast-bg:#fbfaf8;
  --ds-toast-fg:#2f2a26;
  --ds-toast-muted:#585048;
  --ds-toast-success:#126a46;
  --ds-toast-info:#075d86;
  --ds-toast-warning:#885007;
  --ds-toast-error:#a52525;
  --ds-toast-system:#6842a3;
}
html[data-motion="lite"]{--ds-page-duration:90ms}
/* One short opacity transition per navigation; no nested card/row entrances. */
@media(prefers-reduced-motion:no-preference){
  html:not([data-motion="off"]) #page.page-enter{animation:dsPageIn var(--ds-page-duration) ease-out}
}
@keyframes dsPageIn{from{opacity:.82}to{opacity:1}}
/* Interactive elements in the common modal chrome, not specialised table controls. */
.modal-head,.modal-actions{min-width:0}
.modal-head>div{min-width:0;overflow-wrap:anywhere}
.modal-actions{flex-wrap:wrap;gap:var(--ds-space)}
.modal-actions>.btn,.modal-actions>div>.btn{min-height:var(--ds-control-height);white-space:normal}
.modal-head>.icon-btn{flex-shrink:0}
.modal-backdrop.closing,.drawer-backdrop.closing{pointer-events:none}
.modal :is(input,select,textarea){max-width:100%}
/* Real table overflow stays inside the scroll container. */
#page .table-wrap{max-width:100%;overscroll-behavior-inline:contain}
/* Theme-aware notifications; same layout for each type, no runtime color rewriting. */
#toast-root{max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain}
#toast-root .lc-toast{flex:none;background:var(--ds-toast-bg);color:var(--ds-toast-fg);overflow-wrap:anywhere}
#toast-root .lc-toast-title{color:var(--ds-toast-fg)}
#toast-root :is(.lc-toast-text,.lc-toast-time,.lc-toast-x){color:var(--ds-toast-muted)}
#toast-root .lc-toast-x{width:28px;height:28px;flex:none}
#toast-root .lc-t-success{--tc:var(--ds-toast-success)}
#toast-root .lc-t-info{--tc:var(--ds-toast-info)}
#toast-root .lc-t-warning{--tc:var(--ds-toast-warning)}
#toast-root .lc-t-error{--tc:var(--ds-toast-error)}
#toast-root .lc-t-system{--tc:var(--ds-toast-system)}
#toast-root .lc-toast-kind{color:var(--tc)}
#toast-root .undo-toast{position:relative;inset:auto;max-width:100%;width:100%;flex:none;color:var(--ds-toast-fg)}
#toast-root .undo-toast small{color:var(--ds-toast-muted);font-size:12px}
#toast-root .undo-toast>button{min-height:32px;flex-shrink:0}
/* Existing status and security labels retain the semantics in both schemes. */
.sc-current{color:var(--ds-toast-success)}
.sc-warning{color:var(--ds-toast-warning)}
.sc-section,.sc-metric{border-color:var(--ui-line-2)}
.sc-device-info small,.sc-history-row small,.sc-metric small{color:var(--ui-muted)}
@media(max-width:600px){
  .modal-backdrop{padding:8px;align-items:center}
  .modal-backdrop .modal{max-height:calc(100dvh - 16px);max-width:100%;min-width:0;overscroll-behavior:contain}
  .modal-actions:not(.split)> .btn{flex:1 1 120px;min-width:0}
  #toast-root{left:12px;right:12px;bottom:max(12px,env(safe-area-inset-bottom));width:auto;max-height:min(40dvh,270px)}
  #toast-root .lc-toast-text{padding-right:24px}
  #toast-root .lc-toast-glyph{width:36px;height:36px}
}
