:root {
    --om-ivory: #fffdf7;
    --om-ivory-warm: #fff8ee;
    --om-orange-ultralight: #ffefdc;
    --om-orange: #ed6b24;
    --om-orange-strong: #c64e0d;
    --om-ink: #17211b;
    --om-muted: #68756d;
    --om-sage-line: #dce4dd;
    --om-shadow: 0 18px 50px rgba(34,47,38,.10);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body:not(.auth-page) {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--om-ink);
    background:
        radial-gradient(circle at 88% 13%, rgba(237,107,36,.07), transparent 25%),
        #f3f6f1;
}

body:not(.auth-page) button,
body:not(.auth-page) input,
body:not(.auth-page) select,
body:not(.auth-page) textarea {
    font: inherit;
}

body:not(.auth-page) button,
body:not(.auth-page) a {
    -webkit-tap-highlight-color: transparent;
}

body:not(.auth-page) button:focus-visible,
body:not(.auth-page) a:focus-visible,
body:not(.auth-page) input:focus-visible,
body:not(.auth-page) select:focus-visible,
body:not(.auth-page) textarea:focus-visible,
body:not(.auth-page) summary:focus-visible {
    outline: 3px solid rgba(237,107,36,.28);
    outline-offset: 2px;
}

/* GLOBAL FORM CONTROL STANDARD — START
   Low-specificity defaults let purpose-built controls keep their module styling. */
body:not(.auth-page) :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]),
    select,
    textarea
) {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #cbd6cf;
    border-radius: 0;
    color: var(--om-ink);
    background: #fbfcfa;
    box-shadow: none;
    font-size: .88rem;
    line-height: 1.35;
    transition: border-color 140ms ease,box-shadow 140ms ease,background 140ms ease;
}

body:not(.auth-page) :where(textarea) {
    min-height: 88px;
    resize: vertical;
}

body:not(.auth-page) :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]),
    select,
    textarea
):hover:not(:disabled):not([readonly]) {
    border-color: #aebdb4;
    background: #fff;
}

body:not(.auth-page) :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]),
    select,
    textarea
):focus {
    border-color: var(--om-orange);
    outline: 0;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(237,107,36,.14);
}

body:not(.auth-page) :where(input,textarea)::placeholder {
    color: #7b8580;
    opacity: 1;
}

body:not(.auth-page) :where(input,select,textarea):disabled {
    color: #89938d;
    border-color: #dfe5e1;
    background: #f0f3f0;
    cursor: not-allowed;
}

body:not(.auth-page) :where(input,textarea)[readonly] {
    color: #5f6d65;
    background: #f4f6f3;
}

body:not(.auth-page) :where(input,select,textarea)[aria-invalid="true"],
body:not(.auth-page) :where(input,select,textarea):user-invalid {
    border-color: #c93d32;
    background: #fff8f7;
}

body:not(.auth-page) :where(input[type="checkbox"],input[type="radio"]) {
    accent-color: var(--om-orange);
}

body:not(.auth-page) :where(.field,.payment-field,.shift-field) > :where(span,label):first-child,
body:not(.auth-page) :where(label.field) > :where(span):first-child {
    color: #2e3b34;
    font-size: .7rem;
    font-weight: 850;
    letter-spacing: .015em;
}

body:not(.auth-page) :where(.field,.payment-field,.shift-field) small {
    color: var(--om-muted);
    font-size: .68rem;
    line-height: 1.35;
}

body:not(.auth-page) :where(button,.button,.primary-button,.secondary-button,.danger-button) {
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid #d7ded9;
    border-radius: 0;
    color: var(--om-ink);
    background: #fff;
    box-shadow: none;
    cursor: pointer;
    font: inherit;
    font-size: .82rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    transition: border-color 140ms ease,background 140ms ease,color 140ms ease,transform 140ms ease;
}

body:not(.auth-page) :where(button,.button,.primary-button,.secondary-button,.danger-button):hover:not(:disabled) {
    border-color: #efb289;
    background: var(--om-orange-ultralight);
}

body:not(.auth-page) :where(button,.button,.primary-button,.secondary-button,.danger-button):active:not(:disabled) {
    transform: translateY(1px);
}

body:not(.auth-page) :where(button,.button,.primary-button,.secondary-button,.danger-button):disabled {
    color: #8a948e;
    border-color: #dfe5e1;
    background: #eef2ee;
    cursor: not-allowed;
    opacity: .72;
}

body:not(.auth-page) :where(.button.primary,.primary-button) {
    border-color: var(--om-orange);
    color: #fff;
    background: var(--om-orange);
    box-shadow: 0 8px 18px rgba(237,95,23,.18);
}

body:not(.auth-page) :where(.button.primary,.primary-button):hover:not(:disabled) {
    border-color: var(--om-orange-strong);
    color: #fff;
    background: var(--om-orange-strong);
}

body:not(.auth-page) :where(.button.secondary,.button.ghost,.secondary-button) {
    border-color: #efd6c4;
    color: var(--om-ink);
    background: var(--om-ivory);
}

body:not(.auth-page) :where(.danger-button,.button.danger) {
    border-color: #efb6b0;
    color: #a92d24;
    background: #fff2f0;
}

body:not(.auth-page) :where(.danger-button,.button.danger):hover:not(:disabled) {
    border-color: #d96e65;
    color: #8f2119;
    background: #ffe4e0;
}

body:not(.auth-page) :where(.compact,.button.compact) {
    min-height: 34px;
    padding: 0 11px;
    font-size: .75rem;
}

/* Purpose-built controls: their own module layout remains authoritative. */
body:not(.auth-page) :where(
    .icon-button,
    .quantity-control button,
    .remove-line,
    .payment-mode,
    .text-action,
    .reference-tab,
    .master-tab,
    .nav-group > summary
) {
    width: auto;
}
/* GLOBAL FORM CONTROL STANDARD — END */

/* Complete shared application shell; modules must not own or duplicate this. */
body:not(.auth-page) .app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: minmax(250px,1fr) auto minmax(250px,1fr);
    align-items: center;
    column-gap: 20px;
    min-height: 72px;
    width: 100%;
    padding: 10px clamp(12px,1.25vw,24px);
    border-bottom: 1px solid rgba(214,221,215,.9);
    background: rgba(255,255,255,.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

body:not(.auth-page) .app-brand {
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 11px;
    color: var(--om-ink);
    text-decoration: none;
}

body:not(.auth-page) .app-brand > span:last-child {
    display: grid;
}

body:not(.auth-page) .app-brand strong {
    letter-spacing: -.02em;
}

body:not(.auth-page) .app-brand small {
    color: var(--om-muted);
    font-size: .7rem;
}

body:not(.auth-page) .brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    color: #fff;
    background: var(--om-orange);
    box-shadow: 0 12px 28px rgba(237,107,36,.24);
    font-size: .9rem;
    font-weight: 900;
    letter-spacing: -.04em;
}

body:not(.auth-page) .main-nav {
    display: flex;
    padding: 4px;
    border: 1px solid #efc5a8;
    border-radius: 0;
    background: var(--om-orange-ultralight);
}

body:not(.auth-page) .account-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    gap: 12px;
    color: var(--om-muted);
    font-size: .82rem;
}

body:not(.auth-page) .active-store-context {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.15;
    padding-right: 12px;
    border-right: 1px solid var(--line, #d8dfda);
}

body:not(.auth-page) .active-store-context small {
    color: var(--muted, #657069);
    font-size: .65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}

body:not(.auth-page) .active-store-context strong {
    color: var(--ink, #17211b);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

body:not(.auth-page) .secondary-button,
body:not(.auth-page) .button.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid #efd6c4;
    border-radius: 11px;
    color: var(--om-ink);
    background: var(--om-ivory);
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
}

body:not(.auth-page) .secondary-button.compact,
body:not(.auth-page) .button.compact {
    min-height: 38px;
    padding: 0 13px;
    font-size: .82rem;
}

body:not(.auth-page) .module-page {
    padding-top: 6px;
}

/* Shared grouped application navigation */
body:not(.auth-page) .main-nav {
    gap: 4px;
    overflow: visible;
}

body:not(.auth-page) .nav-group {
    position: relative;
}

body:not(.auth-page) .nav-group > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 0;
    color: var(--om-muted);
    cursor: pointer;
    font-size: .82rem;
    font-weight: 800;
    list-style: none;
    user-select: none;
}

body:not(.auth-page) .nav-group > summary::-webkit-details-marker {
    display: none;
}

body:not(.auth-page) .nav-icon {
    display: none;
}

body:not(.auth-page) .nav-group.active > summary,
body:not(.auth-page) .nav-group[open] > summary {
    border-color: #efb88f;
    color: var(--om-orange-strong);
    background: var(--om-ivory);
    box-shadow: none;
}

body:not(.auth-page) .nav-chevron {
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 150ms ease;
}

body:not(.auth-page) .nav-group[open] .nav-chevron {
    transform: translateY(2px) rotate(225deg);
}

body:not(.auth-page) .nav-dropdown {
    position: absolute;
    z-index: 80;
    top: calc(100% + 9px);
    left: 50%;
    display: grid;
    width: 280px;
    padding: 7px;
    border: 1px solid var(--om-sage-line);
    background: rgba(255,253,247,.98);
    box-shadow: 0 20px 50px rgba(31,43,34,.18);
    transform: translateX(-50%);
}

body:not(.auth-page) .nav-group:last-child .nav-dropdown {
    width: 310px;
}

body:not(.auth-page) .nav-dropdown a {
    display: grid;
    flex: none;
    gap: 2px;
    padding: 9px 11px;
    border-radius: 0;
    color: var(--om-ink);
    text-align: left;
    text-decoration: none;
}

body:not(.auth-page) .nav-dropdown a:hover,
body:not(.auth-page) .nav-dropdown a.active {
    color: var(--om-orange-strong);
    background: var(--om-orange-ultralight);
    box-shadow: none;
}

body:not(.auth-page) .nav-dropdown strong {
    font-size: .78rem;
}

body:not(.auth-page) .nav-dropdown small {
    color: var(--om-muted);
    font-size: .66rem;
    font-weight: 600;
}

body:not(.auth-page) .nav-dropdown .nav-section-label {
    display: block;
    margin: 8px 11px 3px;
    color: var(--om-orange-strong);
    font-size: .59rem;
    font-weight: 850;
    letter-spacing: .09em;
    line-height: 1.2;
    text-transform: uppercase;
}

body:not(.auth-page) .nav-dropdown .nav-section-label:first-child {
    margin-top: 3px;
}

body:not(.auth-page) .page-heading,
body:not(.auth-page) .page-shell > .hero:not(.module-hero) {
    position: relative;
    align-items: center;
    min-height: 154px;
    margin-bottom: 2px;
    padding: 22px 32px;
    border: 1px solid #f1e2d3;
    border-radius: 0;
    background:
        radial-gradient(circle at 72% 135%, rgba(237,107,36,.13), transparent 34%),
        linear-gradient(135deg,var(--om-ivory) 0%,var(--om-ivory-warm) 62%,var(--om-orange-ultralight) 100%);
    box-shadow: 0 14px 38px rgba(108,76,43,.08);
    overflow: hidden;
}

body:not(.auth-page) .page-heading h1,
body:not(.auth-page) .page-shell > .hero:not(.module-hero) h1 {
    color: var(--om-ink);
    font-size: clamp(1.75rem,3vw,2.65rem);
}

body:not(.auth-page) .page-heading p:last-child,
body:not(.auth-page) .page-shell > .hero:not(.module-hero) p:last-child {
    color: var(--om-muted);
}

body:not(.auth-page) .page-heading .eyebrow,
body:not(.auth-page) .page-shell > .hero:not(.module-hero) .eyebrow {
    color: var(--om-orange-strong);
}

body:not(.auth-page) .metric-grid,
body:not(.auth-page) .summary-grid {
    gap: 2px;
    margin-bottom: 2px;
}

body:not(.auth-page) .metric-grid--four {
    grid-template-columns: repeat(4,minmax(0,1fr));
    width: 100%;
}

body:not(.auth-page) .metric-grid article,
body:not(.auth-page) .summary-card,
body:not(.auth-page) .content-card,
body:not(.auth-page) .role-card,
body:not(.auth-page) .mapping-card,
body:not(.auth-page) .unknown-card,
body:not(.auth-page) .mobile-card {
    border-radius: 0;
}

body:not(.auth-page) .metric-grid article,
body:not(.auth-page) .summary-card {
    gap: 3px;
    min-height: 68px;
    padding: 11px 14px;
    border-color: var(--om-sage-line);
    background: rgba(255,253,247,.94);
}

body:not(.auth-page) .metric-grid strong,
body:not(.auth-page) .summary-card strong {
    font-size: 1.35rem;
    line-height: 1.05;
}

body:not(.auth-page) .metric-grid span,
body:not(.auth-page) .metric-grid small,
body:not(.auth-page) .summary-card span,
body:not(.auth-page) .summary-card small {
    font-size: .72rem;
    line-height: 1.25;
}

body:not(.auth-page) .metric-grid .dark,
body:not(.auth-page) .summary-card.accent {
    border-color: #ffd7bc;
    color: var(--om-ink);
    background: linear-gradient(135deg,#fff8ee,#ffead4);
}

body:not(.auth-page) .metric-grid .dark span,
body:not(.auth-page) .metric-grid .dark small,
body:not(.auth-page) .summary-card.accent span,
body:not(.auth-page) .summary-card.accent small {
    color: var(--om-muted);
}

body:not(.auth-page) .content-card,
body:not(.auth-page) .role-card {
    border-color: var(--om-sage-line);
    background: rgba(255,255,255,.96);
}

body:not(.auth-page) .button.primary,
body:not(.auth-page) .primary-button {
    background: var(--om-orange);
}

body:not(.auth-page) .button.secondary,
body:not(.auth-page) .secondary-button {
    border-color: #efd6c4;
    background: var(--om-ivory);
}

/* Project-wide compact data density */
body:not(.auth-page) .content-card {
    padding: 16px;
}

body:not(.auth-page) .toolbar,
body:not(.auth-page) .content-toolbar,
body:not(.auth-page) .barcode-toolbar {
    margin-bottom: 12px;
}

body:not(.auth-page) .reference-content {
    min-height: 0;
    padding: 16px;
}

body:not(.auth-page) .reference-toolbar {
    margin-bottom: 8px;
    padding-bottom: 10px;
}

body:not(.auth-page) .reference-toolbar h2 {
    font-size: 1.3rem;
}

body:not(.auth-page) .reference-search input,
body:not(.auth-page) .search-field input,
body:not(.auth-page) .search input {
    min-height: 38px;
}

body:not(.auth-page) .reference-table {
    border-spacing: 0 2px;
}

body:not(.auth-page) .reference-table th,
body:not(.auth-page) .data-table th {
    padding: 7px 10px;
    font-size: .66rem;
}

body:not(.auth-page) .reference-table td,
body:not(.auth-page) .data-table td {
    padding: 8px 10px;
    font-size: .82rem;
}

body:not(.auth-page) .reference-table--orange-head thead {
    color: #fff;
    background: var(--om-orange);
}

body:not(.auth-page) .reference-table--orange-head th {
    color: #fff;
    border-bottom-color: var(--om-orange);
}

body:not(.auth-page) .whatsapp-message-page .reference-table thead {
    color: #fff;
    background: var(--om-orange);
}

body:not(.auth-page) .whatsapp-message-page .reference-table th {
    color: #fff;
    border-bottom-color: var(--om-orange);
}

body:not(.auth-page) .field-grid > .field {
    align-content: start;
}

body:not(.auth-page) .reference-avatar,
body:not(.auth-page) .avatar {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    font-size: .72rem;
}

body:not(.auth-page) .reference-name-cell,
body:not(.auth-page) .person-cell {
    gap: 8px;
}

body:not(.auth-page) .reference-name-cell small {
    display: none;
}

body:not(.auth-page) .reference-code,
body:not(.auth-page) .reference-detail,
body:not(.auth-page) .status {
    padding: 4px 7px;
    font-size: .66rem;
}

body:not(.auth-page) .reference-pagination {
    margin-top: 10px;
    padding-top: 10px;
}

body:not(.auth-page) .product-list,
body:not(.auth-page) .mapping-list,
body:not(.auth-page) .unknown-list {
    gap: 4px;
}

body:not(.auth-page) .product-summary {
    gap: 10px;
    padding: 10px 12px;
}

body:not(.auth-page) .product-avatar,
body:not(.auth-page) .barcode-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
}

body:not(.auth-page) .sku-strip {
    gap: 8px;
    padding: 7px 12px;
    font-size: .72rem;
}

body:not(.auth-page) .mapping-card,
body:not(.auth-page) .unknown-card {
    gap: 9px;
    padding: 9px 11px;
    font-size: .8rem;
}

body:not(.auth-page) .role-grid {
    gap: 6px;
}

body:not(.auth-page) .role-card {
    min-height: 190px;
    padding: 13px;
}

body:not(.auth-page) .role-card h2 {
    margin: 4px 0 2px;
    font-size: 1.05rem;
}

body:not(.auth-page) .permission-list {
    gap: 4px;
    margin: 10px 0;
}

body:not(.auth-page) .permission-chip {
    padding: 4px 6px;
    font-size: .64rem;
}

body:not(.auth-page) .role-card-actions {
    gap: 5px;
    padding-top: 9px;
}

.auth-page {
    background: linear-gradient(135deg,var(--om-ivory) 0%,var(--om-ivory-warm) 58%,var(--om-orange-ultralight) 100%);
}

.auth-page .auth-brand {
    color: var(--om-ink);
    background:
        radial-gradient(circle at 76% 84%,rgba(237,107,36,.14),transparent 32%),
        linear-gradient(145deg,var(--om-ivory),var(--om-orange-ultralight));
}

.auth-page .auth-brand h1 { color: var(--om-ink); }
.auth-page .auth-brand .eyebrow { color: var(--om-orange-strong); }
.auth-page .auth-brand .brand-copy { color: var(--om-muted); }
.auth-page .brand-points span {
    border-color: #f0d6c2;
    color: #435148;
    background: rgba(255,255,255,.62);
}
.auth-page .auth-panel { background: rgba(255,253,247,.94); }

.themed-dialog {
    --themed-dialog-pad: 20px;
    width: min(calc(100% - 24px),620px);
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 0;
    border-radius: 0 !important;
    background: #fffdf9 !important;
    box-shadow: 0 24px 70px rgba(25,35,29,.24);
    color: var(--om-ink);
}

.themed-dialog.wide {
    width: min(calc(100% - 24px),900px);
}

.themed-dialog.extra-wide {
    width: min(calc(100% - 24px),1120px);
}

.themed-dialog::backdrop {
    background: rgba(20,31,25,.62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.themed-dialog .dialog-body,
.themed-dialog .dialog-form {
    max-height: calc(100dvh - 24px);
    padding: var(--themed-dialog-pad);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.themed-dialog .dialog-heading {
    position: relative;
    isolation: isolate;
    min-height: 80px;
    margin: calc(-1 * var(--themed-dialog-pad)) calc(-1 * var(--themed-dialog-pad)) 14px;
    padding: 12px 92px 11px 25px;
    border-bottom: 1px solid #f0dccb;
    background:
        radial-gradient(circle at 72% 145%,rgba(237,107,36,.15),transparent 38%),
        linear-gradient(135deg,var(--om-ivory) 0%,var(--om-ivory-warm) 66%,var(--om-orange-ultralight) 100%);
    overflow: hidden;
}

.themed-dialog .dialog-heading::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0;
    right: 0;
    bottom: 0;
    width: clamp(88px,25%,190px);
    background: linear-gradient(155deg,#ff792c 0%,#f15d16 100%);
    clip-path: polygon(12% 0,100% 0,100% 100%,0 100%);
}

.themed-dialog .dialog-heading > div {
    align-self: center;
}

.themed-dialog .dialog-heading .eyebrow {
    margin: 0 0 5px;
    color: var(--om-orange-strong);
    font-size: .65rem;
    font-weight: 850;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.themed-dialog .dialog-heading h2 {
    margin: 0;
    color: var(--om-ink);
    font-size: clamp(1.3rem,2vw,1.6rem);
    line-height: 1.1;
    letter-spacing: -.025em;
}

.themed-dialog .dialog-heading .icon-button {
    position: absolute;
    top: 50%;
    z-index: 2;
    right: 15px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 0;
    font-size: 1.2rem;
    color: #fff;
    background: rgba(255,255,255,.18);
    transform: translateY(-50%);
}

.themed-dialog .dialog-heading .icon-button:hover {
    background: rgba(255,255,255,.3);
}

.themed-dialog .field,
.themed-dialog .shift-field {
    display: grid;
    gap: 6px;
    margin-bottom: 13px;
}

.themed-dialog .field > span,
.themed-dialog .field > label,
.themed-dialog .shift-field > span,
.themed-dialog .field label {
    color: #2d3b33;
    font-size: .7rem;
    font-weight: 850;
    letter-spacing: .015em;
}

.themed-dialog input:not([type="checkbox"]):not([type="radio"]),
.themed-dialog select,
.themed-dialog textarea {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid #cbd6cf;
    border-radius: 0;
    color: var(--om-ink);
    background: #fbfcfa;
}

.themed-dialog textarea {
    min-height: 88px;
    resize: vertical;
}

.themed-dialog input::placeholder,
.themed-dialog textarea::placeholder {
    color: #78827d;
}

.themed-dialog .check,
.themed-dialog .shift-confirm {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 12px 0;
    padding: 11px 13px;
    border-left: 3px solid var(--om-orange);
    color: #354039;
    background: var(--om-orange-ultralight);
    font-size: .76rem;
}

.themed-dialog input[type="checkbox"],
.themed-dialog input[type="radio"] {
    accent-color: var(--om-orange);
}

.themed-dialog .alert {
    margin-bottom: 12px;
}

.themed-dialog .dialog-actions {
    position: sticky;
    z-index: 4;
    bottom: calc(-1 * var(--themed-dialog-pad));
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin: 16px calc(-1 * var(--themed-dialog-pad)) calc(-1 * var(--themed-dialog-pad));
    padding: 13px var(--themed-dialog-pad);
    border-top: 1px solid #f0dccb;
    border-top-color: #f0dccb;
    background: linear-gradient(90deg,#fffdf9,#fff7ec);
    box-shadow: 0 -8px 20px rgba(31,43,34,.04);
}

.themed-dialog .dialog-actions button {
    min-height: 40px;
    border-radius: 0;
}

/* Canonical action-button pattern:
   paired actions use ivory secondary + orange primary; a lone action is primary. */
body:not(.auth-page) .themed-dialog .dialog-actions > :where(button,.button):not(.danger-button):not(.danger) {
    border: 1px solid #efd6c4;
    border-radius: 0 !important;
    color: var(--om-ink);
    background: var(--om-ivory);
    box-shadow: none;
}

body:not(.auth-page) .themed-dialog .dialog-actions > :where(button,.button):last-child:not(.danger-button):not(.danger) {
    border-color: var(--om-orange);
    color: #fff;
    background: var(--om-orange);
    box-shadow: 0 8px 18px rgba(237,95,23,.18);
}

body:not(.auth-page) .themed-dialog .dialog-actions > :where(button,.button):last-child:not(.danger-button):not(.danger):hover:not(:disabled) {
    border-color: var(--om-orange-strong);
    color: #fff;
    background: var(--om-orange-strong);
}

body:not(.auth-page) :where(
    .button,
    .primary-button,
    .secondary-button,
    .danger-button
) {
    border-radius: 0 !important;
}

/* Reusable non-dialog action pair. */
body:not(.auth-page) .action-pair {
    display: inline-flex;
    align-items: stretch;
    gap: 8px;
}

body:not(.auth-page) .action-pair > :where(button,.button) {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 0 !important;
}

body:not(.auth-page) .action-pair > :where(button,.button):first-child {
    border-color: #efd6c4;
    color: var(--om-ink);
    background: var(--om-ivory);
    box-shadow: none;
}

body:not(.auth-page) .action-pair > :where(button,.button):last-child:not(.danger-button):not(.danger) {
    border-color: var(--om-orange);
    color: #fff;
    background: var(--om-orange);
    box-shadow: 0 8px 18px rgba(237,95,23,.18);
}

/* A dialog action pair is a full-width footer, not a shrink-to-content inline pair. */
body:not(.auth-page) .themed-dialog .dialog-actions.action-pair {
    display: flex;
    width: auto;
    align-items: stretch;
    justify-content: flex-end;
}

@media (min-width: 721px) and (max-width: 980px) {
    body:not(.auth-page) .app-header {
        grid-template-columns: 1fr auto 1fr;
        gap: 12px;
    }
    body:not(.auth-page) .main-nav {
        position: static !important;
        inset: auto !important;
        box-shadow: none;
    }
    body:not(.auth-page) .account-menu > span {
        display: none;
    }
    body:not(.auth-page) .module-page {
        padding-bottom: 76px;
    }
}

@media (max-width: 720px) {
    body:not(.auth-page) .app-header {
        position: sticky;
        top: 0;
        z-index: 50;
        grid-template-columns: 40px minmax(0,1fr) 40px;
        gap: 8px;
        min-height: 58px;
        padding: 7px 10px;
        overflow: visible;
    }
    body:not(.auth-page) .app-brand > span:last-child {
        display: none;
    }
    body:not(.auth-page) .app-brand .brand-mark {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    body:not(.auth-page) .account-menu {
        display: flex;
        min-width: 0;
    }
    body:not(.auth-page) .account-menu > span {
        display: none;
    }
    body:not(.auth-page) .account-menu #logout-button {
        width: 40px;
        min-width: 40px;
        min-height: 40px;
        padding: 0;
        border-radius: 10px;
        overflow: hidden;
        color: transparent;
        font-size: 0;
    }
    body:not(.auth-page) .account-menu #logout-button::before {
        content: "\2192";
        color: var(--om-orange-strong);
        font-size: 1.1rem;
        line-height: 1;
    }
    body:not(.auth-page) .module-page {
        padding-top: 3px;
        padding-bottom: 70px;
    }
    body:not(.auth-page) .metric-grid--four {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
    body:not(.auth-page) .main-nav {
        position: static !important;
        inset: auto !important;
        width: 100%;
        align-items: stretch;
        justify-content: stretch;
        padding: 3px;
        box-shadow: none;
    }
    body:not(.auth-page) .nav-group {
        flex: 1;
    }
    body:not(.auth-page) .nav-group > summary {
        justify-content: center;
        min-height: 36px;
        padding: 0 8px;
        white-space: nowrap;
    }
    body:not(.auth-page) .nav-dropdown {
        top: calc(100% + 9px);
        bottom: auto;
        width: min(310px,calc(100vw - 32px)) !important;
    }
    body:not(.auth-page) .page-heading,
    body:not(.auth-page) .page-shell > .hero:not(.module-hero) {
        min-height: 0;
        padding: 18px;
    }

    .themed-dialog {
        --themed-dialog-pad: 16px;
        width: calc(100% - 16px);
        max-height: calc(100dvh - 16px);
    }
    .themed-dialog .dialog-body,
    .themed-dialog .dialog-form {
        max-height: calc(100dvh - 16px);
    }
    .themed-dialog .dialog-heading {
        min-height: 68px;
        padding: 10px 68px 9px 16px;
    }
    .themed-dialog .dialog-heading::after {
        width: 64px;
        clip-path: polygon(14% 0,100% 0,100% 100%,0 100%);
    }
    .themed-dialog .dialog-heading .icon-button {
        right: 9px;
        width: 36px;
        height: 36px;
    }
    .themed-dialog .dialog-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 430px) {
    body:not(.auth-page) .metric-grid--four {
        grid-template-columns: 1fr;
    }
    body:not(.auth-page) .nav-group > summary {
        gap: 5px;
        padding: 0 4px;
        font-size: .72rem;
    }
    body:not(.auth-page) .nav-chevron {
        width: 6px;
        height: 6px;
    }
}

/*
 * Desktop hover navigation rail.
 * Rollback: remove `hover-rail-nav` from the shared app-header fragment. Every
 * selector below is scoped to that class, so the legacy horizontal nav returns
 * without changing any module template.
 */
@media (min-width: 981px) {
    body:not(.auth-page):has(> .app-header.hover-rail-nav) {
        padding-left: 68px;
    }

    body:not(.auth-page) > .app-header.hover-rail-nav {
        grid-template-columns: minmax(250px,1fr) minmax(250px,1fr);
        width: calc(100% + 68px);
        margin-left: -68px;
        padding-left: calc(68px + clamp(12px,1.25vw,24px));
    }

    body:not(.auth-page) .hover-rail-nav .main-nav {
        position: fixed;
        z-index: 90;
        top: 72px;
        bottom: 0;
        left: 0;
        display: flex;
        width: 68px;
        height: calc(100dvh - 72px);
        padding: 10px 8px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
        border: 0;
        border-right: 1px solid rgba(214,221,215,.95);
        background: rgba(255,255,255,.98);
        box-shadow: 10px 0 26px rgba(31,43,34,0);
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-color: #c6cdc8 transparent;
        scrollbar-width: thin;
        transition: width 180ms ease, box-shadow 180ms ease;
    }

    body:not(.auth-page) .hover-rail-nav .main-nav:hover,
    body:not(.auth-page) .hover-rail-nav .main-nav:focus-within {
        width: 292px;
        box-shadow: 12px 0 34px rgba(31,43,34,.16);
    }

    body:not(.auth-page) .hover-rail-nav .nav-group {
        position: static;
        width: 100%;
        flex: 0 0 auto;
    }

    body:not(.auth-page) .hover-rail-nav .nav-group > summary {
        display: grid;
        width: 100%;
        min-height: 50px;
        grid-template-columns: 38px minmax(0,1fr) 12px;
        align-items: center;
        gap: 8px;
        padding: 0 6px;
        border: 1px solid transparent;
        color: var(--om-muted);
        white-space: nowrap;
        overflow: hidden;
        transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
    }

    body:not(.auth-page) .hover-rail-nav .nav-group > summary:hover {
        color: var(--om-orange-strong);
        background: var(--om-orange-ultralight);
    }

    body:not(.auth-page) .hover-rail-nav .nav-group.active > summary,
    body:not(.auth-page) .hover-rail-nav .nav-group[open] > summary {
        border-color: #efb88f;
        color: var(--om-orange-strong);
        background: var(--om-orange-ultralight);
        box-shadow: inset 3px 0 0 var(--om-orange);
    }

    body:not(.auth-page) .hover-rail-nav .nav-icon {
        display: inline-flex;
        width: 38px;
        height: 38px;
        align-items: center;
        justify-content: center;
        flex: none;
    }

    body:not(.auth-page) .hover-rail-nav .nav-icon svg {
        width: 23px;
        height: 23px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    body:not(.auth-page) .hover-rail-nav .nav-label {
        max-width: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-width 150ms ease, opacity 120ms ease;
    }

    body:not(.auth-page) .hover-rail-nav .nav-chevron {
        opacity: 0;
        transition: transform 150ms ease, opacity 120ms ease;
    }

    body:not(.auth-page) .hover-rail-nav .main-nav:hover .nav-label,
    body:not(.auth-page) .hover-rail-nav .main-nav:focus-within .nav-label {
        max-width: 190px;
        opacity: 1;
    }

    body:not(.auth-page) .hover-rail-nav .main-nav:hover .nav-chevron,
    body:not(.auth-page) .hover-rail-nav .main-nav:focus-within .nav-chevron {
        opacity: 1;
    }

    body:not(.auth-page) .hover-rail-nav .nav-dropdown {
        position: static;
        display: none;
        width: auto !important;
        margin: 2px 0 8px 46px;
        padding: 3px 0 4px 9px;
        border: 0;
        border-left: 1px solid #efd6c4;
        background: transparent;
        box-shadow: none;
        transform: none;
    }

    body:not(.auth-page) .hover-rail-nav .main-nav:hover .nav-group[open] > .nav-dropdown,
    body:not(.auth-page) .hover-rail-nav .main-nav:focus-within .nav-group[open] > .nav-dropdown {
        display: grid;
    }

    body:not(.auth-page) .hover-rail-nav .nav-dropdown a {
        padding: 8px 10px;
    }

    body:not(.auth-page) .hover-rail-nav .nav-dropdown a:hover,
    body:not(.auth-page) .hover-rail-nav .nav-dropdown a.active {
        color: var(--om-orange-strong);
        background: var(--om-orange-ultralight);
        box-shadow: inset 2px 0 0 var(--om-orange);
    }

    body:not(.auth-page) .hover-rail-nav .nav-dropdown .nav-section-label {
        margin-left: 10px;
    }

    @media (prefers-reduced-motion: reduce) {
        body:not(.auth-page) .hover-rail-nav .main-nav,
        body:not(.auth-page) .hover-rail-nav .nav-label,
        body:not(.auth-page) .hover-rail-nav .nav-chevron {
            transition: none;
        }
    }
}
.list-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:4px;padding-top:10px;border-top:1px solid var(--om-sage-line,#d7dfd8);color:var(--om-muted,#65736b);font-size:.875rem}.list-pagination>div{display:flex;align-items:center;gap:8px}.list-pagination button{min-width:92px}.list-pagination[hidden]{display:none!important}@media(max-width:620px){.list-pagination{align-items:stretch;flex-direction:column}.list-pagination>div{display:grid;grid-template-columns:1fr auto 1fr}.list-pagination button{min-width:0}}
.form-media-preview{display:block;width:min(100%,420px);max-height:240px;object-fit:contain;border:1px solid var(--line,#d8e0d9);background:#fff;padding:8px}
