/* Inspectnote design layer. Loaded after theme.min.css + user.css on every page base.
   Tokens and components follow DESIGN.md; the demos in .impeccable/demo are the visual spec.
   Strategy: keep Phoenix/Bootstrap (markup + JS) and override its variables and components,
   so unported screens pick up the new look too. */

@font-face {
    font-family: "Nunito Sans";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/nunito-sans-var.e010923d59d4.woff2") format("woff2");
}

/* ===== Tokens (DESIGN.md frontmatter) ===== */
:root {
    --blue: #2f66f0;
    --blue-hover: #2557d6;
    --blue-ink: #1f4fd1;
    --blue-wash: #eef3ff;
    --blue-wash-2: #dde7ff;
    --blue-ring: #c4d4ff;
    --ink: #141824;
    --text: #31374a;
    --text-2: #454d63;
    --muted: #5d6680;
    --icon-muted: #8a94ad;
    --line: #e3e6ed;
    --line-strong: #cbd0dd;
    --track: #eceff4;
    --ground: #f5f7fa;
    --surface: #fff;
    --hover: #f6f8fb;
    --ok: #1c6c09;
    --ok-fill: #1f8a0a;
    --ok-wash: #e5f4e0;
    --warn: #8a4a05;
    --warn-fill: #c26a0a;
    --warn-wash: #fff4e5;
    --warn-line: #f2c48f;
    --rec: #c8261b;
    --rec-wash: #fdecea;
    --rec-line: #f3b8b2;
    --on-fill: #fff;
    --scrim: rgba(20, 24, 36, .45);
    --r-s: 8px;
    --r-c: 10px;
    --r-m: 12px;
    --r-l: 16px;
    --r-xl: 22px;
    --shadow-float: 0 10px 30px rgba(20, 24, 36, .16), 0 2px 6px rgba(20, 24, 36, .08);
    --shadow-sticky: 0 8px 16px -14px rgba(20, 24, 36, .45);
    --ease-out: cubic-bezier(.16, 1, .3, 1);

    /* Phoenix: the grey scale already matches DESIGN.md; remap the accent and status families */
    --phoenix-primary: var(--blue);
    --phoenix-primary-rgb: 47, 102, 240;
    --phoenix-primary-soft: var(--blue-wash);
    --phoenix-primary-100: var(--blue-wash);
    --phoenix-primary-200: var(--blue-ring);
    --phoenix-primary-500: var(--blue-hover);
    --phoenix-primary-600: var(--blue-ink);
    --phoenix-info: var(--blue);
    --phoenix-info-rgb: 47, 102, 240;
    --phoenix-success: var(--ok-fill);
    --phoenix-success-rgb: 31, 138, 10;
    --phoenix-success-100: var(--ok-wash);
    --phoenix-success-500: var(--ok);
    --phoenix-warning: var(--warn-fill);
    --phoenix-warning-rgb: 194, 106, 10;
    --phoenix-warning-soft: var(--warn-wash);
    --phoenix-warning-100: var(--warn-wash);
    --phoenix-warning-500: var(--warn);
    --phoenix-danger: var(--rec);
    --phoenix-danger-rgb: 200, 38, 27;
    --phoenix-danger-100: var(--rec-wash);
    --phoenix-danger-500: var(--rec);
    --phoenix-link-color: var(--blue-ink);
    --phoenix-link-hover-color: var(--blue-hover);
    --phoenix-body-font-size: .9375rem;
    --phoenix-body-line-height: 1.5;
    --phoenix-body-color: var(--text);
    --phoenix-body-bg: var(--ground);
    --phoenix-heading-color: var(--ink);
    --phoenix-headings-color: var(--ink);
    --phoenix-input-border-color: var(--line-strong);
    --phoenix-border-color: var(--line);
    --phoenix-border-radius: var(--r-s);
    --phoenix-border-radius-sm: 6px;
    --phoenix-border-radius-lg: var(--r-m);
    --phoenix-border-radius-xl: var(--r-l);
    --phoenix-choices-item-bg: var(--blue-wash);
    --phoenix-choices-item-color: var(--blue-ink);
}

/* ===== Browser surfaces ===== */
body {
    font-variant-numeric: tabular-nums;
    caret-color: var(--blue);
    -webkit-text-size-adjust: 100%;
}
::selection { background: var(--blue-ring); color: var(--ink); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
a { text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); font-weight: 800; }
code, kbd, samp, .font-monospace { font-family: ui-monospace, Consolas, monospace; font-size: .88em; }
@media (max-width: 767px) {
    /* 16px so iOS never zooms into a field */
    :root { --phoenix-body-font-size: 1rem; }
}

/* ===== Icons: one drawn set, 24px grid, 2px round stroke ===== */
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-s { width: 18px; height: 18px; }

/* ===== Buttons (Bootstrap classes, DESIGN.md looks) ===== */
.btn {
    --phoenix-btn-padding-x: 16px;
    --phoenix-btn-padding-y: 10px;
    --phoenix-btn-font-size: 15px;
    --phoenix-btn-font-weight: 700;
    --phoenix-btn-line-height: 1.2;
    --phoenix-btn-border-radius: var(--r-s);
    --phoenix-btn-box-shadow: none;
    --phoenix-btn-focus-box-shadow: 0 0 0 3px var(--blue-ring);
    text-transform: none;
    letter-spacing: normal;
}
/* inline SVG icons would otherwise push the line box past 40px */
.btn:has(> svg) { display: inline-flex; align-items: center; justify-content: center; }
.btn:has(> .i) { gap: 8px; }
.btn > .i { width: 18px; height: 18px; }
.btn-sm { --phoenix-btn-padding-x: 12px; --phoenix-btn-padding-y: 7px; --phoenix-btn-font-size: 14px; }
.btn-lg { --phoenix-btn-padding-y: 12px; --phoenix-btn-font-size: 16px; }

.btn-primary, .btn-success, .btn-phoenix-primary {
    --phoenix-btn-color: #fff;
    --phoenix-btn-bg: var(--blue);
    --phoenix-btn-border-color: var(--blue);
    --phoenix-btn-hover-color: #fff;
    --phoenix-btn-hover-bg: var(--blue-hover);
    --phoenix-btn-hover-border-color: var(--blue-hover);
    --phoenix-btn-active-color: #fff;
    --phoenix-btn-active-bg: var(--blue-hover);
    --phoenix-btn-active-border-color: var(--blue-hover);
    --phoenix-btn-disabled-color: #fff;
    --phoenix-btn-disabled-bg: var(--blue);
    --phoenix-btn-disabled-border-color: var(--blue);
}
/* secondary: white, strong hairline, body text */
.btn-secondary, .btn-phoenix-secondary, .btn-outline-secondary, .btn-soft-secondary,
.btn-outline-primary, .btn-outline-success, .btn-phoenix-success, .btn-light {
    --phoenix-btn-color: var(--text);
    --phoenix-btn-bg: var(--surface);
    --phoenix-btn-border-color: var(--line-strong);
    --phoenix-btn-hover-color: var(--ink);
    --phoenix-btn-hover-bg: var(--hover);
    --phoenix-btn-hover-border-color: var(--line-strong);
    --phoenix-btn-active-color: var(--ink);
    --phoenix-btn-active-bg: var(--track);
    --phoenix-btn-active-border-color: var(--line-strong);
    --phoenix-btn-disabled-color: var(--muted);
    --phoenix-btn-disabled-bg: var(--surface);
    --phoenix-btn-disabled-border-color: var(--line);
}
/* soft action: microphone, AI actions */
.btn-soft, .btn-soft-primary, .btn-soft-info, .btn-soft-success {
    --phoenix-btn-color: var(--blue-ink);
    --phoenix-btn-bg: var(--blue-wash);
    --phoenix-btn-border-color: transparent;
    --phoenix-btn-hover-color: var(--blue-ink);
    --phoenix-btn-hover-bg: var(--blue-wash-2);
    --phoenix-btn-hover-border-color: transparent;
    --phoenix-btn-active-color: var(--blue-ink);
    --phoenix-btn-active-bg: var(--blue-wash-2);
    --phoenix-btn-active-border-color: transparent;
    --phoenix-btn-disabled-color: var(--blue-ink);
    --phoenix-btn-disabled-bg: var(--blue-wash);
    --phoenix-btn-disabled-border-color: transparent;
}
.btn-soft-warning {
    --phoenix-btn-color: var(--warn);
    --phoenix-btn-bg: var(--warn-wash);
    --phoenix-btn-border-color: transparent;
    --phoenix-btn-hover-color: var(--warn);
    --phoenix-btn-hover-bg: #ffe9cc;
    --phoenix-btn-hover-border-color: transparent;
}
/* quiet: no border, no fill */
.btn-quiet {
    --phoenix-btn-color: var(--text);
    --phoenix-btn-bg: transparent;
    --phoenix-btn-border-color: transparent;
    --phoenix-btn-hover-color: var(--ink);
    --phoenix-btn-hover-bg: var(--track);
    --phoenix-btn-hover-border-color: transparent;
    --phoenix-btn-active-bg: var(--track);
    --phoenix-btn-active-border-color: transparent;
}
.btn-quiet.next { --phoenix-btn-color: var(--blue-ink); --phoenix-btn-hover-color: var(--blue-ink); }
.btn-link { --phoenix-btn-color: var(--blue-ink); --phoenix-btn-hover-color: var(--blue-hover); }
/* destructive: red text, red wash on hover; never solid red */
.btn-danger, .btn-soft-danger, .btn-outline-danger, .btn-phoenix-danger, .btn-delete {
    --phoenix-btn-color: var(--rec);
    --phoenix-btn-bg: transparent;
    --phoenix-btn-border-color: transparent;
    --phoenix-btn-hover-color: var(--rec);
    --phoenix-btn-hover-bg: var(--rec-wash);
    --phoenix-btn-hover-border-color: transparent;
    --phoenix-btn-active-color: var(--rec);
    --phoenix-btn-active-bg: var(--rec-wash);
    --phoenix-btn-active-border-color: transparent;
    --phoenix-btn-disabled-color: var(--rec);
    --phoenix-btn-disabled-bg: transparent;
    --phoenix-btn-disabled-border-color: transparent;
}
/* the confirm button in a delete dialog */
.btn-delete, .btn-outline-danger {
    --phoenix-btn-bg: var(--surface);
    --phoenix-btn-border-color: var(--rec);
    --phoenix-btn-hover-border-color: var(--rec);
    --phoenix-btn-active-border-color: var(--rec);
}
.btn:disabled, .btn.disabled { --phoenix-btn-disabled-opacity: .45; }
/* icon button: 40px square */
.btn-icon {
    --phoenix-btn-padding-x: 0;
    --phoenix-btn-padding-y: 0;
    --phoenix-btn-border-radius: var(--r-c);
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
}
.btn-icon > .i { width: 22px; height: 22px; }
.btn-close { border-radius: var(--r-c); opacity: .7; }
.btn-close:hover { opacity: 1; background-color: var(--track); }
.btn-close:focus { box-shadow: 0 0 0 3px var(--blue-ring); }
@media (max-width: 767px) {
    .btn:not(.btn-sm):not(.btn-link):not(.btn-icon) { min-height: 44px; }
    .btn-icon { width: 44px; height: 44px; }
}

/* ===== Forms ===== */
.form-label, .col-form-label {
    padding-left: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-2);
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 6px;
}
.form-control, .form-select {
    min-height: 44px;
    padding: 9px 12px;
    font-size: inherit;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text);
    border-color: var(--line-strong);
    border-radius: var(--r-c);
    box-shadow: none;
}
.form-select {
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6680' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-size: 18px;
}
textarea.form-control { min-height: 96px; }
.form-control::placeholder { color: var(--muted); opacity: 1; }
.form-control:focus, .form-select:focus {
    color: var(--text);
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-ring);
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--ground); color: var(--muted); }
.form-control-sm, .form-select-sm { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; border-radius: var(--r-s); }
.form-control.is-invalid, .form-select.is-invalid, .was-validated .form-control:invalid { border-color: var(--rec); background-image: none; padding-right: 12px; }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 3px var(--rec-wash); }
.invalid-feedback { font-size: 13px; font-weight: 700; color: var(--rec); margin-top: 6px; }
.form-text { font-size: 13px; color: var(--muted); margin-top: 6px; }
.form-check-input { border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--blue); border-color: var(--blue); }
.form-check-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-ring); }
.form-check-label { font-weight: 600; color: var(--text); }
/* switch: 42 x 24 track, white knob */
.form-switch .form-check-input {
    width: 42px;
    height: 24px;
    margin-top: 0;
    border: 0;
    background-color: var(--line-strong);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E");
}
.form-switch .form-check-input:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E"); }
.form-switch .form-check-input:checked { background-color: var(--blue); }
.form-switch { display: flex; align-items: center; gap: 10px; }
.input-group-text { background: var(--ground); border-color: var(--line-strong); color: var(--muted); }

/* Choices.js and Select2 (bootstrap-5 theme) look like the inputs above */
.choices__inner, .select2-container--bootstrap-5 .select2-selection {
    min-height: 44px;
    border-color: var(--line-strong);
    border-radius: var(--r-c);
    background-color: var(--surface);
    font-size: inherit;
    box-shadow: none;
}
.is-focused .choices__inner, .is-open .choices__inner,
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-ring);
}
.choices__list--dropdown, .choices__list[aria-expanded],
.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--line);
    border-radius: var(--r-m);
    box-shadow: var(--shadow-float);
}
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background: var(--hover); color: var(--ink); }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected { background: var(--blue-wash); color: var(--blue-ink); }

/* ===== Cards are panels: white, hairline, 16px, flat ===== */
.card {
    --phoenix-card-border-color: var(--line);
    --phoenix-card-border-radius: var(--r-l);
    --phoenix-card-inner-border-radius: calc(var(--r-l) - 1px);
    --phoenix-card-spacer-x: 22px;
    --phoenix-card-spacer-y: 20px;
    --phoenix-card-cap-padding-x: 22px;
    --phoenix-card-cap-padding-y: 16px;
    box-shadow: none;
}

/* ===== Dialogs (Bootstrap modal) ===== */
.modal {
    --phoenix-modal-border-radius: var(--r-l);
    --phoenix-modal-inner-border-radius: calc(var(--r-l) - 1px);
    --phoenix-modal-border-color: transparent;
    --phoenix-modal-box-shadow: var(--shadow-float);
    --phoenix-modal-padding: 18px 22px;
    --phoenix-modal-header-padding: 16px 12px 12px 22px;
    --phoenix-modal-header-border-color: var(--line);
    --phoenix-modal-footer-border-color: var(--line);
    --phoenix-modal-footer-gap: 8px;
}
.modal-backdrop { --phoenix-backdrop-bg: #141824; --phoenix-backdrop-opacity: .55; }
.modal-title { font-size: 20px; font-weight: 800; line-height: 1.3; color: var(--ink); }
.modal-footer { padding: 12px 22px 18px; }
@media (prefers-reduced-motion: no-preference) {
    .modal.fade .modal-dialog { transition: transform .28s var(--ease-out), opacity .28s var(--ease-out); transform: translateY(8px) scale(.98); }
    .modal.show .modal-dialog { transform: none; }
}
/* phone: dialogs rise from the bottom as sheets (full-screen dialogs, like the camera, stay full screen) */
@media (max-width: 767px) {
    .modal-dialog:not([class*=modal-fullscreen]):not(.modal-dialog-keep) { margin: 0; min-height: 100%; display: flex; align-items: flex-end; max-width: none; }
    .modal-dialog:not([class*=modal-fullscreen]):not(.modal-dialog-keep) .modal-content {
        border-radius: var(--r-xl) var(--r-xl) 0 0;
        max-height: 94dvh;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .modal-dialog:not([class*=modal-fullscreen]):not(.modal-dialog-keep) .modal-content::before {
        content: "";
        display: block;
        width: 44px;
        height: 5px;
        border-radius: 3px;
        background: #b5bccb;
        margin: 10px auto 0;
        flex: none;
    }
    .modal.fade .modal-dialog:not([class*=modal-fullscreen]):not(.modal-dialog-keep) { transform: translateY(100%); }
    .modal.show .modal-dialog:not([class*=modal-fullscreen]):not(.modal-dialog-keep) { transform: none; }
    .modal-footer > .btn { flex: 1; }
}

/* drawer: a right-side panel for editing one record next to its list */
.offcanvas.offcanvas-end {
    --phoenix-offcanvas-width: min(460px, 100vw);
    --phoenix-offcanvas-box-shadow: var(--shadow-float);
    border-radius: var(--r-l) 0 0 var(--r-l);
    border-left: 0;
}
.offcanvas-backdrop { --phoenix-backdrop-bg: #141824; --phoenix-backdrop-opacity: .45; }
.offcanvas-title { font-size: 20px; font-weight: 800; color: var(--ink); }
.offcanvas-header { border-bottom: 1px solid var(--line); padding: 16px 12px 12px 22px; }
@media (max-width: 767px) {
    .offcanvas.offcanvas-end {
        top: auto;
        width: 100vw;
        height: auto;
        max-height: 94dvh;
        border-radius: var(--r-xl) var(--r-xl) 0 0;
        transform: translateY(100%);
    }
    .offcanvas.offcanvas-end.showing, .offcanvas.offcanvas-end.show:not(.hiding) { transform: none; }
    .offcanvas.offcanvas-end::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: #b5bccb; margin: 10px auto 0; flex: none; }
}

/* ===== Menus ===== */
.dropdown-menu {
    --phoenix-dropdown-padding-x: 6px;
    --phoenix-dropdown-padding-y: 6px;
    --phoenix-dropdown-font-size: 15px;
    --phoenix-dropdown-color: var(--text);
    --phoenix-dropdown-border-color: var(--line);
    --phoenix-dropdown-border-radius: var(--r-m);
    --phoenix-dropdown-inner-border-radius: calc(var(--r-m) - 1px);
    --phoenix-dropdown-box-shadow: var(--shadow-float);
    --phoenix-dropdown-divider-bg: var(--line);
    --phoenix-dropdown-divider-margin-y: 6px;
    --phoenix-dropdown-link-color: var(--text);
    --phoenix-dropdown-link-hover-color: var(--ink);
    --phoenix-dropdown-link-hover-bg: var(--hover);
    --phoenix-dropdown-link-active-color: var(--blue-ink);
    --phoenix-dropdown-link-active-bg: var(--blue-wash);
    --phoenix-dropdown-item-padding-x: 12px;
    --phoenix-dropdown-item-padding-y: 10px;
    box-shadow: var(--shadow-float);
}
.dropdown-item { border-radius: var(--r-s); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.dropdown-item.text-danger:hover, .dropdown-item.danger:hover { background: var(--rec-wash); }

/* ===== Tables ===== */
.table {
    --phoenix-table-color: var(--text);
    --phoenix-table-border-color: var(--line);
    --phoenix-table-hover-bg: var(--hover);
    --phoenix-table-hover-color: var(--text);
}
.table > thead th {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
}
.table > :not(caption) > * > * { padding: 10px 12px; }

/* ===== Badges become chips ===== */
.badge { --phoenix-badge-border-radius: 999px; --phoenix-badge-font-weight: 700; }
.badge-phoenix {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border: 0;
    font-size: 12px;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
}
.badge-phoenix::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge-phoenix-success { --phoenix-badge-bg: var(--ok-wash); --phoenix-badge-color: var(--ok); }
.badge-phoenix-warning { --phoenix-badge-bg: var(--warn-wash); --phoenix-badge-color: var(--warn); }
.badge-phoenix-danger { --phoenix-badge-bg: var(--rec-wash); --phoenix-badge-color: var(--rec); }
.badge-phoenix-primary, .badge-phoenix-info { --phoenix-badge-bg: var(--blue-wash); --phoenix-badge-color: var(--blue-ink); }
.badge-phoenix-secondary { --phoenix-badge-bg: var(--track); --phoenix-badge-color: var(--text-2); }

/* ===== Notices ===== */
.alert { border-radius: var(--r-m); border-width: 1px; font-weight: 600; font-size: 14px; padding: 10px 14px; }
.alert-danger, .alert-soft-danger { background: var(--rec-wash); border-color: #f5c2bd; color: var(--rec); }
.alert-warning, .alert-soft-warning { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.alert-success, .alert-soft-success { background: var(--ok-wash); border-color: #bfe0b4; color: var(--ok); }
.alert-info, .alert-primary, .alert-soft-info, .alert-soft-primary { background: var(--blue-wash); border-color: var(--blue-ring); color: var(--blue-ink); }

/* ===== Toast: ink, bottom centre ===== */
.toast {
    --phoenix-toast-bg: var(--ink);
    --phoenix-toast-color: #fff;
    --phoenix-toast-border-radius: var(--r-m);
    --phoenix-toast-box-shadow: var(--shadow-float);
    font-weight: 600;
}

/* ===== Progress ===== */
.progress { --phoenix-progress-bg: var(--track); --phoenix-progress-bar-bg: var(--blue); --phoenix-progress-border-radius: 3px; }
.progress-bar.bg-success { background-color: var(--ok-fill) !important; }

/* ===== Secondary navigation (tabs) ===== */
.nav-underline .nav-link, .nav-tabs .nav-link { font-size: 14px; color: var(--text-2); text-transform: none; }
.nav-underline .nav-link.active, .nav-tabs .nav-link.active { color: var(--blue-ink); }

/* ===== SweetAlert2: same dialog language (body prefix: its CSS is injected at runtime, after this file) ===== */
body .swal2-container.swal2-backdrop-show { background: rgba(20, 24, 36, .55); }
body .swal2-popup { border-radius: var(--r-l); font-family: inherit; color: var(--text); padding-bottom: 20px; box-shadow: var(--shadow-float); }
body .swal2-title { font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.3; }
body .swal2-html-container { font-size: 15px; line-height: 1.5; color: var(--text); }
body .swal2-actions { gap: 8px; }
body .swal2-styled { margin: 0; height: 40px; padding: 0 16px; border-radius: var(--r-s) !important; font-weight: 700; font-size: 15px !important; }
body .swal2-styled.swal2-confirm { background-color: var(--blue) !important; border: 1px solid var(--blue) !important; }
body .swal2-styled.swal2-cancel { background-color: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--line-strong) !important; }
body .swal2-styled.swal2-deny { background-color: var(--surface) !important; color: var(--rec) !important; border: 1px solid var(--rec) !important; }
body .swal2-styled:focus, body .swal2-styled.swal2-confirm:focus, body .swal2-styled.swal2-cancel:focus, body .swal2-styled.swal2-deny:focus { box-shadow: 0 0 0 3px var(--blue-ring); }
body .swal2-actions:not(.swal2-loading) .swal2-styled:hover { background-image: none; filter: brightness(.96); }
body .swal2-input, .swal2-textarea, .swal2-select { border: 1px solid var(--line-strong); border-radius: var(--r-c); box-shadow: none; font-size: 15px; }
body .swal2-input:focus, .swal2-textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-ring); }
body .swal2-validation-message { background: var(--rec-wash); color: var(--rec); font-weight: 700; font-size: 14px; }
body .swal2-icon.swal2-success { border-color: var(--ok-wash); color: var(--ok-fill); }
body .swal2-icon.swal2-success [class^=swal2-success-line] { background-color: var(--ok-fill); }
body .swal2-icon.swal2-success .swal2-success-ring { border-color: rgba(31, 138, 10, .25); }
body .swal2-icon.swal2-error { border-color: var(--rec); color: var(--rec); }
body .swal2-icon.swal2-error [class^=swal2-x-mark-line] { background-color: var(--rec); }
body .swal2-icon.swal2-warning { border-color: var(--warn-line); color: var(--warn-fill); }
body .swal2-icon.swal2-info, .swal2-icon.swal2-question { border-color: var(--blue-ring); color: var(--blue); }
body .swal2-loader { border-color: var(--blue) transparent var(--blue) transparent; }
body .swal2-close:hover { color: var(--rec); }

/* ===================================================================
   Shared page components (ported from the demo shell)
   =================================================================== */

/* page header: optional back link, 28px title, meta line, actions on the right */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 20px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head > .t { min-width: 0; }
.page-title { font-size: 28px; line-height: 1.2; font-weight: 800; color: var(--ink); letter-spacing: -.01em; text-wrap: balance; margin: 0; }
.page-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; text-decoration: none; font-size: 14px; margin-bottom: 4px; border-radius: var(--r-s); }
.back-link:hover { color: var(--text); }
.back-link .i { width: 18px; height: 18px; }
@media (max-width: 767px) {
    .page-title { font-size: 24px; }
    .page-head { margin-bottom: 16px; align-items: flex-start; }
    .page-head > .page-actions { width: 100%; }
    .page-head > .page-actions .btn { flex: 1; }
}

/* chips: 28px pills with a status dot */
.chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px; border-radius: 14px; font-size: 13px; font-weight: 700; white-space: nowrap; line-height: 1; background: var(--track); color: var(--text-2); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip.ok { background: var(--ok-wash); color: var(--ok); }
.chip.warn { background: var(--warn-wash); color: var(--warn); }
.chip.err { background: var(--rec-wash); color: var(--rec); }
.chip.busy { background: var(--blue-wash); color: var(--blue-ink); }
.chip.busy::before { animation: chip-pulse 1.4s ease-in-out infinite; }
.chip.plain::before { display: none; }
.chip.sm { height: 24px; padding: 0 10px; font-size: 12px; }
.chip.offline { background: var(--rec); color: #fff; box-shadow: 0 2px 6px rgba(200, 38, 27, .3); }
@keyframes chip-pulse { 50% { opacity: .35; } }

/* panels: white, hairline, never nested */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px 20px 20px; min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-height: 36px; }
.panel-h h2 { font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1.3; margin: 0; }
.panel-h .n { font-size: 13px; font-weight: 700; color: var(--muted); }
.panel-h .end { margin-left: auto; display: flex; gap: 6px; }
@media (max-width: 767px) { .panel { padding: 14px 14px 16px; border-radius: 14px; } }

/* rows inside a panel, separated by hairlines */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { border-top: 1px solid var(--line); }
.lrow { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: var(--r-c); width: 100%; text-align: left; text-decoration: none; color: inherit; }
.lrow:hover { background: var(--hover); color: inherit; }
.lrow .t { flex: 1; min-width: 0; }
.lrow b { display: block; font-size: 16px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow small { display: block; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow > .i { width: 18px; height: 18px; color: var(--icon-muted); }
.more-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 14px; color: var(--blue-ink); text-decoration: none; padding: 8px 10px; margin: 6px -10px -8px; border-radius: var(--r-s); }
.more-link:hover { background: var(--blue-wash); }
.initials { width: 40px; height: 40px; border-radius: 50%; background: var(--blue-wash); color: var(--blue-ink); font-size: 14px; font-weight: 800; display: grid; place-items: center; flex: none; }

/* progress: 6px track, blue fill, green when complete; always next to a text count */
.track { display: block; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.track > span { display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width .4s var(--ease-out); }
.track.done > span { background: var(--ok-fill); }

/* empty states */
.empty { padding: 32px 20px 28px; text-align: center; max-width: 460px; margin: 0 auto; }
.empty h2 { font-size: 20px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.empty p { color: var(--muted); margin-bottom: 16px; }
.empty .page-actions { justify-content: center; }

/* list toolbar: search, filters, count */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.toolbar .count { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); }
.fsearch { position: relative; flex: 0 1 340px; min-width: 200px; }
.fsearch .i { position: absolute; left: 12px; top: 11px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.fsearch .form-control, .fsearch input { width: 100%; min-height: 42px; padding-left: 40px; }
@media (max-width: 767px) {
    .fsearch { flex: 1 1 100%; }
    .toolbar .form-select { flex: 1; }
    .toolbar .count { display: none; }
}

/* data tables (list screens) */
.tblwrap { padding: 6px 8px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: 13px; font-weight: 700; color: var(--text-2); text-align: left; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th .sort-btn { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: inherit; padding: 4px 6px; margin: -4px -6px; border-radius: 6px; background: none; border: 0; cursor: pointer; }
.tbl th .sort-btn .i { width: 16px; height: 16px; color: var(--icon-muted); }
.tbl th .sort-btn:hover { background: var(--hover); color: var(--ink); }
.tbl th[aria-sort] .sort-btn, .tbl th[aria-sort] .sort-btn .i { color: var(--ink); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl td:first-child { border-radius: var(--r-c) 0 0 var(--r-c); }
.tbl td:last-child { border-radius: 0 var(--r-c) var(--r-c) 0; }
.tbl .num { text-align: right; }
.tbl .muted { color: var(--muted); }
.tbl .nw { white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main b, .cell-main a { display: block; color: var(--ink); font-weight: 800; font-size: 15px; text-decoration: none; }
.cell-main a:hover { text-decoration: underline; }
.cell-main small { display: block; color: var(--muted); font-size: 13px; }

/* form fields (plain markup; Bootstrap .form-control inputs inside work too) */
.field { margin-bottom: 14px; border: 0; min-width: 0; padding: 0; }
.field > label, .field > .lbl, .field legend { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; float: none; padding: 0; }
.field .opt { font-weight: 600; color: var(--muted); }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field .err { display: none; font-size: 13px; font-weight: 700; color: var(--rec); margin-top: 6px; }
.field.is-err .form-control, .field.is-err .form-select { border-color: var(--rec); }
.field.is-err .err { display: block; }
.f2 { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 0 12px; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; margin: 0; }
/* a checkbox row inside a .field keeps its row layout (beats .field > label) */
.field > label.check { display: flex; font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 0; }
.check small { font-weight: 600; color: var(--muted); }
.drop { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; border: 2px dashed var(--line-strong); border-radius: var(--r-m); padding: 12px 14px; color: var(--muted); font-weight: 600; text-align: left; cursor: pointer; background: none; }
/* a drop zone used as a field's label keeps its row layout (beats .field > label) */
.field > label.drop { display: flex; margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.drop:hover, .drop:focus-within { border-color: var(--blue); color: var(--blue-ink); background: var(--blue-wash); }
.drop b { color: var(--ink); display: block; }
.drop input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* ===== Delete confirmation: every delete asks first; no undo ===== */
.modal.confirm-delete .modal-dialog { max-width: 440px; }
.modal.confirm-delete .modal-body p:last-child { margin-bottom: 0; }

/* ===== Download being prepared: blocking modal while the file is built ===== */
.modal.download-modal .modal-dialog { max-width: 460px; }

/* "how it works" videos (blocks/videos-modal.html) */
.howto-modal .modal-dialog { max-width: 760px; }
.ht-player { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-m); overflow: hidden; background: var(--ink); }
.ht-player iframe, .ht-poster { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ht-poster { display: block; padding: 0; background: none; cursor: pointer; }
.ht-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ht-play { position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%; background: #fff; color: var(--blue); display: grid; place-items: center; box-shadow: 0 2px 10px rgba(20, 24, 36, .3); transition: transform .2s var(--ease-out); }
.ht-play .i { width: 28px; height: 28px; fill: currentColor; stroke: none; margin-left: 4px; }
.ht-poster:hover .ht-play { transform: scale(1.07); }
.ht-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ht-item { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 6px 6px 10px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); text-align: left; font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--text); }
.ht-item:hover { background: var(--hover); }
.ht-item[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-wash); color: var(--ink); }
.ht-item img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--track); }
.ht-item span { padding: 0 4px; }
@media (max-width: 767px) {
    .ht-list { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .ht-item { flex-direction: row; align-items: center; gap: 12px; padding: 6px; }
    .ht-item img { width: 112px; flex: none; }
}
.download-modal .dl-body { padding: 28px 26px 24px; text-align: center; }
.download-modal h2 { font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.3; margin-bottom: 4px; }
.download-modal .dl-ok, .download-modal .dl-err,
.download-modal.is-done .dl-busy, .download-modal.is-error .dl-busy { display: none; }
.download-modal.is-done .dl-ok, .download-modal.is-error .dl-err { display: block; }
.dl-doc { width: 76px; height: 96px; margin: 0 auto 18px; border-radius: var(--r-s); background: var(--surface); border: 2px solid var(--line-strong); padding: 18px 12px 0; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 8px 16px -12px rgba(20, 24, 36, .35); }
.dl-doc span { display: block; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.dl-doc span:nth-child(2) { width: 82%; }
.dl-doc span:nth-child(4) { width: 64%; }
.dl-doc span:nth-child(5) { width: 74%; }
.dl-doc span::after { content: ""; display: block; height: 100%; background: var(--blue); border-radius: 3px; transform: scaleX(0); transform-origin: left; animation: dl-line 3.6s var(--ease-out) infinite; }
.dl-doc span:nth-child(2)::after { animation-delay: .4s; }
.dl-doc span:nth-child(3)::after { animation-delay: .8s; }
.dl-doc span:nth-child(4)::after { animation-delay: 1.2s; }
.dl-doc span:nth-child(5)::after { animation-delay: 1.6s; }
@keyframes dl-line { 0% { transform: scaleX(0); opacity: 1; } 25% { transform: scaleX(1); opacity: 1; } 80% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.dl-file { font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.dl-bar { position: relative; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; margin: 18px 0 10px; }
.dl-bar span { position: absolute; top: 0; bottom: 0; width: 36%; border-radius: 3px; background: var(--blue); animation: dl-bar 1.5s ease-in-out infinite; }
@keyframes dl-bar { 0% { left: -36%; } 100% { left: 100%; } }
.dl-meta { font-size: 14px; color: var(--muted); }
.dl-meta b { color: var(--text); }
.dl-warn { display: flex; gap: 10px; align-items: flex-start; text-align: left; margin-top: 16px; background: var(--warn-wash); border: 1px solid var(--warn-line); color: var(--warn); border-radius: var(--r-m); padding: 10px 12px; font-size: 14px; font-weight: 600; line-height: 1.45; }
.dl-warn .i { width: 20px; height: 20px; margin-top: 1px; }
.dl-mark { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; color: #fff; }
.dl-mark .i { width: 28px; height: 28px; stroke-width: 3; }
.dl-ok .dl-mark { background: var(--ok-fill); }
.dl-err .dl-mark { background: var(--rec); }
.dl-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
@media (max-width: 767px) { .dl-actions .btn { flex: 1; } }

@media (prefers-reduced-motion: reduce) {
    .dl-doc span::after { animation: none; transform: scaleX(.6); }
    .dl-bar span { animation: none; left: 0; width: 100%; opacity: .35; }
    .chip.busy::before { animation: none; }
}

/* ===== cookie notice (blocks/cookies.html, app and public site) ===== */
#cookieNotice.cookie { position: fixed; z-index: 60; right: 24px; bottom: 24px; width: min(440px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-float); padding: 18px 20px; color: var(--text); }
#cookieNotice.cookie h2 { font-size: 17px; font-weight: 800; color: var(--ink); margin: 0 0 4px; }
#cookieNotice.cookie p { font-size: 14px; margin: 0; }
/* user.css resets every child's padding inside #cookieNotice */
#cookieNotice.cookie .btn { margin-top: 14px; padding: 10px 16px; }
@media (max-width: 767px) {
    #cookieNotice.cookie { left: 8px; right: 8px; bottom: 8px; width: auto; padding: 16px; }
    #cookieNotice.cookie .btn { width: 100%; }
}

/* ===================================================================
   App shell (base.html): top bar, sidebar, phone tab bar
   =================================================================== */
:root { --side-w: 254px; --top-h: 64px; --tab-h: 64px; }
html.navbar-vertical-collapsed { --side-w: 64px; }
body.app { min-height: 100vh; }
html:has(body.app) { scroll-padding-top: calc(var(--top-h) + 16px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr:focus { position: fixed; z-index: 2000; left: 12px; top: 12px; width: auto; height: auto; clip: auto; background: var(--surface); padding: 8px 12px; border-radius: var(--r-s); box-shadow: var(--shadow-float); }

/* fixed, with its height in .app-main's top padding: legacy editor code reads that padding to place sticky parts */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1020; height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 24px; padding: 0 24px; }
/* the logo slot is as wide as the sidebar, so the search starts on the content edge */
.topbar .logo-link { display: block; flex: none; min-width: calc(var(--side-w) - 24px); border-radius: 6px; transition: min-width .2s var(--ease-out); }
.topbar .logo { height: 40px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.topbar .logo-mark { display: none; width: 36px; height: 36px; object-fit: contain; }
.top-search { flex: 0 1 460px; position: relative; }
.top-search > input { width: 100%; height: 38px; border: 1px solid var(--line-strong); border-radius: 19px; padding: 0 16px 0 40px; background: var(--surface); color: var(--text); }
.top-search > input::placeholder { color: var(--muted); }
.top-search > input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-ring); }
.top-search > .i { position: absolute; left: 13px; top: 9px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.top-links { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-link { display: flex; align-items: center; gap: 8px; color: var(--blue-ink); font-weight: 700; padding: 8px 10px; border-radius: var(--r-s); text-decoration: none; }
.top-link:hover { background: var(--blue-wash); color: var(--blue-ink); }
.avatar-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; color: var(--blue-ink); background: var(--blue-wash); font-size: 14px; font-weight: 800; }
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { background: var(--blue-wash-2); }
.top-search-btn { display: none; width: 44px; height: 44px; border: 0; border-radius: 50%; place-items: center; color: var(--text); background: none; }
.top-search-btn:hover { background: var(--track); }

/* user menu */
.user-menu { min-width: 280px; }
.user-menu .pop-who { padding: 8px 12px 10px; }
.user-menu .pop-who b { display: block; color: var(--ink); font-weight: 800; }
.user-menu .pop-who small { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.user-menu .dropdown-item .i { width: 20px; height: 20px; }
.user-menu .dropdown-item .end { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); }
.menu-legal { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 12px 8px; font-size: 13px; }
.menu-legal a { color: var(--muted); font-weight: 600; }

/* sidebar */
.siderail { position: fixed; z-index: 1010; top: var(--top-h); left: 0; bottom: 0; width: var(--side-w); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; overflow-y: auto; overflow-x: hidden; transition: width .2s var(--ease-out); }
.siderail a, .side-toggle { height: 42px; border-radius: var(--r-c); display: flex; align-items: center; gap: 10px; padding: 0 9px; color: var(--text-2); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; overflow: hidden; flex: none; border: 0; background: none; }
.siderail .i { width: 22px; height: 22px; display: inline-grid; place-items: center; font-size: 20px; }
.siderail .lab { overflow: hidden; text-overflow: ellipsis; }
.siderail a:hover, .side-toggle:hover { background: var(--hover); color: var(--text); }
.siderail a[aria-current] { background: var(--blue-wash); color: var(--blue-ink); }
.side-toggle { margin-top: auto; width: 100%; color: var(--muted); }
.navbar-vertical-collapsed .siderail .lab { display: none; }
.navbar-vertical-collapsed .siderail a, .navbar-vertical-collapsed .side-toggle { justify-content: center; padding: 0; }
.navbar-vertical-collapsed .side-toggle .i { transform: scaleX(-1); }

/* content: lays itself out by the width it gets */
/* clip, not hidden: legacy Bootstrap row gutters must not scroll the page sideways, and sticky bars keep working */
.app-main { margin-left: var(--side-w); padding: 20px 24px 40px; container: main / inline-size; transition: margin-left .2s var(--ease-out); min-height: 100vh; overflow-x: clip; padding-top: calc(var(--top-h) + 20px); }
.app-main.slim { padding-left: 0; padding-right: 0; }
.app-main > .page-title:empty { display: none; }
.app-main > .legacy-title { margin: 4px 0 20px; }
.app-foot { margin-top: 40px; font-size: 13px; color: var(--muted); }
.app-foot a { color: var(--muted); }
.app-main.slim .app-foot { padding: 0 24px; }
.tabbar { display: none; }

/* search results (top bar dropdown and phone sheet) */
.sres { position: absolute; z-index: 1030; left: 0; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-float); padding: 8px; max-height: min(70vh, 560px); overflow: auto; }
.sres.sres-sheet { position: static; box-shadow: none; border: 0; padding: 0; max-height: none; min-height: 40dvh; }
.sres .cnt { font-size: 13px; color: var(--muted); font-weight: 600; padding: 4px 10px 2px; margin: 0; }
.sres h3 { font-size: 13px; font-weight: 700; color: var(--text-2); padding: 10px 10px 4px; margin: 0; }
.sres a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-c); text-decoration: none; color: var(--text); }
.sres a:hover, .sres a:focus-visible { background: var(--hover); outline-offset: -2px; }
.sres a span { min-width: 0; }
.sres a b { display: block; color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sres a small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sres a .i { color: var(--icon-muted); width: 20px; height: 20px; }
.sres .none { padding: 16px 10px; color: var(--muted); margin: 0; }
#searchSheet .modal-header { gap: 8px; }
#searchSheet .fsearch { flex: 1; min-width: 0; }

/* toasts: ink, bottom centre */
.toast-container { position: fixed; z-index: 1090; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast-container .toast { pointer-events: auto; width: auto; max-width: calc(100vw - 24px); background: var(--ink) !important; color: #fff; border-radius: var(--r-m); padding: 10px 6px 10px 16px; box-shadow: var(--shadow-float); }
.toast-container .toast .toast-body { padding: 0; font-weight: 600; }
.toast-container .toast-danger .toast-body::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff8a80; margin-right: 8px; vertical-align: 1px; }

@media (max-width: 1199px) {
    :root, html.navbar-vertical-collapsed { --side-w: 64px; }
    .siderail .lab { display: none; }
    .siderail a { justify-content: center; padding: 0; }
    .side-toggle { display: none !important; }
}
/* folded sidebar: the logo mark sits centred over the 64px rail */
@media (min-width: 768px) {
    html.navbar-vertical-collapsed .topbar .logo-link { margin-left: -24px; min-width: var(--side-w); display: grid; place-items: center; }
    html.navbar-vertical-collapsed .topbar .logo { display: none; }
    html.navbar-vertical-collapsed .topbar .logo-mark { display: block; }
}
@media (min-width: 768px) and (max-width: 1199px) {
    .topbar .logo-link { margin-left: -24px; min-width: var(--side-w); display: grid; place-items: center; }
    .topbar .logo { display: none; }
    .topbar .logo-mark { display: block; }
}
@media (max-width: 991px) {
    .top-search { display: none; }
    .top-search-btn { display: grid; }
}
/* phone: top bar + bottom tabs, no sidebar */
@media (max-width: 767px) {
    :root { --top-h: 56px; }
    .topbar { padding: 0 8px 0 14px; gap: 4px; }
    .topbar .logo-link { min-width: 0; }
    .topbar .logo { height: 30px; }
    .top-link { display: none; }
    .top-links { gap: 4px; }
    .siderail { display: none; }
    .app-main { margin: 0; padding: calc(var(--top-h) + 16px) 12px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); }
    .app-main.slim { padding-left: 0; padding-right: 0; }
    .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 1020; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
    .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tabbar .i { display: inline-grid; place-items: center; font-size: 20px; }
    .tabbar a[aria-current] { color: var(--blue-ink); }
    .tabbar a[aria-current] .i { background: var(--blue-wash); border-radius: 14px; width: 52px; padding: 3px 0; height: 28px; }
    .toast-container { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); }
    .app-foot { display: none; }
}

/* SweetAlert as the delete confirmation (ui.js confirmDelete) */
body .swal2-popup.in-confirm { width: min(440px, calc(100vw - 24px)); padding: 0; text-align: left; }
.in-confirm .swal2-title { font-weight: 800; color: var(--ink); text-align: left; padding: 20px 22px 0; font-size: 20px; }
.in-confirm .swal2-html-container { text-align: left; margin: 8px 22px 0; color: var(--text); }
.in-confirm .in-confirm-actions { justify-content: flex-end; width: 100%; margin: 20px 0 0; padding: 12px 22px 18px; border-top: 1px solid var(--line); }
@media (max-width: 767px) {
    body .swal2-container:has(.in-confirm) { padding: 0; }
    body .swal2-container:has(.in-confirm) > .swal2-popup { grid-row: 3; align-self: end; }
    body .swal2-popup.in-confirm { width: 100vw; border-radius: var(--r-xl) var(--r-xl) 0 0; padding-bottom: env(safe-area-inset-bottom); }
    .in-confirm .in-confirm-actions .btn { flex: 1; }
}
