/*
  dg-theme.css — the stylesheet for DegiSoft pages (MasterPageAdmin, Editor-Master-Page).

  Self-contained: replaces app.css, app_ext.css, dg-site.css, pages_app.css, listhelper.css
  and tiles.css, keeping only rules that match markup the app produces (View templates in
  use, page items, operation views, the C# view generators and the client scripts).

  1. Tokens        colours, type, space, shape — change the look here
  2. Mechanics     show/hide rules the scripts depend on (page switching, section modes,
                   templates, popups); keep these when restyling
  3. Components    page, buttons, sections, filters, lists, forms, controls, dialogs, tiles
  4. Responsive    tablet (≤900px) and phone (≤640px)
*/

/* ================================================================ 1. tokens */
:root {
    /* dark by default: native controls (date pickers, selects, scrollbars) render dark too */
    color-scheme: dark;

    /* neutrals: charcoal base, panels a step lighter, soft off-white text (no pure white) */
    --dg-bg: #14181c;
    --dg-surface: #1c2126;
    --dg-surface-2: #222830;
    --dg-surface-3: #2a313a;
    --dg-border: #2f3740;
    --dg-border-strong: #434d58;
    --dg-text: #dde3e7;
    --dg-text-muted: #95a1ab;
    --dg-text-inverse: #071f1c; /* text on primary-coloured buttons */

    /* brand: muted teal, tuned for dark backgrounds */
    --dg-primary: #3bb0a2;
    --dg-primary-hover: #57c3b5;
    --dg-primary-soft: rgba(59, 176, 162, 0.13);
    --dg-primary-soft-2: rgba(59, 176, 162, 0.24);
    --dg-focus: rgba(59, 176, 162, 0.45);

    /* status */
    --dg-success: #5fcf8a;
    --dg-warning: #e2a03f;
    --dg-danger: #f07a7a;
    --dg-danger-soft: rgba(240, 122, 122, 0.13);

    /* type */
    --dg-font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --dg-font-size: 15px;
    --dg-font-size-sm: 13px;
    --dg-line-height: 1.5;

    /* shape and space */
    --dg-radius-sm: 6px;
    --dg-radius: 10px;
    --dg-radius-lg: 14px;
    --dg-space-1: 4px;
    --dg-space-2: 8px;
    --dg-space-3: 12px;
    --dg-space-4: 16px;
    --dg-space-5: 24px;
    --dg-space-6: 32px;
    --dg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --dg-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
    --dg-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --dg-scrim: rgba(5, 7, 9, 0.65);
    --dg-placeholder: #6c7883;
    --dg-knob: #e3e8eb;

    /* layout */
    --dg-page-max: 1200px;
    --dg-gutter: var(--dg-space-5);
    --dg-label-width: 200px;
    --dg-control-max: 520px;
}

/* alternative schemes: <html data-theme="light"> or <html data-theme="indigo"> in the container template */
:root[data-theme="light"] {
    color-scheme: light;
    --dg-bg: #e6e1d7;
    --dg-surface: #fffdf9;
    --dg-surface-2: #f6f2ea;
    --dg-surface-3: #ece6da;
    --dg-border: #dcd4c5;
    --dg-border-strong: #bfb4a1;
    --dg-text: #1d2a2a;
    --dg-text-muted: #5f6a66;
    --dg-text-inverse: #ffffff;
    --dg-primary: #0f766e;
    --dg-primary-hover: #115e59;
    --dg-primary-soft: #e4f3ef;
    --dg-primary-soft-2: #c9e8e1;
    --dg-focus: rgba(15, 118, 110, 0.32);
    --dg-success: #15803d;
    --dg-warning: #b45309;
    --dg-danger: #dc2626;
    --dg-danger-soft: #fee2e2;
    --dg-shadow-sm: 0 1px 2px rgba(41, 33, 20, 0.07);
    --dg-shadow: 0 1px 3px rgba(41, 33, 20, 0.09), 0 4px 12px rgba(41, 33, 20, 0.07);
    --dg-shadow-lg: 0 10px 30px rgba(41, 33, 20, 0.2);
    --dg-scrim: rgba(28, 25, 20, 0.5);
    --dg-placeholder: #9a9184;
    --dg-knob: #ffffff;
}

:root[data-theme="indigo"] {
    color-scheme: light;
    --dg-text-inverse: #ffffff;
    --dg-success: #15803d;
    --dg-warning: #b45309;
    --dg-danger: #dc2626;
    --dg-danger-soft: #fee2e2;
    --dg-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --dg-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.06);
    --dg-shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.18);
    --dg-scrim: rgba(15, 23, 42, 0.5);
    --dg-placeholder: #94a3b8;
    --dg-knob: #ffffff;
    --dg-bg: #dbe1ea;
    --dg-surface: #ffffff;
    --dg-surface-2: #f4f6fa;
    --dg-surface-3: #e8ecf3;
    --dg-border: #d3dae5;
    --dg-border-strong: #b6c0cf;
    --dg-text: #162032;
    --dg-text-muted: #556175;
    --dg-primary: #4f46e5;
    --dg-primary-hover: #4338ca;
    --dg-primary-soft: #eef0ff;
    --dg-primary-soft-2: #dde1ff;
    --dg-focus: rgba(79, 70, 229, 0.35);
}

/* ================================================================ 2. mechanics */

/* templates and stores the scripts clone from */
[hidden],
.hidden,
datatemplate,
[datatemplate],
[view_templates],
[views] {
    display: none;
}

/* pages: only the active, initialised page shows */
.dg-page {
    display: none;
}

.dg-page[active][init] {
    display: block;
}

.dg-container[show-header="False"] > .dg-container-head,
.dg-content:empty,
.dg-tile-block:empty {
    display: none;
}

.dg-container-head::after,
.dg-container-body::after,
.dg-container-footer::after,
.dg-content::after,
.dg-tile-block::after {
    content: "";
    display: block;
    clear: both;
}

.dg-left {
    float: left;
}

.dg-right {
    float: right;
}

.dg-clear {
    clear: both;
}

/* operations in progress */
[exec][opInProgress=true] {
    visibility: collapse;
}

/* section toolbar: which operations show in each mode */
[operation].visible {
    display: block;
}

.sec-head-item.current {
    display: none;
}

[modsec][mode='select'] [query] {
    display: none;
}

[modsec] .sec-head [operation][exec] {
    display: none;
}

[modsec][mode='default'] > .sec-head [operation][exec][type="Create"],
[modsec][mode='edit'] > .sec-head [operation][exec][type="Create"],
[modsec][mode='default'] > .sec-head [operation][exec][target-count='*'][type='list'] {
    display: inline-block;
}

[modsec][mode='select'] > .sec-head [operation][exec][target-count='*'][selectedonly='True'],
[modsec][mode='query'] > .sec-head [operation][exec][target-count='*'][selectedonly='False'],
[modsec][mode='edit'] > .sec-head [operation][exec][target-count='*'][type='list'] {
    display: inline-block;
}

[modsec][mode='edit'] > .sec-head .current[operation][exec][target-count='*'][type='list'],
[modsec][mode='default'] > .sec-head .current[operation][exec][target-count='*'][type='list'],
[modsec][mode='query'] > .sec-head .current[operation][exec][target-count='*'][type='list'],
[modsec][mode='query'] > .sec-head [operation][exec][target-count='*'][type='list'],
[modsec][mode='query'] > .sec-head [operation][exec][target-count='1'] {
    display: none;
}

[modsec] .sec-head [list-data-available-only],
[modsec][mode=edit][list-data-available] .sec-head [list-data-available-only] {
    visibility: collapse;
}

[modsec][list-data-available] .sec-head [list-data-available-only] {
    visibility: visible;
}

[toggle-button] {
    display: none;
}

[toggle-button].visible {
    display: inline-block;
}

/* paging bar only when the list has data */
.query-command.flex-row-left {
    display: none;
}

[modsec][list-data-available] .query-command.flex-row-left {
    display: inline-block;
}

/* row action popup: above the list's sticky header and first column (z-index 1 and 2), which it overlaps on the
   first row; below the dialog overlay (10) */
popup {
    display: none;
    position: absolute;
    z-index: 5;
}

[modsec][mode='default'] > popup.visible {
    display: flex;
    flex-direction: row;
}

/* dropdown option list (one shared element, positioned by the script) */
.dropdown-option {
    display: none;
    position: absolute;
}

.dropdown-option.visible {
    display: block;
    z-index: 20;
}

/* dialog overlay: absolute and scroll-relative, as dg-site.js positions it */
.overlay {
    display: block;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 10;
    margin: auto;
    overflow-y: auto;
    text-align: center;
}

.overlay-dialog {
    display: inline-block;
}

/* icons and labels that come from CSS */
/* Yes and No carry their words in the element (askAQuestion), for screen readers and keyboards */
.dg-btn-yes::before, .dg-btn-no::before { content: none; }
.dg-btn-save::before { content: "Save"; }
.dg-btn-ok::before { content: "OK"; }
.dg-btn-cancel::before { content: "Cancel"; }
.dg-btn-close::before { content: "\2716"; }
.dg-btn-back::before { content: "\2B8C"; }

/* query command buttons: line icon (::before, a mask over currentColor) + label (::after) */
.query-command > [exec='search']::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M20 20l-4.2-4.2'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M20 20l-4.2-4.2'/%3E%3C/svg%3E");
}
.query-command > [exec='clear']::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E");
}
.query-command > [exec='+filter']::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 6v12M6 12h12'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 6v12M6 12h12'/%3E%3C/svg%3E");
}
.query-command > [exec='search']::after { content: "Search"; }
.query-command > [exec='clear']::after { content: "Clear"; }
.query-command > [exec='+filter']::after { content: "Filter set"; }

.query-command [recordcount]::before { content: "Showing"; }
.query-command [pagesize]::before { content: "Rows"; }
.query-command [pagenumber]::before { content: "Page"; }

dropdown[choose] [flipper]::after { content: "\2B9F"; }
dropdown[choose][open] [flipper]::after { content: "\2B9D"; }

/* ================================================================ 3. components */

/* ---------------------------------------------------------------- base */
html {
    overflow: auto;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    text-align: center;
    font-family: var(--dg-font);
    font-size: var(--dg-font-size);
    line-height: var(--dg-line-height);
    color: var(--dg-text);
    background-color: var(--dg-bg);
}

h1, h2, h3, h4 {
    color: var(--dg-text);
    line-height: 1.25;
    font-weight: 600;
}

h2 {
    font-size: 1.15rem;
    margin: var(--dg-space-5) 0 var(--dg-space-3);
}

a {
    color: var(--dg-primary);
}

*:focus-visible {
    outline: 3px solid var(--dg-focus);
    outline-offset: 1px;
}

/* elements the templates make clickable and focusable (role + tabindex) */
[role=button],
[role=link],
[role=menuitem],
[role=switch],
[role=combobox] {
    cursor: pointer;
}

/* "Skip to content" link in the container templates: visible only when focused */
.dg-skip-link {
    position: absolute;
    left: var(--dg-space-3);
    top: -100px;
    z-index: 50;
    padding: var(--dg-space-2) var(--dg-space-4);
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-radius: var(--dg-radius-sm);
    text-decoration: none;
}

.dg-skip-link:focus {
    top: var(--dg-space-3);
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* ---------------------------------------------------------------- page shell */
.dg-container,
.dg-container-body,
.dg-content {
    text-align: left;
}

.dg-content {
    overflow-wrap: normal;
    overflow-x: hidden;
    box-sizing: border-box;
}

.dg-align-center-page {
    max-width: var(--dg-page-max);
    margin-left: auto;
    margin-right: auto;
    padding: 0 var(--dg-gutter);
    box-sizing: border-box;
}

#page-container.dg-content {
    padding: var(--dg-space-5) 0 var(--dg-space-6);
}

.dg-container-head {
    margin-bottom: var(--dg-space-2);
}

.dg-page > .dg-container-head {
    margin-bottom: var(--dg-space-5);
}

.dg-center {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    vertical-align: middle;
}

.h1 {
    display: block;
    font-size: 1.6rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--dg-text);
}

.descr1 {
    display: block;
    font-size: 0.95rem;
    color: var(--dg-text-muted);
    margin-top: 2px;
}

.page-content-group,
.page-content-group-item {
    margin-bottom: var(--dg-space-4);
}

.g1 {
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    background: var(--dg-surface);
    padding: var(--dg-space-4);
}

.jumbotron {
    text-align: center;
    background: linear-gradient(135deg, var(--dg-primary-soft), var(--dg-surface));
    color: var(--dg-text);
    border: 1px solid var(--dg-primary-soft-2);
    border-radius: var(--dg-radius-lg);
    margin: 0 0 var(--dg-space-5);
    padding: var(--dg-space-6) var(--dg-space-4);
    font-size: 1.75rem;
    font-weight: 600;
}

/* content blocks used by page items and views (instead of inline styles) */
.dg-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    padding: var(--dg-space-6) var(--dg-space-4);
    text-align: center;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--dg-text);
    background: linear-gradient(135deg, var(--dg-primary-soft-2), var(--dg-surface) 70%);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
}

.dg-banner-compact {
    min-height: 0;
    padding: var(--dg-space-5) var(--dg-space-4);
}

.dg-banner h1,
.dg-banner h2,
.dg-banner h3 {
    margin: 0;
}

.dg-panel {
    padding: var(--dg-space-5);
    text-align: left;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow-sm);
}

.dg-panel ul {
    margin: 0;
    padding-left: var(--dg-space-5);
}

.dg-panel li + li {
    margin-top: var(--dg-space-2);
}

.dg-muted {
    color: var(--dg-text-muted);
}

/* error page (View "Error") */
.dg-error {
    border-top: 4px solid var(--dg-danger);
}

.dg-error-title {
    margin: 0 0 var(--dg-space-4);
    font-size: 1.3rem;
    color: var(--dg-danger);
}

.dg-error-detail {
    padding: var(--dg-space-4);
    min-height: 120px;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: var(--dg-font-size-sm);
    white-space: pre-wrap;
    background-color: var(--dg-surface-2);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-sm);
}

/* page composition errors (Development only, GetPageOperation) */
.dg-dev-error {
    margin: var(--dg-space-1) 0;
    padding: var(--dg-space-2) var(--dg-space-3);
    color: var(--dg-danger);
    background-color: var(--dg-danger-soft);
    border: 2px dashed var(--dg-danger);
    border-radius: var(--dg-radius-sm);
}

/* small tiles in a page header (sub-page links) */
.dg-tile {
    display: inline-block;
}

.dg-tile-block {
    display: block;
    width: 100%;
}

.dg-tile-block > * {
    margin: 0 var(--dg-space-2) var(--dg-space-2) 0;
}

.dg-tile-small {
    padding: var(--dg-space-2) var(--dg-space-3);
    min-width: 100px;
    background-color: var(--dg-surface);
    color: var(--dg-text);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-sm);
    text-align: left;
}

/* ---------------------------------------------------------------- buttons */
.dg-btn,
.sec-head-item,
.menu .link,
.popupitem {
    font-family: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    border-radius: var(--dg-radius-sm);
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
    user-select: none;
}

.dg-btn {
    display: inline-block;
    min-width: 88px;
    padding: 9px 16px;
    text-align: center;
    vertical-align: middle;
    background-color: var(--dg-surface);
    color: var(--dg-text);
    border: 1px solid var(--dg-border-strong);
    box-sizing: border-box;
}

.dg-btn:hover {
    background-color: var(--dg-surface);   /* a <button class="dg-btn"> took button:hover's primary fill (teal on teal) */
    border-color: var(--dg-primary);
    color: var(--dg-primary);
}

.dg-btn-yes,
.dg-btn-save,
.dg-btn-primary,
button {
    background-color: var(--dg-primary);
    border-color: var(--dg-primary);
    color: var(--dg-text-inverse);
}

.dg-btn-yes:hover,
.dg-btn-save:hover,
.dg-btn-primary:hover,
button:hover {
    background-color: var(--dg-primary-hover);
    color: var(--dg-text-inverse);
}

/* plain <button> elements in page content */
button {
    font-family: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    padding: 10px 18px;
    border: 1px solid var(--dg-primary);
    border-radius: var(--dg-radius-sm);
    cursor: pointer;
}

.dg-btn-block {
    display: block;
    width: 100%;
}

/* result face in operation messages (pages_app.js) */
.dg-result-emoji {
    font-size: 30px;
}

.dg-btn-close,
.dg-btn-back {
    min-width: 0;
    width: 34px;
    height: 34px;
    padding: 0;
    line-height: 32px;
    border-radius: 50%;
    background-color: var(--dg-surface-3);
    border-color: transparent;
    color: var(--dg-text-muted);
}

.dg-btn-close:hover {
    background-color: var(--dg-danger-soft);
    color: var(--dg-danger);
    border-color: transparent;
}

/* links rendered as menus (checkpoint, home, form Save/Cancel) */
.menu-container {
    margin: var(--dg-space-4) 0 0;
}

.menu {
    text-align: center;
}

.menu-item-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--dg-space-2);
    justify-content: center;
}

.menu-item {
    display: inline-block;
}

.link {
    cursor: pointer;
}

.link-title {
    margin: 0;
}

.menu .link {
    display: inline-block;
    min-width: 100px;
    padding: 9px 18px;
    text-align: center;
    background-color: var(--dg-surface);
    color: var(--dg-primary);
    border: 1px solid var(--dg-border-strong);
    box-sizing: border-box;
}

.menu .link:hover {
    border-color: var(--dg-primary);
    background-color: var(--dg-primary-soft);
}

/* a form's save action is the primary button */
.menu .link[save-button],
.overlay-dialog .menu-item:first-child > .link {
    background-color: var(--dg-primary);
    border-color: var(--dg-primary);
    color: var(--dg-text-inverse);
}

.menu .link[save-button]:hover,
.overlay-dialog .menu-item:first-child > .link:hover {
    background-color: var(--dg-primary-hover);
}

/* a form that undoes something (Cancel the meeting, Withdraw) submits with a red button; its menu item is red too */
.menu .link[save-button].dg-btn-undo,
.menu .link[save-button].dg-btn-undo:hover {
    background-color: var(--dg-danger);
    border-color: var(--dg-danger);
    color: #fff;
}

.popupitem.dg-menu-undo,
popup .popupitem.dg-menu-undo,
.dg-card > popup[card-actions] .popupitem.dg-menu-undo {
    color: var(--dg-danger);
}

/* a record's menu items carry the icon the Flutter app gives them (pages_app.js menuIconFor sets data-icon): a line
   icon as a mask over the text colour */
.popupitem[data-icon]::before {
    content: "";
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 7px;
    vertical-align: -2px;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    opacity: .85;
}
.popupitem[data-icon="chevron"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E");
}
.popupitem[data-icon="edit"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L18.5 9.5l-4-4L4 16v4z'/%3E%3Cpath d='M13.5 6.5l4 4'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L18.5 9.5l-4-4L4 16v4z'/%3E%3Cpath d='M13.5 6.5l4 4'/%3E%3C/svg%3E");
}
.popupitem[data-icon="info"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.5'/%3E%3C/svg%3E");
}
.popupitem[data-icon="check"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12.5l2.5 2.5L16 9.5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12.5l2.5 2.5L16 9.5'/%3E%3C/svg%3E");
}
.popupitem[data-icon="cross"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9 9l6 6M15 9l-6 6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9 9l6 6M15 9l-6 6'/%3E%3C/svg%3E");
}
.popupitem[data-icon="block"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M5.6 5.6l12.8 12.8'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M5.6 5.6l12.8 12.8'/%3E%3C/svg%3E");
}
.popupitem[data-icon="trash"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7h14M10 7V5h4v2M7 7l1 13h8l1-13'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7h14M10 7V5h4v2M7 7l1 13h8l1-13'/%3E%3C/svg%3E");
}
.popupitem[data-icon="lock"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
}
.popupitem[data-icon="eye"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}
.popupitem[data-icon="quiz"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.7.4-1 1-1 1.7v.5M12 17v.5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.7.4-1 1-1 1.7v.5M12 17v.5'/%3E%3C/svg%3E");
}
.popupitem[data-icon="upload"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4M7 9l5-5 5 5M5 20h14'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4M7 9l5-5 5 5M5 20h14'/%3E%3C/svg%3E");
}
.popupitem[data-icon="download"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v12M7 11l5 5 5-5M5 20h14'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v12M7 11l5 5 5-5M5 20h14'/%3E%3C/svg%3E");
}
.popupitem[data-icon="send"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M4 12l16-8-6 16-2-7z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M4 12l16-8-6 16-2-7z'/%3E%3C/svg%3E");
}
.popupitem[data-icon="calendar"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='15' rx='2'/%3E%3Cpath d='M4 10h16M9 3v4M15 3v4M9 15l2 2 4-4'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='15' rx='2'/%3E%3Cpath d='M4 10h16M9 3v4M15 3v4M9 15l2 2 4-4'/%3E%3C/svg%3E");
}

/* the icons the app's later rules give (all present, check-in code, take the register, copy, pay ...) */
.popupitem[data-icon="all"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12.5l4 4L15 8.5M10 16.5l1.5 1.5L21 8.5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12.5l4 4L15 8.5M10 16.5l1.5 1.5L21 8.5'/%3E%3C/svg%3E");
}
.popupitem[data-icon="qr"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h2v2h-2zM18 18h2v2h-2zM14 18h2M18 14h2'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h2v2h-2zM18 18h2v2h-2zM14 18h2M18 14h2'/%3E%3C/svg%3E");
}
.popupitem[data-icon="register"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M15 11l2 2 4-4'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M15 11l2 2 4-4'/%3E%3C/svg%3E");
}
.popupitem[data-icon="copy"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 8h11v12H8zM5 16V4h11'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 8h11v12H8zM5 16V4h11'/%3E%3C/svg%3E");
}
.popupitem[data-icon="person"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M5 20c0-3.9 3.1-7 7-7s7 3.1 7 7'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M5 20c0-3.9 3.1-7 7-7s7 3.1 7 7'/%3E%3C/svg%3E");
}
.popupitem[data-icon="pay"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6' width='18' height='12' rx='2'/%3E%3Cpath d='M3 10h18M7 15h3'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6' width='18' height='12' rx='2'/%3E%3Cpath d='M3 10h18M7 15h3'/%3E%3C/svg%3E");
}
.popupitem[data-icon="bell"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 16v-5a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 16v-5a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0'/%3E%3C/svg%3E");
}
.popupitem[data-icon="chat"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E");
}
.popupitem[data-icon="phone"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E");
}
.popupitem[data-icon="person-add"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M18 8v6M15 11h6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M18 8v6M15 11h6'/%3E%3C/svg%3E");
}
.popupitem[data-icon="move"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h14M13 7l5 5-5 5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h14M13 7l5 5-5 5'/%3E%3C/svg%3E");
}
.popupitem[data-icon="undo"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3'/%3E%3C/svg%3E");
}
.popupitem[data-icon="play"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M10 8.5v7l6-3.5z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M10 8.5v7l6-3.5z'/%3E%3C/svg%3E");
}
.popupitem[data-icon="stop"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Crect x='9' y='9' width='6' height='6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Crect x='9' y='9' width='6' height='6'/%3E%3C/svg%3E");
}
.popupitem[data-icon="archive"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 5h18v4H3zM5 9v10h14V9M10 13h4'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 5h18v4H3zM5 9v10h14V9M10 13h4'/%3E%3C/svg%3E");
}
.popupitem[data-icon="history"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5M12 7v5l3 2'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5M12 7v5l3 2'/%3E%3C/svg%3E");
}

.dg-btn-yes.dg-btn-undo,
.dg-btn-yes.dg-btn-undo:hover {
    background-color: var(--dg-danger);
    border-color: var(--dg-danger);
    color: #fff;
}

/* a question names the record it is about, under the question */
.dg-confirm-record {
    display: block;
    margin-top: var(--dg-space-1);
    font-weight: 600;
}

/* ---------------------------------------------------------------- section (card) */
[modsec] {
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow-sm);
    overflow: hidden;
}

[content] [view] {
    overflow-y: hidden;
}

.flex-row-left,
.flex-row-right {
    display: flex;
    width: 100%;
}

.flex-row-left {
    flex-direction: row;
}

.flex-row-right {
    flex-direction: row-reverse;
}

.sec-head {
    background-color: var(--dg-surface);
    border-bottom: 1px solid var(--dg-border);
    padding: var(--dg-space-2) var(--dg-space-3);
}

/* the toolbar is a one-row table: two columns at every width — operations (left, wrapping)
   and the other commands (right, fit to content) */
.sec-head > table,
.sec-head > table > tbody {
    display: block;
    width: 100%;
}

.sec-head > table > tbody > tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: var(--dg-space-3);
}

.sec-head > table > tbody > tr > td {
    display: block;
    min-width: 0;
    padding: 0;
}

.sec-head > table > tbody > tr > td:last-child .flex-row-right {
    justify-content: flex-start; /* row-reverse: items start at the right edge */
}

.sec-head .flex-row-left,
.sec-head .flex-row-right {
    flex-wrap: wrap;
    gap: var(--dg-space-2);
    align-items: center;
}

.sec-head-item {
    margin: 0;
    padding: 8px 14px;
    background-color: var(--dg-primary);
    color: var(--dg-text-inverse);
    border: 1px solid var(--dg-primary);
}

.sec-head-item:hover {
    background-color: var(--dg-primary-hover);
}

/* right-hand group (Select, Select All, Cancel…): secondary */
.sec-head .dg-button-group .sec-head-item {
    background-color: var(--dg-surface);
    color: var(--dg-text);
    border-color: var(--dg-border-strong);
}

.sec-head .dg-button-group .sec-head-item:hover {
    border-color: var(--dg-primary);
    color: var(--dg-primary);
}

.sec-head-item[type="Delete"] {
    background-color: var(--dg-surface);
    color: var(--dg-danger);
    border-color: var(--dg-danger);
}

.sec-head-item[type="Delete"]:hover {
    background-color: var(--dg-danger-soft);
}

[operation] .header {
    margin-bottom: var(--dg-space-2);
}

/* ---------------------------------------------------------------- filters */
/* a list's toolbar (pages_app.js listToolbar): on its right the count, the search box, Filter and Download. Nothing
   searches until asked: Enter or the search button, Apply, a chip's ×. The filter fields live in a panel under Filter:
   closed it is not shown; open it floats under the button (placed in the window: the list's frame clips what
   overflows it), a sheet from the bottom on a phone */
.sec-head > table > tbody > tr > td:has(> .dg-listtools) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--dg-space-2);
}

.dg-listtools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--dg-space-2);
}

.dg-listtools .dg-list-count {
    margin-right: var(--dg-space-1);
}

/* Select and its mode's buttons (the framework's button group, moved into the row; only the mode's .visible ones show) */
.dg-listtools > .dg-button-group {
    display: flex;
    flex-direction: row-reverse;   /* the group's own order: Select All, then Cancel */
    flex: none;
    width: auto;                   /* not its old full width: it pushed Select and Download onto rows of their own */
    flex-wrap: nowrap;
    gap: var(--dg-space-2);
}

.sec-head .dg-listtools .dg-button-group .sec-head-item.visible {
    display: inline-flex;
    align-items: center;
    height: 38px;
    box-sizing: border-box;
    padding: 0 14px;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    border-radius: var(--dg-radius);
}

.sec-head .dg-listtools .dg-button-group .sec-head-item.visible:hover {
    color: var(--dg-text);
    background-color: var(--dg-surface-2);
}

/* selecting: the row is a selection bar ("2 selected", Select All, Cancel); what filters or downloads steps aside */
.dg-select-count {
    display: none;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text);
    white-space: nowrap;
}

[modsec]:is([mode='select'], [mode='query']) .dg-select-count {
    display: inline;
}

[modsec][mode='query'] .dg-select-count {
    display: none;
}

[modsec]:is([mode='select'], [mode='query']) .dg-listtools > :is(.dg-list-count, .dg-list-search, .dg-filter-btn, .dg-export) {
    display: none !important;
}

/* the search box: the list's first "contains" field; its button, or Enter, runs it */
.dg-list-search {
    display: flex;
    align-items: center;
    height: 38px;
    box-sizing: border-box;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius);
    overflow: hidden;
}

.dg-list-search:focus-within {
    border-color: var(--dg-primary);
    box-shadow: 0 0 0 3px var(--dg-focus);
}

.dg-list-search[hidden] {
    display: none;
}

.sec-head .dg-listtools .dg-list-search input[type=search],
.sec-head .dg-listtools .dg-list-search input[type=search]:focus {
    width: 200px;
    min-width: 0;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0 10px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    outline: none;
}

.dg-list-search-clear,
.dg-list-search-clear:hover {
    position: relative;
    flex: none;
    width: 20px;
    height: 20px;
    min-height: 0;
    margin-right: 6px;
    padding: 0;
    background: var(--dg-surface-2);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.dg-list-search-clear[hidden] {
    display: none;
}

.dg-list-search-clear::before,
.dg-list-search-clear::after,
.dg-applied-remove::before,
.dg-applied-remove::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 9px;
    height: 1.5px;
    background-color: var(--dg-text-muted);
    transform: translate(-50%, -50%) rotate(45deg);
}

.dg-list-search-clear::after,
.dg-applied-remove::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.dg-list-search-go,
.dg-list-search-go:hover {
    position: relative;
    flex: none;
    width: 38px;
    height: 100%;
    min-height: 0;
    padding: 0;
    background-color: var(--dg-surface-2);
    border: 0;
    border-left: 1px solid var(--dg-border-strong);
    border-radius: 0;
    cursor: pointer;
}

.dg-list-search-go:hover {
    background-color: var(--dg-primary-soft);
}

/* its magnifier, drawn */
.dg-list-search-go::before {
    content: "";
    position: absolute;
    top: 11px;
    left: 11px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--dg-text);
    border-radius: 50%;
}

.dg-list-search-go::after {
    content: "";
    position: absolute;
    top: 24px;
    left: 22px;
    width: 6px;
    height: 2px;
    background-color: var(--dg-text);
    transform: rotate(45deg);
    transform-origin: left center;
}

/* Filter and Download: quiet buttons, a count on Filter when filters are applied */
.dg-filter-btn,
.sec-head .sec-head-item.dg-export {
    display: inline-flex;
    align-items: center;
    gap: var(--dg-space-2);
    height: 38px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 12px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text);
    cursor: pointer;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius);
}

.dg-filter-btn:hover,
.sec-head .sec-head-item.dg-export:hover {
    color: var(--dg-text);
    background-color: var(--dg-surface-2);
    border-color: var(--dg-primary);
}

.dg-filter-btn[hidden],
.sec-head .sec-head-item.dg-export[hidden] {
    display: none;
}

/* Download is its icon alone (its name: aria-label and title; user: "remove the word from the download button") */
.sec-head .sec-head-item.dg-export {
    justify-content: center;
    width: 38px;
    padding: 0;
}

.dg-filter-btn.dg-filter-on,
.dg-filter-btn[aria-expanded="true"] {
    background-color: var(--dg-primary-soft);
    border-color: var(--dg-primary);
}

.dg-filter-btn::before,
.sec-head .sec-head-item.dg-export::before {
    content: "";
    flex: none;
    width: 15px;
    height: 15px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M7 12h10M10 18h4'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M7 12h10M10 18h4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.sec-head .sec-head-item.dg-export::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10l5 5 5-5M5 20h14'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10l5 5 5-5M5 20h14'/%3E%3C/svg%3E");
}

.dg-filter-count {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    box-sizing: border-box;
    font-size: 12px;
    font-weight: 700;
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-radius: 999px;
}

.dg-filter-count[hidden] {
    display: none;
}

/* the panel */
[query][dg-listbar]:not([dg-filter-open]) {
    display: none !important;
}

[query][dg-listbar][dg-filter-open] {
    position: fixed;
    z-index: 40;
    display: flex;
    flex-direction: column;
    max-height: min(600px, calc(100dvh - 120px));
    padding: 0;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow-lg);
    overflow: hidden;
}

/* a dropdown's list (BODY > .dropdown-option, z-index 20) opened from a field in the panel lies above the panel */
body:has([query][dg-listbar][dg-filter-open]) > .dropdown-option.visible {
    z-index: 41;
}

[query][dg-listbar] > .query-content-area {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

[query][dg-listbar] .query-content {
    padding: var(--dg-space-4) var(--dg-space-4) var(--dg-space-2);
    background: none;
    border: 0;
}

[query][dg-listbar] .query-group .group-content {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--dg-space-4);
}

/* paging is the pager's under the list, and Search is Apply: the panel's own commands stay, hidden, doing the work */
[query][dg-listbar] .query-commands {
    display: none;
}

/* the search box's field is in the toolbar (with two or more sets the panel shows it too: it is set 1's) */
[query][dg-listbar]:not([dg-sets]) .query-group-item[dg-searchbox] {
    display: none;
}

/* two or more filter sets (pages_app.js labelFilterSets): each named, "or" between them, a later one can be removed */
[query][dg-listbar] .query-group + .query-group {
    margin-top: var(--dg-space-4);
    padding-top: var(--dg-space-4);
    border-top: 1px solid var(--dg-border);
}

.dg-filter-sethead {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
    margin-bottom: var(--dg-space-3);
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text-muted);
}

.dg-filter-or,
.dg-applied-or {
    padding: 1px 8px;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text);
    background-color: var(--dg-surface-2);
    border: 1px solid var(--dg-border-strong);
    border-radius: 999px;
}

.dg-filter-setremove,
.dg-filter-setremove:hover {
    min-height: 0;
    margin-left: auto;
    padding: 2px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-primary);
    cursor: pointer;
    background: none;
    border: 0;
}

.dg-applied-or {
    color: var(--dg-text-muted);
    background: none;
    border-color: transparent;
}

/* a field changed and not applied yet: a dot by its name */
[query][dg-listbar] .query-group-item[dg-changed] .query-group-item-cell > span:first-child::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    vertical-align: middle;
    background-color: var(--dg-warning);
    border-radius: 50%;
}

[query][dg-listbar]:not([dg-more-open]) .query-group-item[dg-more] {
    display: none;
}

.dg-filter-more,
.dg-filter-more:hover {
    display: block;
    margin: 0 0 var(--dg-space-3);
    padding: 4px 0;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-primary);
    cursor: pointer;
    background: none;
    border: 0;
}

.dg-filter-more[hidden] {
    display: none;
}

/* a field of a few fixed values: chips (its dropdown stays, hidden, holding the value) */
.query-group-item[dg-chips] control {
    display: none;
}

/* a date or a number as a range: From / To (with Today, This week, This month), or At least / At most; the field
   itself stays, hidden, carrying "from..to" */
.query-group-item[dg-range] control {
    display: none;
}

.dg-filter-range {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
}

.dg-filter-range > input {
    flex: 1 1 0;
    min-width: 0;
}

.dg-filter-range-sep {
    flex: none;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-filter-quick {
    margin-top: var(--dg-space-2);
}

.dg-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dg-filter-chip,
.dg-filter-chip:hover {
    min-height: 0;
    padding: 5px 12px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 500;
    color: var(--dg-text);
    cursor: pointer;
    background-color: transparent;
    border: 1px solid var(--dg-border-strong);
    border-radius: 999px;
}

.dg-filter-chip:hover {
    background-color: var(--dg-surface-2);
    border-color: var(--dg-primary);
}

.dg-filter-chip[aria-pressed="true"],
.dg-filter-chip[aria-pressed="true"]:hover {
    font-weight: 600;
    background-color: var(--dg-primary-soft-2);
    border-color: var(--dg-primary);
}

/* the panel's foot: what waits (or "No changes"), another filter set, Clear all, Apply; closing with changes asks */
.dg-filter-foot {
    flex: none;
    padding: var(--dg-space-3) var(--dg-space-4);
    background-color: var(--dg-surface-2);
    border-top: 1px solid var(--dg-border);
}

.dg-filter-state,
.dg-filter-prompt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dg-space-2) var(--dg-space-3);
}

.dg-filter-state[hidden],
.dg-filter-prompt[hidden] {
    display: none;
}

.dg-filter-status {
    flex: 1 1 100%;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-filter-status.dg-filter-pending {
    color: var(--dg-warning);
}

.dg-filter-prompt-text {
    flex: 1 1 100%;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
}

.dg-filter-set,
.dg-filter-clear,
.dg-filter-prompt-keep,
.dg-filter-set:hover,
.dg-filter-clear:hover,
.dg-filter-prompt-keep:hover {
    min-height: 0;
    padding: 4px 2px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-primary);
    cursor: pointer;
    background: none;
    border: 0;
}

.dg-filter-set {
    margin-right: auto;
}

.dg-filter-apply,
.dg-filter-prompt-apply {
    min-height: 0;
    padding: 8px 20px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    color: var(--dg-text-inverse);
    cursor: pointer;
    background-color: var(--dg-primary);
    border: 1px solid var(--dg-primary);
    border-radius: var(--dg-radius);
}

.dg-filter-apply:disabled,
.dg-filter-apply:disabled:hover {
    cursor: default;
    color: var(--dg-text-muted);
    background-color: var(--dg-surface-3);
    border-color: var(--dg-border-strong);
}

.dg-filter-prompt-discard,
.dg-filter-prompt-discard:hover {
    min-height: 0;
    padding: 8px 16px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
    cursor: pointer;
    background-color: transparent;
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius);
}

/* the line under the toolbar: what is applied, each with its ×, and Clear all */
.dg-applied {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: var(--dg-space-2) var(--dg-space-3);
    background-color: var(--dg-surface);
    border-bottom: 1px solid var(--dg-border);
}

.dg-applied[hidden] {
    display: none;
}

.dg-applied-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 4px 0 10px;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
    background-color: var(--dg-surface-2);
    border: 1px solid var(--dg-border-strong);
    border-radius: 999px;
}

.dg-applied-remove,
.dg-applied-remove:hover {
    position: relative;
    flex: none;
    width: 20px;
    height: 20px;
    min-height: 0;
    padding: 0;
    cursor: pointer;
    background-color: var(--dg-surface-3);
    border: 0;
    border-radius: 50%;
}

.dg-applied-remove:hover {
    background-color: var(--dg-primary-soft-2);
}

.dg-applied-clear,
.dg-applied-clear:hover {
    min-height: 0;
    padding: 2px 4px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-primary);
    cursor: pointer;
    background: none;
    border: 0;
}

/* Download's question when the list has pages (pages_app.js openListDownload) */
.dg-download-pop {
    position: fixed;
    text-align: left;
    z-index: 45;
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-3);
    box-sizing: border-box;
    padding: var(--dg-space-4);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow-lg);
}

.dg-download-pop fieldset {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-2);
    margin: 0;
    padding: 0;
    border: 0;
}

.dg-download-pop legend {
    margin-bottom: var(--dg-space-2);
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--dg-text-muted);
}

.dg-download-pop label {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
    cursor: pointer;
}

.dg-download-pop input[type=radio] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--dg-primary);
}

.dg-download-note {
    margin: 0;
    font-size: 12px;
    color: var(--dg-text-muted);
}

.dg-download-foot {
    display: flex;
    justify-content: flex-end;
    gap: var(--dg-space-2);
}

.dg-download-cancel,
.dg-download-cancel:hover {
    min-height: 0;
    padding: 8px 14px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius);
}

.dg-download-go {
    min-height: 0;
    padding: 8px 18px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    border-radius: var(--dg-radius);
}

/* the server out of reach (dg-ajax.js dgServerReach): one notice under the top bar (at the foot it covered the Inbox's
   message box), gone once it answers */
.dg-offline {
    position: fixed;
    left: 50%;
    top: 68px;
    z-index: 55;
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    padding: 10px 16px;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-warning);
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow-lg);
    transform: translateX(-50%);
}

.dg-offline::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    background-color: var(--dg-warning);
    border-radius: 50%;
}

.dg-offline[hidden] {
    display: none;
}

/* a large download's box (pages_app.js listDownloadProgress): how far it is, Cancel; then what was saved */
.dg-download-progress {
    position: fixed;
    right: var(--dg-space-5);
    bottom: var(--dg-space-5);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-2);
    width: min(380px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: var(--dg-space-4);
    text-align: left;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow-lg);
}

.dg-download-progress.dg-download-done {
    border-color: var(--dg-primary);
}

.dg-download-progress.dg-download-failed {
    border-color: var(--dg-danger);
}

.dg-download-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--dg-space-3);
}

.dg-download-progress-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dg-text);
}

.dg-download-progress-count {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
    white-space: nowrap;
}

.dg-download-progress-bar {
    height: 8px;
    overflow: hidden;
    background-color: var(--dg-surface-3);
    border-radius: 4px;
}

.dg-download-progress-bar > span {
    display: block;
    width: 0;
    height: 100%;
    background-color: var(--dg-primary);
    transition: width 0.2s;
}

.dg-download-done .dg-download-progress-bar {
    display: none;
}

.dg-download-progress-foot {
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
}

.dg-download-progress-note {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    color: var(--dg-text-muted);
    overflow-wrap: anywhere;
}

.dg-download-progress-cancel,
.dg-download-progress-cancel:hover {
    flex: none;
    min-height: 0;
    padding: 6px 12px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius);
}

/* a phone: the toolbar wraps, the search box takes its own row; the panel is a sheet from the bottom */
@media (max-width: 640px) {
    /* the actions on one row, the toolbar's search, Filter and Download on the next (side by side they overlapped) */
    .sec-head > table > tbody > tr:has(.dg-listtools) {
        grid-template-columns: minmax(0, 1fr);
        row-gap: var(--dg-space-2);
    }

    .sec-head > table > tbody > tr > td:has(> .dg-listtools) {
        justify-content: stretch;
    }

    .dg-listtools {
        width: 100%;
    }

    .dg-list-search {
        flex: 1 1 100%;
        order: -1;
    }

    .sec-head .dg-listtools .dg-list-search input[type=search],
    .sec-head .dg-listtools .dg-list-search input[type=search]:focus {
        flex: 1 1 auto;
        width: auto;
    }

    [query][dg-listbar][dg-filter-open] {
        top: auto !important;
        right: 0;
        bottom: 0;
        left: 0 !important;
        width: auto !important;
        max-height: 85dvh;
        border-radius: 18px 18px 0 0;
    }

    .dg-filter-apply,
    .dg-filter-prompt-apply {
        flex: 1 1 auto;
        padding: 12px 20px;
    }

    .dg-download-pop {
        right: 16px;
        left: 16px !important;
        width: auto !important;
    }
}

.query-content {
    background-color: var(--dg-surface-2);
    border-bottom: 1px solid var(--dg-border);
    padding: var(--dg-space-3) var(--dg-space-4) var(--dg-space-2);
    clear: both;
}

.query-content::before {
    content: "";
    display: table;
    clear: both;
}

.query-group {
    margin: 0 0 var(--dg-space-2);
}

.query-group .group-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--dg-space-3);
}

.query-group-item {
    display: block;
    min-width: 0;
}

/* filter cell: <label> wrapping the caption and the control */
.query-group-item-cell {
    display: block;
}

.query-group-item-cell > span:first-child {
    display: block;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text-muted);
    margin-bottom: var(--dg-space-1);
}

.query-group-separator,
.group-separator {
    border-top: 1px solid var(--dg-border);
    margin: var(--dg-space-4) 0;
}

/* query commands: the filter panel's footer bar — record info and paging on the left,
   Filter set / Clear / Search on the right. The markup is a one-row table; it is laid out as flex. */
.query-commands {
    margin-top: var(--dg-space-2);
    padding-top: var(--dg-space-3);
    border-top: 1px solid var(--dg-border);
}

.query-commands > table,
.query-commands > table > tbody {
    display: block;
    width: 100%;
}

/* two columns at every width: record info and paging (left, wrapping) | buttons (right) */
.query-commands > table > tbody > tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: var(--dg-space-3);
}

.query-commands > table > tbody > tr > td {
    display: block;
    min-width: 0;
    padding: 0;
}

/* left: "Showing 1 - 15 of 15 · Rows [20] · Page [1]" */
.query-command.flex-row-left > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dg-space-2) var(--dg-space-5);
    font-size: var(--dg-font-size-sm);
}

.query-command [spacer] {
    display: none;
}

.query-command [recordcount],
.query-command [pagesize],
.query-command [pagenumber] {
    display: inline-flex;
    align-items: center;
    gap: var(--dg-space-2);
}

.query-command [recordcount]::before,
.query-command [pagesize]::before,
.query-command [pagenumber]::before {
    color: var(--dg-text-muted);
    font-weight: 500;
}

.query-command span[recordcount] {
    font-weight: 650;
    color: var(--dg-text);
    font-variant-numeric: tabular-nums;
}

.query-command select[exec='pagesize'],
.query-command input[exec='pagenumber'] {
    height: 32px;
    padding: 0 var(--dg-space-2);
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-sm);
    cursor: pointer;
}

.query-command select[exec='pagesize'] {
    width: auto;
    min-width: 64px;
}

.query-command input[exec='pagenumber'] {
    width: 64px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.query-command select[exec='pagesize']:hover,
.query-command input[exec='pagenumber']:hover {
    border-color: var(--dg-primary);
}

input[paging-command][type=number]::-webkit-inner-spin-button,
input[paging-command][type=number]::-webkit-outer-spin-button {
    opacity: 0;
}

input[paging-command][type=number]:hover::-webkit-inner-spin-button,
input[paging-command][type=number]:hover::-webkit-outer-spin-button {
    opacity: 1;
    cursor: pointer;
}

/* right: buttons in reading order, Search (primary) last */
.query-command.flex-row-right {
    flex-direction: row;
    justify-content: flex-end;
    gap: var(--dg-space-2);
}

.query-command > [exec='search'],
.query-command > [exec='clear'],
.query-command > [exec='+filter'] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 var(--dg-space-3);
    box-sizing: border-box;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    white-space: nowrap;
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-sm);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.query-command > [exec='search']::before,
.query-command > [exec='clear']::before,
.query-command > [exec='+filter']::before {
    content: "";
    width: 16px;
    height: 16px;
    flex: none;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.query-command > [exec='clear'],
.query-command > [exec='+filter'] {
    color: var(--dg-text-muted);
}

.query-command > [exec='clear']:hover,
.query-command > [exec='+filter']:hover {
    color: var(--dg-primary);
    border-color: var(--dg-primary);
    background-color: var(--dg-primary-soft);
}

.query-command > [exec='search'] {
    padding: 0 var(--dg-space-4);
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-color: var(--dg-primary);
}

.query-command > [exec='search']:hover {
    background-color: var(--dg-primary-hover);
    border-color: var(--dg-primary-hover);
}

/* ---------------------------------------------------------------- lists */
/* the visible grid: a size container, so row panels can be sized to it (100cqw) */
.list-content-area {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    container-type: inline-size;
}

/* Row panels (inline menu, inline detail) live in a table cell that spans every column, so on a grid
   wider than its card they would stretch to the table's scroll width. Keep them to the visible grid
   and in view while it scrolls sideways. pages_app.js sets the menu's position inline: !important. */
[inline-menu] popup,
[element-detail-element] .element-detail {
    position: sticky !important;
    left: 0;
    width: 100cqw;
    max-width: 100cqw;
    box-sizing: border-box;
}

/* In a card list the panel is a grid item: it takes a whole row of its own (not the next card's cell, where the
   table sizing above would push it past the section's edge), and the card it opened from steps aside meanwhile. */
.dg-card-list > [element-detail-element] {
    grid-column: 1 / -1;
    background: none;
}

.dg-card-list > [element-detail-element] .element-detail {
    position: static !important;
    width: auto;
    max-width: none;
    margin-top: 0;
}

/* the card a form or details opened from stays in view above it (the question being answered, the slot being
   booked), marked */
.dg-card-list > [templateitem][element-detail-ref] {
    outline: 2px solid var(--dg-primary);
    outline-offset: -1px;
}

/* floating row menu (sections without insert-menu): never wider than the grid; items wrap */
[modsec] > popup {
    max-width: min(calc(100vw - 2 * var(--dg-gutter) - 2px), calc(var(--dg-page-max) - 2 * var(--dg-gutter) - 2px));
    box-sizing: border-box;
}

.d-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.93rem;
}

/* a column empty on every row shown (pages_app.js hideEmptyColumns) */
.d-table [data-empty-col] {
    display: none;
}

.d-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    vertical-align: bottom;
    background-color: var(--dg-surface-2);
    color: var(--dg-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--dg-border);
}

.d-table td,
.d-table th {
    padding: 11px var(--dg-space-4);
}

.d-table td {
    border-bottom: 1px solid var(--dg-border);
    vertical-align: middle;
}

.d-table tbody tr:last-child > td {
    border-bottom: none;
}

/* edit-many tables: a number needs a narrow box, a note a wide one */
.d-table td input[type="number"] {
    width: 7rem;
    min-width: 0;
}

.d-table td textarea {
    min-width: 18rem;
}

.list-content-area .group-separator {
    border-top: none;
    border-left: 1px solid var(--dg-border);
    width: 0;
    padding: 0;
    margin: 0;
}

.list-content-area [highlighted] > .group-separator {
    border-left: none;
}

[templateitem] {
    cursor: pointer;
    transition: background-color 0.12s ease;
}

tbody > [templateitem]:hover {
    background-color: var(--dg-surface-2);
}

[templateitem][highlighted],
[modsec][mode='edit'] [templateitem][highlighted] {
    background-color: var(--dg-primary-soft);
}

[templateitem][selected] {
    background-color: var(--dg-primary-soft);
    box-shadow: inset 4px 0 0 var(--dg-primary);
}

/* row action popup */
popup {
    padding: var(--dg-space-2);
    gap: var(--dg-space-2);
    flex-wrap: wrap;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius) var(--dg-radius) 0 0;
    box-shadow: var(--dg-shadow);
}

popup .popupitem {
    display: inline-block;
    padding: 7px 12px;
    background-color: var(--dg-surface-2);
    color: var(--dg-text);
    border: 1px solid var(--dg-border);
}

popup .popupitem:hover {
    background-color: var(--dg-primary-soft);
    border-color: var(--dg-primary);
    color: var(--dg-primary);
}

/* inline row menu and inline detail (opened under a row) */
tr[inline-menu] > td,
tr[element-detail-element] > td {
    padding: 0;
}

[inline-menu] {
    background-color: var(--dg-primary-soft);
    border: 1px solid var(--dg-primary);
    border-top-width: 0;
}

[element-detail-parent] > [inline-menu] {
    border-bottom-width: 0;
}

[inline-menu-ref] {
    border: 1px solid var(--dg-primary);
    border-bottom-width: 0;
    border-radius: var(--dg-radius-sm) var(--dg-radius-sm) 0 0;
}

/* inline row menu: two columns — Actions (operation-menu-items) | Related (link-menu-items) */
[inline-menu] popup {
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0;
    padding: var(--dg-space-3) 0;
    border-radius: 0;
    background-color: transparent;
    border: none;
    box-shadow: none;
}

[inline-menu] popup > div {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: var(--dg-space-2);
    min-width: 0;
    padding: 0 var(--dg-space-4);
}

[inline-menu] popup > .operation-menu-items {
    flex: 0 1 auto;
    max-width: 45%;
}

[inline-menu] popup > .link-menu-items {
    flex: 1 1 0;
    border-left: 1px solid var(--dg-border);
}

[inline-menu] popup > div:not(:has(.popupitem)) {
    display: none;
}

[inline-menu] popup > div::before {
    text-align: left;
    flex: 0 0 100%;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--dg-text-muted);
}

[inline-menu] popup > .operation-menu-items::before {
    content: "Actions";
}

[inline-menu] popup > .link-menu-items::before {
    content: "Related";
}

[inline-menu] popup .popupitem {
    margin: 0;
    padding: 7px 12px;
    text-align: left;
}

/* a table row's actions at its end (pages_app.js showMenuAtRowEnd): over the row's last columns while it is hovered,
   on the row's own highlight (the tint over the surface, so the columns under it do not show through); no row moves */
tr[dg-row-end-menu][inline-menu-ref] {
    border: 0;
    border-radius: 0;
}

tr[dg-row-end-menu] > td:first-child {
    box-shadow: inset 3px 0 0 var(--dg-primary);
}

/* the cell the menu sits in (pages_app.js showMenuAtRowEnd: the last, or the one before the row's inline decisions,
   which stay sticky at the right) */
tr[dg-row-end-menu] > td[dg-row-end-host] {
    position: relative;
    overflow: visible;
}

[inline-menu][dg-row-end] {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    padding: 0 var(--dg-space-3) 0 48px;
    border: 0;
    white-space: nowrap;
    background: linear-gradient(90deg, transparent 0, var(--dg-primary-soft) 40px),
                linear-gradient(90deg, transparent 0, var(--dg-surface) 40px);
}

[inline-menu][dg-row-end] popup {
    position: static !important;
    width: auto;
    max-width: none;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 0;
}

[inline-menu][dg-row-end] popup > div,
[inline-menu][dg-row-end] popup > .operation-menu-items {
    flex: none;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    max-width: none;
    gap: 6px;
    padding: 0;
}

[inline-menu][dg-row-end] popup > div::before {
    content: none;
}

[inline-menu][dg-row-end] popup > .link-menu-items {
    padding-left: 8px;
    border-left: 1px solid var(--dg-border);
}

[inline-menu][dg-row-end] popup .popupitem {
    padding: 4px 10px;
    white-space: nowrap;
}

/* a row-end menu kept to 40% of its row (pages_app.js foldRowEndItems): its last actions wait under "⋯", which opens the
   whole menu as a list under the row's end */
[inline-menu][dg-row-end] popup .popupitem[dg-row-end-fold] {
    display: none;
}

[inline-menu][dg-row-end] popup .dg-row-end-more {
    font-weight: 700;
    letter-spacing: 1px;
}

[inline-menu][dg-row-end][dg-row-end-open] popup {
    position: fixed !important;
    z-index: 30;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-width: 200px;
    padding: 6px;
    background: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-sm);
    box-shadow: var(--dg-shadow-lg);
}

[inline-menu][dg-row-end][dg-row-end-open] popup > div,
[inline-menu][dg-row-end][dg-row-end-open] popup > .operation-menu-items,
[inline-menu][dg-row-end][dg-row-end-open] popup > .link-menu-items {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
}

[inline-menu][dg-row-end][dg-row-end-open] popup > .link-menu-items {
    margin-top: 4px;
    padding: 4px 0 0;
    border-left: 0;
    border-top: 1px solid var(--dg-border);
}

[inline-menu][dg-row-end][dg-row-end-open] popup .popupitem:not([hidden]),
[inline-menu][dg-row-end][dg-row-end-open] popup .popupitem[dg-row-end-fold]:not([hidden]) {
    display: block;
    text-align: left;
    border-color: transparent;
}

[inline-menu][dg-row-end][dg-row-end-open] popup .popupitem.dg-row-end-more:not([hidden]) {
    display: none;
}
/* a table row's band of actions, when they do not fit at its end (a narrow table, a touch screen): one slim line
   joined to the row, without the Actions / Related headings */
tr[inline-menu] popup {
    align-items: center;
    padding: 2px 0 var(--dg-space-2);
}

tr[inline-menu] popup > div,
tr[inline-menu] popup > .operation-menu-items {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    max-width: none;
    gap: 4px;
}

tr[inline-menu] popup > div::before,
tr[inline-menu] popup > .operation-menu-items::before,
tr[inline-menu] popup > .link-menu-items::before {
    content: none;
}

tr[inline-menu] popup .popupitem {
    padding: 4px 10px;
}

[element-detail-element] {
    background-color: var(--dg-surface-2);
}

[inline-menu-parent] > [element-detail-element] {
    border: 1px solid var(--dg-primary);
    border-top-width: 0;
    border-radius: 0 0 var(--dg-radius-sm) var(--dg-radius-sm);
}

[element-detail-ref] {
    background-color: var(--dg-primary-soft-2);
}

.element-detail {
    text-align: left;
    margin-top: var(--dg-space-2);
    padding: var(--dg-space-3) var(--dg-space-4) var(--dg-space-4);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow);
}

.element-detail-header {
    text-align: right;
}

.element-detail-body {
    margin-top: var(--dg-space-2);
}

/* detail views (read-only): a responsive grid of fields, label above value */
.modelform.modelform-detail .modelform-group-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--dg-space-4) var(--dg-space-5);
    padding: var(--dg-space-4);
}

.modelform.modelform-detail .modelform-row {
    padding: 0;
}

.modelform.modelform-detail .modelform-col {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 2px;
}

.modelform.modelform-detail .col-lable {
    text-align: left;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.modelform.modelform-detail .col-data {
    max-width: none;
    font-size: 1rem;
    color: var(--dg-text);
}

/* an empty value; not a dropdown's arrow (an empty span too: "Male —" on every chosen value) */
.modelform.modelform-detail .col-data span:not(:has(*)):not([flipper]):empty::after {
    content: "\2014"; /* empty value */
    color: var(--dg-text-muted);
}

/* a value read, not chosen: no arrow beside it */
.modelform.modelform-detail .col-data dropdown [flipper] {
    display: none;
}

/* inside the inline detail panel the panel is the frame: no second box around the fields */
.element-detail .modelform.modelform-detail {
    padding: 0;
}

.element-detail .modelform.modelform-detail .modelform-group-content {
    padding: var(--dg-space-2) 0 0;
    border: 0;
    background: transparent;
}

/* ---------------------------------------------------------------- forms */
.modelform {
    padding: var(--dg-space-4);
    overflow: auto;
    text-align: left;
}

/* groups: <fieldset>/<legend> in create and edit forms, <section>/<h3> in detail views */
.modelform-group {
    min-width: 0;
    margin: 0 0 var(--dg-space-4);
    padding: 0;
    border: 0;
}

.modelform-group-header {
    display: block;
    margin: 0;
    padding: 0 0 var(--dg-space-2);
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--dg-text);
}

/* each field is a <label> wrapping caption and control: clicking the caption focuses the control */
.modelform-col > .col-lable,
.modelform-col > .col-data {
    display: block;
}

.modelform-group-content {
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    padding: var(--dg-space-2) var(--dg-space-4);
}

.modelform-row {
    display: block;
    padding: var(--dg-space-2) 0;
}

/* label | control grid; stacks on phones */
.modelform .modelform-col {
    display: grid;
    grid-template-columns: var(--dg-label-width) minmax(0, 1fr);
    align-items: center;
    column-gap: var(--dg-space-4);
}

.modelform .col-lable {
    text-align: right;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text-muted);
}

.modelform .col-data {
    min-width: 0;
    max-width: var(--dg-control-max);
    text-align: left;
}

/* a form opened in a narrow list (a side panel: the Applications home's My children, ~300px): label above control, as
   on a phone; side by side, the labels took the width and the controls were slivers behind a sideways scrollbar.
   The list's grid is the size container (.list-content-area); a dialog's form is not inside one. */
@container (max-width: 520px) {
    .modelform .modelform-col {
        grid-template-columns: minmax(0, 1fr);
        row-gap: var(--dg-space-1);
    }

    .modelform .col-lable {
        text-align: left;
    }

    .modelform .col-data {
        max-width: none;
    }

    .modelform-group-content {
        padding: var(--dg-space-1) var(--dg-space-3);
    }
}

.postbackError {
    border: 1px solid var(--dg-danger);
    border-radius: var(--dg-radius-sm);
}

.input-error,
dropdown[choose].input-error {
    border-color: var(--dg-danger);
    box-shadow: inset 3px 0 0 var(--dg-danger);
}

.error-tooltip {
    margin-top: var(--dg-space-3);
    padding: var(--dg-space-3);
    background-color: var(--dg-danger-soft);
    color: var(--dg-danger);
    border-left: 4px solid var(--dg-danger);
    border-radius: var(--dg-radius-sm);
}

.error-tooltip[specific] {
    position: absolute;
    z-index: 40;
    margin-top: 5px;
    padding: var(--dg-space-4);
    background-color: var(--dg-surface);
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow-lg);
}

.error-tooltip[specific]::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -7px;
    border: 7px solid transparent;
    border-bottom-color: var(--dg-surface);
}

/* ---------------------------------------------------------------- controls */
input:not([type=checkbox]):not([type=radio]):not([type=range]),
select,
textarea {
    font-family: inherit;
    font-size: var(--dg-font-size);
    line-height: 1.3;
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-sm);
    padding: 8px 10px;
    box-sizing: border-box;
    max-width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modelform input:not([type=checkbox]):not([type=radio]),
.modelform select,
.modelform textarea,
.query-content input,
.query-content select {
    width: 100%;
}

/* a box of several lines grows with what is typed (field-sizing, where the browser has it; elsewhere it keeps its
   size and its resize handle), up to 40 % of the window; a short text (a title: maxlength is the column's size in
   bytes, 400 for 200 characters) starts as one line, a long one as three, as in the phone app */
textarea {
    min-height: 72px;
    max-height: 40vh;
    resize: vertical;
    field-sizing: content;
}

textarea:is([maxlength="100"], [maxlength="160"], [maxlength="200"], [maxlength="256"], [maxlength="300"], [maxlength="400"]) {
    min-height: calc(1.3em + 18px);
}

input:not([type=checkbox]):not([type=radio]):focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--dg-primary);
    box-shadow: 0 0 0 3px var(--dg-focus);
}

input::placeholder,
textarea::placeholder {
    color: var(--dg-placeholder);
}

input[type=checkbox] {
    width: 20px;
    height: 20px;
    margin: 0 5px 0 0;
    accent-color: var(--dg-primary);
    vertical-align: middle;
}

/* values rendered by the type views (View table: intList, uniqueidentifierEdit, textDetail…) */
.dg-num {
    font-variant-numeric: tabular-nums;
}

.dg-mono {
    font-family: Consolas, "Cascadia Mono", "SFMono-Regular", monospace;
    font-size: 0.92em;
}

/* keep line breaks of the value itself, not the indentation of the generated markup around it */
.dg-value-text {
    overflow-wrap: anywhere;
}

.dg-value-text > span {
    white-space: pre-wrap;
}

.dg-cell-text {
    display: inline-block;
    max-width: 40ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* a table to type into (mark many, edit many): its text wraps to two lines in narrower columns, so the inputs stay in
   view instead of off to the right (as the Flutter app lays the same fields out in a grid) */
.d-table:has(> tbody > tr > td > input, > tbody > tr > td > textarea, > tbody > tr > td > select) .dg-cell-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    max-width: 22ch;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* a date and time in a table keeps one line ("10 Nov 2026, 20:32" took four beside a long text column) */
.d-table td > .dg-num[view-name^="date"] {
    white-space: nowrap;
}

input[readonly],
textarea[readonly] {
    color: var(--dg-text-muted);
    background-color: var(--dg-surface-2);
}

/* required: a quiet marker on text-like controls */
input[required]:not([type=checkbox]):not([type=radio]),
textarea[required],
select[required],
dropdown[choose][required] {
    box-shadow: inset 3px 0 0 var(--dg-warning);
}

/* custom dropdown control */
dropdown {
    display: inline-block;
    cursor: pointer;
}

dropdown[choose] {
    position: relative;
    display: block;
    width: 100%;
    min-height: 38px;
    box-sizing: border-box;
    padding: 8px 32px 8px 10px;
    white-space: nowrap;
    overflow: clip;
    text-overflow: ellipsis;
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-sm);
}

dropdown[choose] [label] {
    display: block;
    overflow: clip;
    text-overflow: ellipsis;
}

dropdown[choose] [flipper] {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: block;
    color: var(--dg-text-muted);
}

dropdown[choose][open] {
    z-index: 20;
    border-color: var(--dg-primary);
    box-shadow: 0 0 0 3px var(--dg-focus);
}

.dropdown-option {
    min-width: 200px;
    max-width: min(480px, calc(100vw - 48px)); /* placed at the control's left edge: keep it on screen */
    box-sizing: border-box;
    white-space: normal;
    max-height: 60vh;
    overflow-y: auto;
    padding: var(--dg-space-2);
    text-align: left;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow-lg);
}

.dropdown-option.visible {
    margin-top: 4px;
}

.dropdown-option > input {
    display: block;
    width: 100%;
    margin: 0 0 var(--dg-space-2);
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
}

/* a list searched on the server (pages_app.js dropdownSearch): what to type, "Searching…", how many are listed */
.dropdown-option > .dropdown-note {
    margin: 0 0 var(--dg-space-2);
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted, var(--dg-text));
    opacity: .8;
}

.dropdown-option > .dropdown-note[hidden] {
    display: none;
}

/* options of one column (a person and their roles), as the Flutter picker: no heading over the one column, and a long
   option on two lines before it is cut short */
.dropdown-option .d-table:not(:has(thead th + th)) thead {
    display: none;
}

.dropdown-option .d-table:not(:has(thead th + th)) .dg-cell-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    max-width: none;
    white-space: normal;
    overflow: hidden;
}

/* toggle switch; without a bound value (active="{…}") it shows as off */
toggle {
    display: block;
    width: 42px;
    height: 24px;
    padding: 2px;
    box-sizing: border-box;
    text-align: left;
    cursor: pointer;
    border-radius: 999px;
    background-color: var(--dg-border-strong);
}

toggle lever {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin: 0;
    border-radius: 50%;
    background-color: var(--dg-knob);
    box-shadow: var(--dg-shadow-sm);
}

toggle[active='true'] {
    text-align: right;
    background-color: var(--dg-primary);
}

/* ---------------------------------------------------------------- dialogs */
/* the overlay is also a .dg-container (text-align: left): centre the dialog explicitly */
.dg-container.overlay {
    text-align: center;
    padding: 0 var(--dg-space-3);
    box-sizing: border-box;
    background-color: var(--dg-scrim);
}

.overlay-dialog {
    width: min(760px, 100%);
    box-sizing: border-box;
    padding: var(--dg-space-5);
    text-align: left;
    font-size: 1rem;
    background-color: var(--dg-surface);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow-lg);
}

.overlay-dialog > .dg-container:first-child > .dg-container-head {
    margin: calc(var(--dg-space-3) * -1) calc(var(--dg-space-3) * -1) 0 0;
}

.overlay-dialog > .dg-container:first-child > .dg-container-footer {
    margin-top: var(--dg-space-5);
}

.overlay-dialog .modelform {
    padding: var(--dg-space-3) 0 0;
}

[title-modal] {
    text-align: center;
    margin-bottom: var(--dg-space-3);
}

[title-modal] > :nth-child(1) {
    font-size: 1.2rem;
    font-weight: 650;
    color: var(--dg-text);
}

[title-modal] > :nth-child(2) {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

/* alerts and questions (showAlert / askAQuestion) */
.dg-alert {
    font-size: 1.1rem;
}

.dg-alert-default {
    color: var(--dg-text-muted);
}

.dg-alert-error {
    color: var(--dg-danger);
}

.dg-alert-question {
    color: var(--dg-warning);
}

/* operation messages */
.user-messages {
    padding: var(--dg-space-2);
    text-align: center;
}

.user-messages > label {
    display: block;
    margin-bottom: var(--dg-space-4);
    color: var(--dg-text-muted);
}

.user-message-group {
    min-width: 300px;
    margin: var(--dg-space-2) 0;
    padding: var(--dg-space-3);
    background-color: var(--dg-surface-2);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
}

.user-message-group > * {
    padding: var(--dg-space-2);
}

.user-message-group > label {
    color: var(--dg-text-muted);
}

.user-messages .user-message {
    color: var(--dg-success);
}

.user-messages .user-message-warning {
    color: var(--dg-warning);
}

.user-messages .user-message-error,
[error-message] {
    color: var(--dg-danger);
}

/* ---------------------------------------------------------------- sign-in (Login operation view) */
/* the generator appends the operation's menu (Log In) inside .dg-login, after the card */
.dg-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* card + button centred in the viewport */
    min-height: 100svh; /* exactly one screen: the page padding and item margin are removed below */
    box-sizing: border-box;
    padding: var(--dg-space-5) var(--dg-space-3);
}

/* a sign-in page is one screen tall: no page padding or item spacing around it (otherwise it scrolls) */
#page-container.dg-content:has(> .dg-page[active] .dg-login) {
    padding-top: 0;
    padding-bottom: 0;
}

.page-content-group:has(.dg-login),
.page-content-group-item:has(.dg-login) {
    margin-bottom: 0;
}

/* the page holds more than the card (/login/authorize: "New here? Create an account · Forgot your password?" under
   it): the page, not the card alone, is the one screen, with everything centred in it, so those links sit under the
   card instead of below the screen (the card filling the screen pushed them 55px past it, and the page scrolled) */
.dg-page[active]:has(.dg-login) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100svh;
    box-sizing: border-box;
}

.dg-page[active]:has(.dg-login) .dg-login {
    min-height: 0;
}

.dg-login-card {
    width: min(400px, 100%);
    box-sizing: border-box;
    padding: var(--dg-space-6) var(--dg-space-5);
    text-align: left;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow);
}

.dg-login-title {
    font-size: 1.4rem;
    font-weight: 650;
    color: var(--dg-text);
}

.dg-login-subtitle {
    margin: 2px 0 var(--dg-space-5);
    color: var(--dg-text-muted);
}

/* under the login and sign-up forms: to the other one, and to a forgotten password */
.dg-login-links {
    margin: var(--dg-space-4) 0;
    color: var(--dg-text-muted);
    text-align: center;
}

.dg-login-links a {
    color: var(--dg-primary);
    font-weight: 600;
}

.dg-login-field {
    display: block;
    margin-bottom: var(--dg-space-4);
}

.dg-login-field > span:first-child {
    display: block;
    margin-bottom: var(--dg-space-1);
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text-muted);
}

.dg-login-field input:not([type=checkbox]) {
    width: 100%;
    height: 44px;
}

.dg-login-card > button {
    margin-top: var(--dg-space-5);
}

.dg-login-password {
    position: relative;
    display: block;
}

.dg-login-password input:not([type=checkbox]) {
    padding-right: 44px;
}

.dg-login-reveal {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    color: var(--dg-text-muted);
    border-radius: var(--dg-radius-sm);
    cursor: pointer;
    user-select: none;
}

.dg-login-reveal:hover {
    background-color: var(--dg-surface-3);
}

/* the login section: no card chrome or toolbar around the sign-in card; the button spans the card width */
[modsec]:has(.dg-login) {
    background: transparent;
    border: none;
    box-shadow: none;
}

[modsec]:has(.dg-login) .sec-head,
.sec-body div:has(+ .dg-login) {   /* the "Add a new 'Login' record" heading (.dg-login is the [view] root) */
    display: none;
}

/* the button sits in the card: the card's lower edge is the menu's, so card and button read as one panel */
.dg-login:has(> .menu-container) > .dg-login-card {
    padding-bottom: var(--dg-space-2);
    border-bottom: none;
    border-radius: var(--dg-radius-lg) var(--dg-radius-lg) 0 0;
    clip-path: inset(-40px -40px 0 -40px); /* its shadow stops at the join */
}

.dg-login > .menu-container {
    width: min(400px, 100%);
    box-sizing: border-box;
    margin: -1px 0 0; /* overlaps the card by a pixel: no hairline where they meet on a fractional pixel */
    padding: var(--dg-space-3) var(--dg-space-5) var(--dg-space-6);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-top: none;
    border-radius: 0 0 var(--dg-radius-lg) var(--dg-radius-lg);
    box-shadow: var(--dg-shadow);
    clip-path: inset(0 -40px -40px -40px); /* no shadow cast up onto the card */
}

.dg-login > .menu-container .menu-item {
    flex: 1 1 100%;
}

.dg-login > .menu-container .menu .link {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    font-size: 0.9rem;
}

/* ---------------------------------------------------------------- the front door (Polish/09)
   .dg-landing: the default page for someone not signed in (hero, then three panels);
   .dg-gate: the checkpoint, a sign-in sized card of choices. Both take the whole screen without scrolling the page. */
#page-container.dg-content:has(> .dg-page[active] .dg-gate) {
    padding-top: 0;
    padding-bottom: 0;
}

.page-content-group:has(.dg-gate),
.page-content-group-item:has(.dg-gate) {
    margin-bottom: 0;
}

.dg-landing {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-6);
    padding: clamp(var(--dg-space-6), 8vh, 96px) 0 var(--dg-space-6);
}

.dg-landing-hero {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.dg-landing-eyebrow {
    margin: 0 0 var(--dg-space-3);
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dg-primary);
}

.dg-landing-title {
    margin: 0;
    font-size: clamp(1.9rem, 4.5vw, 2.9rem);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--dg-text);
    text-wrap: balance;
}

.dg-landing-lead {
    margin: var(--dg-space-4) auto 0;
    max-width: 600px;
    font-size: 1.08rem;
    color: var(--dg-text-muted);
    text-wrap: pretty;
}

.dg-landing-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--dg-space-3);
    margin-top: var(--dg-space-5);
}

.dg-landing-actions .dg-btn {
    min-width: 168px;
    padding: 11px 22px;
    font-size: 1rem;
    text-decoration: none;
}

.dg-landing-small,
.dg-gate-back {
    margin: var(--dg-space-4) 0 0;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
    text-align: center;
}

.dg-landing-small a,
.dg-gate-back a {
    color: var(--dg-primary);
    font-weight: 600;
}

.dg-landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--dg-space-4);
}

.dg-landing-feature {
    padding: var(--dg-space-5);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-top: 3px solid var(--dg-primary);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow-sm);
}

.dg-landing-feature h2 {
    margin: 0 0 var(--dg-space-2);
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--dg-text);
}

.dg-landing-feature p {
    margin: 0;
    color: var(--dg-text-muted);
}

.dg-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100svh;
    box-sizing: border-box;
    padding: var(--dg-space-5) var(--dg-space-3);
}

.dg-gate-card {
    width: min(420px, 100%);
    box-sizing: border-box;
    padding: var(--dg-space-6) var(--dg-space-5);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow);
}

.dg-gate-card .dg-login-title {
    margin: 0;
}

.dg-gate-choices {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-2);
}

.dg-gate-choice {
    display: block;
    padding: var(--dg-space-3) var(--dg-space-4);
    color: var(--dg-text);
    text-decoration: none;
    background-color: var(--dg-surface-2);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    transition: border-color 0.15s, background-color 0.15s;
}

.dg-gate-choice:hover,
.dg-gate-choice:focus-visible {
    border-color: var(--dg-primary);
    background-color: var(--dg-primary-soft);
}

.dg-gate-choice strong {
    display: block;
    font-weight: 650;
}

.dg-gate-choice span {
    display: block;
    margin-top: 2px;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-gate-choice-primary {
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-color: var(--dg-primary);
}

.dg-gate-choice-primary span {
    color: inherit;
    opacity: 0.8;
}

.dg-gate-choice-primary:hover,
.dg-gate-choice-primary:focus-visible {
    background-color: var(--dg-primary-hover);
    border-color: var(--dg-primary-hover);
}

/* Where are you working today? (login/organization, dg-workplace.js): the choices are buttons in the gate's card */
button.dg-gate-choice {
    width: 100%;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

button.dg-gate-choice:disabled {
    cursor: progress;
    opacity: 0.6;
}

.dg-workplace .dg-gate-choices {
    margin-top: var(--dg-space-4);
    max-height: 50svh;
    overflow-y: auto;
}

.dg-workplace-message {
    margin: var(--dg-space-3) 0 0;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-danger);
}

.dg-workplace-message[hidden] {
    display: none;
}

/* the person's menu: where they are working, under their name */
.dg-topbar-menu-org {
    margin-top: 2px;
    font-weight: 600;
    color: var(--dg-text);
}

/* ---------------------------------------------------------------- status pages (session expired, …)
   page item 1: <div class="dg-status"> icon + title + text; page item 2 (class dg-status-actions):
   the menu, laid out as equal buttons under the card, the last one primary */
.dg-status {
    max-width: 440px;
    box-sizing: border-box;
    /* card (~200px) + buttons (~60px) roughly centred in the viewport */
    margin: max(var(--dg-space-5), calc(50svh - 170px)) auto 0;
    padding: var(--dg-space-6) var(--dg-space-6) var(--dg-space-5);
    text-align: center;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow);
}

.dg-status-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0 auto var(--dg-space-4);
    border-radius: 50%;
    color: var(--dg-primary);
    background-color: var(--dg-primary-soft-2);
}

.dg-status-icon::before {
    content: "";
    width: 28px;
    height: 28px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dg-status-title {
    margin: 0 0 var(--dg-space-2);
    font-size: 1.35rem;
    font-weight: 650;
}

.dg-status-text {
    margin: 0;
    line-height: 1.6;
    color: var(--dg-text-muted);
}

.dg-status-actions .menu-container {
    max-width: 440px;
    margin: var(--dg-space-3) auto 0;
}

.dg-status-actions .menu-item-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: var(--dg-space-2);
}

.dg-status-actions .menu-item {
    display: block;
}

.dg-status-actions .menu .link {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 0.95rem;
}

.dg-status-actions .menu-item:last-child .link {
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-color: var(--dg-primary);
}

.dg-status-actions .menu-item:last-child .link:hover {
    background-color: var(--dg-primary-hover);
}

/* ---------------------------------------------------------------- tiles (NavigationTiles) */
.tile-containers {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-3);
}

.tile-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--dg-space-3);
    text-align: left;
}

.tile-item.largetile {
    position: relative;
    display: block;
    min-width: 0;
    margin: 0;
    padding: var(--dg-space-4) var(--dg-space-4) var(--dg-space-4) 60px;
    text-align: left;
    font-weight: 400;
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow-sm);
}

.tile-item.largetile:hover {
    color: var(--dg-text);
    border-color: var(--dg-primary);
    box-shadow: var(--dg-shadow);
    transform: translateY(-1px);
}

.tile-item > .tile-title {
    display: block;
    font-size: 1rem;
    font-weight: 650;
    color: var(--dg-text);
}

.tile-item > .tile-descr {
    display: block;
    margin-top: 2px;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

/* the app's icon (a symbol on a coloured square, Home/15) */
.tile-item > img {
    position: absolute;
    left: var(--dg-space-4);
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

/* ---------------------------------------------------------------- home dashboard (HomeDashboard, HomeAppTiles) */
.dg-home {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-5);
    margin-bottom: var(--dg-space-5);
}

/* the greeting, and the shortcuts beside it */
.dg-home-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--dg-space-4);
}

.dg-home-hello h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--dg-text);
}

.dg-home-hello p {
    margin: var(--dg-space-1) 0 0;
    color: var(--dg-text-muted);
}

.dg-home-hello .dg-btn {
    margin-top: var(--dg-space-4);
}

.dg-home-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--dg-space-2);
}

.dg-home-shortcut {
    display: inline-flex;
    align-items: center;
    gap: var(--dg-space-2);
    padding: 5px var(--dg-space-3) 5px 5px;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: 999px;
}

.dg-home-shortcut img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    flex: none;
}

.dg-home-shortcut:hover {
    border-color: var(--dg-primary);
}

.dg-home h2,
.dg-home-heading,
.dg-home-apps-group > h3 {
    margin: 0 0 var(--dg-space-3);
    font-size: var(--dg-font-size-sm);
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--dg-text-muted);
}

.dg-home-heading {
    margin-top: var(--dg-space-5);
}

/* an emergency, above everything */
.dg-home-alert {
    display: block;
    padding: var(--dg-space-4);
    color: var(--dg-text);
    text-decoration: none;
    background-color: var(--dg-danger-soft);
    border: 1px solid var(--dg-danger);
    border-left-width: 5px;
    border-radius: var(--dg-radius);
}

.dg-home-alerts {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-3);
}

.dg-home-alerts[hidden] {
    display: none;
}

/* everything below the alerts: one block the page replaces when its cards' newer answers come (HomeBoard) */
.dg-home-body {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-5);
}

.dg-home-alert strong {
    display: block;
    color: var(--dg-danger);
    font-size: 1.35rem;
    font-weight: 700;
}

.dg-home-alert span {
    display: block;
    margin-top: var(--dg-space-1);
}

.dg-home-alert .dg-home-alert-go {
    margin-top: var(--dg-space-3);
    font-weight: 600;
    color: var(--dg-danger);
}

.dg-home-alert.tone-urgent {
    padding: var(--dg-space-5);
    animation: dg-home-alert-pulse 2s ease-in-out infinite;
}

@keyframes dg-home-alert-pulse {
    50% {
        box-shadow: 0 0 0 4px var(--dg-danger-soft);
    }
}

/* quick actions: the first few, the rest under More */
.dg-home-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dg-space-2);
}

.dg-home-actions .dg-home-action {
    text-decoration: none;
}

.dg-home-more {
    position: relative;
}

.dg-home-more > summary {
    list-style: none;
}

.dg-home-more > summary::-webkit-details-marker {
    display: none;
}

.dg-home-more > summary::after {
    content: " \25BE";
}

.dg-home-more-list {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 220px;
    padding: var(--dg-space-2);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow-lg);
}

.dg-home-more-list .dg-home-action {
    justify-content: flex-start;
    text-align: left;
    border-color: transparent;
    background: none;
}

.dg-home-more-list .dg-home-action:hover {
    background-color: var(--dg-primary-soft);
}

/* needs your attention: compact rows, the first few, then Show all */
.dg-home-attn {
    padding: var(--dg-space-4) var(--dg-space-5);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
}

.dg-home-attn > header {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
}

.dg-home-attn > header h2 {
    margin: 0;
}

.dg-home-attn-total {
    padding: 0 8px;
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    color: var(--dg-text-muted);
    background-color: var(--dg-bg);
    border-radius: 999px;
}

.dg-home-attn-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.dg-home-rows {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2px var(--dg-space-4);
    margin: var(--dg-space-3) 0 0;
    padding: 0;
    list-style: none;
}

.dg-home-row {
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
    min-width: 0;
    padding: var(--dg-space-2);
    border-radius: var(--dg-radius-sm);
}

.dg-home-row:hover {
    background-color: var(--dg-primary-soft);
}

.dg-home-badge {
    display: inline-grid;
    place-items: center;
    flex: none;
    min-width: 34px;
    height: 28px;
    padding: 0 8px;
    box-sizing: border-box;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--dg-primary);
    background-color: var(--dg-primary-soft);
    border-radius: 999px;
}

.dg-home-row.tone-warn .dg-home-badge {
    color: var(--dg-warning);
    background-color: color-mix(in srgb, var(--dg-warning) 16%, transparent);
}

.dg-home-row.tone-urgent .dg-home-badge {
    color: var(--dg-danger);
    background-color: var(--dg-danger-soft);
}

.dg-home-row-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dg-home-row-title,
.dg-home-row-from {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dg-home-row-title {
    font-weight: 600;
}

.dg-home-row-from {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-home-row.dg-home-extra {
    display: none;
}

.dg-home-attn-toggle:checked ~ .dg-home-rows .dg-home-extra {
    display: flex;
}

.dg-home-attn-more {
    display: inline-block;
    margin-top: var(--dg-space-2);
    padding: var(--dg-space-1) var(--dg-space-2);
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-primary);
    cursor: pointer;
    border-radius: var(--dg-radius-sm);
}

.dg-home-attn-more:hover {
    background-color: var(--dg-primary-soft);
}

.dg-home-attn-more .hide,
.dg-home-attn-toggle:checked ~ .dg-home-attn-more .show {
    display: none;
}

.dg-home-attn-toggle:checked ~ .dg-home-attn-more .hide {
    display: inline;
}

.dg-home-clear,
.dg-home-wait {
    margin: var(--dg-space-3) 0 0;
    color: var(--dg-text-muted);
}

/* the lists: in columns, each as tall as it needs, with no holes beside short ones */
.dg-home-panels {
    columns: 3 300px;
    column-gap: var(--dg-space-4);
}

.dg-home-panel {
    display: block;
    margin: 0 0 var(--dg-space-4);
    padding: var(--dg-space-4);
    break-inside: avoid;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
}

.dg-home-panel > header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--dg-space-3);
}

.dg-home-panel > header .dg-home-see {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-primary);
    cursor: pointer;
}

.dg-home-panel > header .dg-home-see:hover {
    text-decoration: underline;
}

/* the home page's links open pages as the workspace tiles do (load-page): elements, not anchors */
.dg-home [exec="load-page"] {
    cursor: pointer;
}

.dg-home [exec="load-page"]:focus-visible {
    outline: 2px solid var(--dg-focus);
    outline-offset: 2px;
}

.dg-home-panel ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dg-home-panel li {
    padding: var(--dg-space-3) 0;
    border-top: 1px solid var(--dg-border);
}

.dg-home-panel li:first-child {
    padding-top: 0;
    border-top: 0;
}

.dg-home-panel li > span {
    display: block;
    overflow-wrap: anywhere;
}

.dg-home-item {
    font-weight: 600;
}

.dg-home-detail {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-home-note {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-warning);
}

/* ---- the lean Home (HomeBoard.cs, view home): the hero, four quick actions, its three lists ---- */
.dg-home-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--dg-space-5);
    padding: var(--dg-space-5) var(--dg-space-6);
    background: linear-gradient(120deg, var(--dg-primary-soft-2), var(--dg-primary-soft) 55%, var(--dg-surface));
    border: 1px solid var(--dg-primary-soft-2);
    border-radius: var(--dg-radius-lg);
}

.dg-home-hero-main {
    display: flex;
    flex: 1 1 320px;
    flex-direction: column;
    gap: var(--dg-space-3);
    min-width: 0;
}

.dg-home-brand {
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
}

.dg-home-mark {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-weight: 700;
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-radius: var(--dg-radius);
}

/* no letters to show (an organization with no name): no mark. Not the logo: a picture is an "empty" element too */
span.dg-home-mark:empty {
    display: none;
}

/* the organization's own logo in place of the two letters */
img.dg-home-mark.dg-home-logo {
    object-fit: contain;
    background-color: var(--dg-surface);
}

.dg-home-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dg-home-brand-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.dg-home-brand-date {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-home-hero .dg-home-hello h1 {
    font-size: 2rem;
}

.dg-home-hero .dg-home-hello p {
    max-width: 60ch;
    color: var(--dg-text);
}

/* the two ways on: What's next, the Dashboard */
.dg-home-go {
    display: flex;
    flex: 0 0 190px;
    flex-direction: column;
    gap: var(--dg-space-2);
}

.dg-home-go .dg-btn {
    justify-content: center;
    margin: 0;
    text-align: center;
}

.dg-home-top .dg-home-go {
    flex: none;
    flex-direction: row;
}

/* up to eight: two rows of four on a wide screen, two across on a narrow one, where only the first four show */
.dg-home-actions.dg-home-quick {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--dg-space-3);
}

/* Home's pinned pages (App.View HomePinnedTiles): one grid of four across, as the quick actions; each pin came in a
   tile container of its own (a group per app), so they stood one under another in a quarter of the width */
.dg-home-pinned {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--dg-space-3);
}

.dg-home-pinned > .dg-home-heading {
    grid-column: 1 / -1;
    margin: 0;   /* the page's gap above, the grid's below: its own margins doubled them */
}

.dg-home-pinned > .tile-container {
    display: contents;
}

.dg-home-quick-action {
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
    padding: var(--dg-space-3) var(--dg-space-4);
    font-weight: 600;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
}

.dg-home-quick-action:hover {
    background-color: var(--dg-primary-soft);
    border-color: var(--dg-primary);
}

.dg-home-quick-action img {
    flex: none;
    width: 28px;
    height: 28px;
}

/* messages and announcements side by side on a wide screen */
.dg-home-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--dg-space-4);
    align-items: start;
}

.dg-home-panel.dg-home-list {
    margin: 0;
}

.dg-home-list > header {
    align-items: center;
    justify-content: flex-start;
}

.dg-home-list > header h2 {
    margin: 0;
}

.dg-home-list > header .dg-home-see {
    margin-left: auto;
}

.dg-home-count {
    padding: 1px 9px;
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-radius: 999px;
}

.dg-home-list-announce .dg-home-count {
    background-color: var(--dg-warning);
}

.dg-home-list ul {
    margin-top: var(--dg-space-3);
}

.dg-home-list li,
.dg-home-list li:first-child {
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
    padding: var(--dg-space-3) 0;
    border-top: 1px solid var(--dg-border);
}

.dg-home-list li:hover .dg-home-item {
    color: var(--dg-primary);
}

.dg-home-text {
    flex: 1;
    min-width: 0;
}

.dg-home-text > span {
    display: block;
    overflow-wrap: anywhere;
}

.dg-home-list-messages .dg-home-detail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dg-home-list li > .dg-home-avatar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    background-color: var(--dg-primary-soft-2);
    border-radius: 50%;
}

.dg-home-list li > .dg-home-date {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    width: 44px;
    padding: 4px 0;
    background-color: var(--dg-surface-3);
    border-radius: var(--dg-radius);
}

.dg-home-date span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.dg-home-date strong {
    font-size: 18px;
    line-height: 1.1;
}

.dg-home-list li > .dg-home-date.today {
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
}

/* events: date tiles across the page */
.dg-home-list-events ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--dg-space-3);
}

.dg-home-list-events li,
.dg-home-list-events li:first-child {
    align-items: flex-start;
    padding: var(--dg-space-3);
    background-color: var(--dg-surface-2);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
}

.dg-home-list-events .dg-home-note {
    color: var(--dg-text-muted);
}

@media (max-width: 640px) {
    .dg-home-quick .dg-home-quick-action:nth-child(n + 5) {
        display: none;
    }

    /* the Dashboard's: every one */
    .dg-home-quick.dg-home-quick-all .dg-home-quick-action:nth-child(n + 5) {
        display: flex;
    }
}

/* a list with nothing in it folds to one line */
.dg-home-empty > header h2 {
    font-weight: 600;
    color: var(--dg-text-muted);
}

@media (max-width: 900px) {
    .dg-home-pair {
        grid-template-columns: minmax(0, 1fr);
    }

    .dg-home-actions.dg-home-quick,
    .dg-home-pinned {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dg-home-hero {
        padding: var(--dg-space-4);
    }

    .dg-home-hero .dg-home-go {
        flex: 1 1 100%;
        flex-direction: row;
    }

    .dg-home-hero .dg-home-go .dg-btn {
        flex: 1;
    }
}

.dg-home-apps-group > h3 {
    margin-bottom: var(--dg-space-2);
    font-size: 0.95rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--dg-text);
}

.dg-home-apps-group + .dg-home-apps-group {
    margin-top: var(--dg-space-4);
}

@media (max-width: 640px) {
    .dg-home {
        gap: var(--dg-space-4);
    }

    .dg-home-hello h1 {
        font-size: 1.45rem;
    }

    .dg-home-attn {
        padding: var(--dg-space-3);
    }

    .dg-home-rows {
        grid-template-columns: minmax(0, 1fr);
    }

    .dg-home-more-list {
        position: fixed;
        top: auto;
        bottom: var(--dg-space-3);
        left: var(--dg-space-3);
        right: var(--dg-space-3);
    }
}

/* ---------------------------------------------------------------- top bar (pages_app.js, signed-in pages) */
.dg-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: color-mix(in srgb, var(--dg-bg) 90%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--dg-border);
}

.dg-topbar-inner {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
    max-width: var(--dg-page-max);
    min-height: 56px;
    margin: 0 auto;
    padding: var(--dg-space-2) var(--dg-gutter);
    box-sizing: border-box;   /* lines up with the page (.dg-align-center-page) */
}

.dg-topbar svg {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dg-topbar-brand,
.dg-topbar-link,
.dg-topbar-app {
    display: inline-flex;
    align-items: center;
    gap: var(--dg-space-2);
    padding: 6px 10px;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;   /* framework links (load-page), not <a href> */
    border-radius: var(--dg-radius-sm);
}

.dg-topbar-brand {
    font-weight: 700;
    color: var(--dg-text);
}

.dg-topbar-brand svg {
    width: 20px;
    height: 20px;
    color: var(--dg-primary);
}

.dg-topbar-crumbs {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

.dg-topbar-link {
    color: var(--dg-text-muted);
}

.dg-topbar-app {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: var(--dg-text);
}

.dg-topbar-app::before {
    content: "/";
    margin-right: var(--dg-space-2);
    font-weight: 400;
    color: var(--dg-border-strong);
}

.dg-topbar-app[hidden] {
    display: none;
}

.dg-topbar-brand:hover,
.dg-topbar-link:hover,
.dg-topbar-app:hover,
.dg-topbar-link.current,
.dg-topbar-brand.current {
    color: var(--dg-text);
    background-color: var(--dg-surface);
}

.dg-topbar-right {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
    margin-left: auto;
}

.dg-topbar-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--dg-text-muted);
    border-radius: 50%;
    cursor: pointer;
}

.dg-topbar-icon:hover {
    color: var(--dg-text);
    background-color: var(--dg-surface);
}

.dg-topbar-me {
    display: inline-flex;
    align-items: center;
    gap: var(--dg-space-2);
    max-width: 260px;
    padding: 3px 8px 3px 3px;
    font: inherit;
    color: var(--dg-text);
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--dg-border);
    border-radius: 999px;
}

.dg-topbar-me:hover,
.dg-topbar-me[aria-expanded="true"] {
    color: var(--dg-text);   /* the global button:hover makes text dark (on a dark surface) */
    background-color: var(--dg-surface);
    border-color: var(--dg-border-strong);
}

.dg-avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    font-size: 12px;
    font-weight: 700;
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-radius: 50%;
}

.dg-topbar-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--dg-font-size-sm);
}

.dg-topbar-me svg {
    width: 16px;
    height: 16px;
    color: var(--dg-text-muted);
}

.dg-topbar-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    min-width: 220px;
    padding: 6px;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow-lg);
}

.dg-topbar-menu[hidden] {
    display: none;
}

.dg-topbar-menu-who {
    margin-bottom: 4px;
    padding: 8px 10px;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
    border-bottom: 1px solid var(--dg-border);
}

.dg-topbar-menu-item {
    display: block;
    padding: 8px 10px;
    font: inherit;
    text-align: left;
    text-decoration: none;
    color: var(--dg-text);
    cursor: pointer;
    background: none;
    border: 0;
    border-radius: var(--dg-radius-sm);
}

.dg-topbar-menu-item:hover,
.dg-topbar-menu-item:focus-visible {
    background-color: var(--dg-primary-soft);
    outline: none;
}

.dg-topbar-signout {
    color: var(--dg-danger);
}

@media (max-width: 640px) {
    .dg-topbar-inner {
        padding: var(--dg-space-2) var(--dg-space-3);
        gap: 2px;
    }

    .dg-topbar-brand span,
    .dg-topbar-link span,
    .dg-topbar-name {
        display: none;
    }

    .dg-topbar-me {
        padding: 3px;
    }

    .dg-topbar-me svg {
        display: none;
    }
}

/* ================================================================ 4. responsive */
/* section title (the section's Label): only on sections whose UIClassName includes show-title */
[modsec] > .sec-title {
    display: none;
}

[modsec].show-title > .sec-title {
    display: block;
    padding: var(--dg-space-3) var(--dg-space-4) 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dg-text);
}

/* a query field kept only to carry a value (view HiddenQueryField, e.g. the poll of a Results link) shows nothing */
.query-group-item:has(> .query-group-item-cell input[type="hidden"]) {
    display: none;
}

/* a section whose UIClassName includes hide-when-empty is hidden while its list has no items */
[modsec].hide-when-empty:not(:has(> .sec-body [content] .list > [templateitem])) {
    display: none;
}

/* an app home's default content (page item class hide-when-empty) hides while it has no rows, and its fallback
   (home-fallback: a parent's attendance where a teacher's registers would be) shows once the default has answered
   with nothing */
.page-content-group-item.hide-when-empty:not(:has([modsec] > .sec-body [content] .list > [templateitem])) {
    display: none;
}
.page-content-group-item.hide-when-empty:has([modsec] > .sec-body [content] .list > [templateitem]) ~ .home-fallback,
.page-content-group-item.hide-when-empty:not(:has([modsec][list-loaded])) ~ .home-fallback {
    display: none;
}

/* a list that answered with no rows says so (pages_app.js sets list-loaded), instead of looking unfinished */
[modsec][list-loaded]:not([list-data-available]) > .sec-body [content]:not(:has(> *))::after {
    content: "Nothing here yet.";
    display: block;
    padding: var(--dg-space-5) var(--dg-space-4);
    color: var(--dg-text-muted);
    text-align: center;
}

/* a list that waits for a choice before it reads anything says which (the server's Result.Waiting, kept in
   data-waiting): the organization, for someone who works in many */
[modsec][list-loaded]:not([list-data-available]) > .sec-body [content][data-waiting]:not(:has(> *))::after {
    content: attr(data-waiting);
}

/* a section head with nothing showing in it (pages_app.js updateSectionHead) */
.sec-head[empty] {
    display: none;
}

/* a list's query area with no filter fields and no search or paging commands has nothing to show */
[query]:not(:has(input, select, textarea, dropdown, toggle, [exec])) {
    display: none;
}

/* ---------------------------------------------------------------- card lists (ModelList-Cards, ModelList-Cards-Grouped) */
.dg-cards-header {
    display: none;
}

.dg-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--dg-space-3);
    padding: var(--dg-space-3);
}

.dg-card-list > .dg-card {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-1);
    min-width: 0;
    padding: var(--dg-space-3) var(--dg-space-4);
    overflow: visible;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow-sm);
}

/* no row highlight on cards: a card shows it is active by its action row */
.dg-card-list > [templateitem][highlighted] {
    background-color: var(--dg-surface);
}

/* a card picked in Select mode (the card styles above cover [templateitem][selected]: a picked card looked like the others) */
.dg-card-list > [templateitem][selected] {
    background-color: var(--dg-primary-soft);
    outline: 2px solid var(--dg-primary);
    outline-offset: -1px;
}

/* a card field that is only the viewer's own name (hideOwnNameFields in pages_app.js moves it last) */
/* a line that only repeats the card's title (pages_app.js hideTitleRepeats) */
.dg-card > .dg-card-field.dg-card-repeat {
    display: none;
}

.dg-card > .dg-card-field.dg-card-self {
    display: none;
}

/* a confirmation's second line: what the action does */
.dg-confirm-detail {
    display: block;
    margin-top: var(--dg-space-1);
    color: var(--dg-text-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

/* the card's actions (the section's row menu, moved into the card by pages_app.js): buttons under the fields */
.dg-card > popup[card-actions] {
    position: static;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: var(--dg-space-2);
    max-width: none;
    margin-top: var(--dg-space-2);
    padding: var(--dg-space-2) 0 0;
    background: none;
    border: 0;
    border-top: 1px solid var(--dg-border);
    border-radius: 0;
    box-shadow: none;
}

/* the operations (Edit, Publish…) and the links (Audience, Replies…) flow as one row of buttons, not two
   groups wrapping on their own */
.dg-card > popup[card-actions] > .operation-menu-items,
.dg-card > popup[card-actions] > .link-menu-items {
    display: contents;
}

.dg-card > popup[card-actions] .popupitem {
    padding: 6px 14px;
    background-color: transparent;
    color: var(--dg-text);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-sm);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.dg-card > popup[card-actions] .popupitem:hover {
    background-color: var(--dg-primary-soft);
    border-color: var(--dg-primary);
    color: var(--dg-primary);
}
.dg-card-field {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--dg-space-3);
    min-width: 0;
    font-size: var(--dg-font-size-sm);
}

/* nothing to show (pages_app.js markEmptyCardFields): not its label alone */
.dg-card-field[empty] {
    display: none;
}

/* a long label ("Role, group, organization") wraps within half the card: the value keeps the rest, not a column
   a word wide. Up to that half the label keeps its line and the value wraps ("Why they are coming", "Next step" were
   squeezed onto two right-aligned lines beside a value of a few words). */
.dg-card-field .col-lable {
    flex: 0 0 auto;
    max-width: 50%;
    text-align: left;
    color: var(--dg-text-muted);
}

.dg-card-field .col-data {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

/* a field without a label (list with ShowFieldLabel off) is text across the card, e.g. a sentence */
.dg-card-field:not(:has(.col-lable)) .col-data,
.dg-card-field:has(> .col-lable:empty) .col-data {
    flex: 1 1 auto;
    text-align: left;
}

/* a long value on a labelled card (pages_app.js sets data-long): under its label, from the left */
.dg-card-field[data-long] {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
}

.dg-card-field[data-long] > .col-lable {
    max-width: none;
    text-align: left;
}

.dg-card-field[data-long] .col-data {
    text-align: left;
}

/* a bare number or yes/no named by its field (pages_app.js nameBareValue): "Your answer 1", "100%" */
.dg-cell-text[data-value-name]::before {
    content: attr(data-value-name) "\00a0\00a0";
    color: var(--dg-text-muted);
}

.dg-cell-text[data-value-suffix]::after {
    content: attr(data-value-suffix);
}

/* in a labelled card, a field whose label is left empty (it reads on its own: instructions, "Due Mon 2 Nov") is the
   same: across the card, from the left, with no gap kept for a label */
.dg-card-field > .col-lable:empty {
    display: none;
}

.dg-sentence {
    color: var(--dg-text-muted);
}

popup .popupitem[hidden] {
    display: none;
}

/* the first field is the card's title */
.dg-card > .dg-card-field:first-child {
    margin-bottom: var(--dg-space-1);
    font-size: var(--dg-font-size);
    font-weight: 600;
}

.dg-card > .dg-card-field:first-child .col-lable {
    display: none;
}

.dg-card > .dg-card-field:first-child .col-data {
    flex: 1 1 auto;
    text-align: left;
}

/* pictures in records (views pictureList, pictureDetail; pages_app.js renderImageLink): the picture, a click opens the viewer */
.dg-image {
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    border-radius: var(--dg-radius-sm);
    overflow: hidden;
    background-color: var(--dg-surface-2);
}

.dg-image img {
    display: block;
    max-width: 100%;
    max-height: 240px;
    object-fit: cover;
}

.d-table .dg-image img {
    max-height: 56px;
    width: auto;
}

/* a video (an album's): its first frame, sized as a picture, with a play mark over it */
.dg-image video {
    display: block;
    max-width: 100%;
    max-height: 240px;
    object-fit: cover;
    pointer-events: none;
}

.d-table .dg-image video {
    max-height: 56px;
    width: auto;
}

.dg-video {
    position: relative;
}

.dg-video::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 7v10l8-5z'/%3E%3C/svg%3E") center / 26px no-repeat;
    pointer-events: none;
}

.d-table .dg-video::after {
    width: 24px;
    height: 24px;
    background-size: 16px;
}

/* section class dg-photos: a wall of pictures (a gallery's photos); the picture is the card's first field, edge to
   edge, the caption under it */
[modsec].dg-photos .dg-card-list {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

[modsec].dg-photos .dg-card > .dg-card-field:first-child {
    margin: calc(-1 * var(--dg-space-3)) calc(-1 * var(--dg-space-4)) var(--dg-space-2);
}

[modsec].dg-photos .dg-card .dg-image {
    display: block;
    width: 100%;
    border-radius: 0;
}

[modsec].dg-photos .dg-card .dg-image img,
[modsec].dg-photos .dg-card .dg-image video {
    width: 100%;
    height: 200px;
    max-height: none;
}

/* section class dg-albums: the cover picture across the top of each album card */
[modsec].dg-albums .dg-card .dg-image {
    display: block;
    width: 100%;
}

[modsec].dg-albums .dg-card .dg-image img,
[modsec].dg-albums .dg-card .dg-image video {
    width: 100%;
    height: 160px;
    max-height: none;
}

/* the lightbox (pages_app.js dgLightboxBuild): one picture full-screen, swipe or arrow through the list's others */
.dg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10010;
    display: grid;
    grid-template-rows: 1fr auto;
    background-color: rgba(10, 10, 12, 0.94);
    color: #fff;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
    animation: dg-lightbox-in 160ms ease-out;
}

.dg-lightbox[hidden] {
    display: none;
}

body.dg-lightbox-open {
    overflow: hidden;
}

@keyframes dg-lightbox-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dg-lightbox-figure {
    margin: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--dg-space-3);
    padding: var(--dg-space-4) var(--dg-space-4) 0;
    box-sizing: border-box;
}

.dg-lightbox-img {
    display: block;
    max-width: 100%;
    max-height: calc(100dvh - 120px);
    object-fit: contain;
    border-radius: var(--dg-radius-sm);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    -webkit-user-drag: none;
}

.dg-lightbox-img[hidden],
.dg-lightbox-video[hidden] {
    display: none;
}

/* a video of the list, playing with the browser's controls */
.dg-lightbox-video {
    display: block;
    max-width: 100%;
    max-height: calc(100dvh - 120px);
    border-radius: var(--dg-radius-sm);
    background-color: #000;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.dg-lightbox-img.dg-lightbox-from-right {
    animation: dg-lightbox-right 200ms ease-out;
}

.dg-lightbox-img.dg-lightbox-from-left {
    animation: dg-lightbox-left 200ms ease-out;
}

@keyframes dg-lightbox-right {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: none; }
}

@keyframes dg-lightbox-left {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: none; }
}

.dg-lightbox-caption {
    max-width: min(760px, 100%);
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.88);
    text-wrap: balance;
}

.dg-lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--dg-space-5);
    padding: var(--dg-space-3) var(--dg-space-4) max(var(--dg-space-4), env(safe-area-inset-bottom));
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

/* the bar's "Open file" link only: <body> carries the same class while the viewer is open (pages_app.js), and the
   whole page behind it was underlined */
.dg-lightbox-bar > .dg-lightbox-open {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dg-lightbox-bar > .dg-lightbox-open:hover {
    color: #fff;
}

.dg-lightbox-close,
.dg-lightbox-prev,
.dg-lightbox-next {
    position: absolute;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 120ms;
}

.dg-lightbox-close:hover,
.dg-lightbox-prev:hover,
.dg-lightbox-next:hover {
    background-color: rgba(255, 255, 255, 0.28);
}

.dg-lightbox-close:focus-visible,
.dg-lightbox-prev:focus-visible,
.dg-lightbox-next:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* its cross is drawn too, two bars crossing on the circle's centre (the text "×" sat off it) */
.dg-lightbox-close {
    top: max(var(--dg-space-3), env(safe-area-inset-top));
    right: var(--dg-space-3);
    padding: 0;
    font-size: 0;
}

.dg-lightbox-close::before,
.dg-lightbox-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2.5px;
    background-color: currentColor;
    border-radius: 1px;
    transform: translate(-50%, -50%) rotate(45deg);
}

.dg-lightbox-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* their arrows are drawn, a chevron on the circle's centre: the text "‹ ›" sat on the font's baseline, low */
.dg-lightbox-prev,
.dg-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    padding: 0;
    font-size: 0;
}

.dg-lightbox-prev::before,
.dg-lightbox-next::before {
    content: "";
    width: 11px;
    height: 11px;
    border-top: 2.5px solid currentColor;
    border-right: 2.5px solid currentColor;
}

.dg-lightbox-next::before {
    transform: translateX(-2px) rotate(45deg);
}

.dg-lightbox-prev::before {
    transform: translateX(2px) rotate(-135deg);
}

.dg-lightbox-prev {
    left: var(--dg-space-3);
}

.dg-lightbox-next {
    right: var(--dg-space-3);
}

@media (max-width: 640px) {
    /* on a phone one swipes; the arrows would sit on the picture */
    .dg-lightbox-prev,
    .dg-lightbox-next {
        display: none;
    }

    .dg-lightbox-img,
    .dg-lightbox-video {
        max-height: calc(100dvh - 100px);
        border-radius: 0;
    }

    .dg-lightbox-figure {
        padding: 0;
    }
}

/* in a card, text wraps instead of being cut short as in a table cell */
.dg-card .dg-cell-text {
    display: inline;
    max-width: none;
    overflow: visible;
    white-space: normal;
}

/* grouped: one card per group, an item per row (option, bar, count) */
.dg-card-list[group-by-first] {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

.dg-card-list[group-by-first] > .dg-card {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(120px, 3fr) auto;
    align-items: center;
    column-gap: var(--dg-space-4);
    padding-top: var(--dg-space-2);
    padding-bottom: var(--dg-space-2);
    border-top-width: 0;
    border-radius: 0;
    box-shadow: none;
    cursor: default;
}


.dg-card-list[group-by-first] > .dg-card[group-start] {
    padding-top: var(--dg-space-3);
    border-top-width: 1px;
    border-radius: var(--dg-radius) var(--dg-radius) 0 0;
}

.dg-card-list[group-by-first] > .dg-card[group-start]:not(:first-child) {
    margin-top: var(--dg-space-3);
}

.dg-card-list[group-by-first] > .dg-card[group-end] {
    padding-bottom: var(--dg-space-3);
    border-radius: 0 0 var(--dg-radius) var(--dg-radius);
}

.dg-card-list[group-by-first] > .dg-card[group-start][group-end] {
    border-radius: var(--dg-radius);
}

/* the group's title: on its first item only, across the whole card */
.dg-card-list[group-by-first] > .dg-card > .dg-card-field:first-child {
    grid-column: 1 / -1;
    margin-bottom: var(--dg-space-2);
}

.dg-card-list[group-by-first] > .dg-card:not([group-start]) > .dg-card-field:first-child {
    display: none;
}

.dg-card-list[group-by-first] .dg-card-field {
    justify-content: flex-start;
}

.dg-card-list[group-by-first] .dg-card-field .col-data {
    text-align: left;
}

/* in a grouped item, the item's own name needs no label: the field after the title (or after the badge) */
.dg-card-list[group-by-first] > .dg-card > .dg-card-field:first-child + .dg-card-field:not(:has(.dg-group-badge)) .col-lable,
.dg-card-list[group-by-first] > .dg-card > .dg-card-field:has(.dg-group-badge) + .dg-card-field .col-lable {
    display: none;
}

/* DropdownBadge: a group's badge (e.g. a poll's status) at the top right of the group's card, on its first item
   only; out of the item's grid, so the columns stay aligned with the group's other items */
.dg-card-list[group-by-first] > .dg-card {
    position: relative;
}

.dg-card-list[group-by-first] > .dg-card > .dg-card-field:has(.dg-group-badge) {
    position: absolute;
    top: var(--dg-space-3);
    right: var(--dg-space-4);
}

.dg-card-list[group-by-first] > .dg-card[group-start]:has(.dg-group-badge) > .dg-card-field:first-child {
    padding-right: 10em;
}
.dg-card-list[group-by-first] > .dg-card:not([group-start]) > .dg-card-field:has(.dg-group-badge),
.dg-card-field:has(.dg-group-badge) .col-lable {
    display: none;
}

.dg-group-badge {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid var(--dg-border);
    border-radius: 999px;
    background-color: var(--dg-surface-2);
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    white-space: nowrap;
}

/* a list's status in the colour of what it says (pages_app.js markStatusTones): waiting, done, gone wrong */
:is(.dg-cell-text, dropdown)[data-tone] { font-weight: 600; }
:is(.dg-cell-text, dropdown)[data-tone="warn"] { color: var(--dg-warning); }
:is(.dg-cell-text, dropdown)[data-tone="good"] { color: var(--dg-success); }
:is(.dg-cell-text, dropdown)[data-tone="bad"] { color: var(--dg-danger); }

/* card details: a source chip and a muted line ("closes Thu 6 PM") */
.dg-chip {
    display: inline-block;
    margin-right: var(--dg-space-2);
    padding: 1px 6px;
    border-radius: 4px;
    background-color: var(--dg-primary-soft);
    color: var(--dg-primary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: 1px;
}

.dg-meta {
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
}

/* grouped items of four or five plain fields (cover suggestions: teacher, teaches the subject, lessons that day,
   covers this week): the name, then an equal column per field, on one line. The three columns above are an option,
   its bar and its count; a fourth field wrapped under them. Not polls (badge, subtitle), menus (choices), agenda lists
   (their own grid: time, what, kind; the calendar got squeezed) or longer items (a timetable). Phones keep their two
   columns. */
@media (min-width: 641px) {
    .dg-card-list[group-by-first]:not(.dg-agenda-list) > .dg-card:has(> .dg-card-field:nth-child(5)):not(:has(> .dg-card-field:nth-child(6))):not(:has(.dg-group-badge, .dg-group-subtitle, .dg-choices, .dg-pct-bar, .dg-kind)) {
        grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
    }

    .dg-card-list[group-by-first]:not(.dg-agenda-list) > .dg-card:has(> .dg-card-field:nth-child(6)):not(:has(> .dg-card-field:nth-child(7))):not(:has(.dg-group-badge, .dg-group-subtitle, .dg-choices, .dg-pct-bar, .dg-kind)) {
        grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr));
    }
}

/* grouped cards: a line under the group's title ("closed Oct 20 · 1,204 votes"), on the group's first item only */
.dg-card-list[group-by-first] > .dg-card > .dg-card-field:first-child {
    order: -2;
}

.dg-card-list[group-by-first] > .dg-card > .dg-card-field:has(.dg-group-subtitle) {
    order: -1;
    grid-column: 1 / -1;
    margin: calc(-1 * var(--dg-space-2)) 0 var(--dg-space-2);
}

.dg-card-list[group-by-first] > .dg-card:not([group-start]) > .dg-card-field:has(.dg-group-subtitle),
.dg-card-field:has(.dg-group-subtitle) .col-lable {
    display: none;
}

.dg-group-subtitle {
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
}

/* a record waiting on the viewer (a consent to answer, a form to sign): a badge, shown only when its value is true,
   and its card stands out with an accent at its side */
.dg-todo {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background-color: color-mix(in srgb, var(--dg-warning) 18%, transparent);
    color: var(--dg-warning);
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
}

.dg-todo:not([data-todo="true"]):not([data-todo="1"]):not([data-todo="True"]),
.dg-card-field:has(.dg-todo:not([data-todo="true"]):not([data-todo="1"]):not([data-todo="True"])) {
    display: none;
}

.dg-card:has(.dg-todo:is([data-todo="true"], [data-todo="1"], [data-todo="True"])) {
    box-shadow: inset 4px 0 0 var(--dg-warning);
}

/* in a labelled card the badge says it all: no label beside it ("To pay  To pay") */
.dg-card-field:has(.dg-todo) > .col-lable {
    display: none;
}

.dg-card-field:has(.dg-todo) .col-data {
    text-align: left;
}

/* an operation the page's own script posts (registering a device for notifications), not one a person fills in:
   it stays on the page for the script, without a button (the operation's UIClassNameLink) */
[operation].dg-no-button,
.popupitem.dg-no-button {
    display: none !important;
}

/* a flag shown only when its value is true, e.g. "✓ your vote" */
.dg-flag {
    margin-left: var(--dg-space-2);
    color: var(--dg-primary);
    font-weight: 600;
    white-space: nowrap;
}

.dg-flag:not([data-flag="true"]):not([data-flag="1"]):not([data-flag="True"]) {
    display: none;
}

/* choices on a card (pages_app.js renderInlineChoices) */
.dg-choices {
    width: 100%;
    text-align: left;
}

.dg-choices-set {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-2);
    min-width: 0;
    margin: var(--dg-space-2) 0 0;
    padding: 0;
    border: 0;
}

.dg-choices-set legend {
    margin-bottom: var(--dg-space-2);
    padding: 0;
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
}

/* a choice made of several parts (a meal: who it is for, a meat, two sides): each part's options in a row that wraps,
   so the order reads at a glance (one under the other, a menu card ran a screen and a half); a single question (a
   poll) keeps its options one under the other */
.dg-choices:has(.dg-choices-set + .dg-choices-set) .dg-choices-set,
.dg-choices.dg-choices-groups .dg-choices-set {
    flex-direction: row;
    flex-wrap: wrap;
}

/* a set every card asks the same way (Order for: me, my children), asked once above the list (pages_app.js
   sharedChoices) */
.dg-choices.dg-choices-shared {
    box-sizing: border-box;   /* its padding and border inside its width: it made the list scroll sideways */
    width: auto;
    margin: var(--dg-space-3) var(--dg-space-3) 0;   /* in line with the cards under it */
    padding: var(--dg-space-2) var(--dg-space-3) var(--dg-space-3);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
}

.dg-choices.dg-choices-shared .dg-choices-set legend {
    color: var(--dg-text);
    font-weight: 600;
}

/* who cannot afford a card (pages_app.js spendNote), with Top up */
.dg-choices-warn {
    margin-top: var(--dg-space-3);
    color: var(--dg-warning);
    font-size: var(--dg-font-size-sm);
}

.dg-choices-topup {
    color: var(--dg-primary);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.dg-card.modelform > .dg-card-field:has(.dg-choices-set + .dg-choices-set) > .col-data {
    max-width: none;
}

/* a part still to choose when its button was pressed (pages_app.js choicesShort): its question and boxes stand out */
.dg-choices-set.dg-choices-short legend {
    color: var(--dg-danger);
    font-weight: 600;
}

.dg-choices-set.dg-choices-short .dg-choice {
    border-color: var(--dg-danger);
}

/* choices on a grouped card take the card's width (they sat in its first column, a third of the row); so do a
   several-part choice's (a menu card: its Order button at the card's right, not in its middle) */
.dg-card-list[group-by-first] > .dg-card > .dg-card-field:has(.dg-choices),
.dg-card-list > .dg-card > .dg-card-field:has(.dg-choices-groups) {
    grid-column: 1 / -1;
}

.dg-card-list > .dg-card > .dg-card-field:has(.dg-choices-groups) > .col-data {
    max-width: none;
    width: 100%;
}

.dg-choice {
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
    min-height: 44px;
    padding: var(--dg-space-2) var(--dg-space-3);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    cursor: pointer;
}

.dg-choice:has(input:checked) {
    border-color: var(--dg-primary);
    background-color: var(--dg-primary-soft);
    color: var(--dg-primary);
    font-weight: 600;
}

.dg-choice:has(input:disabled) {
    opacity: 0.55;
    cursor: default;
}

.dg-choice input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--dg-primary);
}

.dg-choices-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--dg-space-2);
    margin-top: var(--dg-space-3);
}

.dg-choices-note {
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
}

.dg-choices-submit {
    min-height: 44px;
    padding: 0 var(--dg-space-5);
    border: 0;
    border-radius: 22px;
    background-color: var(--dg-primary);
    color: var(--dg-text-inverse);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.dg-choices-submit:hover {
    background-color: var(--dg-primary-hover);
}

/* files in records (pages_app.js: dg-file, dg-file-link) */
/* a picture on a card: small, opening the viewer (as the Flutter app's thumbnail) */
.dg-file-thumb .dg-image img {
    display: block;
    max-width: 220px;
    max-height: 96px;
    border-radius: var(--dg-radius-sm);
    object-fit: cover;
}

.dg-file-box {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dg-space-2) var(--dg-space-3);
}

.dg-file-name {
    color: var(--dg-primary);
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.dg-file-choose,
.dg-file-remove {
    min-height: 36px;
    padding: 0 var(--dg-space-4);
    border: 1px solid var(--dg-border);
    border-radius: 18px;
    background-color: var(--dg-surface, transparent);
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.dg-file-note {
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
}

.dg-file-note:empty {
    display: none;
}

.dg-file-note-error {
    color: var(--dg-danger);
}

/* a field that takes several files (pages_app.js renderFileInputMany): the files chosen as small pictures, each with
   its name and a remove mark; Choose files / Add more under them; files can be dropped on it */
.dg-file-many {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

.dg-file-many .dg-file-choose {
    align-self: flex-start;
}

.dg-file-many.dg-file-drop {
    outline: 2px dashed var(--dg-primary);
    outline-offset: 4px;
    border-radius: var(--dg-radius-sm);
}

.dg-file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: var(--dg-space-2);
}

.dg-file-list[hidden] {
    display: none;
}

.dg-file-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.dg-file-item-media {
    display: block;
    aspect-ratio: 1;
    border-radius: var(--dg-radius-sm);
    overflow: hidden;
    background-color: var(--dg-surface-2);
}

.dg-file-item-media img,
.dg-file-item-media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.dg-file-item-media.dg-video::after {
    width: 32px;
    height: 32px;
    background-size: 20px;
}

.dg-file-item-name {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dg-file-item-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 18px;
    line-height: 28px;
    cursor: pointer;
}

.dg-file-item-remove:focus-visible {
    outline: 2px solid var(--dg-primary);
    outline-offset: 2px;
}

/* web push: notifications in this browser on or off (dg-push.js) */
.dg-push {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dg-space-3) var(--dg-space-5);
    padding: var(--dg-space-4) var(--dg-space-5);
    border: 1px solid var(--dg-border);
    border-radius: 12px;
    background-color: var(--dg-surface);
}

.dg-push-note {
    flex: 1 1 260px;
    color: var(--dg-text);
}

.dg-push-button {
    min-height: 44px;
    padding: 0 var(--dg-space-5);
    border: 0;
    border-radius: 22px;
    background-color: var(--dg-primary);
    color: var(--dg-text-inverse);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.dg-push-button:hover {
    background-color: var(--dg-primary-hover);
}

.dg-push-button:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* a card that votes in place doesn't need its action row (kept for clients without this script) */
.dg-card:has(.dg-choices[data-ready]:not([data-buttons])) > popup[card-actions] {
    display: none !important;
}

/* choices as buttons, each sending its own reply (e.g. Decline / Give consent) */
.dg-choices-buttons {
    justify-content: flex-end;
}

.dg-choices-buttons .dg-choices-note {
    margin-right: auto;
}

/* in a one-column list (agenda, timeline) the buttons start under the text: at the end of its 520px column they stood
   in the middle of the card (a meeting's Accept / Decline) */
:is(.dg-agenda-list, .dg-timeline-list) .dg-choices-buttons {
    justify-content: flex-start;
}

:is(.dg-agenda-list, .dg-timeline-list) .dg-choices-buttons .dg-choices-note:empty {
    display: none;
}

/* three or more (a register's Present / Late / Absent / Excused): an even grid across the card, not a ragged row */
.dg-choices-buttons:has(> button:nth-of-type(3)) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.dg-choices-buttons:has(> button:nth-of-type(3)) > .dg-choices-note {
    grid-column: 1 / -1;
    margin: 0;
}

.dg-choices-buttons:has(> button:nth-of-type(3)) > .dg-choices-note:empty {
    display: none;
}

.dg-choices-buttons:has(> button:nth-of-type(3)) > button {
    padding: 0 var(--dg-space-3);
}

.dg-choices-secondary {
    border: 1px solid var(--dg-border-strong);
    background-color: transparent;
    color: var(--dg-text);
}

.dg-choices-secondary:hover {
    background-color: var(--dg-surface-2);
    color: var(--dg-text);   /* button:hover would make it the primary's inverse text: dark on dark */
}

/* announcement cards: "Action needed · Due Fri", priority, "✓ You gave consent"; each shown only with a value */
.dg-due {
    color: var(--dg-warning);
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
}

.dg-reply {
    color: var(--dg-primary);
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
}

.dg-priority {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background-color: var(--dg-danger-soft);
    color: var(--dg-danger);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.dg-priority[data-priority="Important"] {
    background-color: var(--dg-surface-2);
    color: var(--dg-warning);
}

.dg-priority[data-priority="Normal"],
.dg-priority[data-priority=""],
.dg-action[data-action="None"],
.dg-action[data-action=""] {
    display: none;
}

.dg-card-field:has(.dg-due[data-due=""]),
.dg-card-field:has(.dg-reply[data-reply=""]),
.dg-card-field:has(.dg-priority:is([data-priority="Normal"], [data-priority=""])):not(:has(.dg-meta)):not(:has(.dg-action:not([data-action="None"]):not([data-action=""]))),
.dg-card-field:has(.dg-choices:not([data-ready])) {
    display: none;
}

.dg-link {
    color: var(--dg-primary);
    text-decoration: underline;
}

/* section class dg-feed: cards read top to bottom as a news feed (announcements): one column, the source line
   ("SCHOOL Kingston College · 8:15 AM") above the title, the text at reading size. The section takes the page's
   width and its cards take the section's, so they line up with its edges. */
[modsec].dg-feed .dg-card-list {
    grid-template-columns: minmax(0, 1fr);
}

[modsec].dg-feed .dg-card-list > .dg-card {
    gap: var(--dg-space-2);
    padding: var(--dg-space-4);
}

[modsec].dg-feed .dg-card > .dg-card-field:first-child {
    order: 0;
    margin-bottom: 0;
    font-size: 1.05rem;
}

[modsec].dg-feed .dg-card > .dg-card-field:has(.dg-card-meta) {
    order: -1;
}

[modsec].dg-feed .dg-card > .dg-card-field {
    order: 1;
    font-size: var(--dg-font-size);
}

/* a card is also a .modelform: its values use the card's width, not a form control's */
[modsec].dg-feed .dg-card > .dg-card-field .col-data {
    flex: 1 1 auto;
    max-width: none;
}

[modsec].dg-feed .dg-card > .dg-card-field:has(.dg-reply),
[modsec].dg-feed .dg-card > .dg-card-field:has(.dg-choices) {
    order: 2;
}

/* a card waiting for a reply: "⚠ Action needed · Due Fri" across its top, and a warm border */
[modsec].dg-feed .dg-card:has(.dg-due:not([data-due=""])) {
    border-color: color-mix(in srgb, var(--dg-warning) 55%, var(--dg-border));
}

[modsec].dg-feed .dg-card > .dg-card-field:has(.dg-due) {
    order: -2;
    margin: calc(-1 * var(--dg-space-4)) calc(-1 * var(--dg-space-4)) var(--dg-space-1);
    padding: var(--dg-space-2) var(--dg-space-4);
    border-radius: var(--dg-radius) var(--dg-radius) 0 0;
    background-color: color-mix(in srgb, var(--dg-warning) 14%, var(--dg-surface));
}

[modsec].dg-feed .dg-due::before {
    content: "\26A0\FE0E\00A0";
}

/* the reply buttons share the row (Decline | Give consent) */
[modsec].dg-feed .dg-choices-buttons {
    flex-wrap: nowrap;
}

[modsec].dg-feed .dg-choices-buttons .dg-choices-note:empty {
    display: none;
}

[modsec].dg-feed .dg-choices-buttons button {
    flex: 1 1 0;
}

[modsec].dg-feed .dg-reply {
    color: var(--dg-success);
}

/* unread (dg-unread beside the title, the record's IsRead): a dot before the title; its word is for screen readers */
.dg-unread {
    order: -1;
    flex: none;
    display: inline-block;
    width: 8px;
    height: 8px;
    overflow: hidden;
    border-radius: 50%;
    background-color: var(--dg-primary);
    color: transparent;
    font-size: 0;
}

.dg-unread:is([data-read="true"], [data-read="True"], [data-read="1"]) {
    display: none;
}

.dg-read-title {
    display: inline-flex;
    align-items: center;
    gap: var(--dg-space-2);
}

/* attachments (a dg-flag dg-files in the source line): a paper clip and the word */
.dg-flag.dg-files {
    color: var(--dg-text-muted);
    font-weight: 500;
}

.dg-flag.dg-files::before {
    content: "";
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-right: 4px;
    vertical-align: -2px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11l-8.5 8.5a5 5 0 0 1-7-7L14 4a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L15 7'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11l-8.5 8.5a5 5 0 0 1-7-7L14 4a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L15 7'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* section class list-chips: the section's lists as filter chips (All / Ministry / School), the current one
   highlighted instead of hidden, so the others are one tap away */
[modsec].list-chips[mode='default'] > .sec-head .sec-head-item.current[operation][exec][target-count='*'][type='list'] {
    display: inline-block;
}

[modsec].list-chips > .sec-head .sec-head-item[type='list'] {
    padding: 6px 14px;
    border-color: var(--dg-border-strong);
    border-radius: 999px;
    background-color: transparent;
    color: var(--dg-text);
}

[modsec].list-chips > .sec-head .sec-head-item[type='list']:hover {
    border-color: var(--dg-primary);
    color: var(--dg-primary);
}

[modsec].list-chips > .sec-head .sec-head-item.current[type='list'] {
    border-color: var(--dg-primary);
    background-color: var(--dg-primary);
    color: var(--dg-text-inverse);
}

/* PercentBar */
.dg-pct-bar {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
    width: 100%;
}

.dg-pct-bar progress {
    flex: 1 1 auto;
    min-width: 60px;
    height: 8px;
    border: 0;
    border-radius: 4px;
    background-color: var(--dg-surface-3);
    accent-color: var(--dg-primary);
    overflow: hidden;
}

.dg-pct-bar progress::-webkit-progress-bar {
    background-color: var(--dg-surface-3);
}

.dg-pct-bar progress::-webkit-progress-value {
    background-color: var(--dg-primary);
}

.dg-pct-bar progress::-moz-progress-bar {
    background-color: var(--dg-primary);
}

.dg-pct-text {
    flex: 0 0 3.5em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dg-card-field:has(.dg-pct-bar) .col-lable {
    display: none;
}

.dg-card-field:has(.dg-pct-bar) .col-data {
    flex: 1 1 auto;
}

/* ---------------------------------------------------------------- list styles by what a list shows
   Card lists with a class of their own (views ModelList-Agenda, -Timeline, -People, -Stats): the cards' actions,
   inline forms and empty-field rules are the card lists'. Each style counts on its fields' order, which the list
   sets: agenda and timeline put the date or time first and what it is second; people put the name first. */

/* the details under the first lines: label and value side by side, from the left */
:is(.dg-agenda-list, .dg-timeline-list, .dg-people-list) > .dg-card > .dg-card-field:not(:first-child) {
    justify-content: flex-start;
    gap: var(--dg-space-2);
}

:is(.dg-agenda-list, .dg-timeline-list, .dg-people-list) > .dg-card > .dg-card-field:not(:first-child) .col-data {
    text-align: left;
}

/* a long value there stays beside its label and wraps: these lists are one wide column (under its label, an offer's
   "Message" stood alone on a line above a short sentence) */
:is(.dg-agenda-list, .dg-timeline-list, .dg-people-list) > .dg-card > .dg-card-field[data-long]:not(:first-child) {
    flex-direction: row;
    align-items: baseline;
}

/* ...and its label keeps half the card at most: [data-long] lifts the cap for labels above their value, and a long
   label beside a long value took the line ("Someone else picks up today" left the person's name one letter wide) */
:is(.dg-agenda-list, .dg-timeline-list, .dg-people-list) > .dg-card > .dg-card-field[data-long]:not(:first-child) > .col-lable {
    flex: none;
    max-width: 50%;
}

:is(.dg-agenda-list, .dg-timeline-list) > .dg-card > .dg-card-field:nth-child(2) {
    font-size: var(--dg-font-size);
    font-weight: 600;
}

:is(.dg-agenda-list, .dg-timeline-list) > .dg-card > .dg-card-field:nth-child(2) .col-lable {
    display: none;
}

/* agenda (what is coming up): one column; the date or time stands at the left of each item, what and where at
   its right */
.dg-card-list.dg-agenda-list {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--dg-space-2);
}

.dg-agenda-list > .dg-card {
    position: relative;
    min-height: 4.25rem;
    padding-left: calc(var(--dg-space-3) + 10.5rem + var(--dg-space-4));
}

.dg-agenda-list > .dg-card > .dg-card-field:first-child {
    position: absolute;
    top: var(--dg-space-3);
    left: var(--dg-space-3);
    box-sizing: border-box;
    width: 10.5rem;
    margin: 0;
    padding: var(--dg-space-2);
    color: var(--dg-primary);
    background-color: var(--dg-primary-soft);
    border-radius: var(--dg-radius-sm);
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    line-height: 1.3;
}

.dg-agenda-list > .dg-card > .dg-card-field:first-child .col-data {
    overflow-wrap: break-word;
}

/* the date as a calendar leaf, as the app draws it (pages_app.js drawAgendaDates): the weekday, the day, the month and
   any time; the value it is drawn from stays, hidden */
.dg-agenda-list > .dg-card:has(> .dg-card-field[data-leaf]:first-child) {
    padding-left: calc(var(--dg-space-3) + 4.5rem + var(--dg-space-4));
}

.dg-agenda-list > .dg-card > .dg-card-field[data-leaf]:first-child {
    width: 4.5rem;
    padding: var(--dg-space-2) 2px;
    color: var(--dg-text);
    background-color: var(--dg-surface-2);
}

.dg-card-field[data-leaf] > .col-lable,
.dg-card-field[data-leaf] > .col-data {
    display: none;
}

.dg-agenda-leaf {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
    text-align: center;
}

.dg-agenda-leaf-wd,
.dg-agenda-leaf-m {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dg-text-muted);
}

.dg-agenda-leaf-d {
    font-size: 1.35rem;
    font-weight: 700;
}

.dg-agenda-leaf-t {
    margin-top: var(--dg-space-1);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--dg-primary);
    font-variant-numeric: tabular-nums;
}

.dg-agenda-leaf > span:empty {
    display: none;
}

/* an item that waits on the viewer (a dg-todo badge: Late) says so on its leaf too */
.dg-agenda-list > .dg-card:has(.dg-todo:is([data-todo="true"], [data-todo="1"], [data-todo="True"])) .dg-agenda-leaf-wd {
    color: var(--dg-warning);
}

/* what kind an item is (a calendar entry, an HR date): a chip in the kind's colour, at the item's top right */
.dg-kind {
    --dg-kind-hue: var(--dg-text-muted);
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    color: color-mix(in srgb, var(--dg-kind-hue) 70%, var(--dg-text));
    background-color: color-mix(in srgb, var(--dg-kind-hue) 16%, transparent);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.dg-kind:is([data-kind="Meeting"], [data-kind="Staff meeting"], [data-kind="Board meeting"], [data-kind="Leave"]) {
    --dg-kind-hue: #5b8def;
}

.dg-kind:is([data-kind="Parent meeting"], [data-kind="Probation"]) {
    --dg-kind-hue: #9b7bea;
}

.dg-kind:is([data-kind="Event"], [data-kind="Review"]) {
    --dg-kind-hue: #34b884;
}

.dg-kind:is([data-kind="Exam"], [data-kind="Deadline"], [data-kind="Due"], [data-kind="Credential"]) {
    --dg-kind-hue: #e2a03f;
}

.dg-kind[data-kind="Sports"] {
    --dg-kind-hue: #8cc152;
}

.dg-kind[data-kind="Holiday"] {
    --dg-kind-hue: #3bb0a2;
}

.dg-card-field:has(.dg-kind:empty) {
    display: none;
}

.dg-agenda-list:not([group-by-first]) > .dg-card:has(.dg-kind:not(:empty)) {
    padding-right: 7.5rem;
}

.dg-agenda-list:not([group-by-first]) > .dg-card > .dg-card-field:has(.dg-kind) {
    position: absolute;
    top: var(--dg-space-3);
    right: var(--dg-space-3);
}

/* an agenda by day (view ModelList-Agenda-Grouped: the Calendar): each day's leaf at the left of its first item, the
   day's items at its right and a line between the days; an item's time, what (where and details under it), its kind */
.dg-card-list.dg-agenda-list[group-by-first] {
    gap: 0;
}

.dg-card-list.dg-agenda-list[group-by-first] > .dg-card {
    display: grid;
    /* the kind's column is wide enough for the item's Details button: hovering an item does not narrow its text */
    grid-template-columns: 6.5rem minmax(0, 1fr) minmax(6.5rem, auto);
    align-items: baseline;
    align-content: start;
    column-gap: var(--dg-space-4);
    row-gap: 2px;
    min-height: 0;
    margin: 0;
    padding: var(--dg-space-2) 0 var(--dg-space-2) calc(4rem + var(--dg-space-4));
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.dg-card-list.dg-agenda-list[group-by-first] > .dg-card[group-start] {
    padding-top: var(--dg-space-3);
}

.dg-card-list.dg-agenda-list[group-by-first] > .dg-card[group-start]:not(:first-child) {
    border-top: 1px solid var(--dg-border);
}

.dg-card-list.dg-agenda-list[group-by-first] > .dg-card[group-end] {
    padding-bottom: var(--dg-space-3);
}

/* a day of one item is as tall as its leaf */
.dg-card-list.dg-agenda-list[group-by-first] > .dg-card[group-start][group-end] {
    min-height: 4.75rem;
}

/* an item's actions, shown while it is hovered: under its kind, at the right of its second and third lines, where
   the item is empty (as a grid cell of their own they sat beside its last line and pushed it down; as a row under
   the item every hover moved the rest of the day down) */
.dg-card-list.dg-agenda-list[group-by-first] > .dg-card > popup[card-actions] {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    align-self: start;
    justify-content: flex-end;
    /* taller than a line of the item's small text: it hangs below its row rather than making the row (and the item)
       taller, so an item of two lines does not grow either */
    margin: 0 0 -12px;
    padding: 0;
    border-top: 0;
}

/* an item without a kind (attendance by day: one line each): its first line's right end is free */
.dg-card-list.dg-agenda-list[group-by-first] > .dg-card:not(:has(.dg-kind:not(:empty))) > popup[card-actions] {
    grid-row: 1;
}

/* the leaf: out of the item's grid (grid-column auto: placed against the item's own edge, not a column's) */
.dg-card-list.dg-agenda-list[group-by-first] > .dg-card > .dg-card-field:first-child {
    grid-column: auto;
    grid-row: auto;
    top: var(--dg-space-3);
    left: 0;
    width: 4rem;
    margin: 0;
    padding: 0;
    background: none;
}

.dg-card-list.dg-agenda-list[group-by-first] > .dg-card:not([group-start]) > .dg-card-field:first-child {
    display: none;
}

.dg-card-list.dg-agenda-list[group-by-first] .dg-agenda-leaf-d {
    font-size: 1.5rem;
    line-height: 1.1;
}

.dg-card-list.dg-agenda-list[group-by-first] > .dg-card > .dg-card-field:nth-child(2) {
    grid-column: 1;
    grid-row: 1;
    font-size: var(--dg-font-size-sm);
    font-weight: 400;
    color: var(--dg-text-muted);
    font-variant-numeric: tabular-nums;
}

.dg-card-list.dg-agenda-list[group-by-first] > .dg-card > .dg-card-field:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    font-weight: 600;
}

.dg-card-list.dg-agenda-list[group-by-first] > .dg-card > .dg-card-field:nth-child(n + 4) {
    grid-column: 2;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-card-list.dg-agenda-list[group-by-first] > .dg-card > .dg-card-field:has(.dg-kind) {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;   /* at the right edge, also when the item's actions (under it) are wider than it */
    color: inherit;
}

/* timeline (what happened, newest first): the items hang on a line, each at a dot; its time above it, small */
.dg-card-list.dg-timeline-list {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--dg-space-3);
    padding-left: calc(var(--dg-space-3) + 26px);
}

.dg-timeline-list::before {
    position: absolute;
    top: var(--dg-space-4);
    bottom: var(--dg-space-4);
    left: calc(var(--dg-space-3) + 9px);
    width: 2px;
    background-color: var(--dg-border-strong);
    border-radius: 1px;
    content: "";
}

.dg-timeline-list > .dg-card {
    position: relative;
}

.dg-timeline-list > .dg-card::before {
    position: absolute;
    top: 15px;
    left: -24px;
    width: 12px;
    height: 12px;
    background-color: var(--dg-surface);
    border: 2px solid var(--dg-primary);
    border-radius: 50%;
    content: "";
}

.dg-timeline-list > .dg-card > .dg-card-field:first-child {
    margin: 0;
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
}

/* people: each card shows its person's initials (pages_app.js markPeopleCards), the name, then role, group and how to
   reach them */
.dg-card-list.dg-people-list {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.dg-people-list {
    --dg-avatar-l: 70%;
}

:root:is([data-theme="light"], [data-theme="indigo"]) .dg-people-list {
    --dg-avatar-l: 32%;
}

.dg-people-list > .dg-card {
    position: relative;
    min-height: 4.5rem;
    padding-left: calc(var(--dg-space-4) + 50px);
}

.dg-people-list > .dg-card::before {
    position: absolute;
    top: var(--dg-space-3);
    left: var(--dg-space-3);
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: hsl(var(--dg-avatar-hue, 172) 55% var(--dg-avatar-l));
    background-color: hsl(var(--dg-avatar-hue, 172) 55% 50% / 0.16);
    border-radius: 50%;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    content: attr(data-initials);
}

.dg-people-list .dg-value-link {
    color: var(--dg-primary);
}

/* stats (a few things, each with its figures): the name across the top, each figure a tile with its label under it */
.dg-card-list.dg-stats-list {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.dg-stats-list > .dg-card {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    grid-auto-flow: row dense;
    align-content: start;
    gap: var(--dg-space-2);
}

.dg-stats-list > .dg-card > * {
    grid-column: 1 / -1;
}

/* the figures first, then the other details, then the actions */
.dg-stats-list > .dg-card > .dg-card-field:not(:first-child) {
    order: 1;
}

.dg-stats-list > .dg-card > popup[card-actions] {
    order: 2;
}

.dg-stats-list > .dg-card > .dg-card-field:has(> .col-data > :is([view-name="intList"], [view-name="bigintList"], [view-name="smallintList"],
    [view-name="tinyintList"], [view-name="decimalList"], [view-name="numericList"], [view-name="floatList"], [view-name="realList"],
    [view-name="moneyList"], [view-name="smallmoneyList"])):not(:first-child) {
    order: 0;
    grid-column: auto;
    flex-direction: column-reverse;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 2px;
    padding: var(--dg-space-2);
    background-color: var(--dg-surface-2);
    border-radius: var(--dg-radius-sm);
}

.dg-stats-list > .dg-card > .dg-card-field:has(> .col-data > :is([view-name="intList"], [view-name="bigintList"], [view-name="smallintList"],
    [view-name="tinyintList"], [view-name="decimalList"], [view-name="numericList"], [view-name="floatList"], [view-name="realList"],
    [view-name="moneyList"], [view-name="smallmoneyList"])):not(:first-child) .col-data {
    text-align: left;
    color: var(--dg-text);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow-wrap: normal;
}

.dg-stats-list > .dg-card > .dg-card-field:has(> .col-data > :is([view-name="intList"], [view-name="bigintList"], [view-name="smallintList"],
    [view-name="tinyintList"], [view-name="decimalList"], [view-name="numericList"], [view-name="floatList"], [view-name="realList"],
    [view-name="moneyList"], [view-name="smallmoneyList"])):not(:first-child) .col-lable {
    text-align: left;
    font-size: 12px;
    line-height: 1.25;
}

@media (max-width: 640px) {
    /* the date or time above what it is, not beside it */
    .dg-agenda-list > .dg-card {
        min-height: 0;
        padding-left: var(--dg-space-4);
    }

    .dg-agenda-list > .dg-card > .dg-card-field:first-child {
        position: static;
        align-self: flex-start;
        width: auto;
        margin-bottom: var(--dg-space-1);
    }

    /* a leaf is small enough to stay at the left */
    .dg-agenda-list > .dg-card:has(> .dg-card-field[data-leaf]:first-child) {
        padding-left: calc(var(--dg-space-3) + 3.5rem + var(--dg-space-3));
    }

    .dg-agenda-list > .dg-card > .dg-card-field[data-leaf]:first-child {
        position: absolute;
        width: 3.5rem;
        margin: 0;
    }

    .dg-agenda-list:not([group-by-first]) > .dg-card:has(.dg-kind:not(:empty)) {
        padding-right: var(--dg-space-3);
    }

    .dg-agenda-list:not([group-by-first]) > .dg-card > .dg-card-field:has(.dg-kind) {
        position: static;
    }

    /* an agenda by day: the time and kind on a line, what under them */
    .dg-card-list.dg-agenda-list[group-by-first] > .dg-card {
        grid-template-columns: minmax(0, 1fr) auto;
        padding-left: calc(3.25rem + var(--dg-space-3));
    }

    .dg-card-list.dg-agenda-list[group-by-first] > .dg-card > .dg-card-field:first-child {
        width: 3.25rem;
    }

    .dg-card-list.dg-agenda-list[group-by-first] > .dg-card > .dg-card-field:nth-child(3),
    .dg-card-list.dg-agenda-list[group-by-first] > .dg-card > .dg-card-field:nth-child(n + 4) {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .dg-card-list.dg-agenda-list[group-by-first] > .dg-card > .dg-card-field:has(.dg-kind) {
        grid-column: 2;
        grid-row: 1;
    }

    .dg-card-list.dg-timeline-list {
        padding-left: calc(var(--dg-space-2) + 24px);
    }

    .dg-timeline-list::before {
        left: calc(var(--dg-space-2) + 8px);
    }
}

/* phones: a grouped item is its name and count on one line, the bar under them */
@media (max-width: 640px) {
    .dg-card-list {
        grid-template-columns: minmax(0, 1fr);
        padding: var(--dg-space-2);
    }

    .dg-card-list[group-by-first] > .dg-card {
        grid-template-columns: minmax(0, 1fr) auto;
        row-gap: var(--dg-space-1);
    }

    .dg-card-list[group-by-first] > .dg-card > .dg-card-field:first-child {
        order: -1;
    }

    .dg-card-list[group-by-first] > .dg-card > .dg-card-field:has(.dg-pct-bar),
    .dg-card-list[group-by-first] > .dg-card > .dg-card-field:has(.dg-choices) {
        grid-column: 1 / -1;
        order: 1;
    }
}

@media (max-width: 900px) {
    :root {
        --dg-gutter: var(--dg-space-4);
        --dg-label-width: 150px;
    }
}

@media (max-width: 640px) {
    :root {
        --dg-gutter: var(--dg-space-3);
        --dg-font-size: 16px; /* 16px inputs: no zoom-on-focus on iOS */
    }

    .h1 {
        font-size: 1.35rem;
    }

    #page-container.dg-content {
        padding-top: var(--dg-space-4);
    }

    /* forms: label above control */
    .modelform {
        padding: var(--dg-space-3);
    }

    .modelform .modelform-col {
        grid-template-columns: minmax(0, 1fr);
        row-gap: var(--dg-space-1);
    }

    .modelform .col-lable {
        text-align: left;
    }

    .modelform .col-data {
        max-width: none;
    }

    .modelform-group-content {
        padding: var(--dg-space-1) var(--dg-space-3);
    }

    /* toolbar: still two columns; the right-hand commands stack in their narrow column */
    .sec-head > table > tbody > tr > td:last-child .flex-row-right {
        flex-direction: column;
        align-items: stretch;
    }

    .sec-head-item {
        padding: 8px 12px;
    }

    /* filters: one per row */
    .query-group .group-content {
        grid-template-columns: minmax(0, 1fr);
    }

    /* query commands: still two columns; info items stack on the left, compact buttons on the right */
    .query-command.flex-row-left > div {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--dg-space-2);
    }

    .query-command > [exec='clear'],
    .query-command > [exec='+filter'] {
        width: 40px;
        padding: 0;
        justify-content: center;
    }

    .query-command > [exec='clear']::after,
    .query-command > [exec='+filter']::after {
        content: none;
    }

    .query-command > [exec='search'] {
        padding: 0 var(--dg-space-3);
    }

    /* tables scroll sideways inside the card; the first column stays visible */
    .d-table {
        min-width: 600px;
    }

    .d-table td {
        white-space: nowrap;
    }

    .d-table th:first-child,
    .d-table td:first-child {
        position: sticky;
        left: 0;
        min-width: 140px;
        max-width: 200px;
        white-space: normal;
        background-color: var(--dg-surface);
        box-shadow: 1px 0 0 var(--dg-border);
    }

    /* the first column's text wraps inside its cell instead of running over the next column */
    .d-table td:first-child .dg-cell-text {
        display: inline;
        max-width: none;
        overflow: visible;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .d-table th:first-child {
        z-index: 2;
        background-color: var(--dg-surface-2);
    }

    [templateitem][selected] > td:first-child,
    [templateitem][highlighted] > td:first-child {
        background-color: var(--dg-primary-soft);
    }

    /* inline row menu: both columns stay; each lists its items vertically */
    [inline-menu] popup > div {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        padding: 0 var(--dg-space-3);
    }

    [inline-menu] popup > .operation-menu-items {
        flex: 0 0 auto;
        max-width: 40%;
    }

    /* dialogs: near full width */
    .dg-container.overlay {
        padding: 0 var(--dg-space-2);
    }

    .overlay-dialog {
        padding: var(--dg-space-4);
        border-radius: var(--dg-radius);
    }

    .tile-container {
        grid-template-columns: minmax(0, 1fr);
    }

    .jumbotron {
        font-size: 1.3rem;
        padding: var(--dg-space-5) var(--dg-space-3);
    }

    .menu .link {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }

    .tile-item.largetile:hover {
        transform: none;
    }

    .dg-home-alert.tone-urgent {
        animation: none;
    }
}

/* ---------------------------------------------------------------- the messenger (dg-chat.js, Messages > Inbox) */
.dg-chat {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    box-sizing: border-box;
    height: var(--dg-chat-height, calc(100vh - 210px));   /* to the bottom of the screen, 16px short (dg-chat.js measures where it starts) */
    min-height: 460px;
    overflow: hidden;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow-sm);
}

/* a page showing the messenger: its 16px gap is the page's only space below it (nothing to scroll) */
#page-container.dg-content:has(> .dg-page[active] .dg-chat) { padding-bottom: 16px; }
.page-content-group-item:has(> .dg-chat) { margin-bottom: 0; }

.dg-chat-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    border-right: 1px solid var(--dg-border);
}

.dg-chat-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--dg-space-3) var(--dg-space-4) 0;
}

.dg-chat-side-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.dg-chat-new,
.dg-chat-attach,
.dg-chat-mic,
.dg-chat-send,
.dg-chat-back {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    padding: 0;
    color: var(--dg-text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

/* its "+" is drawn, two bars on the circle's centre: the text "+" sat on the font's baseline, 7 px low */
.dg-chat-new {
    position: relative;
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    font-size: 0;
}

.dg-chat-new::before,
.dg-chat-new::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    background-color: currentColor;
    border-radius: 1px;
    transform: translate(-50%, -50%);
}

.dg-chat-new::after {
    width: 2px;
    height: 14px;
}

.dg-chat-attach:hover,
.dg-chat-mic:hover,
.dg-chat-back:hover {
    background-color: var(--dg-primary-soft);
}

.dg-chat-search {
    margin: var(--dg-space-3) var(--dg-space-4);
    padding: 8px 14px;
    color: var(--dg-text);
    background-color: var(--dg-bg);
    border: 1px solid var(--dg-border);
    border-radius: 999px;
    font: inherit;
}

.dg-chat-list {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0 var(--dg-space-2) var(--dg-space-2);
    overflow-y: auto;
    list-style: none;
}

.dg-chat-item {
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
    width: 100%;
    padding: 10px var(--dg-space-2);
    text-align: left;
    color: var(--dg-text);
    background: transparent;
    border: 0;
    border-radius: var(--dg-radius);
    font: inherit;
    cursor: pointer;
}

.dg-chat-item:hover,
.dg-chat-item:focus-visible {
    background-color: var(--dg-primary-soft);
    color: var(--dg-text);   /* not button:hover's dark text (meant for a teal fill): the name went dark on dark */
}

.dg-chat-item.is-active {
    background-color: var(--dg-primary-soft);
    box-shadow: inset 3px 0 0 var(--dg-primary);
}

.dg-chat-avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    color: #fff;
    background-color: hsl(var(--h, 200) 45% 42%);
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.dg-chat-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.dg-chat-item-top,
.dg-chat-item-bottom {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
    min-width: 0;
}

.dg-chat-item-title,
.dg-chat-item-last {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.dg-chat-item-title {
    font-weight: 600;
}

.dg-chat-item-last,
.dg-chat-item-time {
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
}

.dg-chat-item.is-unread .dg-chat-item-last,
.dg-chat-item.is-unread .dg-chat-item-time {
    color: var(--dg-text);
    font-weight: 600;
}

.dg-chat-badge {
    flex: none;
    min-width: 20px;
    padding: 1px 7px;
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.dg-chat-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background-color: var(--dg-bg);
}

.dg-chat-head {
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
    padding: var(--dg-space-3) var(--dg-space-4);
    background-color: var(--dg-surface);
    border-bottom: 1px solid var(--dg-border);
}

.dg-chat-head-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dg-chat-head-text span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
}

.dg-chat-back {
    display: none;
    font-size: 1.8rem;
}

.dg-chat-thread {
    flex: 1;
    min-height: 0;
    padding: var(--dg-space-4);
    overflow-y: auto;
}

.dg-chat-day {
    display: flex;
    justify-content: center;
    margin: var(--dg-space-3) 0;
}

.dg-chat-day span {
    padding: 3px 12px;
    color: var(--dg-text-muted);
    background-color: var(--dg-surface);
    border-radius: 999px;
    font-size: 0.78rem;
}

.dg-chat-row {
    display: flex;
    margin: 3px 0;
}

.dg-chat-row.is-mine {
    justify-content: flex-end;
}

.dg-chat-bubble {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: min(72%, 560px);
    padding: 8px 12px 6px;
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border-radius: 16px 16px 16px 4px;
    box-shadow: var(--dg-shadow-sm);
    overflow-wrap: anywhere;
}

.dg-chat-row.is-mine .dg-chat-bubble {
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-radius: 16px 16px 4px 16px;
}

.dg-chat-bubble.is-deleted {
    font-style: italic;
    opacity: 0.7;
}

.dg-chat-sender {
    color: hsl(var(--h, 200) 60% 55%);
    font-size: 0.8rem;
    font-weight: 700;
}

.dg-chat-text {
    white-space: pre-wrap;
}

.dg-chat-meta {
    align-self: flex-end;
    font-size: 0.7rem;
    opacity: 0.75;
}

/* mine: one tick sent, two seen (Messaging/30) */
.dg-chat-tick {
    letter-spacing: -0.15em;
    font-weight: 700;
}

.dg-chat-tick.is-seen {
    color: #7fe3ff;
}

/* a message's or a conversation's own actions (dg-chat.js moreButton): a quiet ⋯ that shows on hover or focus, as a
   list row's menu does; a touch screen, which has no hover, always shows it */
.dg-chat-more {
    flex: none;
    align-self: center;
    width: 30px;
    height: 30px;
    padding: 0;
    color: var(--dg-text-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 120ms ease-out, background-color 120ms ease-out;
}

.dg-chat-row:hover .dg-chat-more,
.dg-chat-li:hover .dg-chat-more,
.dg-chat-more:focus-visible,
.dg-chat-more[aria-expanded="true"] {
    opacity: 1;
}

.dg-chat-more:hover {
    background-color: var(--dg-surface-2);
    color: var(--dg-text);
}

@media (hover: none) {
    .dg-chat-more {
        opacity: 0.7;
    }
}

.dg-chat-row {
    align-items: center;
    gap: 4px;
}

.dg-chat-li {
    position: relative;
}

.dg-chat-li > .dg-chat-more {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--dg-surface);
}

.dg-chat-menu {
    position: fixed;
    z-index: 10020;
    display: flex;
    flex-direction: column;
    min-width: 160px;
    padding: 6px;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: 12px;
    box-shadow: var(--dg-shadow-lg, 0 8px 28px rgba(0, 0, 0, 0.18));
    animation: dg-chat-menu-in 120ms ease-out;
}

@keyframes dg-chat-menu-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.dg-chat-menu button {
    padding: 9px 12px;
    color: var(--dg-text);
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
}

.dg-chat-menu button:hover,
.dg-chat-menu button:focus-visible {
    background-color: var(--dg-primary-soft);
    outline: none;
}

.dg-chat-menu button.is-danger {
    color: var(--dg-danger);
}

.dg-chat-archived-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
    color: var(--dg-text-muted);
}

/* a message of mine edited in place */
.dg-chat-edit {
    min-width: min(420px, 60vw);
    padding: 6px 8px;
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: 8px;
    font: inherit;
    resize: vertical;
}

.dg-chat-edit-bar {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.dg-chat-photo img {
    display: block;
    max-width: 100%;
    max-height: 320px;
    border-radius: 10px;
}

.dg-chat-voice {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
}

.dg-chat-voice audio {
    width: 240px;
    max-width: 100%;
    height: 36px;
}

.dg-chat-voice-len {
    font-size: 0.75rem;
    opacity: 0.8;
}

.dg-chat-file {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
    padding: 8px 10px;
    color: inherit;
    background-color: rgba(127, 127, 127, 0.15);
    border-radius: 10px;
    text-decoration: none;
}

.dg-chat-file-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 600;
}

.dg-chat-composer {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--dg-space-2);
    padding: var(--dg-space-2) var(--dg-space-3);
    background-color: var(--dg-surface);
    border-top: 1px solid var(--dg-border);
}

.dg-chat-input {
    flex: 1;
    min-width: 0;
    height: 40px;          /* one line; it grows as more is written (dg-chat.js fitInput) */
    min-height: 40px;
    max-height: 160px;
    padding: 9px 14px;
    color: var(--dg-text);
    background-color: var(--dg-bg);
    border: 1px solid var(--dg-border);
    border-radius: 20px;
    font: inherit;
    line-height: 1.35;
    resize: none;
}

.dg-chat-send {
    display: none;
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
}

/* the voice-note button while nothing is written, the send button once something is */
.dg-chat-composer.has-text .dg-chat-send {
    display: inline-grid;
}

.dg-chat-composer.has-text .dg-chat-mic {
    display: none;
}

.dg-chat-status {
    flex-basis: 100%;
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
}

.dg-chat-status:empty {
    display: none;
}

.dg-chat-recording {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
    padding: 0 var(--dg-space-4);
    background-color: var(--dg-surface);
}

.dg-chat-rec-dot {
    width: 12px;
    height: 12px;
    background-color: var(--dg-danger);
    border-radius: 50%;
    animation: dg-chat-pulse 1s ease-in-out infinite;
}

@keyframes dg-chat-pulse {
    50% { opacity: 0.3; }
}

.dg-chat-rec-time {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.dg-chat-rec-label {
    flex: 1;
    color: var(--dg-text-muted);
}

.dg-chat-rec-cancel,
.dg-chat-rec-send {
    padding: 6px 14px;
    color: var(--dg-text);
    background: transparent;
    border: 1px solid var(--dg-border-strong);
    border-radius: 999px;
    font: inherit;
    cursor: pointer;
}

.dg-chat-rec-send {
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border-color: var(--dg-primary);
}

.dg-chat-empty {
    display: grid;
    flex: 1;
    place-content: center;
    gap: var(--dg-space-3);
    color: var(--dg-text-muted);
    text-align: center;
}

.dg-chat-note {
    padding: var(--dg-space-3);
    color: var(--dg-text-muted);
    text-align: center;
}

.dg-chat-contacts {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background-color: var(--dg-surface);
}

/* a phone: one pane at a time (the list, or the open conversation with a back button) */
@media (max-width: 760px) {
    .dg-chat {
        grid-template-columns: minmax(0, 1fr);   /* not 1fr: a long last message (one line) widened the list past the screen */
        height: calc(100dvh - 24px);   /* the visible screen; opening a conversation scrolls it into view */
        min-height: 360px;
        border-radius: var(--dg-radius);
    }

    .dg-chat .dg-chat-main {
        display: none;
    }

    .dg-chat.is-thread .dg-chat-side {
        display: none;
    }

    .dg-chat.is-thread .dg-chat-main {
        display: flex;
    }

    .dg-chat-back {
        display: inline-grid;
    }

    .dg-chat-bubble {
        max-width: 85%;
    }
}

/* ---------------------------------------------------------------- My account > Sign-in and security (dg-account.js) */
.dg-login-field[hidden] { display: none; }
.dg-account { display: grid; gap: var(--dg-space-4); max-width: 760px; }
.dg-account-who { color: var(--dg-text-muted); margin: 0; }
.dg-account-box {
    background: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    padding: var(--dg-space-4) var(--dg-space-5);
    display: grid;
    gap: var(--dg-space-3);
}
.dg-account-box h3 { margin: 0; font-size: 1.05em; }
.dg-account-field { display: grid; gap: 4px; max-width: var(--dg-control-max); }
.dg-account-field > span { font-size: var(--dg-font-size-sm); color: var(--dg-text-muted); }
.dg-account-field small { color: var(--dg-text-muted); font-size: var(--dg-font-size-sm); }
.dg-account-field input, .dg-account-field select {
    font: inherit;
    padding: 8px 10px;
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-sm);
    background: var(--dg-bg);
    color: var(--dg-text);
}
.dg-account-field input:focus, .dg-account-field select:focus { outline: 2px solid var(--dg-focus); outline-offset: 1px; }
.dg-account-box > .dg-btn, .dg-account-box .dg-btn { justify-self: start; }
.dg-account-note { margin: 0; color: var(--dg-text-muted); }
.dg-account-done { color: var(--dg-success); font-weight: 600; }
.dg-account-on { color: var(--dg-success); }
.dg-account-warn { color: var(--dg-warning); font-weight: 600; }
.dg-account-setup ol { margin: 0; padding-left: 1.2em; display: grid; gap: var(--dg-space-3); }
.dg-account-setup code, .dg-account-codes code { font-size: 1.05em; letter-spacing: 0.06em; user-select: all; }
.dg-account-qr svg { display: block; margin-top: var(--dg-space-2); max-width: 220px; height: auto; border-radius: var(--dg-radius-sm); }
.dg-account-codes { border: 1px dashed var(--dg-warning); border-radius: var(--dg-radius-sm); padding: var(--dg-space-3); }
.dg-account-codes ul { columns: 2; margin: 0; padding-left: 1.2em; }
.dg-account-list { margin: 0; padding-left: 1.2em; display: grid; gap: 2px; }
.dg-account-failed { color: var(--dg-danger); }
@media (max-width: 600px) {
    .dg-account-box { padding: var(--dg-space-3); }
    .dg-account-codes ul { columns: 1; }
}


/* ---------------------------------------------------------------- Recover your account (dg-recover.js) */
.dg-recover-card button.dg-btn-block,
.dg-recover-card a.dg-btn-block {
    height: 44px;
    margin-top: var(--dg-space-2);
    font: inherit;
    font-weight: 650;
    text-align: center;
    text-decoration: none;
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border: 1px solid var(--dg-primary);
    border-radius: var(--dg-radius-sm);
    cursor: pointer;
}

.dg-recover-card a.dg-btn-block {
    display: grid;
    place-items: center;
    box-sizing: border-box;
}

.dg-recover-card button.dg-btn-block:hover,
.dg-recover-card a.dg-btn-block:hover {
    background-color: var(--dg-primary-hover);
}

.dg-recover-card button.dg-btn-block:disabled {
    opacity: 0.7;
    cursor: progress;
}

.dg-recover-hint {
    display: block;
    margin-top: var(--dg-space-1);
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-recover-note {
    margin: 0 0 var(--dg-space-3);
    padding: var(--dg-space-2) var(--dg-space-3);
    font-size: var(--dg-font-size-sm);
    border-radius: var(--dg-radius-sm);
}

.dg-recover-note.error {
    color: var(--dg-danger);
    background-color: var(--dg-danger-soft);
}

.dg-recover-note.ok {
    color: var(--dg-success);
    background-color: color-mix(in srgb, var(--dg-success) 14%, transparent);
}

.dg-recover-note[hidden] {
    display: none;
}

.dg-recover-help {
    margin: var(--dg-space-4) 0 0;
    padding-top: var(--dg-space-4);
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
    border-top: 1px solid var(--dg-border);
}

.dg-recover-ok {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: var(--dg-space-3);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dg-success);
    background-color: color-mix(in srgb, var(--dg-success) 16%, transparent);
    border-radius: 50%;
}

.dg-recover-card .dg-login-links {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------- creating an account (login/signup, verify, userid_password, complete)
   The steps' generated forms shown as the sign-in card: one narrow column, the step and a progress bar over the title,
   labels above full-width fields, the step's button across the card. */
.dg-page:is(#signup, #verify, #userid_password, #complete) {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--dg-space-5) 0 var(--dg-space-6);
}

.dg-page:is(#signup, #verify, #userid_password, #complete) > .dg-container-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--dg-space-5);
    text-align: center;
}

.dg-page:is(#signup, #verify, #userid_password, #complete) > .dg-container-head > .dg-content {
    float: none;
    text-align: center;
}

.dg-page:is(#signup, #verify, #userid_password, #complete) > .dg-container-head .h1 {
    font-size: 1.6rem;
}

.dg-page:is(#signup, #verify, #userid_password) > .dg-container-head::before {
    margin-bottom: var(--dg-space-2);
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dg-primary);
}

.dg-page#signup > .dg-container-head::before { content: "Step 1 of 3 \00B7  Your details"; }
.dg-page#verify > .dg-container-head::before { content: "Step 2 of 3 \00B7  Your email"; }
.dg-page#userid_password > .dg-container-head::before { content: "Step 3 of 3 \00B7  How you sign in"; }

.dg-page:is(#signup, #verify, #userid_password) > .dg-container-head::after {
    content: "";
    width: min(260px, 70%);
    height: 4px;
    margin-top: var(--dg-space-4);
    border-radius: 2px;
    background: linear-gradient(var(--dg-primary), var(--dg-primary)) no-repeat, var(--dg-border);
    background-size: 33.3% 100%, auto;
}

.dg-page#verify > .dg-container-head::after { background-size: 66.6% 100%, auto; }
.dg-page#userid_password > .dg-container-head::after { background-size: 100% 100%, auto; }

.dg-page#complete > .dg-container-head::before {
    content: "\2713";
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: var(--dg-space-3);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--dg-success);
    background-color: color-mix(in srgb, var(--dg-success) 16%, transparent);
    border-radius: 50%;
}

/* the form, as a card (the groups inside it lose their own boxes) */
.dg-page:is(#signup, #verify, #userid_password) .modelform-group-content {
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
}

.dg-page#complete {
    margin-top: 8vh;
    padding: var(--dg-space-6) var(--dg-space-5);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow);
}

/* the form, as a card */
.dg-page:is(#signup, #verify, #userid_password) [modsec] {
    padding: var(--dg-space-5);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow);
}

.dg-page:is(#signup, #verify, #userid_password) [modsec] .sec-body,
.dg-page:is(#signup, #verify, #userid_password) [modsec] .edit-content-area,
.dg-page:is(#signup, #verify, #userid_password) [modsec] .modelform {
    padding: 0;
    margin: 0;
    background: none;
    border: 0;
    box-shadow: none;
}

.dg-page:is(#signup, #verify, #userid_password) fieldset.modelform-group {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
}

.dg-page:is(#signup, #verify, #userid_password) .modelform-group > legend,
.dg-page:is(#signup, #verify, #userid_password) .modelform-group-title {
    display: block;
    margin: 0 0 var(--dg-space-4);
    padding: 0;
    font-size: 1.05rem;
    font-weight: 650;
    text-align: left;
    color: var(--dg-text);
}

.dg-page:is(#signup, #verify, #userid_password) .group-separator {
    height: 0;
    margin: var(--dg-space-2) 0 var(--dg-space-4);
    border: 0;
    border-top: 1px solid var(--dg-border);
}

.dg-page:is(#signup, #verify, #userid_password) .modelform-row {
    display: block;
    margin: 0 0 var(--dg-space-4);
    padding: 0;
}

.dg-page:is(#signup, #verify, #userid_password) .modelform-col {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--dg-space-1);
    width: 100%;
    margin: 0;
    padding: 0;
}

.dg-page:is(#signup, #verify, #userid_password) .modelform-col > .col-lable {
    width: auto;
    max-width: none;
    padding: 0;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    text-align: left;
    color: var(--dg-text-muted);
}

.dg-page:is(#signup, #verify, #userid_password) .modelform-col > .col-data {
    width: 100%;
    max-width: none;
}

.dg-page:is(#signup, #verify, #userid_password) .col-data > :is(input, dropdown, select) {
    width: 100%;
    max-width: none;
    min-height: 44px;
    box-sizing: border-box;
}

/* the step's button across the card */
.dg-page:is(#signup, #verify, #userid_password, #complete) nav.menu-container {
    margin-top: var(--dg-space-2);
    padding: 0;
}

.dg-page:is(#signup, #verify, #userid_password, #complete) nav.menu-container :is(.menu, .menu-item-group, .menu-item) {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
}

.dg-page:is(#signup, #verify, #userid_password, #complete) nav.menu-container .link {
    display: grid;
    place-items: center;
    width: 100%;
    height: 46px;
    box-sizing: border-box;
    font-weight: 650;
    color: var(--dg-text-inverse);
    background-color: var(--dg-primary);
    border: 1px solid var(--dg-primary);
    border-radius: var(--dg-radius-sm);
    cursor: pointer;
}

.dg-page:is(#signup, #verify, #userid_password, #complete) nav.menu-container .link:hover {
    background-color: var(--dg-primary-hover);
}

.dg-page#complete .page-content-group-item {
    max-width: 320px;
    margin: 0 auto;
}

.dg-page:is(#signup, #verify, #userid_password, #complete) .dg-login-links {
    margin-top: var(--dg-space-4);
}

@media (max-width: 640px) {
    .dg-page:is(#signup, #verify, #userid_password, #complete) {
        padding-top: var(--dg-space-3);
    }

    .dg-page:is(#signup, #verify, #userid_password) [modsec] {
        padding: var(--dg-space-4);
    }
}

/* My account: the sign-ins of the people in one's care */
.dg-account-kids {
    padding-left: 0;
    list-style: none;
    gap: var(--dg-space-3);
}

.dg-account-kid {
    padding: var(--dg-space-3);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-sm);
}

.dg-account-kid details {
    display: grid;
    gap: var(--dg-space-2);
    margin-top: var(--dg-space-2);
}

.dg-account-kid summary {
    color: var(--dg-primary);
    font-weight: 600;
    cursor: pointer;
}

/* ==== Calls (dg-call.js; the buttons in dg-chat.js) ================================================================ */

.dg-chat-calls {
    display: flex;
    gap: var(--dg-space-1, 4px);
    margin-left: auto;
}

.dg-chat-call {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--dg-primary);
    cursor: pointer;
}

.dg-chat-call svg { width: 22px; height: 22px; }
.dg-chat-call:hover:not(:disabled) { background-color: var(--dg-primary-soft); }
.dg-chat-call:focus-visible { outline: 2px solid var(--dg-focus); outline-offset: 2px; }
.dg-chat-call:disabled { color: var(--dg-text-muted); opacity: 0.6; cursor: not-allowed; }
.dg-chat-call[hidden] { display: none; }

.dg-call {
    position: fixed;
    z-index: 10000;
    font-family: var(--dg-font);
    color: #fff;
}

.dg-call-incoming,
.dg-call-active {
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 30%, #23413d 0%, #0d1514 70%);
}

.dg-call-incoming { background: rgba(5, 9, 9, 0.82); backdrop-filter: blur(6px); }

.dg-call-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--dg-space-2, 8px);
    padding: var(--dg-space-6, 32px) var(--dg-space-5, 24px);
    text-align: center;
    position: relative;
    z-index: 1;
}

.dg-call-avatar {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: #3bb0a2;
    color: #071f1c;
    font-size: 2.6rem;
    font-weight: 600;
    margin-bottom: var(--dg-space-3, 12px);
}

.dg-call-incoming .dg-call-avatar { animation: dg-call-pulse 1.6s ease-out infinite; }

@keyframes dg-call-pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 176, 162, 0.55); }
    100% { box-shadow: 0 0 0 28px rgba(59, 176, 162, 0); }
}

.dg-call-name { font-size: 1.5rem; font-weight: 600; }
.dg-call-status { color: rgba(255, 255, 255, 0.75); font-variant-numeric: tabular-nums; }

.dg-call-actions {
    display: flex;
    gap: var(--dg-space-6, 32px);
    margin-top: var(--dg-space-6, 32px);
}

.dg-call-bar {
    position: absolute;
    bottom: max(24px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    gap: var(--dg-space-5, 24px);
    z-index: 2;
}

.dg-call-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    cursor: pointer;
}

.dg-call-btn .dg-call-icon {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    transition: background-color 0.15s;
}

.dg-call-btn svg { width: 28px; height: 28px; }
.dg-call-btn:hover .dg-call-icon { background: rgba(255, 255, 255, 0.26); }
.dg-call-btn[aria-pressed="true"] .dg-call-icon { background: #fff; color: #10201e; }
.dg-call-btn.is-answer .dg-call-icon { background: #22a35a; }
.dg-call-btn.is-answer:hover .dg-call-icon { background: #2bbd6a; }
.dg-call-btn.is-end .dg-call-icon { background: #d93b3b; }
.dg-call-btn.is-end:hover .dg-call-icon { background: #ec4b4b; }
.dg-call-btn:focus-visible .dg-call-icon { outline: 3px solid #fff; outline-offset: 3px; }
.dg-call-btn[hidden] { display: none; }

.dg-call-remote,
.dg-call-local { display: none; background: #000; }

.dg-call-active.has-video .dg-call-remote {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dg-call-active.has-video .dg-call-card {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    left: 0;
    right: 0;
    padding: var(--dg-space-3, 12px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.dg-call-active.has-video .dg-call-avatar { display: none; }

.dg-call-active.has-local .dg-call-local {
    display: block;
    position: absolute;
    right: 16px;
    bottom: 120px;
    width: min(28vw, 200px);
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    transform: scaleX(-1);
    z-index: 2;
}

.dg-call-note {
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
    padding: 10px 18px;
    border-radius: 999px;
    background: #1d2a2a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    font-size: var(--dg-font-size-sm);
}

.dg-call-note.is-error { background: #9c2b2b; }

@media (prefers-reduced-motion: reduce) {
    .dg-call-incoming .dg-call-avatar { animation: none; }
}

/* ==== Group calls and live events (dg-room.js), the Join banner (dg-call.js), the Live page ======================= */

body.dg-room-open { overflow: hidden; }

.dg-room {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    background: #0d1514;
    color: #fff;
    font-family: var(--dg-font);
}

.dg-room-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    min-height: 52px;
}

.dg-room-title { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-room-count, .dg-room-status { color: rgba(255, 255, 255, 0.7); font-size: var(--dg-font-size-sm); }

.dg-room-live {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #d93b3b;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.dg-room-live .dg-room-icon svg { width: 14px; height: 14px; display: block; }

.dg-room-body { flex: 1; display: flex; min-height: 0; }
.dg-room-main { flex: 1; display: flex; gap: 8px; padding: 0 12px; min-width: 0; min-height: 0; }

.dg-room-stage { display: none; flex: 1; min-width: 0; min-height: 0; }
.dg-room.has-stage .dg-room-stage { display: flex; }

.dg-room-grid {
    flex: 1;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    align-content: center;
    min-height: 0;
}

.dg-room-grid[data-count="1"] { grid-template-columns: 1fr; }
.dg-room-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }

/* with a stage (a shared screen, the whiteboard), the cameras go into a strip beside it */
.dg-room.has-stage .dg-room-grid {
    flex: 0 0 220px;
    grid-template-columns: 1fr;
    grid-auto-rows: 124px;
    align-content: start;
    overflow-y: auto;
}

.dg-room-tile {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 120px;
    border-radius: 12px;
    background: #1c2a28;
    overflow: hidden;
    outline: 3px solid transparent;
    transition: outline-color 0.15s;
}

.dg-room-tile.is-speaking { outline-color: #3bb0a2; }
.dg-room-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.dg-room-tile.has-video video { display: block; }
.dg-room-tile.is-local video { transform: scaleX(-1); }
.dg-room-tile.has-video .dg-room-avatar { display: none; }

.dg-room-avatar {
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: hsl(var(--h, 170), 45%, 42%);
    color: #fff;
    font-size: 1.8rem;
    font-weight: 600;
}

.dg-room-avatar.is-small { width: 32px; height: 32px; font-size: 0.8rem; flex: none; }

.dg-room-tile-foot {
    position: absolute;
    left: 8px;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--dg-font-size-sm);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.dg-room-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-room-mic .dg-room-icon svg { width: 16px; height: 16px; display: block; }
.dg-room-mic.is-off { color: #ff8a8a; }
.dg-room-wait { grid-column: 1 / -1; text-align: center; color: rgba(255, 255, 255, 0.7); }

.dg-room-share-box { position: relative; flex: 1; display: grid; place-items: center; background: #000; border-radius: 12px; overflow: hidden; }
.dg-room-share { width: 100%; height: 100%; object-fit: contain; }
.dg-room-label { position: absolute; left: 12px; top: 12px; padding: 2px 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); font-size: var(--dg-font-size-sm); }

.dg-room-side {
    flex: 0 0 280px;
    padding: 0 16px 16px;
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.dg-room-side[hidden] { display: none; }
.dg-room-side h3 { font-size: 0.95rem; margin: 4px 0 12px; text-align: left; }
.dg-room-side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dg-room-person { display: flex; align-items: center; gap: 8px; }
.dg-room-person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--dg-font-size-sm); text-align: left; }
.dg-room-person-name em { color: #3bb0a2; font-style: normal; font-size: 12px; }

.dg-room-small {
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.dg-room-small:hover { background: rgba(255, 255, 255, 0.12); }

.dg-room-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 16px max(14px, env(safe-area-inset-bottom));
}

.dg-room-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    position: relative;
}

.dg-room-btn .dg-room-icon {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.dg-room-btn svg { width: 24px; height: 24px; }
.dg-room-btn:hover .dg-room-icon { background: rgba(255, 255, 255, 0.24); }
.dg-room-btn[aria-pressed="true"] .dg-room-icon { background: #fff; color: #10201e; }
.dg-room-btn.is-leave .dg-room-icon { background: #d93b3b; color: #fff; }
.dg-room-btn.is-leave:hover .dg-room-icon { background: #ec4b4b; }
.dg-room-btn:focus-visible .dg-room-icon { outline: 3px solid #fff; outline-offset: 2px; }
.dg-room-btn.has-news::after { content: ""; position: absolute; top: 2px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: #e2a03f; }

.dg-room-end {
    padding: 10px 16px;
    border: 1px solid #ec4b4b;
    border-radius: 999px;
    background: transparent;
    color: #ff9a9a;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    cursor: pointer;
}

.dg-room-toast {
    position: fixed;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    z-index: 10001;
    max-width: calc(100vw - 32px);
    padding: 10px 18px;
    border-radius: 999px;
    background: #1d2a2a;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    font-size: var(--dg-font-size-sm);
}

.dg-room-toast.is-error { background: #9c2b2b; }

/* the whiteboard */
.dg-wb { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }

.dg-wb-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}

.dg-wb-group { display: flex; gap: 4px; align-items: center; }

.dg-wb-tool, .dg-wb-size, .dg-wb-action {
    min-width: 36px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.dg-wb-tool[aria-pressed="true"], .dg-wb-size[aria-pressed="true"] { background: #fff; color: #10201e; }

.dg-wb-color {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: var(--c);
    cursor: pointer;
}

.dg-wb-color[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px #3bb0a2; }

.dg-wb-surface { position: relative; flex: 1; display: grid; place-items: center; min-height: 0; }
.dg-wb-canvas { background: #fff; border-radius: 8px; touch-action: none; cursor: crosshair; }

.dg-wb-input {
    position: absolute;
    min-width: 160px;
    padding: 2px 4px;
    border: 1px dashed #3bb0a2;
    background: rgba(255, 255, 255, 0.95);
    font: 20px "Segoe UI", system-ui, sans-serif;
    outline: none;
}

/* the Join banner for a group call going on */
.dg-call-banner {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100vw - 32px);
    padding: 10px 12px 10px 16px;
    border-radius: 12px;
    background: var(--dg-surface);
    color: var(--dg-text);
    border: 1px solid var(--dg-border);
    box-shadow: var(--dg-shadow-lg);
    font-size: var(--dg-font-size-sm);
}

.dg-call-banner-join {
    padding: 6px 14px;
    border: 0;
    border-radius: 999px;
    background: #22a35a;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.dg-call-banner-close { border: 0; background: none; color: var(--dg-text-muted); font-size: 1.3rem; cursor: pointer; }

.dg-chat-groupcall { width: auto; min-width: 40px; padding: 0 8px; border-radius: 20px; gap: 4px; display: inline-flex; align-items: center; }
.dg-chat-groupcall.is-going { background: #22a35a; color: #fff; }
.dg-chat-groupcall-label:empty { display: none; }
.dg-chat-groupcall-label { font-size: var(--dg-font-size-sm); font-weight: 600; }

/* the Live page */
.dg-live-list { display: grid; gap: 12px; }
.dg-live-note { color: var(--dg-text-muted); }

.dg-live-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    background: var(--dg-surface);
}

.dg-live-card.is-live { border-color: #d93b3b; }
.dg-live-card-body { flex: 1; min-width: 0; }
.dg-live-card-body h3 { margin: 6px 0 2px; font-size: 1.05rem; }
.dg-live-card-body p { margin: 0; color: var(--dg-text-muted); font-size: var(--dg-font-size-sm); }
.dg-live-when { color: var(--dg-text-muted); font-size: var(--dg-font-size-sm); }

@media (max-width: 760px) {
    .dg-room.has-stage .dg-room-main { flex-direction: column; }
    .dg-room.has-stage .dg-room-grid { flex: 0 0 110px; grid-auto-flow: column; grid-auto-columns: 150px; grid-auto-rows: 100%; overflow-x: auto; }
    .dg-room-side { position: absolute; inset: 52px 0 90px auto; width: min(300px, 85vw); background: #0d1514; }
    .dg-room-controls { gap: 8px; }
    .dg-room-btn .dg-room-icon { width: 44px; height: 44px; }
    .dg-live-card { flex-direction: column; align-items: stretch; }
}

/* recording (dg-record.js): REC in a room's header and a call's card, the Record button, recordings in Messages and on the Live page */
@keyframes dg-rec-blink { 50% { opacity: 0.35; } }
.dg-room-rec, .dg-call-rec {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(217, 59, 59, 0.18);
    color: #ff8a8a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.dg-room-rec[hidden], .dg-call-rec[hidden] { display: none; }
.dg-room-rec-dot, .dg-call-rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: dg-rec-blink 1.2s steps(2, start) infinite; }
.dg-call-rec { letter-spacing: 0; font-weight: 600; margin-top: 4px; }
.dg-room-btn.is-recording .dg-room-icon, .dg-call-btn.is-recording .dg-call-icon { background: #d93b3b; color: #fff; }
.dg-room-btn.is-recording .dg-room-icon svg, .dg-call-btn.is-recording .dg-call-icon svg { animation: dg-rec-blink 1.2s steps(2, start) infinite; }

.dg-chat-video { display: flex; flex-direction: column; gap: 6px; }
.dg-chat-video-play {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    background: var(--dg-surface-2);
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.dg-chat-video-play:hover { border-color: var(--dg-primary); }
.dg-chat-video-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--dg-primary);
    color: var(--dg-text-inverse);
    font-size: 13px;
}
.dg-chat-video-player { display: block; width: 360px; max-width: 100%; max-height: 320px; border-radius: 10px; background: #000; }
.dg-chat-video-open { font-size: 0.75rem; opacity: 0.85; color: inherit; }

.dg-live-recs { margin-top: 28px; }
.dg-live-recs[hidden] { display: none; }
.dg-live-recs-title { margin: 0 0 12px; font-size: 1.1rem; }
.dg-live-card.is-recording { flex-wrap: wrap; }
.dg-live-card-actions { display: flex; align-items: center; gap: 8px; }
.dg-live-card-actions .dg-room-icon svg { width: 16px; height: 16px; display: block; }
.dg-live-card-actions .dg-btn { display: inline-flex; align-items: center; gap: 4px; }
.dg-live-rec-media { flex: 1 0 100%; }
.dg-live-rec-media:empty { display: none; }
.dg-live-rec-video { display: block; width: 100%; max-height: 70vh; border-radius: var(--dg-radius); background: #000; }
/* the card's menu (Delete), shown on hover or focus as other rows' actions */
.dg-live-more { position: relative; opacity: 0; transition: opacity 0.15s; }
.dg-live-card:hover .dg-live-more, .dg-live-more:focus-within, .dg-live-more[open] { opacity: 1; }
.dg-live-more summary { list-style: none; cursor: pointer; padding: 4px 10px; border-radius: var(--dg-radius-sm); color: var(--dg-text-muted); font-size: 1.2rem; line-height: 1; }
.dg-live-more summary::-webkit-details-marker { display: none; }
.dg-live-more summary:hover { background: var(--dg-surface-2); color: var(--dg-text); }
.dg-live-more-item {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 5;
    padding: 8px 14px;
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-sm);
    background: var(--dg-surface-3);
    color: var(--dg-danger);
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}
@media (hover: none) { .dg-live-more { opacity: 1; } }

/* call and room buttons on hover: their own look, not the page's teal button:hover (which outranks a single class) */
.dg-call-btn:hover, .dg-room-btn:hover { background: none; color: #fff; }
.dg-room-end:hover { background: rgba(236, 75, 75, 0.15); color: #ffb3b3; }
.dg-room-small:hover { color: #fff; }
.dg-wb-tool:hover, .dg-wb-size:hover, .dg-wb-action:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.dg-wb-tool[aria-pressed="true"]:hover, .dg-wb-size[aria-pressed="true"]:hover { background: #fff; color: #10201e; }
.dg-wb-color:hover { background: var(--c); border-color: #fff; }
.dg-call-banner-join:hover { background: #2bbd6a; color: #fff; }
.dg-call-banner-close:hover { background: none; color: var(--dg-text); }
.dg-chat-call:hover:not(:disabled) { color: var(--dg-primary); }
.dg-chat-groupcall.is-going:hover { background: #2bbd6a; color: #fff; }
.dg-chat-video-play:hover { background: var(--dg-surface-2); color: inherit; }
.dg-live-more-item:hover { background: var(--dg-surface-2); color: var(--dg-danger); }

/* the app's Yes/No dialog (askAQuestion) over a call or a group call's room (dg-room.js End, Clear): above them */
body.dg-room-open > .dg-container.overlay, body:has(> .dg-call-active) > .dg-container.overlay { z-index: 10002; }

/* a host's controls in the People panel (dg-room.js): each person's microphone and camera, and a ⋯ menu shown on hover */
.dg-room-cam[hidden] { display: none; }
.dg-room-person .dg-room-mic { display: inline-grid; place-items: center; color: rgba(255, 255, 255, 0.75); }
.dg-room-person .dg-room-mic.is-off { color: #ff8a8a; }
.dg-room-more { position: relative; opacity: 0; transition: opacity 0.15s; }
.dg-room-person:hover .dg-room-more, .dg-room-more:focus-within, .dg-room-more[open] { opacity: 1; }
.dg-room-more summary { list-style: none; cursor: pointer; padding: 2px 8px; border-radius: 6px; color: rgba(255, 255, 255, 0.8); font-size: 1.1rem; line-height: 1.2; }
.dg-room-more summary::-webkit-details-marker { display: none; }
.dg-room-more summary:hover { background: rgba(255, 255, 255, 0.12); }
.dg-room-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 3;
    display: flex;
    flex-direction: column;
    min-width: 170px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: #1b2524;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.dg-room-menu-item {
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    text-align: left;
    cursor: pointer;
}
.dg-room-menu-item:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.dg-room-menu-item.is-danger, .dg-room-menu-item.is-danger:hover { color: #ff8a8a; }
@media (hover: none) { .dg-room-more { opacity: 1; } }
.dg-room-btn:disabled, .dg-call-btn:disabled { opacity: 0.6; cursor: default; }

/* the home page's Happening now (dg-room.js renderNow): live events and group calls going on, each with its button */
.dg-home-now { display: grid; gap: 10px; margin-bottom: var(--dg-space-5); }
.dg-home-now[hidden] { display: none; }
.dg-now-title { margin: 0; font-size: 1.05rem; }
.dg-now-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--dg-border);
    border-left: 5px solid #d93b3b;
    border-radius: var(--dg-radius);
    background: var(--dg-surface);
}
.dg-now-item.is-call { border-left-color: #22a35a; }
.dg-now-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dg-now-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-now-text span { color: var(--dg-text-muted); font-size: var(--dg-font-size-sm); }
.dg-now-call {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #22a35a;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.dg-now-call .dg-room-icon svg, .dg-now-item .dg-room-live .dg-room-icon svg { width: 14px; height: 14px; display: block; }
.dg-now-item .dg-btn { white-space: nowrap; }
@media (max-width: 560px) {
    .dg-now-item { flex-wrap: wrap; }
    .dg-now-text { flex-basis: calc(100% - 120px); }
    .dg-now-item .dg-btn { width: 100%; }
}

/* documents and returns (dg-docs.js), text messages (dg-sms.js), the calendar feed (dg-feed.js) */
.dg-doc-note, .dg-sms-note, .dg-feed-note { color: var(--dg-text-muted); margin: 0 0 12px; }
.dg-doc-searchbar, .dg-doc-form, .dg-sms-row, .dg-feed-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.dg-doc-search, .dg-sms-input, .dg-feed-link, .dg-doc-select, .dg-doc-field input {
    padding: 9px 12px;
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-sm);
    background: var(--dg-surface-2);
    color: var(--dg-text);
    font: inherit;
    min-width: 0;
}
.dg-doc-search { flex: 1 1 280px; }
.dg-doc-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--dg-font-size-sm); color: var(--dg-text-muted); min-width: 0; max-width: 100%; }
.dg-doc-field[hidden] { display: none; }
/* a choice of long names (an organization) is no wider than the screen: on a phone each field takes the row */
.dg-doc-select, .dg-doc-field select { max-width: 100%; }
@media (max-width: 560px) {
    .dg-doc-form .dg-doc-field, .dg-doc-searchbar .dg-doc-field { flex: 1 1 100%; }
    .dg-doc-form .dg-doc-select, .dg-doc-form .dg-doc-field select, .dg-doc-form .dg-doc-field input { width: 100%; }
}
.dg-doc-descr { color: var(--dg-text-muted); margin: 0 0 12px; }
.dg-doc-person { margin: 0 0 20px; padding: 14px 16px; border: 1px solid var(--dg-border); border-radius: var(--dg-radius-lg); background: var(--dg-surface); }
.dg-doc-person h3 { margin: 0 0 8px; font-size: 1.05rem; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.dg-doc-person h3 small { color: var(--dg-text-muted); font-weight: 400; font-size: var(--dg-font-size-sm); }
.dg-doc-list { list-style: none; margin: 0; padding: 0; }
.dg-doc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--dg-border); }
.dg-doc-row.is-revoked .dg-doc-text { opacity: 0.6; }
.dg-doc-text { flex: 1 1 240px; display: flex; flex-direction: column; }
.dg-doc-text span { color: var(--dg-text-muted); font-size: var(--dg-font-size-sm); }
.dg-doc-empty { color: var(--dg-text-muted); }
.dg-doc-actions { display: inline-flex; gap: 8px; }
.dg-doc-btn { text-decoration: none; }
.dg-sms-title { margin: 20px 0 6px; font-size: 1.05rem; }
.dg-sms-status, .dg-feed-status { min-height: 1.2em; margin: 0 0 8px; color: var(--dg-text-muted); font-size: var(--dg-font-size-sm); }
.dg-sms-status.is-error { color: var(--dg-danger); }
.dg-sms-input { flex: 1 1 220px; }
.dg-sms-code { flex: 0 1 160px; letter-spacing: 0.2em; font-size: 1.1rem; }
.dg-sms-quiet { background: transparent; border-color: var(--dg-border); color: var(--dg-text-muted); }
.dg-sms-quiet:hover { background: var(--dg-surface-2); color: var(--dg-text); }
.dg-feed-link { flex: 1 1 320px; font-family: ui-monospace, Consolas, monospace; font-size: var(--dg-font-size-sm); }
.dg-feed-check { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.dg-feed-how { margin: 0 0 12px; }
.dg-feed-how summary { cursor: pointer; color: var(--dg-primary); }
.dg-feed-how ul { margin: 8px 0 0; padding-left: 20px; color: var(--dg-text-muted); }
.dg-feed-meta { color: var(--dg-text-muted); font-size: var(--dg-font-size-sm); }
.dg-feed-reset { background: none; border: 0; padding: 0; color: var(--dg-primary); font: inherit; font-size: inherit; cursor: pointer; text-decoration: underline; }
.dg-feed-reset:hover { background: none; color: var(--dg-primary-hover); }

/* ==== the workspace (Home/28, Polish/126: App.[View] WorkspaceSearch, WorkspacePinned, WorkspaceRecent, WorkspaceApps):
   the search's box in the page's header, then Pinned, Recently used and All apps; the same for every login ==== */
.dg-ws-search,
.dg-ws-recent,
.dg-ws-pinned,
.dg-ws-apps {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-3);
    margin-bottom: var(--dg-space-6);
}

.dg-ws-heading {
    margin: 0;
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dg-text-muted);
}

/* the page's header: the title on the left, the search's box on the right (pages_app.js moves the box there); a
   phone puts the box under the title, the page's width */
.dg-page:has(.dg-ws-search) > .dg-container-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--dg-space-3) var(--dg-space-5);
}

.dg-page:has(.dg-ws-search) > .dg-container-head > .dg-content {
    float: none;
}

.dg-page:has(.dg-ws-search) > .dg-container-head > .dg-right {
    flex: 0 1 460px;
    min-width: 0;
}

.dg-page:has(.dg-ws-search) > .dg-container-head::after,
.dg-page:has(.dg-ws-search) > .dg-container-head > .dg-clear {
    display: none;
}

/* where the search is drawn (its box gone to the header): its results, only while there is a search */
.dg-ws-search:not(:has(.dg-ws-bar)):has(> .dg-ws-results[hidden]) {
    display: none;
}

.dg-ws-bar {
    display: flex;
}

.dg-ws-bar > .dg-ws-find {
    flex: 1 1 auto;
    min-width: 0;
}

/* the search box */
.dg-ws-find {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
    height: 44px;
    padding: 0 14px;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius);
}

.dg-ws-find:focus-within {
    border-color: var(--dg-primary);
    box-shadow: 0 0 0 3px var(--dg-focus);
}

.dg-ws-find-icon {
    flex: none;
    width: 14px;
    height: 14px;
    border: 2px solid var(--dg-text-muted);
    border-radius: 50%;
    position: relative;
}

.dg-ws-find-icon::after {
    content: "";
    position: absolute;
    right: -6px;
    bottom: -5px;
    width: 7px;
    height: 2px;
    background-color: var(--dg-text-muted);
    transform: rotate(45deg);
}

/* the box is the label; the input inside it has none of the theme's own input box */
.dg-ws-bar .dg-ws-find input.dg-ws-input[type=search],
.dg-ws-bar .dg-ws-find input.dg-ws-input[type=search]:focus {
    flex: 1;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: var(--dg-text);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    outline: none;
}

.dg-ws-key {
    padding: 1px 7px;
    font-family: inherit;
    font-size: 12px;
    color: var(--dg-text-muted);
    border: 1px solid var(--dg-border-strong);
    border-radius: var(--dg-radius-sm);
}

.dg-ws-found {
    margin: 0;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-ws-found:empty,
.dg-ws-results[hidden],
.dg-ws-result[hidden],
.dg-ws-result-group[hidden],
.dg-ws-searching,
.dg-ws-apps[hidden] {
    display: none !important;
}

.dg-ws-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--dg-space-4);
    align-items: start;
}

.dg-ws-result-group {
    padding: var(--dg-space-3) var(--dg-space-4);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
}

.dg-ws-result-group > h3 {
    margin: 0 0 var(--dg-space-2);
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--dg-text-muted);
}

.dg-ws-result {
    display: flex;
    flex-direction: column;
    padding: var(--dg-space-2) var(--dg-space-3);
    border-radius: var(--dg-radius);
}

/* a result with its app's icon (Home/32): the icon, then its title over the app's name */
.dg-ws-result:has(> .dg-ws-result-icon) {
    flex-direction: row;
    align-items: center;
    gap: var(--dg-space-3);
}

.dg-ws-result-icon {
    flex: none;
    width: 28px;
    height: 28px;
}

.dg-ws-result-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dg-ws-result:hover,
.dg-ws-result:focus-visible {
    background-color: var(--dg-primary-soft);
}

.dg-ws-result .tile-title {
    font-weight: 600;
}

.dg-ws-result .tile-descr {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

/* pinned: small square tiles of one size, however many (the pins of every page group in one row; user: "pin items too
   big" when they took a sixth of the row each), how to pin beside the heading */
.dg-ws-pinned {
    --dg-ws-pin-gap: var(--dg-space-3);
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--dg-space-3) var(--dg-ws-pin-gap);
}

.dg-ws-pinned > .dg-ws-heading {
    flex: none;
    align-self: baseline;
}

.dg-ws-hint {
    flex: 1 1 0;
    align-self: baseline;
    min-width: 0;
    margin: 0;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

/* a line break after the heading and its hint (ordered between them and the pins): two pins would sit beside them */
.dg-ws-pinned::before {
    content: "";
    order: 1;
    flex-basis: 100%;
    height: 0;
    margin-top: calc(-1 * var(--dg-space-3));
}

.dg-ws-pins {
    display: contents;
}

.dg-ws-pin {
    order: 2;
}

.dg-ws-pin {
    box-sizing: border-box;
    flex: 0 0 116px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 12px 8px 10px;
    text-align: center;
    cursor: pointer;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
}

.dg-ws-pin img {
    width: 34px;
    height: 34px;
}

.dg-ws-pin .tile-title,
.dg-ws-pin .tile-descr {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dg-ws-pin .tile-title {
    font-size: 13px;
    font-weight: 600;
}

/* the app's name under a page's title, left out when it is the same ("Polls" in Polls) */
.dg-ws-pin .tile-descr {
    margin-top: -4px;
    font-size: 11px;
    color: var(--dg-text-muted);
}

.dg-ws-pin .tile-descr:empty,
.dg-ws-recent-item .tile-descr:empty {
    display: none;
}

/* recently used: compact cards, up to ten in two rows of five */
.dg-ws-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.dg-ws-recent-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: var(--dg-space-3);
    row-gap: 2px;
    min-width: 0;
    padding: 10px 14px;
    cursor: pointer;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
}

.dg-ws-recent-item img {
    grid-row: 1 / span 2;
    align-self: center;
    width: 30px;
    height: 30px;
}

.dg-ws-recent-item:has(.tile-descr:empty) img {
    grid-row: auto;
}

.dg-ws-recent-item .tile-title {
    overflow: hidden;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dg-ws-recent-item .tile-descr {
    overflow: hidden;
    font-size: 12px;
    color: var(--dg-text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dg-ws-recent-item:hover,
.dg-ws-pin:hover {
    background-color: var(--dg-primary-soft);
    border-color: var(--dg-primary);
}

/* all apps: one box; the groups flow down columns, each kept whole, so short groups leave no gaps; a group of many
   (Desks) takes the box's width with its apps in columns. Each app: its icon, its name, what it is for. A group's
   name takes the colour of its apps' icons (data-group, Polish/126), mixed toward the text so it reads in any theme */
.dg-ws-directory {
    columns: 4 250px;
    column-gap: var(--dg-space-6);
    padding: 20px 22px 6px;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
}

.dg-ws-group {
    --dg-ws-group: var(--dg-primary);
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-bottom: 18px;
    break-inside: avoid;
}

.dg-ws-group[data-group="Membership"] { --dg-ws-group: #15803d; }
.dg-ws-group[data-group="Communication"] { --dg-ws-group: #0f8f8c; }
.dg-ws-group[data-group="Learning"] { --dg-ws-group: #4f46e5; }
.dg-ws-group[data-group="Community"] { --dg-ws-group: #9333ea; }
.dg-ws-group[data-group="Services"] { --dg-ws-group: #c26a07; }
.dg-ws-group[data-group="Care & safety"] { --dg-ws-group: #db2777; }
.dg-ws-group[data-group="Work"] { --dg-ws-group: #2563eb; }
.dg-ws-group[data-group="Desks"] { --dg-ws-group: #475569; }
.dg-ws-group[data-group="Administration"] { --dg-ws-group: #334155; }

.dg-ws-group > h3 {
    margin: 0 0 6px;
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: color-mix(in srgb, var(--dg-ws-group) 55%, var(--dg-text));
}

.dg-ws-group:has(.dg-ws-tile:nth-child(13)) {
    column-span: all;
    margin-top: 6px;
}

.dg-ws-tiles {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dg-ws-group:has(.dg-ws-tile:nth-child(13)) > .dg-ws-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    column-gap: var(--dg-space-6);
}

.dg-ws-tile {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 10px;
    min-width: 0;
    margin: 0 -8px;
    padding: 5px 8px;
    color: var(--dg-text);
    cursor: pointer;
    border-radius: var(--dg-radius-sm);
}

.dg-ws-tile img {
    grid-row: 1 / span 2;
    width: 30px;
    height: 30px;
}

.dg-ws-tile:has(.tile-descr:empty) img {
    grid-row: auto;
}

.dg-ws-tile .tile-title,
.dg-ws-tile .tile-descr {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dg-ws-tile .tile-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.dg-ws-tile .tile-descr {
    font-size: 12px;
    line-height: 1.35;
    color: var(--dg-text-muted);
}

.dg-ws-tile .tile-descr:empty {
    display: none;
}

.dg-ws-tile:hover,
.dg-ws-tile:focus-visible {
    background-color: var(--dg-primary-soft);
}

/* the lists' tabs, were a workspace to have two lists again (pages_app.js draws them only then) */
.dg-ws-tabs {
    display: flex;
    gap: var(--dg-space-1);
    margin-bottom: var(--dg-space-4);
    overflow-x: auto;
    scrollbar-width: none;
    box-shadow: inset 0 -1px 0 var(--dg-border);
}

.dg-ws-tabs [role="tab"] {
    flex: none;
    white-space: nowrap;
    padding: var(--dg-space-2) var(--dg-space-4);
    font: inherit;
    font-weight: 600;
    color: var(--dg-text-muted);
    cursor: pointer;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
}

.dg-ws-tabs [role="tab"][aria-selected="true"] {
    color: var(--dg-text);
    border-bottom-color: var(--dg-primary);
}

.dg-ws-tab-count {
    font-weight: 500;
    color: var(--dg-text-muted);
}

/* a page's Pin / Unpin, in its header */
.dg-pin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    color: var(--dg-text-muted);
    cursor: pointer;
    background: none;
    border: 1px solid var(--dg-border);
    border-radius: 999px;
}

.dg-pin > span[aria-hidden]::before {
    content: "\2606";
}

.dg-pin[aria-pressed="true"] {
    color: var(--dg-primary);
    border-color: var(--dg-primary);
}

.dg-pin[aria-pressed="true"] > span[aria-hidden]::before {
    content: "\2605";
}

.dg-pin:hover {
    color: var(--dg-text);
    background-color: var(--dg-surface);   /* not button:hover's primary fill */
    border-color: var(--dg-primary);
}

@media (max-width: 900px) {
    .dg-ws-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .dg-page:has(.dg-ws-search) > .dg-container-head > .dg-right {
        flex-basis: 100%;
    }

    .dg-ws-key {
        display: none;
    }

    /* how to pin, under the heading, only while there are no pins (an empty heading else) */
    .dg-ws-hint {
        flex-basis: 100%;
    }

    .dg-ws-pinned:has(.dg-ws-pin) .dg-ws-hint {
        display: none;
    }

    .dg-ws-search,
    .dg-ws-recent,
    .dg-ws-pinned,
    .dg-ws-apps {
        margin-bottom: var(--dg-space-5);
    }

    /* pinned: icons, four to a row, each name under its icon */
    .dg-ws-pinned {
        --dg-ws-pin-gap: 6px;
    }

    .dg-ws-pinned > .dg-ws-heading {
        flex-basis: 100%;
    }

    .dg-ws-pin,
    .dg-ws-pin:hover {
        flex-basis: calc((100% - 3 * var(--dg-ws-pin-gap)) / 4);
        gap: 6px;
        padding: 0;
        background: none;
        border: 0;
    }

    .dg-ws-pin img {
        width: 46px;
        height: 46px;
    }

    .dg-ws-pin .tile-title {
        font-size: 12px;
        font-weight: 500;
    }

    .dg-ws-pin .tile-descr {
        display: none;
    }

    /* recently used: one row that slides sideways (main.dg-content clips at the page's gutter, so it stops there) */
    .dg-ws-row {
        display: flex;
        gap: var(--dg-space-2);
        overflow-x: auto;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }

    .dg-ws-row::-webkit-scrollbar {
        display: none;
    }

    .dg-ws-recent-item {
        flex: none;
        max-width: 75%;
        scroll-snap-align: start;
    }

    /* all apps: a list of groups, each its name and how many apps, opening to its apps (pages_app.js
       foldWorkspaceGroups; without its button a group stays open) */
    .dg-ws-directory {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        columns: auto;
        padding: 0;
        overflow: hidden;
    }

    .dg-ws-group {
        margin: 0;
    }

    .dg-ws-group + .dg-ws-group {
        border-top: 1px solid var(--dg-border);
    }

    .dg-ws-group > h3 {
        margin: 0;
    }

    .dg-ws-group > h3:not(:has(.dg-ws-group-toggle)) {
        padding: 14px 14px 6px;
    }

    .dg-ws-group-toggle,
    .dg-ws-group-toggle:hover {
        display: flex;
        align-items: center;
        gap: var(--dg-space-2);
        width: 100%;
        min-height: 48px;
        padding: 0 14px;
        font: inherit;
        font-size: 15px;
        font-weight: 600;
        color: color-mix(in srgb, var(--dg-ws-group) 55%, var(--dg-text));
        text-align: left;
        cursor: pointer;
        background: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .dg-ws-group-toggle:hover {
        background-color: var(--dg-surface-2);
    }

    .dg-ws-group-count {
        font-size: var(--dg-font-size-sm);
        font-weight: 500;
        color: var(--dg-text-muted);
    }

    .dg-ws-group-toggle::after {
        content: "";
        width: 7px;
        height: 7px;
        margin: 0 4px 0 auto;
        border-right: 2px solid var(--dg-text-muted);
        border-bottom: 2px solid var(--dg-text-muted);
        transform: rotate(-45deg);
        transition: transform 0.15s;
    }

    .dg-ws-group[data-open] .dg-ws-group-toggle::after {
        transform: rotate(45deg);
    }

    .dg-ws-group:has(> h3 > .dg-ws-group-toggle):not([data-open]) > .dg-ws-tiles {
        display: none;
    }

    .dg-ws-tiles,
    .dg-ws-group:has(.dg-ws-tile:nth-child(13)) > .dg-ws-tiles {
        display: flex;
        columns: auto;
        padding: 0 14px 10px;
    }

    .dg-ws-tile {
        padding: 8px;
    }

    .dg-pin .dg-pin-text {
        display: none;
    }
}

/* ---- an app's landing page (AppLanding): the app's other pages as small links, its main action, Needs you; then
   the home's own list in its landing form (ModelSection Landing): the first rows, no filters, Select or paging,
   View all only while it has more ---- */
.dg-apphome {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-4);
}

/* no panel of its own (its page item's group, g1): the links sit under the page's title, Needs you is a panel */
.g1:has(> .page-content-group-item > .dg-apphome) {
    padding: 0;
    border: 0;
    background: none;
}

.page-content-group-item:has(> .dg-apphome) {
    margin-bottom: 0;
}

.dg-apphome-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--dg-space-3) var(--dg-space-4);
}

/* the views' parts: the links (AppLandingPages) and the main action, side by side */
.dg-apphome-links {
    flex: 1 1 320px;
    min-width: 0;
}

.dg-apphome-action {
    flex: none;
    /* the main add, then the list's other adds beside it (Apply, Apply for a new child) */
    display: flex;
    flex-wrap: wrap;
    gap: var(--dg-space-2);
}

.dg-apphome-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dg-space-2) var(--dg-space-5);
}

.dg-apphome-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dg-space-2);
}

/* a group's name: the plain group has none */
.dg-apphome-group-name {
    margin-right: 2px;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-apphome-group-name:empty,
.dg-apphome-queue-from:empty {
    display: none;
}

.dg-apphome-page {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: 999px;
    cursor: pointer;
}

.dg-apphome-page:hover {
    color: var(--dg-primary);
    border-color: var(--dg-primary);
}

.dg-apphome-page:focus-visible,
.dg-apphome-queue:focus-visible,
.dg-apphome-all:focus-visible {
    outline: 2px solid var(--dg-focus);
    outline-offset: 2px;
}

/* an app's setup pages (the page's class dg-quiet): quieter */
.dg-apphome-page.dg-quiet {
    color: var(--dg-text-muted);
    background-color: transparent;
}

.dg-apphome-add {
    flex: none;
}

/* Needs you: one row per queue, its number first (as Needs your attention on the Dashboard) */
.dg-apphome-needs {
    padding: var(--dg-space-3) var(--dg-space-5) var(--dg-space-4);
    background-color: color-mix(in srgb, var(--dg-warning) 6%, var(--dg-surface));
    border: 1px solid color-mix(in srgb, var(--dg-warning) 28%, var(--dg-border));
    border-radius: var(--dg-radius-lg);
}

.dg-apphome-needs h2 {
    margin: 0;
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--dg-warning);
}

/* At a glance (Canteen/11): counts that only say how things stand (meals on order): the same rows, calm, not warm */
.dg-apphome-needs.dg-apphome-glance {
    margin-top: var(--dg-space-3);
    background-color: var(--dg-surface);
    border-color: var(--dg-border);
}

.dg-apphome-needs.dg-apphome-glance h2 {
    color: var(--dg-text-muted);
}

.dg-apphome-queue.tone-info .dg-apphome-count,
.dg-home-glance .dg-home-badge {
    color: var(--dg-text);
    background-color: var(--dg-surface-2);
}

.dg-apphome-needs ul {
    display: grid;
    /* auto-fit: one or two queues take the row, their text on one line (auto-fill kept empty columns beside them) */
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2px var(--dg-space-4);
    margin: var(--dg-space-2) 0 0;
    padding: 0;
    list-style: none;
}

.dg-apphome-queue {
    display: flex;
    align-items: center;
    gap: var(--dg-space-3);
    min-width: 0;
    padding: var(--dg-space-2);
    border-radius: var(--dg-radius-sm);
    cursor: pointer;
}

.dg-apphome-queue:hover {
    background-color: var(--dg-primary-soft);
}

.dg-apphome-count {
    display: inline-grid;
    place-items: center;
    flex: none;
    min-width: 34px;
    height: 28px;
    padding: 0 8px;
    box-sizing: border-box;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--dg-primary);
    background-color: var(--dg-primary-soft);
    border-radius: 999px;
}

.dg-apphome-queue.tone-warn .dg-apphome-count {
    color: var(--dg-warning);
    background-color: color-mix(in srgb, var(--dg-warning) 16%, transparent);
}

.dg-apphome-queue.tone-urgent .dg-apphome-count {
    color: var(--dg-danger);
    background-color: var(--dg-danger-soft);
}

.dg-apphome-queue-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* a queue's words wrap to two lines rather than cut off in a narrow column */
.dg-apphome-queue-title,
.dg-apphome-queue-from {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dg-apphome-queue-title {
    font-weight: 600;
}

.dg-apphome-queue-from {
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

/* the home's own list: its toolbar (the add is the landing's main action), filters and paging are on its own page */
[modsec].dg-apphome-list > .sec-head,
[modsec].dg-apphome-list > .sec-body [query] {
    display: none;
}

[modsec].dg-apphome-list .list > [templateitem]:nth-child(n + 6) {
    display: none;
}

.dg-apphome-all {
    display: none;
    margin: var(--dg-space-2) var(--dg-space-4) var(--dg-space-3);
    font-weight: 600;
    color: var(--dg-primary);
    cursor: pointer;
}

.dg-apphome-all:hover {
    text-decoration: underline;
}

[modsec].dg-apphome-list:has(.list > [templateitem]:nth-child(6)) > .dg-apphome-all {
    display: inline-block;
}

/* a list that waits for a choice (its organization, for a large working set) shows View all: the choice is on its page */
[modsec].dg-apphome-list:has(> .sec-head [operation][require-filter="true" i]) > .dg-apphome-all {
    display: inline-block;
}

/* a list's count in its head and its paging under it (pages_app.js listPager); the filter panel's own paging row stays
   hidden, still holding the values a search reads */
.query-commands .query-command.flex-row-left,
[modsec][list-data-available] .query-commands .query-command.flex-row-left {
    display: none;
}

.dg-list-count {
    align-self: center;
    line-height: 34px;   /* the head's buttons' height: level with them, alone too */
    margin-right: var(--dg-space-2);
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
    white-space: nowrap;
}

.dg-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--dg-space-2) var(--dg-space-4);
    padding: var(--dg-space-3) var(--dg-space-4);
    border-top: 1px solid var(--dg-border);
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
}

.dg-pager-count strong {
    color: var(--dg-text);
    font-weight: 600;
}

.dg-pager-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.dg-pager button {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-sm);
    background: transparent;
    color: var(--dg-text);
    font: inherit;
    cursor: pointer;
}

.dg-pager button:hover:not(:disabled) {
    border-color: var(--dg-primary);
    color: var(--dg-primary);
}

.dg-pager button[aria-current="page"] {
    background-color: var(--dg-primary-soft);
    border-color: var(--dg-primary);
    font-weight: 600;
}

.dg-pager button:disabled {
    opacity: 0.45;
    cursor: default;
}

.dg-pager .dg-pager-step {
    border-color: transparent;
    color: var(--dg-text-muted);
}

.dg-pager-gap {
    padding: 0 4px;
}

.dg-pager-of {
    display: none;
    padding: 0 var(--dg-space-2);
}

.dg-pager-size {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
}

.dg-pager-size select {
    width: auto;
    min-width: 72px;
}

/* a phone: Previous, "Page 2 of 8", Next (the page numbers are too many to tap) */
@media (max-width: 600px) {
    .dg-pager {
        justify-content: center;
    }

    .dg-pager-num,
    .dg-pager-gap {
        display: none;
    }

    .dg-pager-of {
        display: inline;
    }

    .dg-pager .dg-pager-step {
        min-height: 44px;
        border-color: var(--dg-border);
    }
}

/* a page opened from a count of what waits (?card=...): the note above its list, which shows only those, and the way to all
   (App.View PageCardFilter; HomeCardFilter.cs) */
.dg-card-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dg-space-2) var(--dg-space-4);
    margin: 0 0 var(--dg-space-3);
    padding: var(--dg-space-2) var(--dg-space-4);
    background-color: color-mix(in srgb, var(--dg-warning) 6%, var(--dg-surface));
    border: 1px solid color-mix(in srgb, var(--dg-warning) 28%, var(--dg-border));
    border-radius: var(--dg-radius-md, 8px);
    color: var(--dg-text-muted);
}

.dg-card-filter strong {
    color: var(--dg-text);
}

.dg-card-filter-all {
    margin-left: auto;
    font-weight: 600;
    color: var(--dg-primary);
    text-decoration: none;
}

.dg-card-filter-all:hover,
.dg-card-filter-all:focus-visible {
    text-decoration: underline;
}

/* the home's own list says what it is: its title, or the landing page's (Waiting to be marked) */
[modsec].dg-apphome-list > .sec-title {
    display: block;
    padding: var(--dg-space-3) var(--dg-space-4) 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dg-text);
}

/* related panels (page items of the group home-related): beside the home's list on a wide screen, under it otherwise */
.page-content-group.home-related > .page-content-group-item {
    margin-bottom: var(--dg-space-4);
}

@media (min-width: 1000px) {
    .dg-page:has(> .page-content-group.home-related) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        column-gap: var(--dg-space-5);
        align-items: start;
    }

    .dg-page:has(> .page-content-group.home-related) > * {
        grid-column: 1 / -1;
    }

    .dg-page:has(> .page-content-group.home-related) > .page-content-group.home-default {
        grid-column: 1;
    }

    .dg-page:has(> .page-content-group.home-related) > .page-content-group.home-related {
        grid-column: 2;
    }

    /* a table in the narrow column keeps its first two columns */
    .page-content-group.home-related table th:nth-child(n + 3),
    .page-content-group.home-related table td:nth-child(n + 3) {
        display: none;
    }
}

/* a related panel of text (a page item's own markup: How an application goes) */
.dg-apphome-note {
    padding: var(--dg-space-4);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
}

.dg-apphome-note h3 {
    margin: 0 0 var(--dg-space-2);
    font-size: 1rem;
}

.dg-apphome-note ol {
    margin: 0;
    padding-left: 1.2em;
    color: var(--dg-text-muted);
    font-size: var(--dg-font-size-sm);
}

/* inline actions (pages_app.js drawInlineActions): the decision a row waits for (Approve, Reject) as small buttons on
   it, at the right of a table's row, at the foot of a card; the answer that turns down is the quieter one */
.dg-inline-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--dg-space-2);
}

.dg-card > .dg-inline-actions {
    margin-top: var(--dg-space-2);
}

/* in a one-column list (agenda, timeline) they start under the text, as a meeting's Accept / Decline do (at the far
   end of a wide card they were a long way from what they decide) */
:is(.dg-agenda-list, .dg-timeline-list) > .dg-card > .dg-inline-actions {
    justify-content: flex-start;
}

td.dg-inline-cell,
th.dg-inline-cell {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

/* in a table's cell, side by side (the cell is as narrow as its buttons) */
td.dg-inline-cell > .dg-inline-actions {
    flex-wrap: nowrap;
}

.dg-inline-btn {
    min-height: 0;
    padding: 4px 12px;
    border: 1px solid var(--dg-primary);
    border-radius: var(--dg-radius);
    background-color: var(--dg-primary);
    color: var(--dg-text-inverse);
    font: inherit;
    font-size: var(--dg-font-size-sm);
    font-weight: 600;
    cursor: pointer;
}

.dg-inline-btn:hover {
    background-color: var(--dg-primary-hover);
    border-color: var(--dg-primary-hover);
}

.dg-inline-btn.dg-inline-secondary {
    background-color: transparent;
    border-color: var(--dg-border-strong);
    color: var(--dg-text);
}

.dg-inline-btn.dg-inline-secondary:hover {
    border-color: var(--dg-danger);
    color: var(--dg-danger);
}

.dg-inline-btn:focus-visible {
    outline: 2px solid var(--dg-focus);
    outline-offset: 2px;
}

/* a wide table scrolls sideways (on a phone, and on a desk's wide list: the market's Approvals cut its Approve in
   half): its decisions stay in view at its right edge */
td.dg-inline-cell {
    position: sticky;
    right: 0;
    background-color: var(--dg-surface);
}

/* its heading cell stays there too, over the headings sliding under it ("Counts for", "Status" showed above the
   buttons that hid their values); a soft edge shows the columns go on beneath */
th.dg-inline-cell {
    position: sticky;
    right: 0;
    z-index: 1;
}

td.dg-inline-cell,
th.dg-inline-cell {
    box-shadow: -10px 0 10px -10px rgba(0, 0, 0, 0.55);
}

/* the main action of another page (New announcement): a link that looks like the button */
a.dg-apphome-add {
    text-decoration: none;
}

/* one panel for the home's own list and what waits for the person's answer above it (Announcements' Feed, the
   Calendar's Coming up): the page items of home-default under a heading (dg-apphome-heading). The lists lose their
   own panels; their titles are small labels, and a list without one (the Calendar's days) sits under the heading. */
.page-content-group.home-default:has(> .page-content-group-item > .dg-apphome-heading) {
    display: flex;
    flex-direction: column;
    gap: var(--dg-space-3);
    margin-bottom: var(--dg-space-4);
    padding: var(--dg-space-4) var(--dg-space-5) var(--dg-space-3);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-lg);
    box-shadow: var(--dg-shadow-sm);
}

.home-default:has(> .page-content-group-item > .dg-apphome-heading) > .page-content-group-item {
    margin: 0;
}

.dg-apphome-heading {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dg-text);
}

.home-default:has(> .page-content-group-item > .dg-apphome-heading) [modsec].dg-apphome-list {
    overflow: visible;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.home-default:has(> .page-content-group-item > .dg-apphome-heading) [modsec].dg-apphome-list > .sec-title {
    padding: 0 0 var(--dg-space-2);
    font-size: var(--dg-font-size-sm);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--dg-text-muted);
}

.home-default:has(> .page-content-group-item > .dg-apphome-heading) [modsec].dg-apphome-list > .sec-title:empty {
    display: none;
}

.home-default:has(> .page-content-group-item > .dg-apphome-heading) [modsec].dg-apphome-list .dg-card-list {
    padding: 0;
}

.home-default:has(> .page-content-group-item > .dg-apphome-heading) .dg-apphome-all {
    margin: var(--dg-space-2) 0 var(--dg-space-1);
}

/* what waits for the person's answer (page item class dg-answer): a warm label with how many, warm cards; the cards'
   own "your answer is needed" says it again, and goes */
.page-content-group-item.dg-answer [modsec] > .sec-title,
.home-default:has(> .page-content-group-item > .dg-apphome-heading) > .page-content-group-item.dg-answer [modsec].dg-apphome-list > .sec-title {
    display: flex;
    align-items: center;
    gap: var(--dg-space-2);
    color: var(--dg-warning);
}

.page-content-group-item.dg-answer [modsec] > .sec-title::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--dg-warning);
}

.page-content-group-item.dg-answer [modsec] > .sec-title[data-rows]::after {
    content: "\00B7\00A0" attr(data-rows);
}

.page-content-group-item.dg-answer .dg-card-list > .dg-card {
    background-color: color-mix(in srgb, var(--dg-warning) 7%, var(--dg-surface));
    border-color: color-mix(in srgb, var(--dg-warning) 30%, var(--dg-border));
}

.page-content-group-item.dg-answer .dg-card-field:has(.dg-todo) {
    display: none;
}

.page-content-group-item.dg-answer .dg-choices-submit:not(.dg-choices-secondary) {
    color: #1a1206;
    background-color: var(--dg-warning);
    border-color: var(--dg-warning);
}

/* Announcements on a landing page, as its mockup draws a card: the title with who sent it and when at its right (an
   unread dot and the priority before it), the text, what is asked (Action needed · by Mon) with its buttons at the
   right; the source's kind (SCHOOL) and the warm band across the top are the Feed page's */
[modsec].dg-apphome-list.dg-feed .dg-card-list > .dg-card {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--dg-space-2) var(--dg-space-3);
    padding: var(--dg-space-3) var(--dg-space-4);
}

[modsec].dg-apphome-list.dg-feed .dg-card > .dg-card-field {
    order: 4;
    flex: 1 1 100%;
    min-width: 0;
    margin: 0;
}

[modsec].dg-apphome-list.dg-feed .dg-card > .dg-card-field:has(.dg-card-meta),
[modsec].dg-apphome-list.dg-feed .dg-card > .dg-card-field:has(.dg-card-meta) > .col-data,
[modsec].dg-apphome-list.dg-feed .dg-card .dg-card-meta {
    display: contents;
}

[modsec].dg-apphome-list.dg-feed .dg-card .dg-card-meta > .dg-chip {
    display: none;
}

[modsec].dg-apphome-list.dg-feed .dg-card .dg-card-meta > .dg-priority {
    order: 1;
    align-self: center;
}

[modsec].dg-apphome-list.dg-feed .dg-card > .dg-card-field:first-child {
    order: 2;
    flex: 1 1 14rem;
    font-size: 1rem;
    font-weight: 600;
}

[modsec].dg-apphome-list.dg-feed .dg-card .dg-card-meta > .dg-meta {
    order: 3;
    margin-left: auto;
    font-size: 0.78rem;
}

[modsec].dg-apphome-list.dg-feed .dg-card .dg-card-meta > .dg-files {
    order: 5;
    flex: 1 1 100%;
    margin: 0;
    font-size: var(--dg-font-size-sm);
}

[modsec].dg-apphome-list.dg-feed .dg-card > .dg-card-field:has(.dg-due),
[modsec].dg-apphome-list.dg-feed .dg-card > .dg-card-field:has(.dg-reply) {
    order: 6;
    flex: 1 1 auto;
    align-self: center;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: none;
}

[modsec].dg-apphome-list.dg-feed .dg-due::before {
    content: none;
}

[modsec].dg-apphome-list.dg-feed .dg-card > .dg-card-field:has(.dg-choices) {
    order: 7;
    flex: 0 1 auto;
    margin-left: auto;
}

/* a card's answer buttons on a landing page (Acknowledge, Accept | Decline): small, at the card's right */
[modsec].dg-apphome-list .dg-choices-foot {
    margin: 0;
    padding: 0;
}

[modsec].dg-apphome-list .dg-card > .dg-card-field:has(.dg-choices[data-buttons]) {
    align-self: flex-end;
}

[modsec].dg-apphome-list .dg-choices-buttons {
    justify-content: flex-end;
}

[modsec].dg-apphome-list .dg-choices-buttons button {
    flex: none;
    min-height: 0;
    padding: 6px 16px;
    border-radius: var(--dg-radius);
    font-size: var(--dg-font-size-sm);
}

[modsec].dg-apphome-list.dg-feed .dg-card > .dg-card-field .col-data {
    line-height: 1.5;
}

/* the file panel (pages_app.js dgFilePanelOpen): a file or a document shown over the page, in a frame, with Close.
   Under a call (10000) and the lightbox, over everything else. */
.dg-filepanel {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: rgba(10, 16, 24, 0.55);
}
.dg-filepanel[hidden] { display: none; }
.dg-filepanel-box {
    display: flex;
    flex-direction: column;
    width: min(1100px, 100%);
    height: min(900px, 100%);
    border-radius: 12px;
    overflow: hidden;
    background: var(--dg-surface);
    box-shadow: var(--dg-shadow-lg);
}
.dg-filepanel-bar {
    display: flex;
    justify-content: flex-end;
    padding: 6px 8px;
    border-bottom: 1px solid var(--dg-border);
    background: var(--dg-surface);
}
.dg-filepanel-frame { flex: 1; min-height: 0; width: 100%; border: 0; background: var(--dg-surface); }
body.dg-filepanel-open { overflow: hidden; }
@media (max-width: 700px) {
    .dg-filepanel { padding: 0; }
    .dg-filepanel-box { width: 100%; height: 100%; border-radius: 0; }
}

/* Get the app (dg-install.js): a card for each way to have it (this browser, the App Store, Google Play), this
   device's own first and marked; on a computer, a code to scan that opens the page on the phone */
.dg-install-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.dg-install-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    background: var(--dg-surface);
    min-width: 0;
}
.dg-install-card.is-mine { border-color: var(--dg-primary); }
.dg-install-card h2, .dg-install-phone h2 { margin: 0; font-size: 1.05rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dg-install-tag {
    font-size: var(--dg-font-size-sm);
    font-weight: 500;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--dg-primary-soft);
    color: var(--dg-primary);
}
.dg-install-note { margin: 0; color: var(--dg-text-muted); }
.dg-install-body { margin-top: auto; padding-top: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.dg-install-state { margin: 0; color: var(--dg-text-muted); }
.dg-install-state[role=status] { color: var(--dg-success); }
.dg-install-steps { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.dg-install-phone { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 18px; padding: 18px; border: 1px solid var(--dg-border); border-radius: var(--dg-radius); background: var(--dg-surface); }
.dg-install-phone > div:last-child { flex: 1 1 220px; display: flex; flex-direction: column; gap: 8px; }
.dg-install-qr svg { display: block; width: 148px; height: auto; border-radius: var(--dg-radius-sm); }

/* the top bar's Back, in the installed app (pages_app.js): a button like the bar's other round icons */
.dg-topbar-back { border: 0; background: none; padding: 0; flex: none; margin-right: 2px; }
.dg-topbar-back[hidden] { display: none; }
.dg-topbar-back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dg-topbar-back:disabled { opacity: 0.35; cursor: default; }
.dg-topbar-back:disabled:hover { background: none; color: var(--dg-text-muted); }

/* Which organization the desk counts are for (someone who works in many: HomeBoard.DeskLine), and the dialog that
   chooses it (dg-workplace.js chooseDesk) */
.dg-home-desk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dg-space-2) var(--dg-space-4);
    margin: 0 0 var(--dg-space-3);
    padding: var(--dg-space-2) var(--dg-space-4);
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-md, 8px);
    color: var(--dg-text-muted);
}

.dg-home-desk strong {
    color: var(--dg-text);
}

.dg-home-desk-choose {
    margin-left: auto;
}

.dg-desk-choose {
    box-sizing: border-box;
    width: 100%;
    min-width: min(84vw, 460px);
    padding: var(--dg-space-2) var(--dg-space-1) var(--dg-space-3);
}

.dg-desk-about,
.dg-desk-note {
    margin: 0 0 var(--dg-space-3);
    color: var(--dg-text-muted);
}

.dg-desk-search {
    display: flex;
    gap: var(--dg-space-2);
    margin: 0 0 var(--dg-space-3);
}

.dg-desk-box {
    flex: 1;
    min-width: 0;
}

.dg-desk-found {
    max-height: 46vh;
    overflow-y: auto;
    margin: 0 0 var(--dg-space-2);
}

.dg-desk-found:empty,
.dg-desk-note[hidden] {
    display: none;
}

/* The bell (pages_app.js) and its list (dg-notices.js): what the system told the person, kept 30 days */
.dg-topbar-bell { position: relative; border: 0; background: none; padding: 0; flex: none; }
.dg-topbar-bell[aria-expanded="true"] { color: var(--dg-text); background-color: var(--dg-surface); }

.dg-topbar-badge {
    position: absolute;
    top: 1px;
    right: 0;
    box-sizing: border-box;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background-color: var(--dg-danger);
    border-radius: 999px;
    pointer-events: none;
}

.dg-topbar-badge[hidden] { display: none; }

.dg-notices {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(400px, calc(100vw - 24px));
    max-height: min(70vh, 620px);
    text-align: left;
    background-color: var(--dg-surface);
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow-lg);
}

.dg-notices[hidden],
.dg-notices-status[hidden],
.dg-notices-more[hidden] { display: none; }

.dg-notices-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--dg-space-3);
    padding: var(--dg-space-3) var(--dg-space-4);
    border-bottom: 1px solid var(--dg-border);
}

.dg-notices-title { margin: 0; font-size: 1rem; font-weight: 650; color: var(--dg-text); }

.dg-notices-close {
    padding: 4px 10px;
    font: inherit;
    font-size: var(--dg-font-size-sm);
    color: var(--dg-text-muted);
    cursor: pointer;
    background: none;
    border: 1px solid var(--dg-border);
    border-radius: var(--dg-radius-sm);
}

.dg-notices-close:hover,
.dg-notices-close:focus-visible { color: var(--dg-text); border-color: var(--dg-primary); background: none; }

.dg-notices-status { padding: var(--dg-space-5) var(--dg-space-4); text-align: center; color: var(--dg-text-muted); }

.dg-notices-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

.dg-notice { padding: var(--dg-space-3) var(--dg-space-4); border-bottom: 1px solid var(--dg-border); border-left: 3px solid transparent; }
.dg-notice:last-child { border-bottom: 0; }
.dg-notice-new { border-left-color: var(--dg-primary); background-color: var(--dg-primary-soft); }
.dg-notice-link { cursor: pointer; }

.dg-notice-link:hover,
.dg-notice-link:focus-visible { background-color: var(--dg-primary-soft); outline: none; }
.dg-notice-link:focus-visible { box-shadow: inset 0 0 0 2px var(--dg-primary); }

.dg-notice-head { display: flex; align-items: baseline; gap: var(--dg-space-2); font-size: var(--dg-font-size-sm); color: var(--dg-text-muted); }
.dg-notice-kind { font-weight: 600; }
.dg-notice-when { margin-left: auto; white-space: nowrap; }
.dg-notice-mark { padding: 0 6px; font-size: 11px; font-weight: 700; color: var(--dg-primary); border: 1px solid var(--dg-primary); border-radius: 999px; }
.dg-notice-title { margin-top: 2px; font-weight: 600; color: var(--dg-text); overflow-wrap: anywhere; }
.dg-notice-body { margin-top: 2px; color: var(--dg-text); overflow-wrap: anywhere; }

.dg-notices-more { margin: var(--dg-space-3) var(--dg-space-4); align-self: center; }

/* a phone: the list takes the screen's width under the bar */
@media (max-width: 640px) {
    .dg-notices { position: fixed; top: 56px; right: 8px; left: 8px; width: auto; max-height: calc(100svh - 72px); }
}
