/* =====================================================================
   THE REPORT DESIGNER (2026-09-30) - the start cards, the report bar,
   the palette, the page, and the setup / preview / confirm dialogs.
   Kirk: "Templates - wasting a whole rail on the left. The terrible top
   drop downs, the preview in 4th column that should be a dialog ... Then
   there will be room to actually work." Every colour is a --theme-*
   token (mixed with color-mix) so tenant themes and dark mode carry.
   Prefix: rdz-. The band internals keep their rcd-* classes (app-cards.css)
   and are restyled here to look like the page they print.
   ===================================================================== */

.rdz-app {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding-bottom: 2rem;
}

.rdz-iconbtn {
    display: inline-grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    flex: 0 0 auto;
    border: 1px solid var(--theme-border);
    border-radius: 0.55rem;
    background: var(--theme-background-raised);
    color: var(--theme-text);
}
.rdz-iconbtn:hover:not(:disabled) { border-color: var(--theme-primary); color: var(--theme-primary); }
.rdz-iconbtn:disabled { opacity: 0.45; }

.rdz-linkbtn {
    border: 0;
    background: none;
    padding: 0;
    color: var(--theme-primary);
    font-size: var(--theme-font-size-xs, 0.75rem);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}
.rdz-linkbtn:hover { text-decoration: underline; }

/* ---- Start screen ------------------------------------------------------ */
.rdz-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--theme-border);
}
.rdz-head-icon { color: var(--theme-offset); }
.rdz-head-actions { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }

.rdz-start {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.85rem;
}
.rdz-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    min-height: 150px;
    padding: 1rem 1.05rem 0.9rem;
    text-align: left;
    font: inherit;
    color: var(--theme-text);
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.75rem);
    box-shadow: var(--theme-shadow);
    cursor: pointer;
    transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.rdz-card:hover {
    border-color: color-mix(in srgb, var(--theme-primary) 55%, var(--theme-border));
    transform: translateY(-2px);
    box-shadow: var(--theme-shadow-lg, var(--theme-shadow));
}
.rdz-card-kind {
    display: inline-grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    margin-bottom: 0.25rem;
    border-radius: 0.6rem;
    font-size: 1.15rem;
    color: var(--theme-offset);
    background: color-mix(in srgb, var(--theme-offset) 12%, transparent);
}
.rdz-card-kind.is-fill { color: var(--theme-accent); background: color-mix(in srgb, var(--theme-accent) 12%, transparent); }
.rdz-card-title { font-size: 1.02rem; font-weight: 700; color: var(--theme-text-emphasis); line-height: 1.25; }
.rdz-card-sub { font-size: var(--theme-font-size-sm, 0.85rem); color: var(--theme-text-secondary); }
.rdz-card-facts {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-top: auto;
    padding-top: 0.5rem;
    font-size: var(--theme-font-size-xs, 0.75rem);
    color: var(--theme-text-muted);
}
.rdz-card-facts i { margin-right: 0.35rem; }
.rdz-card-new {
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px dashed color-mix(in srgb, var(--theme-primary) 45%, var(--theme-border));
    background: color-mix(in srgb, var(--theme-primary) 5%, var(--theme-surface));
    box-shadow: none;
}
.rdz-card-plus {
    display: inline-grid;
    place-items: center;
    width: 2.8rem;
    height: 2.8rem;
    margin-bottom: 0.3rem;
    border-radius: 50%;
    font-size: 1.4rem;
    color: var(--theme-text-on-primary);
    background: var(--theme-primary);
}
.rdz-start-empty { color: var(--theme-text-muted); text-align: center; margin: 0.5rem 0 0; }

/* ---- The report bar ------------------------------------------------------ */
.rdz-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    background: color-mix(in srgb, var(--theme-surface) 94%, transparent);
    backdrop-filter: blur(6px);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.75rem);
    box-shadow: var(--theme-shadow);
}
.rdz-bar-id { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; flex: 1 1 auto; }
.rdz-title {
    width: 100%;
    min-width: 0;
    padding: 0.05rem 0.25rem;
    border: 1px solid transparent;
    border-radius: 0.4rem;
    background: transparent;
    color: var(--theme-text-emphasis);
    font-size: 1.25rem;
    font-weight: 750;
    line-height: 1.25;
}
.rdz-title:hover { border-color: var(--theme-border); }
.rdz-title:focus { outline: none; border-color: var(--theme-primary); background: var(--theme-background-raised); }
.rdz-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    padding: 0.05rem 0.2rem;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
    color: var(--theme-text-secondary);
    cursor: pointer;
}
.rdz-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    background: var(--theme-background-subtle);
    font-size: var(--theme-font-size-xs, 0.75rem);
    white-space: nowrap;
}
.rdz-pill i { color: var(--theme-offset); }
.rdz-summary-edit { font-size: var(--theme-font-size-xs, 0.75rem); color: var(--theme-primary); font-weight: 600; margin-left: 0.15rem; }
.rdz-summary-edit i { margin-right: 0.2rem; }
.rdz-summary:hover .rdz-pill { background: color-mix(in srgb, var(--theme-primary) 10%, var(--theme-background-subtle)); }
.rdz-summary:hover .rdz-summary-edit { text-decoration: underline; }
.rdz-bar-actions { display: flex; align-items: center; gap: 0.45rem; flex: 0 0 auto; }
.rdz-savestate { font-size: var(--theme-font-size-xs, 0.75rem); color: var(--theme-text-muted); white-space: nowrap; }
.rdz-savestate.is-dirty { color: var(--theme-warning); font-weight: 600; }
.rdz-savestate.is-dirty::before { content: "\2022"; margin-right: 0.3rem; }

.rdz-menu { position: relative; }
.rdz-menu-shield { position: fixed; inset: 0; z-index: 40; }
.rdz-menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 41;
    display: flex;
    flex-direction: column;
    min-width: 14rem;
    padding: 0.3rem;
    background: var(--theme-background-float, var(--theme-surface));
    border: 1px solid var(--theme-border);
    border-radius: 0.65rem;
    box-shadow: var(--theme-shadow-lg, var(--theme-shadow));
}
.rdz-menu-pop button {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.6rem;
    border: 0;
    border-radius: 0.45rem;
    background: none;
    text-align: left;
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm, 0.875rem);
}
.rdz-menu-pop button:hover { background: var(--theme-background-hover); }
.rdz-menu-pop button.is-danger { color: var(--theme-danger); }

/* ---- Notes (save refusals, problems found) ---------------------------------- */
.rdz-notes {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.55rem 2.4rem 0.55rem 0.75rem;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.75rem);
}
.rdz-note { display: flex; align-items: flex-start; gap: 0.5rem; font-size: var(--theme-font-size-sm, 0.875rem); color: var(--theme-text); }
.rdz-note > i { color: var(--theme-info); margin-top: 0.15rem; }
.rdz-note-warn > i { color: var(--theme-warning); }
.rdz-note-error > i { color: var(--theme-danger); }
.rdz-notes-x { position: absolute; top: 0.45rem; right: 0.45rem; border: 0; background: none; color: var(--theme-text-muted); }
.rdz-notes-x:hover { color: var(--theme-text); }

/* ---- The work area: palette | page ---------------------------------------- */
.rdz-work {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.rdz-palette {
    position: sticky;
    top: 5.6rem;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    padding: 0.65rem;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.75rem);
    box-shadow: var(--theme-shadow);
}
.rdz-pal-search { display: flex; align-items: center; gap: 0.4rem; }
.rdz-pal-search i { color: var(--theme-text-muted); }
.rdz-pal-tip {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.5rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--theme-info) 8%, var(--theme-surface));
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs, 0.75rem);
    line-height: 1.35;
}
.rdz-pal-tip i { color: var(--theme-info); margin-top: 0.05rem; }
.rdz-pal-sec { margin-top: 0.85rem; }
.rdz-pal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}
.rdz-pal-note { margin: 0 0 0.35rem; font-size: var(--theme-font-size-xs, 0.75rem); color: var(--theme-text-muted); }
.rdz-pal-empty {
    padding: 0.7rem 0.5rem;
    text-align: center;
    font-size: var(--theme-font-size-sm, 0.85rem);
    color: var(--theme-text-muted);
    border: 1px dashed var(--theme-border);
    border-radius: 0.55rem;
}
.rdz-pal-empty p { margin: 0 0 0.5rem; }

.rdz-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.rdz-block {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.5rem;
    border: 1px solid var(--theme-border);
    border-radius: 0.55rem;
    background: var(--theme-background-raised);
    color: var(--theme-text);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
.rdz-block i { color: var(--theme-offset); font-size: 0.95rem; }
.rdz-block:hover { border-color: var(--theme-primary); background: color-mix(in srgb, var(--theme-primary) 6%, var(--theme-background-raised)); }
.rdz-block:active, .rdz-item:active { cursor: grabbing; }

.rdz-pal-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.32rem 0.3rem;
    border: 0;
    border-radius: 0.45rem;
    background: none;
    text-align: left;
    color: var(--theme-text-emphasis);
    font-size: 0.82rem;
    font-weight: 650;
}
.rdz-pal-group:hover { background: var(--theme-background-hover); }
.rdz-pal-group i { font-size: 0.7rem; color: var(--theme-text-muted); }
.rdz-count {
    margin-left: auto;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--theme-background-subtle);
    color: var(--theme-text-muted);
    font-size: 0.68rem;
    font-weight: 600;
}
.rdz-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin: 0 0 0.2rem;
    padding: 0.34rem 0.5rem 0.34rem 0.65rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: var(--theme-background-subtle);
    color: var(--theme-text);
    font-size: 0.84rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
.rdz-item:hover { border-color: var(--theme-primary); background: color-mix(in srgb, var(--theme-primary) 7%, var(--theme-background-raised)); }
.rdz-item i { flex: 0 0 auto; color: var(--theme-offset); }
.rdz-item-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rdz-item-tag {
    margin-left: auto;
    flex: 0 0 auto;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--theme-warning) 16%, transparent);
    color: var(--theme-warning);
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* ---- The stage: a desk with a real-looking page on it -------------------- */
.rdz-stage { min-width: 0; }
.rdz-desk {
    min-height: calc(100vh - 11rem);
    padding: 1.6rem 1rem 2rem;
    border-radius: var(--theme-radius, 0.75rem);
    background:
        radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--theme-text-muted) 18%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
        var(--theme-background-subtle);
}
.rdz-page {
    position: relative;
    max-width: 8.5in;
    min-height: 9in;
    margin: 0 auto;
    padding: 0.55in 0.6in 0.7in;
    background: var(--theme-background-raised);
    border: 1px solid var(--theme-border);
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 10px 28px rgba(0, 0, 0, 0.08);
    color: var(--theme-text);
}
.rdz-page-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.4rem; padding: 2.5rem 0.5rem 1rem; }
.rdz-page-empty > i { font-size: 2.4rem; color: color-mix(in srgb, var(--theme-offset) 55%, transparent); }
.rdz-page-empty h3 { margin: 0.2rem 0 0; font-size: 1.25rem; font-weight: 750; color: var(--theme-text-emphasis); }
.rdz-page-empty p { margin: 0 0 0.8rem; color: var(--theme-text-secondary); max-width: 26rem; }
.rdz-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; width: 100%; max-width: 36rem; }
.rdz-quick button {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0.75rem;
    border: 1px solid var(--theme-border);
    border-radius: 0.65rem;
    background: var(--theme-surface);
    text-align: left;
    color: var(--theme-text);
    font-size: 0.8rem;
}
.rdz-quick button:hover { border-color: var(--theme-primary); background: color-mix(in srgb, var(--theme-primary) 6%, var(--theme-surface)); }
.rdz-quick i { font-size: 1.2rem; color: var(--theme-primary); }
.rdz-quick strong { display: block; font-size: 0.86rem; color: var(--theme-text-emphasis); }

.rdz-sources { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; max-width: 8.5in; margin: 0.9rem auto 0; }
.rdz-sources-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--theme-text-muted); }
.rdz-source-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.3rem 0.15rem 0.6rem;
    border: 1px solid var(--theme-border);
    border-radius: 999px;
    background: var(--theme-surface);
    font-size: 0.78rem;
}
.rdz-source-chip i { color: var(--theme-offset); }
.rdz-source-chip button { border: 0; background: none; padding: 0 0.1rem; color: var(--theme-text-muted); }
.rdz-source-chip button:hover { color: var(--theme-danger); }

/* ---- Bands on the page: they look like what prints; the frame appears on hover -- */
.rdz-page .rcd-drop { height: 10px; margin: 0; }
.rdz-page .rcd-drop.is-active { height: 30px; margin: 3px 0; border-radius: 6px; }
.rdz-page .rcd-band {
    position: relative;
    margin: 0;
    padding: 0.55rem 0.6rem 0.6rem;
    border: 1px dashed transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
.rdz-page .rcd-band:hover { border-color: color-mix(in srgb, var(--theme-primary) 45%, transparent); }
.rdz-page .rcd-band.is-selected {
    border: 1px solid var(--theme-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 16%, transparent);
    background: color-mix(in srgb, var(--theme-primary) 3%, transparent);
}
.rdz-page .rcd-band.is-hover { background: color-mix(in srgb, var(--theme-primary) 6%, transparent); }
/* The frame's label + tools float on the top edge, like a design tool - never in the page's flow. */
.rdz-page .rcd-band-head {
    position: absolute;
    top: -0.8rem;
    left: 0.5rem;
    z-index: 3;
    display: none;
    align-items: center;
    gap: 0.35rem;
    padding: 0.12rem 0.3rem 0.12rem 0.2rem;
    border-radius: 0.4rem;
    background: var(--theme-primary);
    color: var(--theme-text-on-primary);
    box-shadow: var(--theme-shadow);
    cursor: grab;
}
.rdz-page .rcd-band:hover > .rcd-band-head,
.rdz-page .rcd-band.is-selected > .rcd-band-head { display: flex; }
.rdz-page .rcd-band-grip { font-size: 0.8rem; opacity: 0.8; }
.rdz-page .rcd-band-ico { color: inherit; font-size: 0.75rem; }
.rdz-page .rcd-band-title { color: inherit; font-size: 0.64rem; letter-spacing: 0.05em; }
.rdz-page .rcd-align { margin-left: 0.2rem; }
.rdz-page .rcd-align button { border-color: color-mix(in srgb, var(--theme-text-on-primary) 35%, transparent); background: transparent; color: inherit; }
.rdz-page .rcd-align button.is-on { background: var(--theme-text-on-primary); color: var(--theme-primary); border-color: var(--theme-text-on-primary); }
.rcd-band-tools { display: inline-flex; align-items: center; gap: 0.1rem; margin-left: 0.25rem; }
.rcd-band-tools button {
    display: inline-grid;
    place-items: center;
    width: 1.35rem;
    height: 1.25rem;
    padding: 0;
    border: 0;
    border-radius: 0.3rem;
    background: transparent;
    color: inherit;
    font-size: 0.72rem;
    visibility: visible;
}
.rcd-band-tools button:hover:not(:disabled) { background: color-mix(in srgb, var(--theme-text-on-primary) 22%, transparent); }
.rcd-band-tools button:disabled { opacity: 0.4; }
.rdz-page .rcd-band-x { margin-left: 0; }
.rdz-page .rcd-band-x:hover { color: inherit; background: color-mix(in srgb, var(--theme-danger) 70%, transparent) !important; }
.rdz-page .rcd-band-body { padding: 0; }

/* Header block: the facts across the top, like the printed masthead's fact row. */
.rdz-page .rcd-k-header .rcd-band-body { padding: 0.55rem 0.2rem; border-top: 3px solid var(--theme-text-emphasis); border-bottom: 1px solid var(--theme-border); }
/* A field: the label small and quiet, the answer as the value it will print. */
.rdz-page .rcd-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.55rem 1.1rem; }
.rdz-page .rcd-k-header .rcd-fields { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.rdz-page .rcd-field { flex-direction: column; align-items: flex-start; gap: 0.12rem; min-width: 0; }
.rdz-page .rcd-field-labelro { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; }
.rdz-page .rcd-field .rcd-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 0.84rem; font-weight: 600; }
.rdz-page .rcd-field .rcd-field-label { max-width: 100%; }
/* A question card, as the printed answer card: an edge, the question, where the answer lands. */
.rdz-page .rcd-k-step .rcd-band-body { padding: 0.5rem 0.75rem; border: 1px solid var(--theme-border); border-left: 3px solid var(--theme-primary); border-radius: 4px; }
.rdz-page .rcd-step-name { font-size: 0.95rem; color: var(--theme-text-emphasis); }
.rdz-page .rcd-step::after {
    content: "";
    display: block;
    flex-basis: 100%;
    height: 0.55rem;
    margin-top: 0.15rem;
    border-radius: 3px;
    background: repeating-linear-gradient(90deg, var(--theme-background-subtle) 0 70%, transparent 70% 100%);
    max-width: 55%;
}
/* The full story: a stack of ghost cards. */
.rdz-page .rcd-k-answerStory .rcd-story {
    padding: 0.6rem 0.75rem 1.9rem;
    border: 1px solid var(--theme-border);
    border-left: 3px solid var(--theme-primary);
    border-radius: 4px;
    background:
        linear-gradient(var(--theme-background-subtle), var(--theme-background-subtle)) 0.75rem calc(100% - 1.1rem) / 45% 0.5rem no-repeat,
        linear-gradient(var(--theme-background-subtle), var(--theme-background-subtle)) 0.75rem calc(100% - 0.45rem) / 30% 0.5rem no-repeat;
    box-shadow: 0 5px 0 -1px var(--theme-background-raised), 0 5px 0 0 var(--theme-border), 0 10px 0 -1px var(--theme-background-raised), 0 10px 0 0 var(--theme-border);
    margin-bottom: 0.7rem;
}
.rdz-page .rcd-k-chart .rcd-chart,
.rdz-page .rcd-k-image .rcd-imageband {
    min-height: 5.5rem;
    padding: 0.75rem;
    border: 1px dashed var(--theme-border);
    border-radius: 6px;
    background: color-mix(in srgb, var(--theme-background-subtle) 60%, transparent);
    justify-content: center;
}
.rdz-page .rcd-k-chart .rcd-chart > i:first-child,
.rdz-page .rcd-k-image .rcd-imageband > i:first-child { font-size: 1.5rem; }
.rdz-page .rcd-k-table .rcd-tablecols { padding-bottom: 0.35rem; border-bottom: 2px solid var(--theme-text-emphasis); }
.rdz-page .rcd-text { font-size: 0.92rem; }
.rdz-page .rcd-cols { gap: 0.9rem; }
.rdz-page .rcd-pagebreak span { background: var(--theme-background-raised); }

/* ---- Fill-in mode --------------------------------------------------------- */
.rdz-fill { min-width: 0; }
.rdz-fill-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.6rem; }
.rdz-fill-hint { font-size: var(--theme-font-size-xs, 0.75rem); color: var(--theme-text-muted); }
.rdz-fill-empty { padding: 2rem; text-align: center; color: var(--theme-text-muted); }
.rdz-fill-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    max-width: 34rem;
    margin: 2rem auto;
    padding: 2.6rem 1.5rem;
    text-align: center;
    border: 2px dashed color-mix(in srgb, var(--theme-primary) 45%, var(--theme-border));
    border-radius: var(--theme-radius, 0.75rem);
    background: color-mix(in srgb, var(--theme-primary) 4%, var(--theme-surface));
    color: var(--theme-text-secondary);
    cursor: pointer;
}
.rdz-fill-drop:hover { background: color-mix(in srgb, var(--theme-primary) 8%, var(--theme-surface)); }
.rdz-fill-drop i { font-size: 2.4rem; color: var(--theme-primary); }
.rdz-fill-drop strong { font-size: 1.05rem; color: var(--theme-text-emphasis); }
.rdz-fill-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---- Dialogs ------------------------------------------------------------- */
.rdz-dlg-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: color-mix(in srgb, var(--theme-text-emphasis) 38%, transparent);
    animation: rdz-fade 150ms ease;
}
.rdz-dlg {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1051;
    display: flex;
    flex-direction: column;
    width: min(46rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    transform: translate(-50%, -50%);
    background: var(--theme-background);
    border: 1px solid var(--theme-border);
    border-radius: 1rem;
    box-shadow: var(--theme-shadow-lg, 0 20px 50px rgba(0, 0, 0, 0.25));
    animation: rdz-pop 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes rdz-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rdz-pop { from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } to { opacity: 1; transform: translate(-50%, -50%); } }
.rdz-dlg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1.2rem 0.75rem;
    border-bottom: 1px solid var(--theme-border);
    background: linear-gradient(180deg, color-mix(in srgb, var(--theme-primary) 7%, var(--theme-surface)), var(--theme-surface));
    border-radius: 1rem 1rem 0 0;
}
.rdz-dlg-head h2 { margin: 0; font-size: 1.2rem; font-weight: 750; color: var(--theme-text-emphasis); }
.rdz-dlg-body { display: flex; flex-direction: column; gap: 1.15rem; padding: 1.05rem 1.2rem 1.2rem; overflow-y: auto; }
.rdz-dlg-body h2 { margin: 0; font-size: 1.15rem; font-weight: 750; color: var(--theme-text-emphasis); }
.rdz-dlg-body p { margin: 0; color: var(--theme-text-secondary); }
.rdz-dlg-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.2rem;
    border-top: 1px solid var(--theme-border);
    background: var(--theme-surface);
    border-radius: 0 0 1rem 1rem;
}
.rdz-confirm { width: min(30rem, calc(100vw - 2rem)); }

/* The setup questions. */
.rdz-q { display: flex; flex-direction: column; gap: 0.45rem; }
.rdz-q-label { display: flex; align-items: center; gap: 0.55rem; margin: 0; font-weight: 700; font-size: 0.98rem; color: var(--theme-text-emphasis); }
.rdz-q-num {
    display: inline-grid;
    place-items: center;
    width: 1.45rem;
    height: 1.45rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--theme-primary);
    color: var(--theme-text-on-primary);
    font-size: 0.75rem;
    font-weight: 750;
}
.rdz-q-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; font-size: var(--theme-font-size-xs, 0.75rem); color: var(--theme-text-muted); }
.rdz-codename {
    min-width: 12rem;
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--theme-border);
    border-radius: 0.35rem;
    background: var(--theme-background-raised);
    color: var(--theme-text);
    font-family: var(--theme-font-mono, ui-monospace, monospace);
    font-size: 0.78rem;
}
.rdz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.rdz-choice {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.8rem 0.9rem;
    border: 1.5px solid var(--theme-border);
    border-radius: 0.8rem;
    background: var(--theme-surface);
    text-align: left;
    color: var(--theme-text);
}
.rdz-choice > i { font-size: 1.4rem; color: var(--theme-offset); }
.rdz-choice-title { font-weight: 700; color: var(--theme-text-emphasis); }
.rdz-choice-sub { font-size: 0.8rem; color: var(--theme-text-secondary); line-height: 1.35; }
.rdz-choice:hover { border-color: color-mix(in srgb, var(--theme-primary) 55%, var(--theme-border)); }
.rdz-choice.is-on { border-color: var(--theme-primary); background: color-mix(in srgb, var(--theme-primary) 7%, var(--theme-surface)); }
.rdz-choice.is-on::after {
    content: "\2713";
    position: absolute;
    top: 0.55rem;
    right: 0.65rem;
    display: grid;
    place-items: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: var(--theme-primary);
    color: var(--theme-text-on-primary);
    font-size: 0.75rem;
    font-weight: 700;
}
.rdz-radios { display: flex; flex-direction: column; gap: 0.4rem; }
.rdz-radio {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--theme-border);
    border-radius: 0.65rem;
    background: var(--theme-surface);
    cursor: pointer;
}
.rdz-radio input { margin-top: 0.2rem; accent-color: var(--theme-primary); }
.rdz-radio strong { display: block; font-weight: 650; color: var(--theme-text-emphasis); }
.rdz-radio small { display: block; color: var(--theme-text-muted); }
.rdz-radio.is-on { border-color: var(--theme-primary); background: color-mix(in srgb, var(--theme-primary) 6%, var(--theme-surface)); }
.rdz-radio-pick { margin: -0.1rem 0 0.2rem 2rem; width: calc(100% - 2rem); }
.rdz-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.35rem; }
.rdz-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--theme-border);
    border-radius: 0.55rem;
    background: var(--theme-surface);
    font-size: 0.86rem;
    cursor: pointer;
}
.rdz-check input { accent-color: var(--theme-primary); }
.rdz-check.is-on { border-color: var(--theme-primary); background: color-mix(in srgb, var(--theme-primary) 6%, var(--theme-surface)); }
.rdz-filter { margin-top: 0.3rem; }
.rdz-filter-on { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; font-size: var(--theme-font-size-sm, 0.875rem); }
.rdz-filter-on i { color: var(--theme-primary); }
.rdz-filter .card { margin-top: 0 !important; }

/* The preview dialog: the real page, big. */
.rdz-preview { width: min(1120px, calc(100vw - 2rem)); height: calc(100vh - 2rem); }
.rdz-preview-head { flex-wrap: wrap; }
.rdz-preview-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; }
.rdz-preview-pick { width: auto; min-width: 16rem; max-width: 28rem; }
.rdz-preview-lang { width: auto; }
.rdz-preview-body {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-height: 0;
    padding: 1rem;
    background: var(--theme-background-subtle);
    border-radius: 0 0 1rem 1rem;
}
.rdz-preview-frame {
    width: min(calc(8.5in + 2rem), 100%);
    height: 100%;
    border: 0;
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 10px 28px rgba(0, 0, 0, 0.1);
}
.rdz-preview-msg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; max-width: 26rem; text-align: center; color: var(--theme-text-secondary); }
.rdz-preview-msg > i { font-size: 2.2rem; color: color-mix(in srgb, var(--theme-offset) 60%, transparent); }

/* ---- Narrower screens ----------------------------------------------------- */
@media (max-width: 1100px) {
    .rdz-work { grid-template-columns: 260px minmax(0, 1fr); }
    .rdz-page { padding: 0.45in 0.4in 0.6in; }
}
@media (max-width: 860px) {
    .rdz-work { grid-template-columns: minmax(0, 1fr); }
    .rdz-palette { position: static; max-height: 22rem; }
    .rdz-bar { flex-wrap: wrap; top: 0; }
    .rdz-bar-actions { width: 100%; justify-content: flex-end; }
    .rdz-choices { grid-template-columns: 1fr; }
    .rdz-page { padding: 1.1rem 0.9rem 1.4rem; min-height: 0; }
    .rdz-desk { padding: 0.75rem 0.4rem 1rem; }
}
