/*
 * EncodeLabel label designer (/design): the looks. The markup is in design.php
 * and the behaviour in assets/js/page-design.js.
 *
 * The screen is one "workspace" as tall as the window:
 *   .dz-top     the bar along the top (name, paper, datalist, undo, print)
 *   .dz-rail    the things you can add (left)
 *   .dz-stage   the desk with the label on it (middle)
 *   .dz-tray    what needs a look on this label (under the desk)
 *   .dz-panel   the settings (right); on a phone it is a sheet that slides up
 *   .dz-bar     Add / Edit / Label / Print along the bottom (phones only);
 *               Label opens the sheet with the paper, the datalist and the Layers list
 *
 * Colours come from the site's tokens only, so light and dark both work.
 * The label itself is always white with black ink (--sheet / --sheet-ink):
 * it shows what the printer makes. Sizes: three panes from 700px up, the
 * phone layout below that.
 */

/* ---- The workspace ---------------------------------------------------------------- */
.dz {
  --dz-top: 77px;                       /* where the workspace starts; page-design.js measures it */
  display: flex; flex-direction: column; gap: 10px;
  height: calc(100dvh - var(--dz-top) - 16px - var(--banner-space, 0px));
  min-height: 480px;
}
/* design.php sends the workspace hidden and page-design.js shows it once every script has run.
   Until then its place is held (it is laid out, but nothing in it can be seen, pressed or read
   out), so the text under it is not shown first and then pushed down the page. !important
   because the shell hides every [hidden] thing with !important. The place is given back when
   it will never be filled: the "Part of the designer could not load" note is showing,
   JavaScript is switched off (two ways of telling, for older and newer browsers), or 15 seconds
   have gone by and the scripts have still not run (a dropped connection): the place then
   closes by itself. */
.dz[hidden] { display: flex !important; visibility: hidden; overflow: hidden; animation: dz-give-back 15s step-end forwards; }
@keyframes dz-give-back { to { height: 0; min-height: 0; } }
[data-dz-broken]:not([hidden]) ~ .dz[hidden] { display: none !important; }
@media (scripting: none) { .dz[hidden] { display: none !important; } }
noscript:has(> .alert) ~ .dz[hidden] { display: none !important; }
.dz-body { display: grid; flex: 1 1 auto; grid-template-columns: 76px minmax(0, 1fr) 328px; gap: 10px; min-height: 0; }

/* ---- The bar along the top ------------------------------------------------------- */
.dz-top {
  display: flex; flex: none; align-items: center; gap: 8px; min-width: 0; padding: 7px 8px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
}
.dz-name {
  flex: 0 1 230px; width: 230px; min-width: 96px; min-height: 40px; padding: 6px 10px;
  border-color: transparent; background: transparent; font-weight: 700; text-overflow: ellipsis;
}
.dz-name:hover { border-color: var(--field-line); }
.dz-name:focus { border-color: var(--field-line); background: var(--field); }
.dz-chip {
  display: inline-flex; flex: 0 1 auto; align-items: center; gap: 8px; min-width: 0; max-width: 300px; min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--paper); color: var(--ink);
  font: inherit; font-size: .875rem; cursor: pointer; list-style: none;
}
.dz-chip::-webkit-details-marker { display: none; }
.dz-chip:hover { border-color: var(--ink); }
.dz-chip .icon { flex: none; color: var(--muted); }
.dz-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-data { display: flex; flex: 0 1 auto; min-width: 0; }
.dz-data > .menu { min-width: 0; }
.dz-data > .menu > .dz-chip { max-width: min(100%, 300px); }
.dz-data .menu-panel { min-width: 230px; }
.dz-top-space { flex: 1 1 0; }
.dz-saves { display: inline-flex; flex: none; align-items: center; gap: 8px; }
.dz-saves[hidden] { display: none; }
.dz-save { display: inline-flex; min-width: 0; }
.dz-save .ksv-save { flex-wrap: nowrap; }
/* The Save button's own line ("Unsaved changes") is read out to screen readers but not shown in
   this crowded bar: the quiet line under the desk (and in the Label panel) says the same. */
.dz-save .ksv-state { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.dz-print { flex: none; }
.dz-narrow-only { display: none; }
@media (pointer: coarse) { .dz-chip { min-height: 44px; } .dz-name { min-height: 44px; } }

/* ---- The things to add (left) ----------------------------------------------------- */
.dz-rail {
  display: flex; flex-direction: column; gap: 2px; min-height: 0; padding: 6px; overflow-y: auto; scrollbar-width: thin;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
}
.dz-tool {
  display: flex; flex: none; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 56px; padding: 6px 2px; border: 0; border-radius: var(--radius-small); background: none; color: var(--ink);
  font: inherit; font-size: .72rem; line-height: 1.15; text-align: center; cursor: pointer;
}
.dz-tool [data-icon], .dz-tool > .icon { width: 22px; height: 22px; }
.dz-tool:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.dz-tool:active { background: var(--soft); }
.dz-rail-sep { flex: none; height: 1px; margin: 4px 6px; background: var(--line); }

/* ---- The desk and the label on it -------------------------------------------------- */
.dz-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.dz-stage {
  position: relative; flex: 1 1 auto; min-height: 120px; overflow: hidden;
  border: 1px solid var(--desk-line); border-radius: var(--radius);
  /* the same faint cutting-mat grid as the site's other previews */
  background:
    linear-gradient(var(--desk-line) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--desk-line) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--desk);
  touch-action: none;                   /* dragging on the desk moves things, never the page */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  cursor: default;
}
.dz-stage:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.dz-stage[data-dz-pointer]:focus-visible { outline: none; }
.dz-paper {
  position: absolute; left: 0; top: 0; color-scheme: light;
  filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--sheet-ink) 22%, transparent)) drop-shadow(0 8px 20px color-mix(in srgb, var(--sheet-ink) 16%, transparent));
}
.dz-art { display: block; width: 100%; height: 100%; max-width: none; overflow: visible; }
.dz-label { fill: var(--sheet); }
.dz-safe {
  fill: none; stroke: var(--brand); stroke-width: 1; stroke-dasharray: 3 3; opacity: .38;
  vector-effect: non-scaling-stroke; pointer-events: none;
}
.dz-overlay { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; overflow: visible; }
.dz-sel { fill: none; stroke: var(--brand); stroke-width: 1.5; }
.dz-sel-off { stroke-dasharray: 4 3; }
.dz-hover { fill: none; stroke: var(--brand); stroke-width: 1; opacity: .55; }
.dz-handle { fill: var(--sheet); stroke: var(--brand); stroke-width: 1.5; }
.dz-guide { stroke: var(--brand); stroke-width: 1; shape-rendering: crispEdges; }
.dz-badge {
  position: absolute; z-index: 2; padding: 2px 8px; border-radius: var(--radius-small);
  background: var(--ink); color: var(--paper); font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap;
  pointer-events: none; transform: translateX(-50%);
}
.dz-empty {
  position: absolute; left: 50%; top: 14px; z-index: 1; width: max-content; max-width: calc(100% - 28px); margin: 0; padding: 6px 12px;
  border-radius: var(--radius-small); background: var(--card); color: var(--muted); box-shadow: var(--shadow);
  font-size: .9rem; text-align: center; transform: translateX(-50%); pointer-events: none;
}
.dz-zoom, .dz-rowbar {
  position: absolute; bottom: 10px; z-index: 3; display: flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--card); box-shadow: var(--shadow);
}
.dz-zoom { right: 10px; }
.dz-rowbar { left: 10px; min-width: 0; max-width: calc(100% - 214px); }   /* never under the zoom buttons (about 180px wide) */
.dz-rowbar[hidden] { display: none; }
.dz-rowbar .btn { flex: none; }
.dz-zoom .btn, .dz-rowbar .btn { border-color: transparent; background: transparent; }
.dz-zoom .btn:hover, .dz-rowbar .btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.dz-zoom-fit { min-width: 58px; padding: 6px 4px; font-variant-numeric: tabular-nums; }
.dz-rowbar-text { min-width: 0; padding: 0 6px; overflow: hidden; font-size: .875rem; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
@media (pointer: coarse) { .dz-rowbar { max-width: calc(100% - 238px); } }   /* (bigger zoom buttons) */
/* A narrow desk (a tablet with its side panes, a phone): page-design.js marks it "is-tight". The row line
   is then "3 / 250" in place of "Row 3 of 250" and the shortcuts button gives up its place. */
.is-tight .dz-rowbar-word { display: none; }
.is-tight .dz-rowbar-of { font-size: 0; }
.is-tight .dz-rowbar-text { padding: 0 2px; font-size: .8125rem; }
.is-tight .dz-rowbar-of::before { content: "/"; padding: 0 3px; font-size: .8125rem; }
.is-tight .dz-keys-button { display: none; }
.is-tight .dz-rowbar { max-width: calc(100% - 186px); }

/* ---- What needs a look (under the desk) ------------------------------------------------ */
.dz-tray {
  flex: none; display: flex; flex-direction: column; min-height: 0; max-height: 46%;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.dz-tray-line { display: flex; flex: none; align-items: center; gap: 8px; min-width: 0; }
.dz-tray-toggle {
  display: flex; flex: 1 1 auto; align-items: center; gap: 9px; min-width: 0; min-height: 40px; padding: 6px 12px;
  border: 0; border-radius: var(--radius); background: none; color: var(--muted); font: inherit; font-size: .9rem; text-align: left; cursor: pointer;
}
.dz-tray-toggle > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-tray-dot { flex: none; width: 9px; height: 9px; border-radius: 2px; background: var(--ok); }
.dz-tray.is-warn .dz-tray-toggle { color: var(--warn); font-weight: 600; }
.dz-tray.is-warn .dz-tray-dot { background: var(--warn); }
.dz-tray.is-error .dz-tray-toggle { color: var(--error); font-weight: 600; }
.dz-tray.is-error .dz-tray-dot { background: var(--error); }
.dz-tray-chevron { flex: none; color: var(--muted); }
.dz-tray-toggle[aria-expanded="true"] .dz-tray-chevron { transform: rotate(180deg); }
.dz-kept { flex: none; padding: 0 12px 0 0; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.dz-kept[hidden] { display: none; }
.dz-kept-note { display: none; margin-top: 18px; font-size: .85rem; }
.dz-tray-body { min-height: 0; padding: 2px 12px 12px; overflow-y: auto; border-top: 1px solid var(--line); }
.dz-problems { margin: 0; padding: 0; list-style: none; }
.dz-problems:empty { display: none; }
.dz-problem {
  display: flex; align-items: baseline; gap: 9px; width: 100%; min-height: 40px; padding: 8px 2px;
  border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer;
}
.dz-problem:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.dz-problem::before { content: ""; flex: none; align-self: center; width: 8px; height: 8px; border-radius: 1px; background: var(--warn); }
.dz-problem.is-error::before { background: var(--error); }
.dz-problem strong { font-weight: 650; }
.dz-check { padding-top: 10px; }
.dz-check[hidden] { display: none; }
.dz-check-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dz-check-head p { flex: 1 1 200px; margin: 0; color: var(--muted); font-size: .9rem; }
.dz-progress { height: 6px; margin: 10px 0 0; border-radius: 3px; background: var(--line); overflow: hidden; }
.dz-progress > span { display: block; height: 100%; background: var(--brand); }
.dz-check-list { margin: 8px 0 0; padding: 0; list-style: none; }
.dz-check-list > li { padding: 8px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.dz-check-list p { margin: 0 0 4px; }
.dz-rows { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--muted); }
.dz-rows .link-button { min-width: 28px; min-height: 28px; font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .dz-rows .link-button { min-width: 40px; min-height: 40px; } .dz-tray-toggle { min-height: 44px; } }

/* ---- The settings (right) -------------------------------------------------------------- */
.dz-panel {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
}
.dz-panel-head { display: flex; flex: none; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.dz-views { flex: 1 1 auto; }
.dz-sheet-title, .dz-sheet-close { display: none; }
.dz-panel-body { flex: 1 1 auto; min-height: 0; padding: 4px 14px 18px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.dz-h {
  display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; padding: 0;
  color: var(--muted); font: 700 .78rem/1.2 var(--body); letter-spacing: .06em; text-transform: uppercase;
}
.dz-h:first-child { margin-top: 12px; }
.dz-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.dz-what { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; font: 700 1.05rem/1.25 var(--display); }
.dz-what:focus { outline: none; }
.dz-what .icon { flex: none; color: var(--muted); }
.dz-what > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-panel-body .field { margin-bottom: 12px; }
.dz-panel-body .field > label, .dz-panel-body .field-label { font-size: .9rem; }
.dz-panel-body textarea { min-height: 0; resize: vertical; }
.dz-panel-body .hint { font-size: .85rem; }
.dz-note { margin: 12px 0; color: var(--muted); font-size: .92rem; }
.dz-none { margin: 22px 4px; color: var(--muted); text-align: center; }
.dz-none .bars { display: block; margin: 0 auto 10px; }
.dz-none p { margin: 0 0 12px; }

/* rows of small controls */
.dz-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 12px; }
.dz-row > .field { flex: 1 1 auto; margin-bottom: 0; }
.dz-row > .field.dz-fixed { flex: none; }
.dz-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-bottom: 12px; }
.dz-grid2 > .field { min-width: 0; margin-bottom: 0; }
.dz-panel-body .segmented { display: flex; }
.dz-panel-body .segmented > button { flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; }
.dz-panel-body .stepper { display: flex; }
.dz-panel-body .stepper > button { width: 34px; }
.dz-panel-body .stepper > input { flex: 1 1 auto; width: 0; padding-left: 4px; padding-right: 4px; font-variant-numeric: tabular-nums; }
.dz-switches { display: grid; gap: 0; margin-bottom: 8px; }
.dz-switches .switch { min-height: 40px; }
.dz-color { display: flex; align-items: center; gap: 10px; }
.dz-color input[type="color"] { flex: none; width: 52px; }
.dz-color-value { color: var(--muted); font: .85rem var(--mono); }
.dz-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.dz-buttons > .btn { flex: 1 1 auto; }
.dz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; padding: 0; list-style: none; }
.dz-chips > li { min-width: 0; }
.dz-chips .chip { max-width: 100%; }
.dz-field-chip {
  display: inline-flex; align-items: center; max-width: 100%; min-height: 32px; padding: 3px 10px;
  border: 1px dashed var(--field-line); border-radius: var(--radius-small); background: var(--paper); color: var(--ink);
  font: .82rem var(--mono); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dz-field-chip:hover { border-style: solid; border-color: var(--ink); }
.dz-chips-label { margin: 0 0 8px; color: var(--muted); font-size: .85rem; }
.dz-type {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 10px;
  border: 1px solid var(--field-line); border-radius: var(--radius-small); background: var(--card); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
}
.dz-type:hover { border-color: var(--ink); }
.dz-type .icon { flex: none; color: var(--muted); }
.dz-type strong { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-type span:last-child { flex: none; color: var(--link); font-size: .875rem; }
.dz-value-status { margin: -4px 0 12px; }
.dz-fix { margin: -6px 0 12px; }
.dz-thumb {
  display: grid; place-items: center; height: 96px; margin-bottom: 10px; padding: 8px;
  border: 1px solid var(--desk-line); border-radius: var(--radius-small); background: var(--desk);
}
.dz-thumb img { display: block; max-width: 100%; height: 78px; object-fit: contain; background: var(--sheet); }
.dz-meter { margin: 4px 0 12px; }
.dz-rowjump { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dz-rowjump .stepper { flex: 0 0 150px; }
.dz-rowjump span { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.dz-datasum { margin: 0 0 10px; font-size: .95rem; overflow-wrap: anywhere; }
@media (pointer: coarse) {
  .dz-panel-body .stepper > button { width: 44px; }
  .dz-field-chip { min-height: 44px; }
  .dz-switches .switch { min-height: 44px; }
  .dz-panel .segmented > button { min-height: 44px; }
}

/* the list of everything on the label */
.dz-layers { margin: 0 0 8px; padding: 0; list-style: none; }
.dz-layer { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line); }
.dz-layer:first-child { border-top: 1px solid var(--line); }
.dz-layer-main {
  display: flex; flex: 1 1 auto; align-items: center; gap: 9px; min-width: 0; min-height: 44px; padding: 6px 4px;
  border: 0; border-radius: var(--radius-small); background: none; color: var(--ink); font: inherit; font-size: .92rem; text-align: left; cursor: pointer;
}
.dz-layer-main .icon { flex: none; color: var(--muted); }
.dz-layer-main > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-layer-main:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.dz-layer-main[aria-pressed="true"] { background: var(--soft); font-weight: 650; box-shadow: inset 3px 0 0 var(--brand); }
.dz-layer.is-off .dz-layer-main > span { color: var(--muted); text-decoration: line-through; }
.dz-layer-button {
  display: grid; flex: none; place-items: center; width: 32px; height: 36px; padding: 0;
  border: 0; border-radius: var(--radius-small); background: none; color: var(--muted); cursor: pointer;
}
.dz-layer-button:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.dz-layer-button:disabled { opacity: .3; cursor: default; }
.dz-layer-button[aria-pressed="true"] { color: var(--ink); background: var(--soft); }
.dz-layer-button .icon { width: 18px; height: 18px; }
@media (pointer: coarse) { .dz-layer-button { width: 44px; height: 44px; } }
/* (on a tablet a layer is deleted from its own settings, or with the Delete key: its name needs the room here) */
@media (pointer: coarse) and (min-width: 700px) and (max-width: 1100px) { .dz-layer-button[data-dz-layer-act="delete"] { display: none; } }

/* ---- Pop-ups of this page --------------------------------------------------------------- */
.dz-layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.dz-layout {
  display: flex; flex-direction: column; gap: 4px; width: 100%; height: 100%; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
}
.dz-layout:hover { border-color: var(--ink); }
.dz-layout-picture {
  display: grid; place-items: center; height: 124px; margin-bottom: 6px; padding: 10px;
  border-radius: var(--radius-small); background: var(--desk); color-scheme: light;
}
.dz-layout-picture svg { display: block; max-width: 100%; max-height: 104px; width: auto; height: auto; filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--sheet-ink) 25%, transparent)); }
.dz-layout strong { font-size: 1rem; }
.dz-layout span { color: var(--muted); font-size: .875rem; line-height: 1.4; }
.dz-keys-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.dz-keys-list dt { white-space: nowrap; }
.dz-keys-list dd { margin: 0; color: var(--muted); }
/* "Where should the QR code lead?" (the UPC and QR code layout, page-design.js askLink): the address box
   and the GS1 note sit under their own choice, in line with its words. */
.dz-link .dz-link-address, .dz-link .check + .hint { margin-left: 28px; }
.dz-link .check + .hint { margin-top: -4px; }
/* "Your Wi-Fi network" (the Wi-Fi card layout, page-design.js askWifi): spaced like Quick label's Wi-Fi
   pop-up. The password is hidden with dots in an ordinary text box (never type=password, which would
   bring the browser's password manager). */
.dz-wifi .dz-wifi-intro { margin: 0 0 16px; }
.dz-wifi .dz-wifi-more {
  margin: -4px 0 16px; padding: 8px 12px; border-left: 4px solid var(--warn); border-radius: var(--radius-small);
  background: var(--warn-soft); font-size: .92rem;
}
.dz-wifi-choice { margin-bottom: 8px; }
.dz-wifi-choice legend { margin-bottom: 0; }
.dz-wifi-choice .check { padding: 8px 0; }
.dz-wifi-pass .field { margin-bottom: 4px; }
.dz-secret[data-dz-hide] { -webkit-text-security: disc; }
.dz-wifi .status-line { margin-top: 4px; }
.dz-print-box { min-height: 200px; }
/* At the top of the Print pop-up: the label and its datalist do not belong together yet (page-design.js, labelNote). */
.dz-print-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.dz-print-warn > p { flex: 1 1 280px; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.dz-print-warn > .btn { flex: none; }

/* ---- Under the workspace ---------------------------------------------------------------- */
.dz-about { max-width: 980px; margin: 40px auto 0; }
.dz-about h2 { margin: 0 0 12px; }
.dz-about-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; margin: 0 0 14px; padding: 0; list-style: none; color: var(--muted); }
.dz-about-list strong { display: block; color: var(--ink); }

/* The how-to text under that: the worked example and the badges side by side where there
   is room, then the questions at a comfortable line length. */
.dz-learn {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px 40px; align-items: start;
  max-width: 980px; margin: 40px auto 0; padding-top: 28px; border-top: 1px solid var(--line);
}
.dz-learn h2 { margin: 0 0 12px; font-size: 1.25rem; }
.dz-learn p { margin: 0 0 12px; }
.dz-learn > section > :last-child { margin-bottom: 0; }
.dz-learn .table-wrap { margin: 0 0 16px; }
.dz-learn .step-list { gap: 12px; margin: 0 0 12px; }
.dz-learn .step-list p { color: var(--ink); }
.dz-learn-questions { grid-column: 1 / -1; max-width: 46rem; }
.dz-learn-questions .faq-list { margin-bottom: 0; }

/* The phone's bottom bar and its sheet are not used on wide screens. */
.dz-bar { display: none; }
.dz-add { display: none; }

/* ---- Medium screens: narrower side panes -------------------------------------------- */
@media (max-width: 1100px) {
  .dz-body { grid-template-columns: 64px minmax(0, 1fr) 292px; gap: 8px; }
  .dz-name { flex-basis: 170px; width: 170px; }
  .dz-chip { max-width: 190px; }
  .dz-data > .menu > .dz-chip { max-width: min(100%, 190px); }
  .dz-wide-only { display: none; }
  .dz-narrow-only { display: inline; }
  .dz-kept { display: none; }                 /* no room beside the tray line: the Label panel says it instead */
  .dz-kept-note { display: block; }
  .dz-about-list { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .dz-chip { max-width: 150px; padding-left: 9px; padding-right: 9px; }
  .dz-data > .menu > .dz-chip { max-width: min(100%, 150px); }
  .dz-chip-paper .dz-chip-text { max-width: 96px; }
  .dz-name { flex-basis: 130px; width: 130px; }
  .dz-top { gap: 6px; }
  .dz-learn { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}

/* ---- Phones: desk on top, a bar along the bottom, settings in a sheet ----------------- */
@media (max-width: 699px) {
  .dz { --dz-top: 57px; gap: 0; min-height: 430px; height: calc(100dvh - var(--dz-top) - var(--banner-space, 0px)); margin: -16px calc(-1 * var(--gutter)) 0; }
  .dz-top { gap: 4px; padding: 5px 8px; border-width: 0 0 1px; border-radius: 0; box-shadow: none; }
  .dz-name { flex: 1 1 auto; width: auto; min-height: 44px; }
  .dz-chip-paper, .dz-data, .dz-top .dz-print, .dz-top-space { display: none; }
  .dz-top .btn-icon.btn-small { flex: none; width: 44px; min-height: 44px; }
  .dz-name { min-width: 64px; }
  .dz-saves { gap: 4px; }
  .dz-saves .btn { justify-content: center; width: 44px; min-height: 44px; padding: 0; }
  .dz-saves .btn > span:not(:first-child) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .dz-body { display: flex; flex-direction: column; gap: 0; }
  .dz-rail { display: none; }
  .dz-main { flex: 1 1 auto; gap: 0; }
  .dz-stage { border-width: 0; border-radius: 0; }
  .dz-stage:focus-visible { outline-offset: -3px; }
  .dz-zoom, .dz-rowbar { bottom: 8px; }
  .dz-zoom { right: 8px; }
  .dz-zoom-fit { min-width: 48px; }
  .dz-stage .dz-rowbar { left: 8px; max-width: calc(100% - 160px); }   /* (the zoom buttons are about 140px here) */
  .dz-keys-button { display: none; }
  .dz-zoom .btn-icon.btn-small, .dz-rowbar .btn-icon.btn-small { width: 40px; min-height: 40px; }
  .dz-tray { max-height: 40%; border-width: 1px 0 0; border-radius: 0; }
  .dz-tray-toggle { min-height: 44px; }

  /* the sheet: hidden until the bar opens it; the desk keeps the room above it */
  .dz-panel { display: none; flex: none; height: min(56%, 440px); border-width: 1px 0 0; border-radius: 0; box-shadow: var(--shadow-float); }
  .dz[data-dz-sheet-open] .dz-panel { display: flex; }
  .dz[data-dz-sheet-open] .dz-tray { display: none; }
  .dz-panel .dz-views { display: none; }
  .dz-sheet-title { display: block; flex: 1 1 auto; min-width: 0; margin: 0; font: 700 1.05rem/1.2 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dz-sheet-title:focus { outline: none; }
  .dz-sheet-close { display: inline-flex; flex: none; width: 44px; min-height: 44px; }
  .dz-panel-head { padding: 6px 8px 6px 16px; }
  .dz-panel-body { padding: 2px 16px 18px; }
  .dz-what { display: none; }
  .dz-add { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
  .dz-add .dz-tool { min-height: 72px; border: 1px solid var(--line); font-size: .85rem; }
  .dz-add .dz-tool > .icon { width: 26px; height: 26px; }
  .dz-add-wide { grid-column: 1 / -1; }

  .dz-bar {
    display: flex; flex: none; gap: 2px; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); background: var(--card);
  }
  .has-cookie-banner .dz-bar { padding-bottom: 4px; }
  .dz-bar-button {
    display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 52px; padding: 4px 2px;
    border: 0; border-radius: var(--radius-small); background: none; color: var(--ink); font: inherit; font-size: .74rem; cursor: pointer;
  }
  .dz-bar-button [data-icon] { width: 22px; height: 22px; }
  .dz-bar-button[aria-pressed="true"] { background: var(--soft); color: var(--link); font-weight: 650; }
  .dz-bar-button:disabled { opacity: .45; }
  .dz-bar-print { background: var(--brand); color: var(--brand-ink); font-weight: 650; }
  .dz-kept { display: none; }
  .dz-about { margin: 28px var(--gutter) 0; }
  .dz-learn { margin: 28px var(--gutter) 0; padding-top: 24px; }
  /* Toasts appear above the bottom bar, not on it. */
  body:has(.dz-bar) .toasts { bottom: calc(76px + env(safe-area-inset-bottom) + var(--banner-space, 0px)); }
}

/* A wide but very short window (a phone held sideways): let the workspace keep a usable height. */
@media (min-width: 700px) and (max-height: 560px) {
  .dz { height: auto; min-height: 0; }
  .dz-body { height: max(420px, calc(100dvh - 90px)); }
}

@media (prefers-reduced-motion: no-preference) {
  .dz-tool, .dz-chip, .dz-layer-main { transition: background-color .12s, border-color .12s; }
}
@media (forced-colors: active) {
  .dz-sel, .dz-handle, .dz-guide, .dz-hover { stroke: Highlight; }
  .dz-layer-main[aria-pressed="true"], .dz-bar-button[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .dz-stage { forced-color-adjust: none; }
}
