/* Screen-only presentation. Printed documents retain their established layout. */
@media screen {
  :root[data-display-density] {
    --density-row-y: 12px;
    --density-head-y: 10px;
    --density-cell-x: 16px;
    --density-fact-y: 6px;
    --density-panel: 20px;
    --density-section: 20px;
    --density-control-y: 7px;
  }
  :root[data-display-density="compact"] {
    --density-row-y: 6px;
    --density-head-y: 6px;
    --density-cell-x: 12px;
    --density-fact-y: 3px;
    --density-panel: 14px;
    --density-section: 14px;
    --density-control-y: 4px;
  }
  :root[data-display-density="roomy"] {
    --density-row-y: 18px;
    --density-head-y: 16px;
    --density-cell-x: 20px;
    --density-fact-y: 10px;
    --density-panel: 28px;
    --density-section: 28px;
    --density-control-y: 10px;
  }
  :root[data-display-density] .content table th { padding:var(--density-head-y) var(--density-cell-x); }
  :root[data-display-density] .content table td { padding:var(--density-row-y) var(--density-cell-x); }
  :root[data-display-density] .content table .button { padding-top:var(--density-control-y); padding-bottom:var(--density-control-y); min-height:28px; }
  :root[data-display-density] .product-panel,
  :root[data-display-density] .panel-heading,
  :root[data-display-density] .action-panel { padding:var(--density-panel); }
  :root[data-display-density] .spaced { margin-top:var(--density-section); }
  :root[data-display-density] .page-heading { margin-bottom:var(--density-section); }
  :root[data-display-density] .product-facts {
    grid-template-columns:minmax(160px,240px) minmax(0,1fr);
    gap:0 24px;
    margin:12px 0 0;
    align-items:stretch;
  }
  :root[data-display-density] .product-facts dt,
  :root[data-display-density] .product-facts dd {
    margin:0;
    padding:var(--density-fact-y) 0;
    border-bottom:1px solid #edf1f4;
    min-width:0;
    overflow-wrap:anywhere;
  }
  :root[data-display-density] .product-facts dt:last-of-type,
  :root[data-display-density] .product-facts dd:last-of-type { border-bottom:0; }
  :root[data-display-density] .product-facts .tag { padding:2px 8px; }
  :root[data-display-density] .content dl:not(.product-facts) dt { margin-top:var(--density-row-y); }
  :root[data-display-density] .content dl:not(.product-facts) dd { margin-top:0; }
}

.preferences-trigger {
  display:flex; align-items:center; gap:8px; width:100%; min-height:40px;
  padding:8px 10px; border:1px solid #4a687b; border-radius:6px;
  background:transparent; color:#fff; text-align:left; font-size:14px;
}
.preferences-trigger:hover { background:#234459; }
.preferences-trigger svg { width:17px; height:17px; flex-shrink:0; }
.preferences-trigger small { margin-left:auto; color:#bdd0dc; font-size:11px; }
.display-preferences {
  position:fixed; inset:auto auto 22px 16px; margin:0; padding:20px;
  width:300px; max-width:calc(100vw - 32px); max-height:calc(100dvh - 44px);
  color:var(--ink); background:#fff; border:1px solid #bacdd9; border-radius:10px;
  box-shadow:0 14px 48px #102d4140;
}
.display-preferences::backdrop { background:#102d412b; }
.display-preferences-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.display-preferences-heading h2 { font-size:18px; }
.preferences-close { width:32px; min-height:32px; padding:0; border:0; border-radius:5px; background:#edf3f7; color:var(--ink); font-size:23px; line-height:1; }
.density-options { margin:14px 0; padding:0; border:0; }
.density-options legend { padding:0 0 10px; font-size:13px; color:#526675; }
.density-options label {
  display:flex; align-items:center; gap:12px; padding:10px; margin:5px 0;
  border:1px solid #dce5eb; border-radius:6px; cursor:pointer;
}
.density-options label:has(input:checked) { border-color:#007fc8; background:#eaf5fc; }
.density-options label:focus-within { outline:2px solid #007fc8; outline-offset:2px; }
.density-options input { width:18px; height:18px; margin:0; accent-color:#007fc8; flex-shrink:0; }
.density-options strong { display:block; font-size:14px; }
.density-options small { display:block; font-size:12px; color:#526675; }

@media screen and (min-width:801px) {
  .sidebar { overflow:hidden; }
  .sidebar>.brand,.sidebar>.workspace,.sidebar-bottom { flex-shrink:0; }
  .sidebar nav { flex:1; min-height:0; overflow-y:auto; align-content:start; overscroll-behavior:contain; }
  .sidebar-bottom { margin-top:16px; padding-top:12px; gap:8px; }
}
@media screen and (max-width:800px) {
  .preferences-trigger { width:auto; gap:10px; }
}
@media screen and (max-width:600px) {
  :root[data-display-density] .product-panel { padding:min(var(--density-panel),20px); }
  :root[data-display-density] .product-facts { grid-template-columns:minmax(0,1fr); gap:0; }
  :root[data-display-density] .product-facts dt { padding-bottom:0; border-bottom:0; }
  :root[data-display-density] .product-facts dd { padding-top:2px; padding-bottom:max(var(--density-fact-y),6px); }
}
@media screen and (pointer:coarse) {
  :root[data-display-density] .content table .button { min-height:44px; }
  .preferences-trigger,.preferences-close { min-height:44px; }
  .preferences-close { min-width:44px; }
}
@media print { .display-preferences,.preferences-trigger { display:none!important; } }
