/* The tool card from the mockup, built on the design system's tokens and zv- components. Global rather than scoped: js/dm-tool.js builds most of the tool, and scoped styles only reach the markup a component renders itself. */

.dm-tool {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: 22px;
    box-shadow: var(--shadow-md);
}

/* 1 Mask / 2 Restore the answer: a segmented control with step numbers (not in the design system yet). */
.dm-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding: var(--space-1);
    border-radius: 10px;
    background: var(--surface-sunken);
    width: fit-content;
    max-width: 100%;
}

.dm-tabs button {
    font: inherit;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch-min);
    padding: 0 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.dm-tabs button[aria-pressed="true"] {
    background: var(--surface-raised);
    color: var(--ink);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.dm-tab-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--line);
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 700;
}

.dm-tabs button[aria-pressed="true"] .dm-tab-num {
    background: var(--accent);
    color: var(--on-accent);
}

.dm-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dm-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
    gap: var(--space-5);
}

.dm-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.dm-column-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-1) var(--space-3);
}

.dm-column-label {
    font-size: 16px;
    font-weight: 600;
}

.dm-link-btn {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    border: none;
    background: none;
    color: var(--accent-ink);
    text-decoration: underline;
    cursor: pointer;
}

.dm-link-btn:hover {
    text-decoration-thickness: 2px;
}

.dm-text.zv-input,
.dm-output {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    min-height: 236px;
    padding: 14px var(--space-4);
    border-radius: 10px;
    font-size: 15px;
}

.dm-text.zv-input {
    line-height: 1.6;
    resize: vertical;
}

.dm-text.zv-input:disabled {
    cursor: default;
}

.dm-output {
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 560px;
    overflow-y: auto;
}

.dm-output-empty {
    color: var(--ink-muted);
}

/* Labels in the masked text, and values put back (green) or labels not recognised (yellow) in the answer. */
.dm-label,
.dm-restored,
.dm-unknown {
    border-radius: 4px;
    padding: 1px 4px;
    font-weight: 700;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    white-space: nowrap;
}

.dm-label {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.dm-restored {
    background: var(--success-soft);
    color: var(--success);
}

.dm-unknown {
    background: var(--warning-soft);
    color: var(--warning);
}

.dm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

/* The types: check boxes shaped as chips, with the number of hits. */
.dm-types {
    flex: 1 1 400px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.dm-type {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch-min);
    padding: 0 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--line-control);
    background: var(--surface-field);
    color: var(--ink-muted);
    font-size: 14px;
    cursor: pointer;
}

.dm-type:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--ink);
}

.dm-type:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.dm-type input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

.dm-type-count {
    font-weight: 700;
}

.dm-copy.zv-btn {
    flex: 0 0 auto;
    min-height: 48px;
}

.dm-summary {
    margin: 0;
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.dm-summary .icon {
    margin-top: 3px;
}

.dm-summary-restore {
    flex: 1 1 320px;
    max-width: 560px;
}

.dm-promo .zv-btn {
    flex: 0 0 auto;
}

.dm-tool button:disabled {
    cursor: default;
}

@media (max-width: 600px) {
    .dm-tool {
        padding: var(--space-5);
    }

    .dm-copy.zv-btn {
        width: 100%;
    }

    .dm-tabs {
        flex-wrap: nowrap;
    }

    .dm-tabs button {
        padding: 0 var(--space-3);
        font-size: 14px;
    }
}

/* The icon on a copy button, swapped by the script (copy, check). */
.dm-icon-slot {
    display: contents;
}

/* ---- Text, Screenshot and Document: the tabs above the tool, and the Work mode button at the end of their row
   (Zavanto/Design Tip.md); under 640 px a select in the tabs' place, beside the button. ---- */
.dm-kinds-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--line);
    margin-top: calc(var(--space-2) * -1);
}

.dm-kinds-row .zv-work-link {
    margin-left: auto;
}

.dm-kinds {
    display: flex;
    gap: var(--space-1);
    align-self: stretch;
    min-width: 0;
}

.dm-kinds-select {
    display: none;
    font: inherit;
    font-size: 15px;
    height: var(--touch-min);
    min-width: 0;
    flex: 0 1 auto;
    padding: 0 var(--space-2);
    border: 1px solid var(--line-control);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    color: var(--ink);
}

.dm-kinds-select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (max-width: 639.98px) {
    .dm-kinds-row {
        border-bottom: 0;
        margin-top: 0;
    }

    .dm-kinds-row .dm-kinds {
        display: none;
    }

    .dm-kinds-select {
        display: block;
    }

    .dm-kinds-row .zv-work-link {
        min-height: var(--touch-min);
    }
}

.dm-kinds [role="tab"] {
    font: inherit;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch-min);
    padding: 0 var(--space-4);
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    color: var(--ink-muted);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.dm-kinds [role="tab"][aria-selected="true"] {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.dm-kinds [role="tab"]:disabled {
    cursor: default;
}

.dm-kinds .icon {
    width: 18px;
    height: 18px;
}

.dm-kind-panel {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* ---- the Screenshot tab ---- */
.dm-shot-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-8) var(--space-4);
    border: 2px dashed var(--line-strong, var(--line));
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    text-align: center;
}

.dm-shot-drop.dm-shot-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.dm-shot-drop > .icon {
    width: 36px;
    height: 36px;
    color: var(--ink-muted);
}

.dm-shot-empty {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    max-width: 32ch;
}

.dm-shot-hint {
    margin: 0;
    font-size: 14px;
    color: var(--ink-muted);
}

.dm-shot-drop label.zv-btn:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.dm-shot-work {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.dm-shot-stage {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    touch-action: none;
    cursor: crosshair;
    background: var(--surface-sunken);
}

.dm-shot-view {
    display: block;
    width: 100%;
    height: auto;
}

.dm-shot-overlay {
    position: absolute;
    inset: 0;
}

/* A covered detail: opaque, with its label. Burnt into the image as it is when copied or downloaded. */
.dm-box {
    position: absolute;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 0;
    border: none;
    border-radius: 2px;
    background: #1b1f24;
    color: #ffffff;
    font: 600 12px/1 system-ui, sans-serif;
    white-space: nowrap;
    cursor: pointer;
}

.dm-box:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
}

/* Removed: only an outline is left, so it can be covered again. */
.dm-box-removed {
    background: transparent;
    color: transparent;
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

.dm-box-drawing {
    background: rgba(27, 31, 36, 0.85);
    pointer-events: none;
}

.dm-crop {
    position: absolute;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55);
    pointer-events: none;
}

.dm-crop-active {
    outline: 2px solid var(--accent);
}

.dm-crop-handle {
    position: absolute;
    width: 28px;
    height: 28px;
    margin: -14px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: var(--shadow-sm);
    pointer-events: auto;
    cursor: nwse-resize;
    touch-action: none;
}

.dm-crop-tl { left: 0; top: 0; }
.dm-crop-tr { right: 0; top: 0; cursor: nesw-resize; }
.dm-crop-bl { left: 0; bottom: 0; cursor: nesw-resize; }
.dm-crop-br { right: 0; bottom: 0; }

.dm-crop-handle:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
}

.dm-shot-tools,
.dm-shot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.dm-shot-actions .zv-btn-primary {
    flex: 1 1 220px;
}

.dm-shot-summary {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.dm-shot-summary p {
    margin: 0;
}

.dm-shot-labels {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.dm-shot-reminder {
    font-size: 14px;
    color: var(--ink-muted);
}

/* Three tabs on a phone: no icons, less air, so Text, Screenshot and Document fit at 320 px. */
@media (max-width: 480px) {
    .dm-kinds {
        gap: 0;
    }

    .dm-kinds [role="tab"] {
        flex: 1 1 auto;
        justify-content: center;
        padding: 0 var(--space-2);
        font-size: 15px;
    }

    .dm-kinds .icon {
        display: none;
    }
}

/* "Have a file? Use Document" under the text field. */
.dm-file-hint {
    margin: var(--space-2) 0 0;
    font-size: 14px;
    color: var(--ink-muted);
}

/* ---- the Document tab ---- */
.dm-doc-work > .dm-types {
    flex: none;
}

.dm-doc-work,
.dm-doc-restore {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.dm-doc-restore[hidden],
.dm-doc-work[hidden] {
    display: none;
}

.dm-doc-file {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.dm-doc-file > .icon {
    flex: none;
    width: 28px;
    height: 28px;
    color: var(--ink-muted);
}

.dm-doc-file-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.dm-doc-file-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.dm-doc-file-meta {
    font-size: 14px;
    color: var(--ink-muted);
}

.dm-doc-other {
    flex: none;
}

.dm-doc-hint,
.dm-doc-key-text {
    margin: 0;
    font-size: 14px;
    color: var(--ink-muted);
}

/* The preview: labels are buttons (a click leaves the detail as it is), released details are underlined. */
.dm-doc-text {
    min-height: 160px;
}

.dm-doc-label {
    font: inherit;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.dm-doc-label:hover {
    outline: 2px solid var(--accent);
}

.dm-doc-hidden {
    background: #1b1f24;
    color: #ffffff;
}

.dm-doc-released {
    font: inherit;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    text-decoration: underline dashed var(--accent);
    text-underline-offset: 3px;
    cursor: pointer;
}

.dm-doc-label:focus-visible,
.dm-doc-released:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
}

.dm-doc-tools,
.dm-doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.dm-doc-actions .zv-btn {
    flex: 1 1 220px;
}

.dm-doc-notes {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.dm-doc-notes:empty {
    display: none;
}

.dm-doc-note {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-2);
    margin: 0;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    font-size: 14px;
    line-height: 1.5;
}

.dm-doc-note > span:first-of-type {
    flex: 1 1 200px;
}

.dm-doc-note .icon {
    flex: none;
    margin-top: 2px;
}

.dm-doc-note-warning {
    background: var(--warning-soft);
    color: var(--ink);
}

.dm-doc-note-warning > .icon {
    color: var(--warning);
}

.dm-doc-status-warning > .icon {
    color: var(--warning);
}

.dm-doc-key {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
}

.dm-doc-key label.zv-btn:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.dm-doc-key-status {
    margin: 0;
}

/* PDF pages, one under the other, drawn as they come into view. */
.dm-doc-pages {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    max-height: 80vh;
    overflow-y: auto;
    padding-right: var(--space-1);
}

.dm-doc-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.dm-doc-page-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-muted);
}

.dm-doc-stage {
    background: #ffffff;
    touch-action: auto;
}

.dm-doc-stage .dm-shot-view {
    height: 100%;
}

.dm-doc-pdf-text summary {
    cursor: pointer;
    font-weight: 600;
    padding: var(--space-2) 0;
}

.dm-doc-pdf-text[open] {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.dm-doc-or {
    margin: 0;
    text-align: center;
    font-size: 14px;
    color: var(--ink-muted);
}

.dm-doc-answer {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.dm-doc-answer .dm-output {
    min-height: 120px;
}

.dm-doc-answer .zv-btn-primary {
    align-self: flex-start;
}

.dm-doc-restored {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
}

.dm-doc-restored:empty {
    display: none;
}

@media (max-width: 600px) {
    .dm-doc-answer .zv-btn-primary,
    .dm-doc-restored .zv-btn-primary {
        align-self: stretch;
    }
}

/* ---- the enlarged view (js/dm-zoom.js): the whole screen, the image and its boxes ---- */
html.dm-zoom-open {
    overflow: hidden;
}

.dm-zoom {
    box-sizing: border-box;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    border: none;
    background: var(--surface);
    color: var(--ink);
}

.dm-zoom[open] {
    display: flex;
    flex-direction: column;
}

.dm-zoom::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.dm-zoom-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--line);
    background: var(--surface-raised);
}

.dm-zoom-bar .zv-btn {
    min-height: var(--touch-min);
}

.dm-zoom-done.zv-btn-primary {
    padding: 0 var(--space-4);
    font-size: 16px;
}

.dm-zoom-step {
    min-width: var(--touch-min);
    justify-content: center;
    font-size: 20px;
    padding: 0;
}

.dm-zoom-draw[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent, #ffffff);
}

.dm-zoom-done {
    margin-left: auto;
}

.dm-zoom-viewport {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
    touch-action: none;
    background: var(--surface-sunken);
    cursor: grab;
}

.dm-zoom-viewport:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
}

.dm-zoom-drawing .dm-zoom-viewport {
    cursor: crosshair;
}

.dm-zoom-world {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
}

.dm-zoom-world canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.dm-zoom-hint {
    margin: 0;
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    color: var(--ink-muted);
    border-top: 1px solid var(--line);
    background: var(--surface-raised);
}

@media (max-width: 380px) {
    .dm-zoom-bar .zv-btn {
        padding: 0 var(--space-2);
    }
}

/* "This is removed from the file": what the Word file said about who made it (js/dm-document.js). */
.dm-doc-removed {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    font-size: 14px;
    line-height: 1.5;
}

.dm-doc-removed h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.dm-doc-removed ul {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-wrap: anywhere;
}

.dm-doc-removed p {
    margin: 0;
    color: var(--ink-muted);
}

/* ---- The work mode (/arbeta, /work): a tool, not a page. The tool fills Zavanto/Design's zv-tool-main, and only its
   panes scroll. ---- */
.dm-tool-work {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: var(--space-3);
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.dm-tool-work > .dm-kind-panel:not([hidden]) {
    flex: 1 1 auto;
    min-height: 0;
}

/* The Text tab: two steps of two panes, in a grid of two rows. */
.dm-work-text {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.dm-work-steps {
    display: none;
}

.dm-work-step {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    min-height: 0;
}

.dm-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.dm-pane-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 48px;
    box-sizing: border-box;
    padding: var(--space-2) 14px;
    border-bottom: 1px solid var(--line);
}

.dm-pane-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.dm-pane-head .zv-btn {
    margin-left: auto;
    white-space: nowrap;
    min-height: 32px;
    padding: 0 var(--space-3);
    font-size: 13px;
}

.dm-pane-head .zv-btn svg {
    width: 16px;
    height: 16px;
}

.dm-pane-text,
.dm-pane-output {
    flex: 1 1 0;
    min-height: 0;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 14px;
    border: 0;
    border-radius: 0;
    font: inherit;
    font-size: 14px;
    line-height: 1.6;
    overflow: auto;
}

.dm-pane-text {
    resize: none;
    background: var(--surface-raised);
    color: var(--ink);
}

.dm-pane-text:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.dm-pane-text::placeholder {
    color: var(--ink-muted);
}

.dm-pane-output.dm-output {
    max-height: none;
    border: 0;
    border-radius: 0;
    background: var(--surface-sunken);
}

.dm-pane-output:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.dm-pane-foot {
    flex: 0 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 34px;
    box-sizing: border-box;
    padding: var(--space-1) 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    line-height: 16px;
    color: var(--ink-muted);
}

.dm-pane-summary {
    margin: 0;
    min-width: 0;
}

/* What to mask: the chips folded under a summary, opening upwards over the field. */
.dm-types-menu {
    margin-left: auto;
    flex: 0 0 auto;
}

.dm-types-menu:has(> .dm-types[hidden]) {
    display: none;
}

.dm-types-menu > summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent-ink);
    text-decoration: underline;
    min-height: 24px;
    display: flex;
    align-items: center;
}

.dm-types-menu > summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.dm-types-menu[open] > .dm-types {
    position: absolute;
    left: var(--space-2);
    right: var(--space-2);
    bottom: calc(100% + var(--space-1));
    z-index: 2;
    max-height: 260px;
    overflow: auto;
    box-sizing: border-box;
    padding: var(--space-3);
    gap: var(--space-1);
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.dm-tool-work .dm-type {
    min-height: 32px;
    padding: 0 10px;
    gap: 6px;
    font-size: 13px;
}

.dm-tool-work .dm-type input {
    width: 16px;
    height: 16px;
}

/* SecureShare after a restore, as one line under the restored answer. */
.dm-pane-promo .zv-app-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    flex: 0 0 auto;
}

.dm-pane-promo .zv-app-icon svg {
    width: 13px;
    height: 13px;
}

.dm-pane-promo-text {
    min-width: 0;
    color: var(--ink);
}

.dm-pane-promo a {
    margin-left: auto;
    font-weight: 600;
    color: var(--accent-ink);
    white-space: nowrap;
}

/* Screenshot and Document: the same frame, the tab's work in one pane that scrolls on its own. */
.dm-tool-work > .dm-shot:not([hidden]),
.dm-tool-work > .dm-doc:not([hidden]) {
    overflow: auto;
    box-sizing: border-box;
    padding: var(--space-4);
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.dm-tool-work .dm-shot-work {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-2);
}

.dm-tool-work .dm-shot-work > * {
    flex: 1 1 100%;
    order: 4;
}

.dm-tool-work .dm-shot-work > .dm-shot-hint {
    order: 0;
    margin: 0;
}

.dm-tool-work .dm-shot-work > .dm-shot-tools,
.dm-tool-work .dm-shot-work > .dm-shot-actions {
    flex: 0 1 auto;
    order: 1;
}

.dm-tool-work .dm-shot-actions .zv-btn-primary {
    flex: 0 1 auto;
}

.dm-tool-work .dm-shot-work::after {
    content: "";
    flex: 1 1 100%;
    order: 2;
}

.dm-tool-work .dm-shot-work > .dm-shot-stage {
    flex: 0 0 auto;
    order: 3;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
}

.dm-tool-work .dm-shot-work .dm-shot-view {
    width: auto;
    max-width: 100%;
    max-height: max(220px, calc(100dvh - 300px));
}

.dm-tool-work .dm-doc-work > * {
    order: 2;
}

.dm-tool-work .dm-doc-work > .dm-doc-file {
    order: 0;
}

.dm-tool-work .dm-doc-work > .dm-doc-actions {
    order: 1;
}

.dm-tool-work .dm-doc-pages,
.dm-tool-work .dm-doc-text {
    max-height: max(260px, calc(100dvh - 340px));
}

/* From 720 px the steps are not boxes of their own: their panes are placed straight in the Text tab's grid, and from
   1200 px the labels are a column of their own, 280 px wide, beside both rows. */
@media (min-width: 720px) {
    .dm-work-text {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas: "in out" "ai res";
    }

    .dm-work-step {
        display: contents;
    }

    .dm-pane-in { grid-area: in; }
    .dm-pane-out { grid-area: out; }
    .dm-pane-ai { grid-area: ai; }
    .dm-pane-res { grid-area: res; }
}

@media (min-width: 1200px) {
    .dm-work-text {
        grid-template-columns: repeat(2, minmax(0, 1fr)) 280px;
        grid-template-areas: "in out labels" "ai res labels";
    }

    .dm-work-labels {
        grid-area: labels;
    }
}

/* The labels' pane: a header with the number of details, and the list scrolling on its own. */
.dm-work-labels-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--ink-muted);
}

.dm-work-labels-list {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    padding: 0 14px 14px;
    font-size: 13px;
    line-height: 18px;
}

.dm-work-labels-list:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.dm-work-labels-list > .dm-output-empty {
    margin: 14px 0 0;
}

.dm-work-labels-type h4 {
    display: flex;
    justify-content: space-between;
    margin: 12px 0 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
}

.dm-work-labels-type ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dm-work-labels-type li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 0;
    border-top: 1px solid var(--line);
    overflow-wrap: anywhere;
}

.dm-work-labels-type .dm-label {
    font-size: 12px;
}

.dm-labels-open.zv-btn,
.dm-labels-close,
.dm-labels-sheet-open.zv-tool-pane-btn {
    display: none;
}

/* Under 720 px the list in the sheet (js/dm-work.js moves it there): the sheet's body scrolls, not the list. */
.dm-labels-sheet .dm-work-labels-list {
    padding: 0;
    overflow: visible;
}

/* Between 720 and 1200 px: a drawer from the right, opened by Labels in the masked text's header. */
@media (min-width: 720px) and (max-width: 1199.98px) {
    .dm-labels-open.zv-btn {
        display: inline-flex;
    }

    .dm-labels-open + .dm-pane-copy.zv-btn {
        margin-left: 0;
    }

    .dm-work-labels {
        display: none;
        position: fixed;
        top: calc(44px + var(--zv-safe-top));
        right: var(--zv-safe-right);
        bottom: calc(28px + var(--zv-safe-bottom));
        z-index: 20;
        width: min(340px, 90vw);
        border-radius: var(--radius-md) 0 0 var(--radius-md);
        box-shadow: var(--shadow-md);
    }

    .dm-work-labels[data-open] {
        display: flex;
    }

    .dm-labels-close {
        display: inline-flex;
        width: 32px;
        height: 32px;
        margin-right: -6px;
        color: var(--ink-muted);
    }

    .dm-labels-close:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

    .dm-labels-close .icon {
        width: 18px;
        height: 18px;
    }
}

/* Under 720 px: the steps Mask and Restore as tabs under the header, two panes each, one above the other and sharing the
   height, and the copy button fixed at the bottom, 48 px high. The step is the bottom row (zv-tool-safe-bottom): its
   68 px under the panes are --zv-tool-safe-pad, and the installed app adds the home indicator's inset to it. The labels
   are not in the flow: "Labels (6)" in the masked text's header opens them as a sheet. No status line at the bottom: it
   is in the more menu (Zavanto/Design AppHeader.md "Smalt"). */
@media (max-width: 719.98px) {
    .dm-tool-work {
        padding: 0;
    }

    .dm-tool-work > .dm-shot:not([hidden]),
    .dm-tool-work > .dm-doc:not([hidden]) {
        margin: var(--space-2) var(--space-2) calc(var(--space-2) + var(--zv-safe-bottom));
        padding: var(--space-3);
    }

    .dm-work-text {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .dm-work-steps {
        flex: 0 0 auto;
        display: flex;
        background: var(--surface-raised);
        border-bottom: 1px solid var(--line);
    }

    .dm-work-steps [role="tab"] {
        flex: 1 1 0;
        font: inherit;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        height: 44px;
        border: 0;
        border-bottom: 3px solid transparent;
        background: transparent;
        color: var(--ink-muted);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
    }

    .dm-work-steps [role="tab"][aria-selected="true"] {
        color: var(--ink);
        border-bottom-color: var(--accent);
    }

    .dm-work-steps [role="tab"][aria-selected="true"] .dm-tab-num {
        background: var(--accent);
        color: var(--on-accent);
    }

    .dm-work-steps [role="tab"]:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
    }

    .dm-work-step {
        flex: 1 1 auto;
        position: relative;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
        padding-top: var(--space-2);
        padding-left: var(--space-2);
        padding-right: var(--space-2);
        --zv-tool-safe-pad: 68px;
    }

    .dm-work-labels {
        display: none;
    }

    .dm-labels-sheet-open.zv-tool-pane-btn {
        display: inline-flex;
        margin-left: auto;
    }

    .dm-work-step > .dm-pane {
        flex: 1 1 0;
    }

    .dm-pane-head .dm-tab-num {
        display: none;
    }

    /* The copy button: in the masked or restored pane's header from 720 px, fixed at the step's bottom here. Its
       containing block is the step, so the pane does not clip it. */
    .dm-pane-head .dm-pane-copy.zv-btn {
        position: absolute;
        left: var(--space-2);
        right: var(--space-2);
        bottom: calc(var(--space-2) + var(--zv-safe-bottom));
        width: auto;
        min-height: 48px;
        margin: 0;
        border-radius: 10px;
        font-size: 15px;
    }

    .dm-pane-text,
    .dm-pane-output {
        font-size: 15px;
        line-height: 1.5;
        padding: var(--space-3);
    }
}

/* The keyboard shortcuts (js/dm-work.js). */
.dm-shortcuts {
    box-sizing: border-box;
    width: min(460px, calc(100vw - 2 * var(--space-4)));
    max-height: calc(100dvh - 2 * var(--space-4));
    padding: var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    color: var(--ink);
    box-shadow: var(--shadow-md);
}

.dm-shortcuts::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.dm-shortcuts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.dm-shortcuts-head h3 {
    margin: 0;
    font-size: 18px;
}

.dm-shortcuts-list {
    margin: 0 0 var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* What the shortcut does, then its keys; on a narrow screen the keys go under it. */
.dm-shortcuts-list > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
}

.dm-shortcuts-list dt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    font-size: 13px;
    color: var(--ink-muted);
}

.dm-shortcuts-list dd {
    order: -1;
    flex: 1 1 12em;
    margin: 0;
}

.dm-shortcuts kbd {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 6px;
    border: 1px solid var(--line-control);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    color: var(--ink);
}

.dm-shortcuts-note {
    margin: 0 0 var(--space-2);
    font-size: 14px;
    color: var(--ink-muted);
}

