/* Feel more like a native app, less like a web page. */
html.native-ios {
    /* iOS's env(safe-area-inset-bottom) reports genuine values (the home
       indicator inset) - no forced floor needed here, unlike Android. */
    --dw-bottom-reserve: env(safe-area-inset-bottom, 0px);
    --bottom-bar-height: 62px;
    --bottom-bar-offset: 24px;
    /* #bottomBar's total footprint from the screen's bottom edge. */
    --dw-bar-height: calc(var(--bottom-bar-height) + var(--bottom-bar-offset));

    /* Design tokens (light mode) - matches native-android.css's light-mode palette
       so the two platforms share one look. */
    --dw-bg: #F7F8FA;
    --dw-surface: #FFFFFF;
    --dw-surface-translucent: rgba(255, 255, 255, 0.16);
    --dw-glass-edge: rgba(255, 255, 255, 0.6);
    --dw-surface-2: #F2F2F2;
    --dw-active-row: #F0F0F0;

    --dw-text: #111111;
    --dw-text-tertiary: #6E6E73;   /* least-prominent text (other-month days): 4.9:1 on --dw-bg */

    --dw-border: #E5E7EB;
    --dw-border-strong: #D8DADF;
    --dw-field-border: #858589;   /* a form field's edge: WCAG wants 3:1 against the page for it (3.5:1 on --dw-bg) */

    --dw-press-tint: rgba(0, 0, 0, 0.06);

    --dw-shadow-pill: 0 8px 24px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.08);
    --dw-shadow-sheet: 0 -6px 24px rgba(0, 0, 0, 0.25);
    --dw-shadow-dialog: 0 12px 48px rgba(0, 0, 0, 0.25);
}

/* The libraries' own colours (light mode) - the same block as native-android.css's. The themes' values
   are tuned for a white page; on this file's grey surfaces (--dw-bg, --dw-surface-2) a few fell just short
   of WCAG's 4.5:1: field labels and placeholders (Syncfusion's outline colour), selected-tab text (its
   primary colour) and links. Filled primary buttons keep the brand blue (--sf-primary, site.css). Dark
   mode has its own full block below, which this must stay above. */
html.native-ios:root {
    --color-sf-outline: 110, 106, 115;     /* 5.0:1 on --dw-bg (the theme's 121, 116, 126 was 4.3:1) */
    --color-sf-primary: 0, 106, 182;       /* 5.0:1 on --dw-surface-2 (the brand 0, 119, 204 was 4.2:1) */
    --sf-primary: rgb(0, 119, 204);
    --bs-link-color: #0A58CA;
    --bs-link-color-rgb: 10, 88, 202;
}

/* Design tokens (dark mode) - follows the system setting, no in-app toggle.
   Matches native-android.css's own dark-mode block so both platforms share
   one look. */
@media (prefers-color-scheme: dark) {
    html.native-ios {
        --dw-bg: #1C1C1E;
        --dw-surface: #2C2C2E;
        --dw-surface-translucent: rgba(44, 44, 46, 0.16);
        --dw-glass-edge: rgba(255, 255, 255, 0.16);
        --dw-surface-2: #3A3A3C;
        --dw-active-row: #3A3A3C;

        --dw-text: #F2F2F2;
        --dw-text-tertiary: #A1A1A6;   /* least-prominent text (other-month days): 5.4:1 on --dw-surface */

        --dw-border: #333335;
        --dw-border-strong: #5A5A5C;
        --dw-field-border: #8E8E93;   /* 5.2:1 on --dw-bg */

        --dw-press-tint: rgba(255, 255, 255, 0.08);

        --dw-shadow-pill: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
        --dw-shadow-sheet: 0 -6px 24px rgba(0, 0, 0, 0.6);
        --dw-shadow-dialog: 0 12px 48px rgba(0, 0, 0, 0.6);
    }

    /* The libraries' own colours, dark - the same block as native-android.css's.
       The pages' components are Syncfusion's Material 3 theme (material3.css, loaded by each page after
       this file), which reads every colour from these --color-sf-* RGB triplets; Syncfusion's own dark
       mode (its .e-dark-mode class) is nothing more than a second set of them. Pointing them at this
       file's dark palette here turns every Syncfusion component dark at once - the Scheduler, dialogs,
       popups, inputs, tabs, buttons - where before only the ones patched one by one below were, and the
       rest stayed light-theme: white screens, or dark text on this dark page. Bootstrap's body colours
       (the text colour everything else inherits) and the Portal tokens (portal-tokens.css) likewise.
       html.native-ios:root outranks site.css's html:root brand colours and the theme's own :root. */
    html.native-ios:root {
        color-scheme: dark;   /* the browser's own controls (date/select inputs, scrollbars) draw dark too */

        /* Text colours below are measured as rendered (the computed colour on the composited surface behind it),
           and small text gets margin over WCAG's 4.5:1: 6:1 or more on --dw-surface, 5:1 or more on --dw-surface-2. */
        --color-sf-primary: 140, 196, 255;              /* the brand blue, lightened to read on dark: 7.6:1 on --dw-surface, 6.2:1 on --dw-surface-2 */
        --color-sf-primary-container: 0, 74, 128;
        --color-sf-on-primary: 0, 28, 56;
        --color-sf-on-primary-container: 209, 228, 255;
        --color-sf-secondary: 199, 199, 204;
        --color-sf-secondary-container: 58, 58, 60;
        --color-sf-on-secondary: 28, 28, 30;
        --color-sf-on-secondary-container: 242, 242, 242;
        --color-sf-tertiary: 239, 184, 200;
        --color-sf-tertiary-container: 99, 59, 72;
        --color-sf-on-tertiary: 73, 37, 50;
        --color-sf-on-tertiary-containe: 255, 216, 228;   /* sic - Syncfusion's own spelling */
        --color-sf-surface: 44, 44, 46;                  /* --dw-surface */
        --color-sf-surface-variant: 58, 58, 60;          /* --dw-surface-2 */
        --color-sf-on-surface: 242, 242, 242;            /* --dw-text */
        --color-sf-on-surface-variant: 199, 199, 204;    /* secondary text, 8.3:1 */
        --color-sf-on-background: 242, 242, 242;
        --color-sf-outline: 174, 174, 178;               /* field edges, labels and placeholders: 6.3:1 on --dw-surface, 5.1:1 on --dw-surface-2 */
        --color-sf-outline-variant: 72, 72, 74;          /* dividers */
        --color-sf-surface-tint-color: 140, 196, 255;
        --color-sf-inverse-surface: 230, 225, 229;
        --color-sf-inverse-on-surface: 49, 48, 51;
        --color-sf-inverse-primary: 0, 119, 204;
        --color-sf-error: 255, 180, 171;
        --color-sf-error-container: 147, 0, 10;
        --color-sf-on-error: 105, 0, 5;
        --color-sf-on-error-container: 255, 218, 214;
        --color-sf-success: 83, 202, 23;
        --color-sf-success-container: 22, 62, 2;
        --color-sf-on-success: 13, 39, 0;
        --color-sf-on-success-container: 183, 250, 150;
        --color-sf-info: 71, 172, 251;
        --color-sf-info-container: 0, 67, 120;
        --color-sf-on-info: 0, 51, 91;
        --color-sf-on-info-container: 173, 219, 255;
        --color-sf-warning: 245, 180, 130;
        --color-sf-warning-container: 123, 65, 0;
        --color-sf-on-warning: 99, 52, 0;
        --color-sf-on-warning-container: 255, 220, 193;
        --color-sf-spreadsheet-gridline: 72, 72, 74;
        --color-sf-shadow-focus-ring1: 0 0 0 1px #000, 0 0 0 3px #fff;
        --color-sf-success-text: 0, 0, 0;
        --color-sf-warning-text: 0, 0, 0;
        --color-sf-info-text: 0, 0, 0;
        --color-sf-danger-text: 0, 0, 0;
        --color-sf-content-text-color-alt2: var(--color-sf-on-secondary);
        /* site.css's filled primary buttons put white text on --sf-primary: they keep the brand blue (4.7:1). */
        --sf-primary: rgb(0, 119, 204);

        --bs-body-color: var(--dw-text);
        --bs-body-color-rgb: 242, 242, 242;
        --bs-body-bg: var(--dw-surface);
        --bs-body-bg-rgb: 44, 44, 46;
        --bs-emphasis-color: #FFFFFF;
        --bs-emphasis-color-rgb: 255, 255, 255;
        --bs-secondary-color: rgba(242, 242, 242, 0.75);
        --bs-secondary-color-rgb: 242, 242, 242;
        --bs-secondary-bg: var(--dw-surface-2);
        --bs-tertiary-color: rgba(242, 242, 242, 0.6);
        --bs-tertiary-bg: var(--dw-surface-2);
        --bs-border-color: var(--dw-border-strong);
        --bs-border-color-translucent: rgba(255, 255, 255, 0.15);
        --bs-link-color: #8CC4FF;                        /* = --color-sf-primary: 7.6:1 on --dw-surface */
        --bs-link-color-rgb: 140, 196, 255;
        --bs-link-hover-color: #B3D8FF;
        --bs-link-hover-color-rgb: 179, 216, 255;
        --bs-form-invalid-color: #EA868F;
        --bs-form-invalid-border-color: #EA868F;

        --portal-color-text: var(--dw-text);
        --portal-color-text-muted: #C7C7CC;
        --portal-color-border: var(--dw-border-strong);
        --portal-surface-page: var(--dw-bg);
        --portal-surface-card: var(--dw-surface);
        --portal-surface-tint: var(--dw-surface-2);
        /* Blue text (links, clickable references, form links and tags). --portal-color-accent itself stays the brand
           blue: it is also a fill under white text. */
        --portal-color-accent-text: #8CC4FF;
        --portal-color-accent-text-hover: #B3D8FF;
        /* The organisation's own colours (the sidebar/secondary navy by default) as text, e.g. Home's area labels and
           "Open" links: mixed 70% toward white, so any brand colour - even black - reads 6.5:1 on --dw-surface and
           keeps its hue. */
        --portal-color-brand-text: color-mix(in srgb, var(--sidebar-bg) 30%, #FFFFFF);
        --portal-color-brand-secondary-text: color-mix(in srgb, var(--secondary-bg) 30%, #FFFFFF);
    }

    /* form-js (the dynamic forms' library, dist/style.css) draws placeholders, read-only and disabled values and its
       date picker's labels from its own light-theme text tokens (#505562 on the dark field: 1.5:1). Re-pointed here,
       where its --color-* tokens read them. */
    html.native-ios .fjs-container {
        --bio-text: var(--dw-text);
        --bio-text-subtle: rgb(174, 174, 178);           /* = --color-sf-outline: placeholders, read-only values (5.1:1 on the field) */
        --bio-text-subtlest: var(--dw-text-tertiary);    /* disabled text, other-month days */
        /* Its neutral fills: a tag's remove (x) button was a fixed light-grey square, and its x (this text colour at
           60%) almost vanished on it. Disabled/read-only tags and the focused list item use surface-strong. */
        --bio-neutral-subtle: #48484A;
        --bio-neutral-subtle-hover: #5A5A5C;
        --bio-surface-strong: #48484A;
    }
}

/* The system's Increase Contrast setting (iOS Accessibility > Display & Text Size; WebKit reports it as
   prefers-contrast: more): secondary, placeholder and blue text move closer to the main text colour. The same
   block as native-android.css's; it must follow the light and dark blocks above, which share its specificity. */
@media (prefers-contrast: more) {
    html.native-ios:root {
        --color-sf-outline: 72, 72, 74;
        --color-sf-on-surface-variant: 28, 28, 30;
        --bs-link-color: #0040A0;
        --bs-link-color-rgb: 0, 64, 160;
    }
    html.native-ios {
        --dw-text-tertiary: #3A3A3C;
    }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
    html.native-ios:root {
        --color-sf-outline: 209, 209, 214;
        --color-sf-on-surface-variant: 242, 242, 242;
        --color-sf-primary: 179, 216, 255;
        --bs-link-color: #B3D8FF;
        --bs-link-color-rgb: 179, 216, 255;
        --portal-color-text-muted: #E5E5EA;
        --portal-color-accent-text: #B3D8FF;
        --portal-color-accent-text-hover: #D1E7FF;
    }
    html.native-ios {
        --dw-text-tertiary: #C7C7CC;
    }
    html.native-ios .fjs-container {
        --bio-text-subtle: rgb(209, 209, 214);
    }
}

html.native-ios {
    --dw-grid-surface: var(--dw-surface);
    --dw-grid-surface-2: var(--dw-surface-2);
    --dw-grid-active-row: var(--dw-active-row);
    --dw-grid-text: var(--dw-text);
    --dw-grid-border: var(--dw-border);
}

html.native-ios,
html.native-ios body {
    height: 100dvh;
    overflow: hidden;                        /* body is not a scroller; .main-container is */
    overscroll-behavior: none;               /* no rubber-band / pull-to-refresh */
    -webkit-tap-highlight-color: transparent; /* no grey flash on tap */
}

html.native-ios input,
html.native-ios textarea,
html.native-ios select,
html.native-ios .e-input,
html.native-ios .e-input-group input,
html.native-ios [contenteditable="true"] {
    font-size: 16px !important;
}

/* --- Shell structure: flex column, no fixed positioning (constraint: no
   position:fixed in the shell) --------------------------------------------- */
html.native-ios .topBar,
html.native-ios .topBar-center,
html.native-ios .topBar-RHS-button-container {
    background-color: var(--dw-bg) !important;
}
html.native-ios .topBar {
    position: static;
    flex-shrink: 0;
    box-sizing: border-box;
    height: calc(44px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: calc(10px + env(safe-area-inset-right, 0px));
    border-bottom: 1px solid var(--dw-border);
}
html.native-ios .topBar::after {
    display: none !important;   /* two-tone corner notch - not needed on a flat bar */
}

html.native-ios .main-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    background: var(--dw-bg);
    margin: 0;
    border-radius: 0;
}

/* Document viewer pane - never wider than the device, unlike desktop
   where horizontal scroll is fine. */
html.native-ios .pane-content {
    overflow-x: hidden;
}

/* SMS/Chat view only - the input box is the one piece of content that must
   stay fully clear of the floating bottom bar (unlike a grid, where the bar
   just floats over the last row or two and nothing is lost) - everywhere
   else .main-container stays edge-to-edge/full-screen behind the bar. */
html.native-ios #chat-container {
    padding-bottom: var(--dw-bar-height);
}

html.native-ios .e-dialog:not(.e-schedule-dialog) {
    max-width: calc(100vw - 32px) !important;
}

/* site.css reserves both of these on body for the desktop/mobile-web case,
   where .topBar is position:fixed and needs page content pushed clear of it.
   In-app, .topBar is a normal flex child instead (own safe-area padding
   above) and #bottomBar is a floating position:fixed pill (clears itself) -
   left in place, body's own border-box height budget loses that much space
   from both ends, showing up as a blank gap under the status bar and a
   blank strip above the home indicator. */
html.native-ios body {
    padding-top: 0;
    padding-bottom: 0;
}

html.native-ios * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
html.native-ios input,
html.native-ios textarea,
html.native-ios [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

/* Momentum scrolling for scrollable regions. */
html.native-ios .layout-container,
html.native-ios .second-bar,
html.native-ios main {
    -webkit-overflow-scrolling: touch;
}

/* Desktop's side rail - collapsed on mobile, but its decorative corner-notch
   shapes still rendered a stray navy patch */
html.native-ios .second-bar {
    display: none !important;
}

html.native-ios,
html.native-ios body {
    background-color: var(--dw-surface);
}

/* --- Top bar --- */
/* Repurposed as the menu button (native-app.js swaps its onclick and adds
   an e-menu icon child) - the org logo moves into the search bar instead,
   see .dw-search-logo below. */
html.native-ios .topBar-LHS-logo-container,
html.native-ios .topBar-LHS-buttons .btn-topbar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    max-width: 32px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    box-sizing: border-box;
    border-radius: 50%;
    background-color: var(--dw-surface-2) !important;
    border: 1px solid var(--dw-border-strong);
    color: var(--dw-text) !important;
}
html.native-ios .topBar-LHS-logo-container {
    background-image: none !important;
    margin-left: calc(10px + env(safe-area-inset-left, 0px));
}
/* Pinned by its own box, not flex distribution - immune to the empty
   label span or any other sibling still claiming layout space. */
html.native-ios .topBar-LHS-logo-container .hamburger-menu-icon,
html.native-ios .topBar-LHS-buttons .btn-topbar svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}
html.native-ios .topBar-LHS-logo-container .hamburger-menu-icon {
    width: 20px;
    height: 20px;
    color: var(--dw-text);
}
/* Small org logo, inline at the start of the search pill (native-app.js
   inserts this as .search-wrapper's first child). */
html.native-ios .dw-search-logo {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-right: 6px;
    border-radius: 50%;
    background-image: var(--image-bg);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
/* .topBar-RHS-button-container = document viewer action buttons (Edit/Submit/Close),
   empty on the plain grid view but still reserving dead space */
html.native-ios .topBar-RHS-button-container {
    min-width: 0 !important;
    padding-right: 0 !important;
    gap: 2px !important;
}
/* Real action buttons (Edit/Clone/Close) always render mirrored into #bottomBar instead */
html.native-ios #rhs-buttons-container {
    display: none !important;
}
html.native-ios .search-wrapper,
html.native-ios .e-input.search-input,
html.native-ios #customSearchBox {
    background-color: var(--dw-surface-2) !important;
    border: none;
    box-sizing: border-box;
}
html.native-ios .search-wrapper {
    height: 32px !important;   /* matches the menu/filter/refresh buttons exactly, so the whole row sits on one common height */
    border-radius: 16px !important;   /* full capsule at this height, not the CDN theme's flatter 13px-on-32px box */
    padding-left: 10px !important;
}
html.native-ios .search-input,
html.native-ios .search-icon,
html.native-ios .clear-icon {
    color: var(--dw-text) !important;
}
/* No "Search" placeholder word - the logo already marks what the field is. */
html.native-ios .search-input::placeholder,
html.native-ios .e-input.search-input::placeholder {
    color: transparent !important;
}
/* One icon at a time, like a real iOS search field - magnifying glass while
   empty, swapped for the clear button once there's text - instead of both
   sitting there permanently. */
html.native-ios .search-input:placeholder-shown ~ .clear-icon {
    display: none !important;
}
html.native-ios .search-input:not(:placeholder-shown) ~ .search-icon {
    display: none !important;
}

html.native-ios .topBar .btn-topbar {
    color: var(--dw-text);
    background-color: transparent;
}
html.native-ios .topBar .btn-topbar:hover,
html.native-ios .topBar .btn-topbar:active,
html.native-ios .topBar .btn-topbar:focus {
    background-color: var(--dw-surface-2) !important;
    color: var(--dw-text) !important;
}
html.native-ios .topBar-LHS-buttons .btn-topbar:active {
    background-color: var(--dw-active-row) !important;
}

/* Top bar: wider search field; filter + refresh pushed to the far right. */
html.native-ios .search-bar {
    max-width: none !important;        /* lift the 50% cap so search fills the bar */
    flex: 1 1 auto !important;
    margin-left: 8px;
}
html.native-ios .search-wrapper,
html.native-ios .search-input {
    width: 100% !important;
}
html.native-ios .topBar-LHS-buttons {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-left: 10px;      /* push filter + refresh to the far right, with breathing room off the search pill */
}

/* Scheduler's "Group Jobs By Users" toggle + location dropdown (only
   rendered for certain auth types, Scheduler/Index.cshtml) - site.css has a
   max-width:768px rule meant to shrink these to fit a phone-width topBar
   (hide the toggle's own label, cap the dropdown's width), but on this shell
   they were still colliding - the toggle's "Group Jobs By Users" label was
   rendering full-width behind the dropdown instead of being hidden. Redone
   here with !important so it actually takes effect regardless of why the
   site.css version wasn't. */
html.native-ios .topBar-toggle-container {
    /* No max-width/overflow:hidden here - the label is display:none below
       (removed from flow entirely, taking zero space), so capping the
       container's own width on top of that was clipping the switch control
       itself, making it half-cut-off and its hit target too small to tap. */
    flex: 0 0 auto !important;
    margin-left: 6px !important;
}
html.native-ios .scheduler-toggle-label {
    display: none !important;
}
html.native-ios .topBar-dropdown-container {
    flex: 0 0 auto !important;
    min-width: 90px !important;
    max-width: 120px !important;
    width: auto !important;
    margin-left: 6px !important;
    margin-right: 12px !important;   /* .topBar-RHS-button-container is empty on the Scheduler page, so .topBar-center otherwise runs flush to the screen edge with nothing reserving a gutter here */
    background-color: var(--dw-surface-2) !important;   /* site.css's fixed white box held the region name in the theme's text colour - white on white in dark mode */
}
html.native-ios .topBar-dropdown-container * {
    font-size: 16px !important;
    padding-left: 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
}

html.native-ios #menuBtn {
    display: none !important;
}

/* --- Floating bottom bar, glass background --- */
html.native-ios #bottomBar {
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 500;   /* above page content, below the menu sheet/overlay (1000+) */
    width: fit-content !important;
    max-width: calc(100% - 32px);
    min-height: 40px;
    overflow: hidden;
    background: var(--dw-surface-translucent) !important;
    -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
    backdrop-filter: blur(28px) saturate(180%) !important;
    border: 1px solid var(--dw-glass-edge);
    border-radius: calc(var(--bottom-bar-height) / 2);
    box-shadow: var(--dw-shadow-pill);
    margin: 0 auto var(--bottom-bar-offset) auto;
    height: var(--bottom-bar-height);
    padding: 6px;
}

html.native-ios #bottomBar:has(button) {
    display: flex !important;   /* only ever shown when it has a button to show */
}

html.native-ios.dw-kb-open #bottomBar {
    display: none !important;   /* hidden while the keyboard is up */
}

html.native-ios #bottomBar.dw-bb-multi {
    gap: 16px;
}

html.native-ios #bottomBar .btn-topbar,
html.native-ios #bottomBar .btn-topbar:hover,
html.native-ios #bottomBar .btn-topbar:focus,
html.native-ios #bottomBar .btn-topbar:active {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: transparent !important;
    color: var(--dw-text) !important;
    box-shadow: none !important;
    outline: none !important;
    border: none !important;
    flex: 1 1 0;
    gap: 4px;
    height: 100%;
    min-width: 96px;
    min-height: 0;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    padding: 0 12px;
    border-radius: calc((var(--bottom-bar-height) - 14px) / 2);
    box-sizing: border-box;
}
html.native-ios #bottomBar .btn-topbar:active {
    background-color: var(--dw-surface-2) !important;
    opacity: 1;
}
html.native-ios #bottomBar:has(.btn-topbar:nth-child(3)) .btn-topbar {
    flex: 0 1 auto;
    min-width: 64px;
    padding: 0 8px;
}
html.native-ios #bottomBar .btn-topbar .icon-topbar,
html.native-ios #bottomBar .btn-topbar svg {
    align-self: center !important;
    float: none !important;
    margin: 0 !important;
}
html.native-ios #bottomBar .btn-topbar-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    margin: 0 !important;
    float: none !important;
}

html.native-ios #bottomBar {
    transform-origin: left center;
}
@media (prefers-reduced-motion: no-preference) {
    html.native-ios #bottomBar {
        transition: opacity 700ms ease, transform 700ms ease;
    }
    html.native-ios #bottomBarMini {
        transition: opacity 650ms ease, transform 850ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }
}
html.native-ios #bottomBar.dw-bb-animating,
html.native-ios #bottomBarMini.dw-bb-animating {
    will-change: opacity, transform;
}
html.native-ios #bottomBar.dw-bb-collapsed {
    opacity: 0;
    transform: scaleX(0.12);
    pointer-events: none;
}

html.native-ios #bottomBarMini {
    position: fixed;
    left: calc(28px + env(safe-area-inset-left, 0px));
    bottom: var(--bottom-bar-offset);
    z-index: 500;
    width: var(--bottom-bar-height);
    height: var(--bottom-bar-height);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    background: var(--dw-surface-translucent) !important;
    -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
    backdrop-filter: blur(28px) saturate(180%) !important;
    border: 1px solid var(--dw-glass-edge);
    border-radius: 50%;
    box-shadow: var(--dw-shadow-pill);
    color: var(--dw-text) !important;
    opacity: 0;
    transform: scaleX(0.3);
    pointer-events: none;
}
html.native-ios #bottomBarMini:active {
    background-color: var(--dw-surface-2) !important;
}
html.native-ios #bottomBarMini .dw-bb-mini-icon,
html.native-ios #bottomBarMini svg {
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
}
html:has(#bottomBar.dw-bb-collapsed) #bottomBarMini {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
    html.native-ios #bottomBar,
    html.native-ios #bottomBarMini {
        transition: opacity 120ms ease !important;
    }
}

html.native-ios .search-input::placeholder {
    font-size: 16px;   /* stay above the 16px iOS-zoom-safe floor */
}

/* --- Tap targets: pad small controls to ~48x48 via an invisible hit-slop
   layer, without resizing the visible icon/button (constraint: don't shrink
   or grow fonts/icons). --------------------------------------------------- */
html.native-ios .btn-topbar,
html.native-ios .topBar-LHS-logo-container,
html.native-ios .search-icon,
html.native-ios .clear-icon {
    position: relative;
}
html.native-ios .btn-topbar::after,
html.native-ios .topBar-LHS-logo-container::after,
html.native-ios .search-icon::after,
html.native-ios .clear-icon::after {
    content: "";
    position: absolute;
    inset: -8px;
}

/* --- Module menu: tap-to-close catcher --- */
/* Invisible, not a dim scrim - the push+fade below (on .topBar/
   .layout-container) is what visually communicates "menu open" instead, so
   this is purely a full-screen tap target for closing the menu. */
html.native-ios #dwSheetOverlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: transparent;
    opacity: 0;
    pointer-events: none;
}
html.native-ios #dwSheetOverlay.dw-open {
    opacity: 1;
    pointer-events: auto;
}

/* Everything else pushes right and fades while the menu is open, Reddit-app
   style, instead of the menu floating over it - see setSheetOverlayVisible
   in native-app.js for the dw-menu-open class this reads. */
html.native-ios .topBar,
html.native-ios .layout-container {
    transition: transform 0.3s ease, opacity 0.3s ease;
}
html.native-ios.dw-menu-open .topBar,
html.native-ios.dw-menu-open .layout-container {
    transform: translateX(min(78%, 420px));   /* matches the drawer's own width below */
    opacity: 0.5;
    pointer-events: none;
}

/* --- Module menu: left-side drawer (real Syncfusion sidebar + JS-built
   fallback), reparented to <body> (native-app.js) so it isn't dragged along
   by the push transform above - opened from a button in the top bar. Full
   height, fixed width, no resize gesture - simpler than a sheet since
   there's no snap height to drag between. */
html.native-ios .phone-second-bar.e-sidebar,
html.native-ios .phone-second-bar.e-sidebar.e-right,
html.native-ios .dw-fallback-sheet {
    width: 78% !important;
    max-width: 420px !important;
    right: auto !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    height: auto !important;
    max-height: none !important;
    box-sizing: border-box !important;
    padding-top: env(safe-area-inset-top, 0px) !important;   /* reserved on the clipping container itself, not the inner scroll list, so scrolled rows are clipped here and can never slide up under the status bar/notch */
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: 0;
    box-shadow: var(--dw-shadow-sheet);
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease !important;
}
html.native-ios .phone-second-bar.e-sidebar.e-open,
html.native-ios .dw-fallback-sheet.dw-open {
    transform: translateX(0) !important;
}

html.native-ios .dw-fallback-sheet {
    position: fixed;
    z-index: 1005;
    background: var(--dw-surface);
    border-right: 1px solid var(--dw-border);
}

html.native-ios .phone-second-bar {
    background: var(--dw-surface) !important;
}
html.native-ios .phone-second-bar .e-list-text,
html.native-ios .phone-second-bar .e-icons,
html.native-ios .phone-second-bar .e-list-icon {
    color: var(--dw-text) !important;
    font-weight: 500 !important;
}
/* Row layout/sizing below is normally supplied by site.css's own
   @media (max-width: 768px) block, which stops applying once the
   viewport crosses 768px (iPhone landscape, iPad) - but the app is
   still "mobile shell" at that width (isMobileLayout() no longer keys
   off width, see mobileSite.js), so these are re-declared here
   unconditionally so row sizing/text stay consistent with portrait. */
html.native-ios .phone-second-bar .e-list-text {
    font-size: 18px !important;
}
html.native-ios .phone-second-bar {
    --phone-tree-icon-w: 18px;
    --phone-tree-icon-gap: 12px;
}
html.native-ios .phone-second-bar .e-text-content {
    display: flex !important;
    align-items: center !important;
    min-height: 48px !important;
    gap: var(--phone-tree-icon-gap) !important;
    width: 100%;
    padding-left: 0 !important;
    margin-left: 0 !important;
    text-indent: 0 !important;
}
html.native-ios .phone-second-bar .e-text-content:not(:has(.e-list-icon))::before {
    content: '';
    display: inline-block;
    width: var(--phone-tree-icon-w);
    flex-shrink: 0;
}
/* Views (nested under a module): no reserved icon spacer here - instead a
   fixed 10px, measured so the text lines up with the module's own icon
   (which carries a Syncfusion-theme 12px margin-left the spacer above
   doesn't know about). */
html.native-ios .phone-second-bar .phone-tree-parent .e-ul .e-text-content::before {
    display: none !important;
}
html.native-ios .phone-second-bar .phone-tree-parent .e-ul .e-text-content {
    padding-left: 10px !important;
}
html.native-ios .phone-second-bar .e-list-icon {
    width: var(--phone-tree-icon-w) !important;
    height: var(--phone-tree-icon-w) !important;
    flex-shrink: 0;
}
html.native-ios .phone-second-bar .e-fullrow {
    height: 44px !important;
    /* .e-fullrow (the active/hover row's pill background) is a
       position:absolute sibling that comes BEFORE .e-text-content in the
       DOM, with an explicit z-index:0 from the Syncfusion theme, while
       .e-text-content is only position:relative with z-index:auto. Both
       land in the same CSS stacking step ("z-index:0/auto positioned
       descendants, in tree order"), which should paint .e-fullrow first
       and .e-text-content on top - but confirmed via live testing (App,
       2026-09-17) that WKWebView instead paints .e-fullrow ON TOP,
       fully hiding the row's own text, whenever the row is (re)rendered
       at a width beyond the ~768px the component was normally tested at
       (iPhone landscape, iPad) - a blank pill with no label wherever a
       view is selected in the module drawer. A live z-index bump on
       .e-text-content alone didn't fix it (WKWebView doesn't appear to
       recompute an already-decided paint order from a z-index tweak
       alone); a negative z-index here does, by unambiguously dropping
       .e-fullrow out of that shared stacking step entirely instead of
       just reordering within it. */
    z-index: -1 !important;
}
html.native-ios .e-treeview .e-list-item.e-active:not(.phone-tree-parent) > .e-fullrow {
    background: var(--dw-active-row) !important;
    border: none !important;
    border-radius: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
}
html.native-ios .phone-second-bar .e-treeview .e-list-item {
    padding: 4px 2px !important;
    line-height: normal !important;
}
html.native-ios .phone-second-bar #phoneSidebar ul {
    padding-left: 0 !important;
}
html.native-ios .phone-second-bar .e-treeview .e-list-item.phone-tree-parent {
    padding: 4px 2px !important;
}
html.native-ios .phone-second-bar .phone-tree-parent > .e-text-content {
    padding-left: 0 !important;
    margin-left: 0 !important;
    text-indent: 0 !important;
}
/* Module name (the top-level row only, not its views) is bold. */
html.native-ios .phone-second-bar .phone-tree-parent > .e-text-content .e-list-text {
    font-weight: 700 !important;
}
html.native-ios .phone-second-bar .phone-tree-parent,
html.native-ios .phone-second-bar .phone-tree-parent * {
    -webkit-tap-highlight-color: transparent;
}
html.native-ios .phone-second-bar .phone-tree-parent.e-hover > .e-fullrow,
html.native-ios .phone-second-bar .phone-tree-parent.e-active > .e-fullrow,
html.native-ios .phone-second-bar .phone-tree-parent.e-node-focus > .e-fullrow,
html.native-ios .phone-second-bar .phone-tree-parent:hover > .e-fullrow,
html.native-ios .phone-second-bar .phone-tree-parent:active > .e-fullrow,
html.native-ios .phone-second-bar .phone-tree-parent:focus > .e-fullrow,
html.native-ios .phone-second-bar .phone-tree-parent .e-hover,
html.native-ios .phone-second-bar .phone-tree-parent .e-active,
html.native-ios .phone-second-bar .phone-tree-parent .e-node-focus {
    background: transparent !important;
}
/* Every group is expanded from the start (native-app.js's expandPhoneSidebarTree)
   and can't be collapsed back - the toggle icon has nothing left to do. */
html.native-ios .phone-second-bar .e-icon-collapsible,
html.native-ios .phone-second-bar .e-icon-expandable {
    display: none !important;
}
/* Divider between modules (top-level entries only). Full width, edge to edge.
   --dw-border-strong (not the plain --dw-border used elsewhere) because in
   dark mode --dw-border (#333335) sits almost the same luminosity as this
   drawer's own --dw-surface background (#2C2C2E) - same issue as the
   .dw-fallback-item divider below, which already got this same treatment;
   this one didn't. */
html.native-ios #phoneSidebar > ul > li:not(:first-child) {
    border-top: 1px solid var(--dw-border-strong);
}
@media (prefers-color-scheme: dark) {
    html.native-ios #phoneSidebar > ul > li:not(:first-child) {
        border-top: 1px solid rgba(255, 255, 255, 0.3);
    }
}
/* Notification badge: only on the view itself, not the module it lives
   under - now that every module is always expanded, the module-level badge
   (aggregated count) is redundant with the view-level one right below it. */
html.native-ios .phone-second-bar .phone-tree-parent > .e-text-content .e-badge {
    display: none !important;
}
/* Same site.css @media (max-width: 768px) gap as elsewhere in this file -
   the badge is absolutely positioned against the row's right edge by
   EJ2's own theme, and site.css pulls it back on-screen with a transform
   (its raw position sits mostly past the edge otherwise); that pull-back
   never applied at landscape/iPad widths, so the badge that was visible
   in portrait, right next to the label, drifted out toward the row's
   now-edge-to-edge right boundary and became hard to see. */
html.native-ios .phone-second-bar .e-badge.e-badge-overlap,
html.native-ios .phone-second-bar .e-badge.e-badge-notification {
    /* Fixed offset from its positioned ancestor (.e-text-content, which
       spans the row's full edge-to-edge width) instead of site.css's
       percentage transform, which pulls back a fraction of the badge's
       OWN width from a left/right anchor point tuned for the old inset
       pill row - confirmed via live measurement (App, 2026-09-17) that
       combination still left the badge's right edge ~6px past the row's
       own right edge. A fixed right/left/transform here is anchored
       directly to the row edge instead, independent of the badge's
       rendered width (1 vs 2-digit counts) or the row's own width. */
    top: 15px !important;
    right: 12px !important;
    left: auto !important;
    transform: none !important;
}

html.native-ios .phone-second-bar #phoneSidebar,
html.native-ios .dw-fallback-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-top: 12px !important;
    padding-bottom: calc(12px + var(--dw-bottom-reserve)) !important;
}

/* Fallback menu rows (matched against the real sheet's own row measurements) */
html.native-ios .dw-fallback-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 4px 8px 4px 2px;
}
/* Divider between modules, not between a module and its own views. Full
   width, edge to edge. --dw-border-strong (not the plain --dw-border used
   elsewhere) because in dark mode --dw-border (#333335) sits almost the same
   luminosity as this menu's own --dw-surface background (#2C2C2E). Even
   --dw-border-strong (#5A5A5C) read as too subtle here, so dark mode gets
   its own explicit, bolder line color instead of reusing a shared token -
   this is the one place that needs it, so boosting --dw-border-strong
   itself would be an untargeted, broader change. */
html.native-ios .dw-fallback-item:not(:first-child) {
    border-top: 1px solid var(--dw-border-strong);
}
@media (prefers-color-scheme: dark) {
    html.native-ios .dw-fallback-item:not(:first-child) {
        border-top: 1px solid rgba(255, 255, 255, 0.3);
    }
}
html.native-ios .dw-fallback-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding-left: 16px;
    min-height: 48px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--dw-text) !important;
    font-size: 18px !important;
    font-weight: 700 !important;   /* module name */
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
/* Every group is permanently expanded in this fallback menu (there's no
   collapsed state to distinguish "open" from), so highlighting
   .dw-fallback-expanded here painted every single module header with this
   background all the time - unlike the real Syncfusion sidebar (used on
   every other page), which only highlights the one actually-selected item,
   never a module header. Left plain (matches .dw-fallback-row's own default
   transparent background above) so this fallback menu reads the same as
   the real one. */
html.native-ios .dw-fallback-row:active {
    background: var(--dw-press-tint);
}
html.native-ios .dw-fallback-row > i {
    flex: 0 0 auto;
    width: 16px;
    text-align: center;
    font-size: 16px;
}
html.native-ios .dw-fallback-children {
    display: none;
}
html.native-ios .dw-fallback-item.dw-fallback-expanded .dw-fallback-children {
    display: block;
}
html.native-ios .dw-fallback-child {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 4px 8px;
    /* Flat list - lines up with the module row's own icon, not its text
       (confirmed against the real Syncfusion sidebar's own rendering: child
       rows sit at the module icon's left edge, well short of the module
       text). Matches .dw-fallback-row's own padding-left above. */
    padding-left: 16px;
    min-height: 48px;
    background: transparent;
    border: none;
    color: var(--dw-text) !important;
    font-size: 18px !important;
    font-weight: 500 !important;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
html.native-ios .dw-fallback-child:active {
    background: var(--dw-press-tint);
}

/* --- Grid: flush/edge-to-edge, matching native-android.css's own grid reset -
   no card margin or rounded corners boxing it in. --------------------------- */
html.native-ios .e-grid {
    border: none !important;
    font-family: inherit;
}
html.native-ios .e-grid .e-gridheader {
    background: var(--dw-surface) !important;
    border-bottom: 1px solid var(--dw-border) !important;
    border-color: var(--dw-border) !important;
}
/* Sized the same way as .e-rowcell below (same padding, same font-size) so
   the header reads as one continuous table with the rows instead of a
   visibly shorter strip above them - matching padding on the outer cell
   only, same as rows do. (Earlier attempts also resized the header's own
   inner .e-headercelldiv/.e-headercell-container wrapper divs to force this,
   which broke Syncfusion's own layout - the filter icon wrapped onto its own
   line below the text instead of sitting beside it. Leaving those wrapper
   divs alone and letting Syncfusion centre its own contents in the taller
   outer cell avoids that.) */
html.native-ios .e-grid .e-columnheader .e-headercell,
html.native-ios .e-grid .e-columnheader .e-detailheadercell {
    background: var(--dw-surface) !important;
    height: auto !important;
    min-height: 48px !important;
    padding-top: 14px;
    padding-bottom: 14px;
}
html.native-ios .e-grid .e-columnheader .e-headercell,
html.native-ios .e-grid .e-columnheader .e-headercell * {
    border-color: var(--dw-border) !important;
    box-shadow: none !important;
}
html.native-ios .e-grid .e-headertext {
    color: var(--dw-text) !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    letter-spacing: 0.01em;
}
/* Confirmed via runtime diagnostic: .e-headercell's own inner wrapper
   (.e-headercelldiv, holding the column title + sort/filter icons) carries
   its own light gray background regardless of the header cell's own dark
   background above it - same paint-order issue as the row cells below. */
html.native-ios .e-grid .e-headercelldiv {
    background-color: var(--dw-surface) !important;
}
html.native-ios .e-grid .e-filterbarcell .e-input-group,
html.native-ios .e-grid .e-filterbarcell input.e-input {
    background: var(--dw-surface) !important;
    color: var(--dw-text) !important;
    border-color: var(--dw-border) !important;
}
html.native-ios .e-grid .e-filterbarcell .e-input-group-icon,
html.native-ios .e-grid .e-filterbarcell .e-clear-icon {
    color: var(--dw-text) !important;
}
html.native-ios .e-toolbar:not(.e-schedule-toolbar) {
    background: var(--dw-surface-2) !important;
    border-color: var(--dw-border) !important;
}
html.native-ios .e-toolbar:not(.e-schedule-toolbar) .e-toolbar-items .e-toolbar-item .e-tbar-btn-text,
html.native-ios .e-toolbar:not(.e-schedule-toolbar) .e-tbar-btn .e-icons {
    color: var(--dw-text) !important;
}
/* Roomier rows: extra vertical padding is what actually reads as "space
   between rows" on a table where every row still touches its neighbour. */
html.native-ios .e-grid .e-rowcell {
    background-color: var(--dw-surface) !important;
    color: var(--dw-text) !important;
    font-size: 14px !important;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    border-color: var(--dw-border) !important;
}
html.native-ios .e-grid .e-row {
    background: var(--dw-surface);
}
html.native-ios .e-grid .e-altrow {
    background-color: var(--dw-surface-2) !important;
}
/* Confirmed via runtime diagnostic: .e-altrow's own <td class="e-rowcell">
   children carry an opaque white background of their own (Syncfusion's
   default), which sits on top of and fully hides the dark background set on
   the parent .e-altrow <tr> above - same root cause as the .e-rowcell
   selection bug elsewhere in this file (the parent-row rule never touches
   the actual cell element paint order looks at). */
html.native-ios .e-grid .e-altrow .e-rowcell {
    background-color: var(--dw-surface-2) !important;
}
/* Confirmed via the same diagnostic: the grid's own content/table wrapper
   elements (visible at the scroll edges and, briefly, through any gap
   before rows finish laying out) default to plain white too. */
html.native-ios .e-grid .e-gridcontent,
html.native-ios .e-grid .e-content,
html.native-ios .e-grid .e-table {
    background-color: var(--dw-surface) !important;
}
html.native-ios .e-grid .e-row:last-child .e-rowcell {
    border-bottom: none !important;   /* no stray line against the rounded bottom edge */
}
html.native-ios .e-grid .e-row:active .e-rowcell,
html.native-ios .e-grid .e-row.e-hover .e-rowcell {
    background: var(--dw-press-tint) !important;
}
html.native-ios .e-grid .e-row.e-active .e-rowcell,
html.native-ios .e-grid .e-selectionbackground,
html.native-ios .e-grid td.e-active,
html.native-ios .e-grid td.e-cellselectionbackground {
    /* Syncfusion's own material3 theme puts the selected-cell classes
       (e-active/e-cellselectionbackground) directly on the <td>, not on a
       .e-row.e-active ancestor - the two selectors above never actually
       matched anything, so the tapped row fell through to material3's own
       rule (td.e-active { background: rgba(var(--color-sf-primary-container),
       0.65) }), a light-theme-only token this app never redefines for dark
       mode, rendering as a near-white highlight regardless of app theme. */
    background-color: var(--dw-active-row) !important;
    color: var(--dw-text) !important;
}
/* Grid's brief loading/refresh state (skeleton text placeholders in the
   header + a masked/dimmed body while data reloads) defaults to light
   colors this app never redefines for dark mode, showing as a stark white
   flash over an otherwise dark grid. Best-effort - Syncfusion doesn't
   publish a single documented class for the body mask, so this covers the
   commonly-used ones. */
html.native-ios .e-grid .e-mask,
html.native-ios .e-grid .e-mask.e-skeleton {
    background-color: var(--dw-surface-2) !important;
}
html.native-ios .e-grid .e-masked-row,
html.native-ios .e-grid .e-masked-row .e-rowcell,
html.native-ios .e-grid td.e-updatedtd {
    background-color: var(--dw-surface) !important;
    color: var(--dw-text) !important;
}
html.native-ios .e-grid .e-sortfilterdiv,
html.native-ios .e-grid .e-icon-filter,
html.native-ios .e-grid .e-icon-ascending,
html.native-ios .e-grid .e-icon-descending {
    color: var(--dw-text) !important;
}
/* "No records to display" (grid empty) and "Choose from Menu to view
   documents." (#gridMessage, _GridPartial2.cshtml - shown when no view is
   selected at all) both default to a plain, low-contrast gray that was
   barely readable against the dark background. */
html.native-ios .e-grid .e-emptyrow,
html.native-ios #gridMessage {
    color: var(--dw-text) !important;
}
/* Pager: same rounded, roomy treatment as the grid itself. */
html.native-ios .e-grid .e-pager {
    border-top: 1px solid var(--dw-border) !important;
    background: var(--dw-surface) !important;
    color: var(--dw-text) !important;
    padding: 8px 0;
}
html.native-ios .e-grid .e-pager .e-numericcontainer .e-currentitem,
html.native-ios .e-grid .e-pager .e-numericcontainer .e-active {
    border-radius: 8px;
    font-weight: 700;
}
html.native-ios .e-grid .e-pager [class*="disable"] {
    opacity: 0.35 !important;
}
/* Confirmed via runtime diagnostic: the pager's own nav icons/containers
   (prev/next/first/last, the numeric page links, the wrapping container)
   each carry their own opaque white background, same paint-order issue as
   .e-altrow's cells above - the pager's own dark background rule never
   reaches them. */
html.native-ios .e-grid .e-pager .e-pagercontainer,
html.native-ios .e-grid .e-pager .e-icons,
html.native-ios .e-grid .e-pager .e-link {
    background-color: var(--dw-surface) !important;
    color: var(--dw-text) !important;
}

/* Grid toolbar (Add/Edit/Delete/Update/Cancel) - CreateForm.cshtml's */
html.native-ios .e-grid .e-toolbar {
    background: var(--dw-surface-2) !important;
    border: none !important;
    border-top: 1px solid var(--dw-border) !important;
    box-shadow: none !important;
}
html.native-ios .e-grid .e-toolbar .e-toolbar-items {
    background: transparent !important;
}
html.native-ios .e-grid .e-toolbar .e-tbar-btn {
    background: transparent !important;
    border: none !important;
    border-radius: 8px;
    margin: 4px 2px;
}
html.native-ios .e-grid .e-toolbar .e-tbar-btn:hover,
html.native-ios .e-grid .e-toolbar .e-tbar-btn:focus {
    background: var(--dw-surface) !important;
}
html.native-ios .e-grid .e-toolbar .e-tbar-btn .e-icons,
html.native-ios .e-grid .e-toolbar .e-tbar-btn-text {
    color: var(--dw-text) !important;
}
html.native-ios .e-grid .e-toolbar .e-tbar-btn.e-overlay,
html.native-ios .e-grid .e-toolbar .e-tbar-btn[aria-disabled="true"] {
    opacity: 0.35;
}
/* Disabled toolbar button's own wrapper (e.g. "Add" while a row is being
   edited) kept a plain white background regardless of app theme. */
html.native-ios .e-grid .e-toolbar .e-toolbar-item {
    background: transparent !important;
}
/* Toolbar overflow scroll (too many buttons for a phone-width bar) - the
   fade gradient and nav arrow both paint from Syncfusion's own light
   --color-sf-surface, never redefined here, showing as a stray white patch. */
html.native-ios .e-grid .e-toolbar .e-scroll-overlay.e-scroll-left-overlay {
    background-image: linear-gradient(-270deg, var(--dw-surface-2) 0%, transparent 100%) !important;
}
html.native-ios .e-grid .e-toolbar .e-scroll-overlay.e-scroll-right-overlay {
    background-image: linear-gradient(-270deg, transparent 0%, var(--dw-surface-2) 100%) !important;
}
html.native-ios .e-grid .e-toolbar .e-scroll-nav {
    background: var(--dw-surface-2) !important;
    border-color: var(--dw-border) !important;
    box-shadow: none !important;
}
html.native-ios .e-grid .e-toolbar .e-scroll-nav .e-nav-arrow {
    color: var(--dw-text) !important;
}

/* Grid footer (Subtotal/GST/Total aggregate rows) - CreateForm.cshtml's */
html.native-ios .e-grid .e-gridfooter,
html.native-ios .e-grid .e-summarycontent,
html.native-ios .e-grid .e-summarycontent .e-table {
    background: var(--dw-surface-2) !important;
    border-top: 1px solid var(--dw-border) !important;
}
html.native-ios .e-grid .e-summarycell {
    background: var(--dw-surface-2) !important;
    color: var(--dw-text) !important;
    border-color: var(--dw-border) !important;
}

/* Scheduler's appointment editor dialog goes full-screen on a phone-width
   viewport (Syncfusion's own responsive behaviour, not something this app
   controls) - its header (with the close/save/delete controls the user
   actually needs to tap) was rendering flush at the dialog's own top:0,
   under the status bar/notch, with no way to reach it. native-ios.css never
   had any dialog handling at all (unlike native-android.css's own extensive
   .e-dialog theming), so this was never accounted for. */
html.native-ios .e-schedule-dialog.e-dialog {
    padding-top: env(safe-area-inset-top, 0px) !important;
    box-sizing: border-box !important;
}

/* Tapping an appointment card (not the Editor form above - confirmed via a
   runtime diagnostic that this is Syncfusion's separate "ViewEventInfo"
   adaptive/mobile popup, position:fixed at top:0 with its own
   .e-quick-popup-wrapper.e-device wrapper) opens a read-only info card whose
   header (subject + close/edit/delete icons) rendered flush at top:0 under
   the status bar, same root cause as the Editor dialog above but a distinct
   element the .e-schedule-dialog rule above never matched. */
html.native-ios .e-quick-popup-wrapper.e-device {
    padding-top: env(safe-area-inset-top, 0px) !important;
    box-sizing: border-box !important;
}

html.native-ios .e-schedule .e-agenda-view,
html.native-ios .e-schedule .e-agenda-view .e-content-wrap {
    overflow-x: hidden !important;
}
html.native-ios .e-schedule .e-agenda-view .e-content-wrap table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
}
html.native-ios .e-schedule .e-agenda-view .e-subject-wrap,
html.native-ios .e-schedule .e-agenda-view .e-appointment-details,
html.native-ios .e-schedule .e-agenda-view .e-subject {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* form-js dynamic forms (DocuWare-generated approval/task forms,
   CreateForm.cshtml) - mirrors native-android.css's own #form block, which
   this file never had: labels/text picked up dark mode via the general
   inherited text color, but the actual input/select/textarea controls kept
   their plain white background from the browser's default form-control
   styling, so every field read as a bright white box on a dark page. */
html.native-ios #form,
html.native-ios #form *:not(button):not(button *):not(input):not(select):not(select *):not(textarea) {
    color: var(--dw-text) !important;
}
html.native-ios #form input:not([type="radio"]):not([type="checkbox"]),
html.native-ios #form select,
html.native-ios #form textarea {
    background-color: var(--dw-surface-2) !important;
    color: var(--dw-text) !important;
    border-color: var(--dw-field-border) !important;
}
/* Submit button - kept plain white/black deliberately (not the accent-button treatment) */
html.native-ios #form .fjs-button[type="submit"],
html.native-ios #form button[type="submit"] {
    background-color: #FFFFFF !important;
    color: #000000 !important;
    border-color: var(--dw-border) !important;
}
/* Select/dropdown option list */
html.native-ios #form .fjs-dropdownlist {
    background-color: var(--dw-surface-2) !important;
    border: 1px solid var(--dw-border) !important;
    box-shadow: var(--dw-shadow-dialog) !important;
}
html.native-ios #form .fjs-dropdownlist .fjs-dropdownlist-item {
    color: var(--dw-text) !important;
    border-bottom-color: var(--dw-border) !important;
}
html.native-ios #form .fjs-dropdownlist .fjs-dropdownlist-item.focused {
    background-color: var(--dw-active-row) !important;
    color: var(--dw-text) !important;
}
/* Icon/adornment box beside an input (e.g. the calendar icon on a Date
   field) - kept its own plain light-gray box regardless of app theme. */
html.native-ios #form .fjs-input-adornment {
    background-color: var(--dw-surface-2) !important;
    border-color: var(--dw-field-border) !important;
    color: var(--dw-text) !important;
}
html.native-ios #form .fjs-input-adornment svg {
    fill: var(--dw-text) !important;
    color: var(--dw-text) !important;
}
/* Searchable select field (Location Name, Supplier, Ship To) - the group
   box wrapping the search input plus its dropdown-arrow/clear icons kept
   a plain white background regardless of app theme. */
html.native-ios #form .fjs-input-group {
    background-color: var(--dw-surface-2) !important;
    border-color: var(--dw-field-border) !important;
}
html.native-ios #form .fjs-select-arrow,
html.native-ios #form .fjs-select-cross {
    color: var(--dw-text) !important;
}
/* Read-only and disabled fields read as information, not as something to fill in (portal-form.css does the same on
   the web): the two rules above gave them the editable fill and edge, so a disabled dropdown looked enabled. No fill,
   a quieter edge, a muted arrow; the value keeps the main text colour so it stays readable. */
html.native-ios #form .fjs-form-field.fjs-readonly .fjs-input-group,
html.native-ios #form .fjs-form-field.fjs-disabled .fjs-input-group,
html.native-ios #form .fjs-input-group:has(.fjs-input[readonly], .fjs-input:disabled, select:disabled),
html.native-ios #form .fjs-form-field.fjs-readonly .fjs-taglist,
html.native-ios #form .fjs-form-field.fjs-disabled .fjs-taglist,
html.native-ios #form .fjs-form-field.fjs-readonly textarea,
html.native-ios #form .fjs-form-field.fjs-disabled textarea {
    background-color: transparent !important;
    border-color: var(--dw-border-strong) !important;
}
html.native-ios #form .fjs-form-field.fjs-readonly .fjs-input-group input,
html.native-ios #form .fjs-form-field.fjs-disabled .fjs-input-group input,
html.native-ios #form .fjs-input-group:has(.fjs-input[readonly], .fjs-input:disabled) input {
    background-color: transparent !important;
}
html.native-ios #form .fjs-form-field.fjs-readonly .fjs-select-arrow,
html.native-ios #form .fjs-form-field.fjs-disabled .fjs-select-arrow {
    color: var(--dw-text-tertiary) !important;
}
/* Number field's up/down stepper - NOT the native <input type=number>
   spinner (iOS WebKit doesn't render one at all) but form-js's own
   custom .fjs-number-arrow-container buttons, styled via its vendored
   CSS custom properties (--color-background/--color-text) which are
   never redefined for dark mode, leaving them at their light-theme
   default (plain white box, dark arrows) - confirmed via form-js-
   base.css and by live testing (App, 2026-09-17) that a
   ::-webkit-inner-spin-button override has no effect, since that
   pseudo-element doesn't exist here at all. */
@media (prefers-color-scheme: dark) {
    html.native-ios #form .fjs-number-arrow-container {
        border-color: var(--dw-field-border) !important;
    }
    html.native-ios #form .fjs-number-arrow-separator {
        background-color: var(--dw-field-border) !important;
    }
    html.native-ios #form .fjs-number-arrow-container button {
        background-color: var(--dw-surface-2) !important;
        color: var(--dw-text) !important;
    }
    html.native-ios #form .fjs-number-arrow-container button:hover {
        background-color: var(--dw-active-row) !important;
        color: var(--dw-text) !important;
    }
}

/* Signature field's Undo/Redo/Clear toolbar - SignatureRenderer.js (this
   app's own component, not vendored) hardcodes their look via an inline
   `style` attribute (white background, #444 text, light-gray border) with
   no class to hook - fine on web (always light) but left them looking
   like stray light-mode chips against the app's dark form background.
   Targeted by `title` since that's the only stable attribute the markup
   gives each one. Inline styles beat a plain external rule, so this
   needs !important to win. */
@media (prefers-color-scheme: dark) {
    html.native-ios #form .signature-field button[title="Undo"],
    html.native-ios #form .signature-field button[title="Redo"] {
        background: var(--dw-surface-2) !important;
        border-color: var(--dw-border-strong) !important;
        color: var(--dw-text) !important;
    }
    html.native-ios #form .signature-field button[title="Clear"] {
        background: var(--dw-surface-2) !important;
        border-color: #7a3b38 !important;
        color: #ff6b6b !important;
    }
}

/* Form Builder's "Text field" autocomplete suggestions (Form Editor -
   #form-editor, not the runtime #form above) - confirmed via runtime
   diagnostic to be a typeahead.js widget (.autocomplete-wrapper .tt-menu /
   .tt-suggestion), plain white with barely-visible light gray text.
   Explicitly dark mode only, per instruction - light mode is untouched. */
@media (prefers-color-scheme: dark) {
    html.native-ios .autocomplete-wrapper .tt-menu {
        background-color: #000000 !important;
        border-color: var(--dw-border-strong) !important;
    }
    html.native-ios .autocomplete-wrapper .tt-menu .tt-suggestion,
    html.native-ios .autocomplete-wrapper .tt-menu .tt-suggestion * {
        background-color: transparent !important;
        color: #FFFFFF !important;
    }
    html.native-ios .autocomplete-wrapper .tt-menu .tt-suggestion.tt-cursor,
    html.native-ios .autocomplete-wrapper .tt-menu .tt-suggestion:hover {
        background-color: var(--dw-active-row) !important;
    }
}

/* form-js "Date" field popup - Flatpickr, vendored inside the third-party
   @bpmn-io/form-js package and compiled into wwwroot/dist/style.css by the
   Vite build (wwwroot/js/bpmn/form.js), so its own plain-light-theme CSS
   can't be edited directly (node_modules, and a generated build output).
   Appended to <body> when opened, not nested under #form, so this needs its
   own global override here rather than living under the #form block above.
   Explicitly dark mode only, per instruction - light mode is untouched. */
@media (prefers-color-scheme: dark) {
    html.native-ios .flatpickr-calendar {
        box-shadow: var(--dw-shadow-dialog) !important;
    }
    html.native-ios .flatpickr-months .flatpickr-month,
    html.native-ios .flatpickr-weekdays,
    html.native-ios span.flatpickr-weekday,
    html.native-ios .flatpickr-current-month .flatpickr-monthDropdown-months,
    html.native-ios .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
        background-color: var(--dw-surface-2) !important;
        color: var(--dw-text) !important;
        fill: var(--dw-text) !important;
    }
    html.native-ios .flatpickr-months .flatpickr-prev-month,
    html.native-ios .flatpickr-months .flatpickr-next-month {
        color: var(--dw-text) !important;
        fill: var(--dw-text) !important;
    }
    html.native-ios .flatpickr-innerContainer,
    html.native-ios .flatpickr-time {
        background-color: var(--dw-surface) !important;
        border-color: var(--dw-border) !important;
    }
    html.native-ios .flatpickr-day {
        color: var(--dw-text) !important;
    }
    html.native-ios .flatpickr-day.inRange,
    html.native-ios .flatpickr-day:hover,
    html.native-ios .flatpickr-day:focus {
        background-color: var(--dw-active-row) !important;
        border-color: var(--dw-active-row) !important;
    }
    html.native-ios .flatpickr-day.today {
        border-color: var(--dw-border-strong) !important;
    }
    html.native-ios .flatpickr-day.today:hover,
    html.native-ios .flatpickr-day.today:focus {
        border-color: var(--dw-border-strong) !important;
        background-color: var(--dw-active-row) !important;
        color: var(--dw-text) !important;
    }
    /* Days outside the month are real, pickable dates: readable (they were 2.3:1). Disabled days stay faint. */
    html.native-ios .flatpickr-day.prevMonthDay,
    html.native-ios .flatpickr-day.nextMonthDay {
        color: var(--dw-text-tertiary) !important;
    }
    html.native-ios .flatpickr-day.flatpickr-disabled,
    html.native-ios .flatpickr-day.flatpickr-disabled:hover,
    html.native-ios .flatpickr-day.notAllowed {
        color: rgba(255, 255, 255, 0.3) !important;
    }
    /* Year stepper (up/down arrows next to the year input) */
    html.native-ios .numInputWrapper span.arrowUp:after {
        border-bottom-color: var(--dw-text) !important;
    }
    html.native-ios .numInputWrapper span.arrowDown:after {
        border-top-color: var(--dw-text) !important;
    }
    html.native-ios .numInputWrapper span svg path {
        fill: var(--dw-text) !important;
    }
    html.native-ios .numInputWrapper span:hover,
    html.native-ios .numInputWrapper:hover {
        background-color: var(--dw-press-tint) !important;
    }

    html.native-ios .e-datepicker.e-popup-wrapper {
        box-shadow: var(--dw-shadow-dialog) !important;
    }
    html.native-ios .e-datepicker.e-date-modal {
        background: rgba(0, 0, 0, 0.5) !important;
    }
    html.native-ios .e-datepicker .e-model-header {
        background: var(--dw-surface-2) !important;
        color: var(--dw-text) !important;
    }
    html.native-ios .e-datepicker .e-calendar,
    html.native-ios .e-calendar {
        background: var(--dw-surface) !important;
        border-color: var(--dw-border) !important;
    }
    html.native-ios .e-calendar .e-header .e-title,
    html.native-ios .e-calendar .e-header .e-prev,
    html.native-ios .e-calendar .e-header .e-next,
    html.native-ios .e-calendar .e-date-icon-prev,
    html.native-ios .e-calendar .e-date-icon-next,
    html.native-ios .e-calendar th,
    html.native-ios .e-calendar .e-content span {
        color: var(--dw-text) !important;
    }
    html.native-ios .e-calendar .e-content td:hover span.e-day,
    html.native-ios .e-calendar .e-content td:focus span.e-day {
        background: var(--dw-active-row) !important;
        color: var(--dw-text) !important;
    }
    html.native-ios .e-calendar .e-content td.e-selected span.e-day,
    html.native-ios .e-calendar .e-content td.e-today.e-selected span.e-day,
    html.native-ios .e-calendar .e-content td.e-today:focus span.e-day {
        background: var(--dw-active-row) !important;
        border-color: var(--dw-active-row) !important;
        color: var(--dw-text) !important;
    }
    html.native-ios .e-calendar .e-content td.e-today span.e-day {
        background: none !important;
        border-color: var(--dw-text) !important;
        color: var(--dw-text) !important;
    }
    /* Other-month days are pickable dates: readable (--dw-border-strong was 2.0:1). Disabled days stay faint. */
    html.native-ios .e-calendar .e-content .e-other-month span.e-day {
        color: var(--dw-text-tertiary) !important;
    }
    html.native-ios .e-calendar .e-content td.e-disabled span.e-day {
        color: var(--dw-border-strong) !important;
    }
    html.native-ios .e-calendar .e-content .e-footer {
        color: var(--dw-text) !important;
    }
}

/* SMS/Chat view - mirrors native-android.css's own .e-chat-ui block, which
   this file never had (only the bottom-bar clearance padding above): the
   chat card, message bubbles and footer all kept Syncfusion's plain white
   chat-ui theme regardless of app dark mode. */
html.native-ios #chat-container,
html.native-ios .e-chat-ui,
html.native-ios .e-chat-ui .e-chat-content,
html.native-ios .e-chat-ui .e-message-wrapper,
html.native-ios .e-chat-ui .e-footer {
    background-color: var(--dw-bg) !important;
}
html.native-ios .e-chat-ui .e-chat-header {
    background-color: var(--dw-surface) !important;
    color: var(--dw-text) !important;
    border-color: var(--dw-border) !important;
}
/* Incoming-message bubble (the other person's messages) - Syncfusion's own
   theme colors this via rgba(var(--color-sf-on-surface))/(--color-sf-surface),
   light-theme-only tokens this app never redefines for dark mode, so it was
   staying dark-text-on-light-bubble regardless of app theme. Outgoing
   bubbles (.e-right) keep their own existing green/white styling, which
   already reads fine and wasn't reported as a problem. */
html.native-ios .e-chat-ui .e-left .e-message-content {
    background-color: var(--dw-surface-2) !important;
    color: var(--dw-text) !important;
    /* Syncfusion's own border-radius here is just 4px - on a box that's
       width:fit-content (sized tightly to the text), that reads as a
       highlighted word rather than a chat bubble. Rounder corners make it
       unambiguously a bubble instead. */
    border-radius: 14px !important;
    padding: 8px 12px !important;
}
/* Confirmed via runtime diagnostic: the actual message text sits in a
   nested <div class="e-text"> with its own light gray background
   (rgb(226,226,228), independent of .e-message-content's own background
   above) - that's what was reading as a highlight box wrapped tightly
   around just the words, not the bubble itself. */
html.native-ios .e-chat-ui .e-left .e-message-content .e-text {
    background-color: transparent !important;
    color: var(--dw-text) !important;
}
/* Sender name + timestamp above each message */
html.native-ios .e-chat-ui .e-message-wrapper .e-message-header,
html.native-ios .e-chat-ui .e-message-wrapper .e-timestamp,
html.native-ios .e-chat-ui .e-message-wrapper .e-time {
    color: var(--dw-text) !important;
}
/* Footer (textarea + send button) in Chat View */
html.native-ios .e-chat-ui .e-footer,
html.native-ios .e-chat-ui .e-footer * {
    background-color: var(--dw-surface-2) !important;
    border-color: transparent !important;
    box-shadow: none !important;
}
html.native-ios .e-chat-ui .e-chat-textarea {
    color: var(--dw-text) !important;
    border-color: var(--dw-field-border) !important;
}
html.native-ios .e-chat-ui .e-footer button,
html.native-ios .e-chat-ui .e-footer button * {
    color: #FFFFFF !important;
}
