/* The look of every application built on the core: Inter, a slate palette and one brand colour,
   white rounded surfaces on a pale page.

   Re-theming: everything below is drawn from the properties in :root. An application changes its
   look by redefining some of them in a stylesheet of its own, loaded after this one (theme.css in
   its web project): the --brand-* ramp for the colour (the Syncfusion components follow it), the
   --sidebar-*, --topbar-* and --login-* values for the frame, --radius and --font for the shapes. */

/* Tailwind's palettes and the themes made from them (Branding, Theme). */
@import "tailwind-themes.css";
:root {
    /* Text and icons on the brand colour (buttons, avatars); a theme sets its own. */
    --on-brand: #fff;
    --brand-50: #f0f9ff;
    --brand-100: #e0f2fe;
    --brand-200: #bae6fd;
    --brand-300: #7dd3fc;
    --brand-400: #38bdf8;
    --brand-500: #0ea5e9;
    /* 600 and 700 are a shade deeper than the usual sky blue, so white text on them passes WCAG AA. */
    --brand-600: #0277b5;
    --brand-700: #01608f;
    --brand-800: #075985;
    --brand-900: #0c4a6e;
    --brand-950: #082f49;

    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* The names the screens use. */
    --ink: var(--slate-900);
    --muted: var(--slate-500);
    --line: var(--slate-200);
    --surface: #ffffff;
    --page: var(--slate-50);
    --brand: var(--brand-600);
    --brand-soft: var(--brand-50);
    --danger: #be123c;
    --ok: #047857;

    /* The frame: the menu at the side, the bar at the top. */
    --sidebar-bg: var(--surface);
    --sidebar-line: var(--line);
    --sidebar-ink: var(--slate-600);
    --sidebar-ink-strong: var(--slate-900);
    --sidebar-caption: var(--slate-400);
    --sidebar-hover-bg: var(--slate-100);
    --sidebar-active-bg: var(--brand-50);
    --sidebar-active-ink: var(--brand-700);
    --topbar-bg: var(--surface);

    /* The sign-in page: a navy brand half and a pale form half. Its colours are its own, apart from
       the brand ramp, as ProtoCRM NG's sign-in page has them. */
    --login-bg: #21275a;
    --login-line: #343c7a;
    --login-muted: #aab1d6;
    --login-accent: #2a6fdb;
    --login-accent-soft: #7fa8ef;
    --login-panel-bg: #f6f8fc;
    --login-ink: #1c2147;
    --login-panel-muted: #5f6673;
    --login-border: #d6dbe6;
    --login-button-bg: var(--login-bg);
    --login-button-hover-bg: #2c3475;

    --radius: .75rem;
    --radius-lg: 1.125rem;
    --shadow-card: 0 1px 2px 0 rgb(16 24 40 / .06), 0 1px 3px 0 rgb(16 24 40 / .1);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* Syncfusion's Tailwind 3 theme is built on indigo and reads these properties, so pointing them
       at the brand ramp is the whole re-colouring: no theme rebuild. */
    --color-sf-primary: var(--brand-600);
    --color-sf-primary-bg-color: var(--brand-600);
    --color-sf-primary-bg-color-disabled: var(--brand-300);
    --color-sf-primary-bg-color-focus: var(--brand-700);
    --color-sf-primary-bg-color-hover: var(--brand-700);
    --color-sf-primary-bg-color-pressed: var(--brand-800);
    --color-sf-primary-border-color: var(--brand-600);
    --color-sf-primary-border-color-disabled: var(--brand-300);
    --color-sf-primary-border-color-focus: var(--brand-700);
    --color-sf-primary-border-color-hover: var(--brand-700);
    --color-sf-primary-border-color-pressed: var(--brand-800);
    --color-sf-primary-dark: var(--brand-700);
    --color-sf-primary-darker: var(--brand-800);
    --color-sf-primary-light: var(--brand-400);
    --color-sf-primary-lighter: var(--brand-100);
    --color-sf-primary-outline: var(--brand-600);
    --color-sf-chip-primary-bg-color: var(--brand-50);
    --color-sf-chip-primary-bg-color-hover: var(--brand-50);
    --color-sf-chip-primary-bg-color-pressed: var(--brand-100);
    --color-sf-chip-primary-border-color: var(--brand-100);
    --color-sf-chip-primary-border-color-hover: var(--brand-200);
    --color-sf-chip-primary-text: var(--brand-700);
    --color-sf-chip-primary-text-hover: var(--brand-700);
    --color-sf-chip-primary-icon-color: var(--brand-700);

    /* Colours of the frame not drawn from the ramps, so dark mode can change them. */
    --login-heading: var(--login-bg);
    --login-input-bg: #ffffff;
    --login-input-hover-bg: #f1f4fa;
    --danger-soft: #fff1f2;
    --danger-line: #fecdd3;
    --ok-soft: #ecfdf5;
    --ok-line: #a7f3d0;
    --warn-soft: #fffbeb;
    --warn-line: #fde68a;
    --warn: #92400e;
    --link: var(--brand-600);
    color-scheme: light;
}

/* ---------- Dark mode ----------
   On when the user chooses it in the top bar, or when the computer is set to dark and the user has
   chosen nothing (js/look.js puts data-theme="dark" and Syncfusion's e-dark-mode class on <html>).
   The slate ramp is turned round, so a screen written with --slate-100 for a soft fill and
   --slate-900 for strong text stays right in both; the soft brand tints are mixed from the
   application's own --brand-500 into the dark surface, so an application's colour carries over. */
/* A tenant's own colour (Administration > Branding; look.js sets --tenant-brand on the page): the whole
   ramp from that one colour, lighter towards 50 and darker towards 950. The selectors weigh more than
   an application's own :root ramp, so the tenant's wins. */
:root[data-tenant-brand] {
    --brand-50: color-mix(in srgb, var(--tenant-brand) 5%, #fff);
    --brand-100: color-mix(in srgb, var(--tenant-brand) 10%, #fff);
    --brand-200: color-mix(in srgb, var(--tenant-brand) 22%, #fff);
    --brand-300: color-mix(in srgb, var(--tenant-brand) 40%, #fff);
    --brand-400: color-mix(in srgb, var(--tenant-brand) 62%, #fff);
    --brand-500: color-mix(in srgb, var(--tenant-brand) 82%, #fff);
    --brand-600: var(--tenant-brand);
    --brand-700: color-mix(in srgb, var(--tenant-brand) 82%, #000);
    --brand-800: color-mix(in srgb, var(--tenant-brand) 66%, #000);
    --brand-900: color-mix(in srgb, var(--tenant-brand) 50%, #000);
    --brand-950: color-mix(in srgb, var(--tenant-brand) 35%, #000);
}

/* In the dark look the colour is lifted towards white, so a dark brand (navy) stays visible. */
:root[data-theme="dark"][data-tenant-brand] {
    --brand-300: color-mix(in srgb, var(--tenant-brand) 30%, #fff);
    --brand-400: color-mix(in srgb, var(--tenant-brand) 45%, #fff);
    --brand-500: color-mix(in srgb, var(--tenant-brand) 58%, #fff);
    --brand-600: color-mix(in srgb, var(--tenant-brand) 68%, #fff);
    --brand-700: color-mix(in srgb, var(--tenant-brand) 76%, #fff);
    --brand-800: color-mix(in srgb, var(--tenant-brand) 84%, #fff);
    --brand-50: color-mix(in srgb, var(--brand-500) 14%, #111827);
    --brand-100: color-mix(in srgb, var(--brand-500) 24%, #111827);
    --brand-200: color-mix(in srgb, var(--brand-500) 38%, #111827);
}

:root[data-theme="dark"] {
    --slate-50: #0b1220;
    --slate-100: #1e293b;
    --slate-200: #2b3648;
    --slate-300: #3d4a5f;
    --slate-400: #64748b;
    --slate-500: #94a3b8;
    --slate-600: #cbd5e1;
    --slate-700: #e2e8f0;
    --slate-900: #f1f5f9;
    --slate-950: #f8fafc;

    --surface: #111827;
    --page: #0b1120;
    --brand-50: color-mix(in srgb, var(--brand-500) 14%, #111827);
    --brand-100: color-mix(in srgb, var(--brand-500) 24%, #111827);
    --brand-200: color-mix(in srgb, var(--brand-500) 38%, #111827);
    --danger: #fb7185;
    --ok: #34d399;
    --warn: #fcd34d;
    --danger-soft: color-mix(in srgb, #f43f5e 14%, #111827);
    --danger-line: color-mix(in srgb, #f43f5e 40%, #111827);
    --ok-soft: color-mix(in srgb, #10b981 14%, #111827);
    --ok-line: color-mix(in srgb, #10b981 40%, #111827);
    --warn-soft: color-mix(in srgb, #f59e0b 14%, #111827);
    --warn-line: color-mix(in srgb, #f59e0b 40%, #111827);
    --shadow-card: 0 1px 2px 0 rgb(0 0 0 / .45);

    --sidebar-active-ink: var(--brand-300);
    --color-sf-chip-primary-text: var(--brand-300);
    --color-sf-chip-primary-text-hover: var(--brand-300);
    --color-sf-chip-primary-icon-color: var(--brand-300);

    --login-panel-bg: #0b1120;
    --login-ink: #e2e8f0;
    --login-panel-muted: #94a3b8;
    --login-border: #334155;
    --login-heading: #f1f5f9;
    --login-input-bg: #111827;
    --login-input-hover-bg: #1e293b;
    --login-button-bg: var(--login-accent);
    --login-button-hover-bg: color-mix(in srgb, var(--login-accent) 80%, #ffffff);
    --link: var(--brand-300);
    /* Syncfusion's accents drawn as text on the dark surface (the chosen view, today's date). */
    --color-sf-primary: var(--brand-400);
    color-scheme: dark;
}
:root[data-theme="dark"] .badge, :root[data-theme="dark"] .tabs [role=tab].sel { color: var(--brand-300); }
:root[data-theme="dark"] .e-grid .e-row:hover .e-rowcell { background: var(--slate-100) !important; }

html, body {
    margin: 0;
    height: 100%;
    font-family: var(--font);
    /* Look:FontSize sets it (js/look.js); the rem sizes of the screens follow. */
    font-size: var(--base-font-size, 14px);
    color: var(--ink);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--link); }
.app-loading { padding: 3rem; color: var(--muted); }
.icon { width: 1.25rem; height: 1.25rem; flex: none; }

/* ---------- Shell ---------- */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; width: 16rem; flex: none; background: var(--sidebar-bg); color: var(--sidebar-ink-strong); border-right: 1px solid var(--sidebar-line); transition: width .2s; }
.sidebar-shade { display: none; }
.sidebar .brand { display: flex; align-items: center; gap: .75rem; height: 4rem; flex: none; padding: 0 1rem; overflow: hidden; }
.sidebar .brand-logo { display: block; max-width: 100%; max-height: 44px; object-fit: contain; }
.brand-mark { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: .75rem; color: var(--on-brand); font-weight: 700; font-size: 1.05rem;
    background: linear-gradient(135deg, var(--brand-400), var(--brand-600)); }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name small { display: block; font-weight: 500; font-size: .72rem; color: var(--sidebar-ink); letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar .brand-tenant { margin: -.6rem 1rem .35rem; font-size: .75rem; font-weight: 600; color: var(--sidebar-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.menu { flex: 1; min-height: 0; overflow-y: auto; padding: .5rem .75rem .75rem; }
.menu-search { position: relative; flex: none; padding: 0 .75rem .25rem; }
.menu-search .icon { position: absolute; left: 1.4rem; top: .6rem; width: 1rem; height: 1rem; color: var(--sidebar-caption); pointer-events: none; }
.menu-search input { width: 100%; box-sizing: border-box; padding: .5rem .6rem .5rem 2.1rem; font: inherit; font-size: .875rem; color: var(--sidebar-ink-strong);
    background: var(--sidebar-hover-bg); border: 1px solid transparent; border-radius: var(--radius); outline: none; }
.menu-search input::placeholder { color: var(--sidebar-caption); }
.menu-search input:focus { background: var(--sidebar-bg); border-color: var(--brand-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 25%, transparent); }
.menu-none { margin: .5rem .75rem; font-size: .8125rem; color: var(--sidebar-ink); }
.menu-caption { padding: .5rem .75rem .25rem; font-size: .786rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-caption); }
.menu-link, .menu-group { display: flex; align-items: center; gap: .75rem; width: 100%; box-sizing: border-box; margin-top: .25rem; padding: .625rem .75rem; border: 0; border-radius: var(--radius);
    background: none; font: inherit; font-size: .875rem; font-weight: 500; color: var(--sidebar-ink); text-decoration: none; text-align: left; cursor: pointer; transition: background .12s, color .12s; }
.menu-link:hover, .menu-group:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-ink-strong); }
.menu-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-ink); }
.menu-link > span, .menu-group > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-group.current { color: var(--sidebar-ink-strong); }
.menu-group .chevron { width: 1rem; height: 1rem; color: var(--sidebar-caption); transition: transform .15s; }
.menu-group .chevron.shut { transform: rotate(-90deg); }
.menu-items { margin: .125rem 0 .25rem 1.25rem; padding-left: .5rem; border-left: 1px solid var(--sidebar-line); }
.menu-link.nested { margin-top: .125rem; padding-block: .5rem; }
.menu-link.nested .icon { width: 1rem; height: 1rem; }
.sidebar-foot { padding: .75rem; border-top: 1px solid var(--sidebar-line); }
/* The footer's card, as CRMNG's: the application and its version, the user and how many are working now. */
.about-info { flex: none; margin: .5rem .75rem; padding: .5rem .75rem; border: 1px solid var(--sidebar-line); border-radius: var(--radius);
    font-size: .75rem; line-height: 1.6; color: var(--sidebar-ink); background: var(--sidebar-hover-bg); }
.about-info > div { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.about-info .about-app { font-weight: 600; color: var(--sidebar-ink-strong); }
.about-info .about-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.about-info .about-online { display: inline-flex; align-items: center; gap: .2rem; margin-left: auto; padding: 0 .4rem; border: 0; border-radius: 999px;
    font: inherit; font-weight: 600; color: var(--sidebar-active-ink); background: var(--sidebar-active-bg); }
.about-info button.about-online { cursor: pointer; }
.about-info button.about-online:hover { filter: brightness(.95); }
.about-info .about-online svg { width: .85rem; height: .85rem; }
/* Branding, Themes: daisyUI-like theme gallery, editor and live preview (ThemeStudio). */
.ts-looks { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; margin: .25rem 0 1rem; }
.ts-look { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.ts-look.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.ts-look-name { font-size: .75rem; font-weight: 500; color: var(--muted); }
.ts-start { display: flex; flex-direction: column; gap: 4px; margin-left: auto; font-size: .8rem; color: var(--muted); }
.ts-start select, .ts-shape select, .ts-field input { font: inherit; color: var(--ink); background: var(--surface); padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; }
.ts-body { display: grid; grid-template-columns: 13rem minmax(0, 1fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.ts-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; max-height: 34rem; overflow-y: auto; padding: .15rem; }
.ts-tile { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; min-height: 3.6rem; padding: .45rem .5rem; border: 1px solid var(--line);
    border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; font-size: .75rem; text-align: left; cursor: pointer; }
.ts-tile:hover { outline: 2px solid var(--brand-200); }
.ts-tile.on { outline: 2px solid var(--brand); outline-offset: 1px; }
.ts-tile:disabled { cursor: default; }
.ts-tile-name { font-weight: 600; text-transform: capitalize; }
.ts-tile-note { color: var(--muted); }
.ts-chips { display: flex; gap: .2rem; }
.ts-chips span { width: .8rem; height: .8rem; border-radius: 999px; }
.ts-editor { min-width: 0; }
.ts-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: .5rem; font-size: .8rem; color: var(--muted); }
.ts-group { margin: .75rem 0 .35rem; font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ts-colours { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .5rem; }
.ts-colour { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); grid-template-rows: auto auto; column-gap: .4rem; align-items: center; }
.ts-swatch { grid-row: span 2; position: relative; width: 1.6rem; height: 1.6rem; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ts-swatch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ts-key { font-size: .6875rem; color: var(--muted); }
.ts-value { min-width: 0; padding: .1rem .3rem; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink);
    font: .75rem/1.4 ui-monospace, Consolas, monospace; }
.ts-value.bad { border-color: var(--danger); }
.ts-shape { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; }
.ts-shape label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.ts-shape label.tick { flex-direction: row; align-items: center; color: var(--ink); }
.ts-problem { margin: .5rem 0 0; color: var(--danger); font-size: .8125rem; }
.ts-preview-wrap { min-width: 0; }
.ts-preview { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); min-height: 22rem; margin-top: .3rem; overflow: hidden;
    border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--page); color: var(--ink); font-size: .8125rem; }
.ts-mock-side { padding: .6rem .5rem; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-line); color: var(--sidebar-ink); }
.ts-mock-brand { display: flex; align-items: center; gap: .4rem; margin-bottom: .6rem; font-weight: 700; color: var(--sidebar-ink-strong); }
.ts-mock-brand .brand-mark { width: 1.6rem; height: 1.6rem; border-radius: .5rem; font-size: .8rem; }
.ts-mock-link { padding: .35rem .5rem; border-radius: var(--radius); }
.ts-mock-link.on { background: var(--sidebar-active-bg); color: var(--sidebar-active-ink); font-weight: 600; }
.ts-mock-main { min-width: 0; padding: .6rem; }
.ts-mock-top { display: flex; justify-content: flex-end; margin: -.6rem -.6rem .6rem; padding: .35rem .6rem; background: var(--topbar-bg); border-bottom: 1px solid var(--line); }
.ts-mock-top .avatar { font-size: .65rem; }
.ts-mock-card { padding: .75rem; margin-bottom: .5rem; }
.ts-mock-card h3 { margin: 0 0 .15rem; font-size: .9rem; }
.ts-mock-card .field { margin: .5rem 0; }
.ts-mock-card .plain { width: 100%; box-sizing: border-box; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; }
.ts-mock-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.ts-mock-link-text { color: var(--link, var(--brand)); text-decoration: underline; }
.ts-mock-card .alert { padding: .35rem .6rem; margin-bottom: .35rem; font-size: .75rem; }
.ts-mock-status { display: flex; flex-wrap: wrap; gap: .25rem; }
.ts-mock-status span { padding: .1rem .45rem; border-radius: var(--radius-selector, 999px); font-size: .6875rem; background: var(--slate-100); color: var(--ink); }
.ts-import { margin: 1rem 0 .75rem; }
.ts-import summary { cursor: pointer; font-weight: 600; }
.ts-import textarea { width: 100%; box-sizing: border-box; margin: .4rem 0; padding: .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
    color: var(--ink); font: .75rem/1.4 ui-monospace, Consolas, monospace; }
@media (max-width: 1300px) { .ts-body { grid-template-columns: 13rem minmax(0, 1fr); } .ts-preview-wrap { grid-column: 1 / -1; } }
@media (max-width: 760px) { .ts-body { grid-template-columns: 1fr; } .ts-gallery { grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); max-height: 16rem; } .ts-start { margin-left: 0; } }

/* The Help panel, from the right over the page, and the Help page. */
.help-shade { position: fixed; inset: 0; z-index: 1900; background: rgba(15, 23, 42, .25); }
.help-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1901; box-sizing: border-box; display: flex; flex-direction: column; width: min(560px, 100vw);
    background: var(--surface); color: var(--ink); border-left: 1px solid var(--line); box-shadow: -8px 0 28px rgba(0, 0, 0, .18); outline: none;
    animation: help-in .16s ease-out; }
@keyframes help-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .help-drawer { animation: none; } }
.help-bar { display: flex; align-items: center; gap: .25rem; padding: .5rem .75rem; border-bottom: 1px solid var(--line); }
.help-bar .help-icon { padding: .4rem; }
.help-bar .help-icon:disabled { opacity: .35; cursor: default; background: none; }
.help-title { flex: 1; min-width: 0; margin-left: .25rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.help-search { display: flex; align-items: center; gap: .5rem; margin: .75rem; padding: 0 .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--page); color: var(--muted); }
.help-search input { flex: 1; min-width: 0; padding: .5rem 0; border: 0; outline: none; background: none; font: inherit; color: var(--ink); }
.help-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.help-body { flex: 1; overflow-y: auto; padding: .25rem 1.25rem 2.5rem; }
.help-muted { color: var(--muted); }
.help-note { padding: .5rem .75rem; border-radius: var(--radius); background: var(--brand-soft); font-size: .875rem; }
.help-summary { margin: .25rem 0 .75rem; color: var(--muted); font-style: italic; }
.help-link { display: inline-flex; align-items: center; gap: .3rem; padding: 0; border: 0; background: none; font: inherit; color: var(--brand); cursor: pointer; }
.help-link .icon { width: 1rem; height: 1rem; }
.help-link .chevron.shut { transform: rotate(-90deg); }
.help-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .25rem 0 .5rem; font-size: .8125rem; color: var(--muted); }
.help-section { list-style: none; margin: 0 0 .75rem; padding: .25rem; border: 1px solid var(--line); border-radius: var(--radius); }
.help-section-link { display: block; width: 100%; padding: .35rem .6rem; border: 0; border-radius: calc(var(--radius) - .25rem); background: none; font: inherit; font-size: .875rem; color: var(--ink); text-align: left; cursor: pointer; }
.help-section-link:hover, .help-section-link.current { background: var(--brand-soft); }
.help-section-link.current { font-weight: 600; color: var(--brand); }
.help-modes { display: inline-flex; margin: 0 0 .75rem; padding: .15rem; border: 1px solid var(--line); border-radius: 999px; }
.help-modes button { padding: .2rem .75rem; border: 0; border-radius: 999px; background: none; font: inherit; font-size: .8125rem; color: var(--muted); cursor: pointer; }
.help-modes button.on { background: var(--brand); color: var(--on-brand); }
.help-result, .help-entry { display: block; width: 100%; margin-bottom: .5rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.help-result:hover, .help-entry:hover { border-color: var(--brand); }
.help-result-title, .help-entry-title { display: block; font-weight: 600; }
.help-result-text, .help-entry-text { display: block; margin-top: .15rem; font-size: .8125rem; color: var(--muted); }
.help-result-category { display: block; margin-top: .25rem; font-size: .6875rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--brand); }
.help-category h3 { margin: 1rem 0 .5rem; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.help-category ul { list-style: none; margin: 0; padding: 0; }
.help-page { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.help-page-nav { position: sticky; top: 1rem; max-height: calc(100vh - 7rem); overflow-y: auto; padding: .5rem; }
.help-page-nav .help-search { margin: .25rem .25rem .5rem; }
.help-nav-group { margin: .75rem .5rem .25rem; font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.help-nav-link { display: block; padding: .35rem .6rem; border-radius: calc(var(--radius) - .25rem); font-size: .875rem; color: var(--ink); text-decoration: none; }
.help-nav-link:hover, .help-nav-link.current { background: var(--brand-soft); }
.help-nav-link.current { font-weight: 600; color: var(--brand); }
.help-page-body { min-width: 0; }
@media (max-width: 900px) { .help-page { grid-template-columns: 1fr; } .help-page-nav { position: static; max-height: none; } }
/* An article's text. A :::advanced block is hidden in the simple view. */
.kb-simple .advanced { display: none; }
.kb-article { line-height: 1.65; overflow-wrap: anywhere; }
.kb-article h1 { font-size: 1.35rem; margin: 0 0 .5rem; }
.kb-article h2 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.kb-article h3 { font-size: .95rem; margin: 1.1rem 0 .35rem; }
.kb-article p { margin: 0 0 .75rem; }
.kb-article ul, .kb-article ol { margin: 0 0 .75rem; padding-left: 1.25rem; }
.kb-article li { margin-bottom: .3rem; }
.kb-article a { color: var(--brand); }
.kb-article code { padding: .05rem .3rem; border-radius: .3rem; background: var(--page); font-size: .875em; }
.kb-article blockquote { margin: 0 0 .9rem; padding: .6rem .8rem; border-left: 3px solid var(--brand); border-radius: 0 var(--radius) var(--radius) 0; background: var(--brand-soft); }
.kb-article blockquote p:last-child { margin-bottom: 0; }
.kb-article table { display: block; overflow-x: auto; width: 100%; margin: 0 0 .9rem; border-collapse: collapse; font-size: .875rem; }
.kb-article th, .kb-article td { padding: .4rem .6rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.kb-article th { background: var(--page); font-weight: 600; }
.kb-article .advanced { margin-top: .5rem; }
.kb-article img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.online-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(15, 23, 42, .45); }
.online-dialog { display: flex; flex-direction: column; gap: .75rem; width: 100%; max-width: 640px; max-height: 80vh; padding: 1rem 1.25rem; border-radius: var(--radius);
    background: var(--surface); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); outline: none; }
.online-dialog header { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.online-dialog .online-list { overflow: auto; }
.online-dialog table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.online-dialog th, .online-dialog td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); text-align: left; }
.online-dialog .num { text-align: right; }
.online-dialog .avatar { display: inline-grid; width: 1.6rem; height: 1.6rem; margin-right: .5rem; font-size: .65rem; vertical-align: middle; }
.online-dialog footer { display: flex; justify-content: flex-end; gap: .5rem; }
.sidebar-foot .btn-ghost { width: 100%; color: var(--sidebar-ink); }
.sidebar-foot .btn-ghost:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-ink-strong); }

.shell.collapsed .sidebar { width: 76px; }
.shell.collapsed .brand { justify-content: center; padding: 0 .5rem; }
.shell.collapsed .brand-name, .shell.collapsed .menu-caption, .shell.collapsed .menu-link > span, .shell.collapsed .sidebar-foot span { display: none; }
.shell.collapsed .menu-link { justify-content: center; }

.btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .5rem .75rem; border: 0; border-radius: var(--radius); background: none;
    font: inherit; font-size: .875rem; font-weight: 500; color: var(--slate-600); cursor: pointer; transition: background .12s, color .12s; }
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-900); }
.btn-ghost:focus-visible, .menu-link:focus-visible, .menu-group:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

.main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: .75rem; height: 4rem; flex: none; padding: 0 1.5rem; background: var(--topbar-bg); border-bottom: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
/* The bar takes no backdrop-filter: that would shut a module's full-page overlay, opened from the bar, inside the bar. */
.topbar-right > a { padding: .5rem .75rem; border-radius: var(--radius); font-size: .875rem; font-weight: 500; color: var(--slate-600); text-decoration: none; }
.topbar-right > a:hover { background: var(--slate-100); color: var(--slate-900); }
.menu-toggle { display: none; }
/* A tenants administrator's choice of tenant, and the strip that says they are working in someone else's. */
.tenant-switch { display: flex; align-items: center; gap: .35rem; color: var(--muted); }
.tenant-switch select { max-width: 14rem; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-size: .875rem; }
@media (max-width: 639px) { .tenant-switch select { max-width: 8.5rem; } }
.tenant-switch-error { color: var(--danger, #b91c1c); font-size: .8125rem; }
.acting-banner { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .5rem 1.25rem; background: var(--warn-soft);
    border-bottom: 1px solid var(--warn-line); color: var(--warn); font-size: .875rem; }
.acting-banner .btn-ghost { margin-left: auto; color: inherit; font-weight: 600; }
.who { display: flex; align-items: center; gap: .75rem; margin-left: .5rem; padding-left: .75rem; border-left: 1px solid var(--line); }
.who-text { line-height: 1.2; margin-right: .25rem; }
.who-text strong { display: block; font-size: .875rem; font-weight: 600; }
.who-text small { display: block; font-size: .75rem; color: var(--muted); max-width: 16rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: 999px; color: var(--on-brand); font-size: .75rem; font-weight: 700;
    background: linear-gradient(135deg, var(--brand-400), var(--brand-600)); }
.content { flex: 1; min-height: 0; overflow-y: auto; padding: 1.25rem 1.5rem; }

/* ---------- Pages ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.5rem; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 1.25rem; margin-bottom: 1rem; }
.card h2 { font-size: 1rem; margin: 0 0 .75rem; font-weight: 600; }
.muted { color: var(--muted); }
.row-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.field { margin-bottom: 1rem; }
.field > label { display: block; font-size: .875rem; font-weight: 500; color: var(--slate-700); margin-bottom: .375rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.alert { padding: .625rem .875rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; font-size: .875rem; }
.alert.error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.badge { display: inline-flex; align-items: center; padding: .125rem .625rem; border-radius: var(--radius-selector, 999px); font-size: .75rem; font-weight: 600; background: var(--brand-50); color: var(--brand-700); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.off { background: var(--slate-100); color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; font-weight: 500; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
code { background: var(--slate-100); padding: .05rem .3rem; border-radius: .3rem; font-size: .85em; }
select.plain, textarea.plain, input.plain { width: 100%; box-sizing: border-box; font: inherit; padding: .5rem .75rem; border: 1px solid var(--slate-300); border-radius: .5rem; background: var(--surface); color: var(--ink); }
select.plain:focus, textarea.plain:focus, input.plain:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 25%, transparent); }

/* ---------- Syncfusion, blended with the shell ---------- */
.e-control, .e-btn, .e-grid, .e-input-group, .e-dialog, .e-dropdown-popup, .e-popup { font-family: var(--font); }
.e-btn { border-radius: var(--radius); font-weight: 600; }
.e-btn.e-primary { box-shadow: 0 1px 2px rgb(16 24 40 / .08); }
.e-dialog { border-radius: var(--radius-lg); overflow: hidden; }
.e-dialog .e-dlg-header { font-weight: 600; }
.e-grid { border-radius: var(--radius-lg); border-color: var(--line); overflow: hidden; box-shadow: var(--shadow-card); }
.e-grid .e-gridheader, .e-grid .e-toolbar { border-color: var(--line); }
.e-grid .e-headercell, .e-grid .e-headercell .e-headertext { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-500); }
.e-grid .e-rowcell { font-size: .875rem; border-color: var(--slate-100); }
.e-grid .e-row:hover .e-rowcell { background: var(--slate-50) !important; }

/* ---------- Sign-in ---------- */
.login-wrap { min-height: 100vh; display: flex; background: var(--login-panel-bg); color: var(--login-ink); }

/* The brand half. */
.login-brand { position: relative; flex: 1 1 55%; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
    padding: 40px clamp(32px, 5vw, 72px); overflow: hidden; background: var(--login-bg); color: #fff; }
/* Two hairline circles at the lower right. CSS only: nothing to download. */
.login-brand::before, .login-brand::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid var(--login-line); pointer-events: none; }
.login-brand::before { width: 640px; height: 640px; right: -260px; bottom: -300px; }
.login-brand::after { width: 520px; height: 520px; right: -100px; bottom: -360px; }
.login-brand > * { position: relative; }
/* A tenant's wallpaper (darkened in the element's own style) takes the plain colour's place. */
.login-brand.pictured { background-size: cover; background-position: center; background-repeat: no-repeat; }
.login-brand.pictured::before, .login-brand.pictured::after { border-color: rgb(255 255 255 / .18); }

.login-company { display: flex; align-items: center; gap: .7em; font-size: 15px; }
.login-company-mark { display: grid; place-items: center; width: 2.6em; height: 2.6em; flex: none; border-radius: 50%; border: 1.5px solid rgb(255 255 255 / .85); font-weight: 500; font-size: 1.05em; }
.login-company-name { display: flex; flex-direction: column; font-size: 1.35em; font-weight: 300; line-height: 1; letter-spacing: .01em; }
.login-company-name small { margin-top: .45em; font-size: .42em; font-weight: 400; letter-spacing: .62em; color: var(--login-muted); }

.login-hero { animation: login-rise .5s ease-out both; }
.login-product { margin: 0; font-size: clamp(34px, 4.6vw, 64px); font-weight: 500; line-height: 1; letter-spacing: -.01em; white-space: nowrap; color: #fff; }
.login-tag { display: inline-block; margin-left: .18em; padding: .12em .32em; border-radius: .2em; background: var(--login-accent); font-size: .42em; font-weight: 600; letter-spacing: .06em; vertical-align: .42em; }
.login-tagline { margin-top: 1rem; font-size: 13px; letter-spacing: .18em; color: var(--login-muted); }
.login-features { list-style: none; margin: 2.25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .85rem; font-size: 15px; font-weight: 300; color: #dfe3f3; }
.login-features li { display: flex; align-items: center; gap: .75rem; }
.login-feature-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none; border-radius: 9px; border: 1px solid var(--login-line); color: var(--login-accent-soft); }
.login-feature-icon .icon { width: 18px; height: 18px; stroke-width: 1.8; }
.login-brand.pictured .login-feature-icon { border-color: rgb(255 255 255 / .3); }
.login-foot { display: flex; flex-direction: column; gap: .9rem; font-size: 12px; color: var(--login-muted); }
.login-accent-line { width: 48px; height: 2px; background: var(--login-accent); }

/* The form half. */
.login-panel { flex: 1 1 45%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 72px 32px 24px; }
.login-card { width: 100%; max-width: 380px; animation: login-rise .5s .08s ease-out both; }
.login-card h1 { margin: 0; font-size: 26px; font-weight: 500; letter-spacing: 0; color: var(--login-heading); }
.login-card > p { margin: .35rem 0 1.5rem; font-size: 14px; color: var(--login-panel-muted); }
.login-logo { margin-bottom: 1.75rem; }
.login-logo img { max-width: 16rem; max-height: 90px; }
.login-card .field > label { color: var(--login-ink); }
/* Syncfusion's text box: taller, squarer, and ringed in the page's blue when the cursor is in it. */
.login-card .e-input-group { min-height: 42px; border-radius: 8px !important; border-color: var(--login-border) !important; background: var(--login-input-bg) !important; }
.login-card .e-input-group.e-input-focus { border-color: var(--login-accent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--login-accent) 15%, transparent) !important; }
.login-card .e-input-group input.e-input { min-height: 40px; font-size: 15px; color: var(--login-ink); }
/* Show or hide the password. */
.login-password { position: relative; }
.login-password .e-input-group input.e-input { padding-right: 2.5rem; }
.login-eye { position: absolute; right: .5rem; bottom: 9px; display: flex; align-items: center; justify-content: center; padding: .15rem; border: 0; background: none; color: #9ca3af; cursor: pointer; }
.login-eye:hover { color: var(--login-panel-muted); }
/* The button paints itself in the page's navy, whatever the brand colour is. */
.login-card .e-btn.e-primary { width: 100%; min-height: 44px; margin-top: .25rem; border: 0 !important; border-radius: 8px !important; font-size: 15px; font-weight: 500;
    background: var(--login-button-bg) !important; color: #fff !important; box-shadow: none !important; transition: background .15s ease, box-shadow .15s ease; }
.login-card .e-btn.e-primary:hover:not(:disabled) { background: var(--login-button-hover-bg) !important; box-shadow: 0 6px 16px rgb(33 39 90 / .25) !important; }
.login-card .e-btn.e-primary:disabled { opacity: .7; }
.login-or { display: flex; align-items: center; gap: .75rem; margin: 1.1rem 0 .9rem; color: #9ca3af; font-size: 13px; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--login-border); }
.ms-btn { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: .65rem; padding: .5rem .75rem; font: inherit; font-size: 15px; font-weight: 500;
    color: var(--login-ink); background: var(--login-input-bg); border: 1px solid var(--login-border); border-radius: 8px; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.ms-btn:hover { background: var(--login-input-hover-bg); border-color: var(--slate-400); }
.ms-btn:disabled { opacity: .6; cursor: default; }
/* The support link and the version, under the form. */
.login-card-foot { display: flex; justify-content: space-between; margin-top: 1.5rem; padding: 0 .25rem; font-size: 12px; color: var(--login-panel-muted); }
.login-card-foot a, .login-card-foot .link-btn { color: var(--login-heading); font-weight: 500; text-decoration: none; }
/* The language and the theme, under the form, before anyone has signed in. */
.login-prefs { display: flex; justify-content: center; gap: 1rem; margin-top: 1rem; font-size: 12px; }
.login-prefs .link-btn { display: inline-flex; align-items: center; gap: .35rem; font-size: 12px; color: var(--login-panel-muted); }
.login-prefs .icon { width: .95rem; height: .95rem; }
.login-card-foot a:hover { text-decoration: underline; }

@keyframes login-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .login-hero, .login-card { animation: none; } }

/* Narrow screens: the brand half becomes a header. */
@media (max-width: 900px) {
    .login-wrap { flex-direction: column; }
    .login-brand { flex: 0 0 auto; padding: 20px 16px 24px; gap: 1.25rem; }
    .login-brand::before { width: 360px; height: 360px; right: -180px; bottom: -220px; }
    .login-brand::after { display: none; }
    .login-company { font-size: 13px; }
    .login-product { font-size: clamp(28px, 8vw, 40px); }
    .login-tagline { margin-top: .6rem; font-size: 11px; letter-spacing: .12em; }
    .login-features, .login-foot { display: none; }
    .login-panel { flex: 1 0 auto; justify-content: flex-start; padding: 28px 16px 20px; }
}

/* ---------- Sign-in as a card (AppInfo.SignIn) ----------
   The form on the left of a tinted card, photos on the right. Its colours are the --signin-*
   properties; an application gives its own in theme.css. */
:root {
    --signin-font: var(--font);
    --signin-page: #eef0f4;
    --signin-card: var(--slate-50);
    --signin-ink: var(--slate-900);
    --signin-label: var(--slate-700);
    --signin-muted: var(--slate-500);
    --signin-line: var(--slate-200);
    --signin-line-hover: var(--slate-400);
    --signin-field: #fbfbfd;
    --signin-button: var(--brand-600);
    --signin-button-hover: var(--brand-700);
    --signin-button-ink: #ffffff;
    --signin-photo-bg: var(--brand-900);
    --signin-wash: color-mix(in srgb, var(--brand-800) 38%, transparent);
    --signin-shade: var(--brand-950);
    --signin-photo-ink: #ebebf1;
}
:root[data-theme="dark"] {
    --signin-page: #0b1120;
    --signin-card: #111827;
    --signin-ink: #f1f5f9;
    --signin-label: #e2e8f0;
    --signin-muted: #94a3b8;
    --signin-line: #2b3648;
    --signin-line-hover: #64748b;
    --signin-field: #0b1220;
}
/* An application's logo is drawn for a light page: white in the dark look. A tenant's own logo is left as it is. */
:root[data-theme="dark"] .app-logo { filter: brightness(0) invert(1); }
/* A tenant's logo is its own colours, which may be dark ink: in the dark look it sits on a white card. */
:root[data-theme="dark"] .tenant-logo, :root[data-theme="dark"] .signin-logo:not(.app-logo) { background: #fff; border-radius: 6px; padding: 3px 6px; }

.signin { display: grid; min-height: 100vh; box-sizing: border-box; padding: 20px; background: var(--signin-page); font-family: var(--signin-font); font-weight: 500; letter-spacing: .01em; color: var(--signin-ink); }
.signin *, .signin *::before, .signin *::after { box-sizing: border-box; }
.signin p, .signin h1, .signin ul { margin: 0; }
.signin-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 12px; width: 100%; max-width: 1560px; margin: auto;
    min-height: min(860px, calc(100vh - 40px)); padding: 12px; border-radius: 24px; background: var(--signin-card);
    box-shadow: 0 1px 2px rgb(1 0 76 / .04), 0 24px 60px -32px rgb(1 0 76 / .22); }

.signin-side { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; padding: 20px 24px 16px; }
.signin-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.signin-logo { display: block; width: 130px; height: auto; margin: 4px 0 4px 2px; }
.signin-menus { display: flex; align-items: center; gap: 4px; }
.signin-quiet { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent;
    font: inherit; font-size: 13px; color: var(--signin-label); white-space: nowrap; cursor: pointer; }
.signin-quiet:hover { background: color-mix(in srgb, var(--signin-ink) 6%, transparent); color: var(--signin-ink); }
.signin-quiet .icon { width: 16px; height: 16px; stroke-width: 1.5; }
.signin-quiet .chevron { width: 12px; height: 12px; color: var(--signin-muted); transition: transform .15s; }
.signin-quiet[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.signin-lang { position: relative; }
.signin-lang-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; min-width: 100%; width: max-content; padding: 4px; list-style: none;
    border: 1px solid var(--signin-line); border-radius: 10px; background: var(--signin-card); box-shadow: 0 12px 32px -12px rgb(1 0 76 / .18); }
.signin-lang-menu button { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; min-height: 40px; padding: 0 12px;
    border: 0; border-radius: 6px; background: none; font: inherit; font-size: 13px; color: var(--signin-label); cursor: pointer; }
.signin-lang-menu button:hover { background: color-mix(in srgb, var(--signin-ink) 6%, transparent); color: var(--signin-ink); }
.signin-lang-menu button[aria-current="true"] { color: var(--signin-ink); font-weight: 600; }

.signin-main { display: grid; justify-items: center; align-items: center; padding-block: 40px; }
.signin-form { width: 100%; max-width: 400px; }
.signin-form.shaking { animation: signin-shake .32s cubic-bezier(.2, 0, 0, 1); }
.signin-form h1 { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -.02em; color: var(--signin-ink); }
.signin-sub { margin-top: 8px !important; margin-bottom: 32px !important; font-size: 14px; color: var(--signin-muted); }
.signin-alert { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--danger-line); border-radius: 12px;
    background: var(--danger-soft); color: var(--danger); font-size: 14px; line-height: 20px; animation: signin-in .26s cubic-bezier(.2, 0, 0, 1); }
.signin-alert svg { flex: none; margin-top: 1px; }
.signin-field { display: grid; gap: 8px; margin-bottom: 20px; }
.signin-field label { font-size: 13px; font-weight: 600; color: var(--signin-label); }
.signin-control { position: relative; }
.signin-control input { width: 100%; height: 52px; padding: 0 16px 0 46px; border: 1px solid var(--signin-line); border-radius: 12px; background: var(--signin-field);
    font: inherit; font-size: 15px; color: var(--signin-ink); box-shadow: inset 0 1px 2px rgb(1 0 76 / .04); outline: none; transition: border-color .15s, box-shadow .15s; }
.signin-control input.with-action { padding-right: 48px; }
.signin-control input::placeholder { color: var(--signin-muted); opacity: .8; }
.signin-control input:hover { border-color: var(--signin-line-hover); }
.signin-control input:focus, .signin-control input:focus-visible { outline: none; border-color: var(--signin-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signin-ink) 10%, transparent); }
.signin-control input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 12%, transparent); }
.signin-control input:-webkit-autofill { -webkit-text-fill-color: var(--signin-ink); box-shadow: 0 0 0 1000px var(--signin-field) inset; transition: background-color 9999s; }
.signin-lead { position: absolute; top: 50%; left: 16px; transform: translateY(-50%); color: var(--signin-muted); pointer-events: none; transition: color .15s; }
.signin-control:focus-within .signin-lead { color: var(--signin-ink); }
.signin-eye { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px;
    background: transparent; color: var(--signin-muted); cursor: pointer; }
.signin-eye:hover { color: var(--signin-ink); }

.signin-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 52px; padding: 0 24px;
    border: 1px solid var(--signin-line); border-radius: 12px; background: var(--signin-field); color: var(--signin-ink); font: inherit; font-size: 15px; font-weight: 600;
    cursor: pointer; box-shadow: 0 1px 2px rgb(1 0 76 / .05); transition: background-color .15s, border-color .15s, transform .12s; }
.signin-btn:hover:not(:disabled) { border-color: var(--signin-line-hover); }
.signin-btn:disabled { cursor: progress; }
.signin-btn.primary { margin-top: 4px; border: 0; background: var(--signin-button); color: var(--signin-button-ink);
    box-shadow: 0 1px 2px rgb(1 0 76 / .25), 0 10px 22px -12px rgb(1 0 76 / .6); }
.signin-btn.primary:hover:not(:disabled) { background: var(--signin-button-hover); }
.signin-btn.primary:active { transform: translateY(1px); }
.signin-spinner { width: 16px; height: 16px; border: 2px solid color-mix(in srgb, var(--signin-button-ink) 30%, transparent); border-top-color: var(--signin-button-ink);
    border-radius: 50%; animation: signin-spin .7s linear infinite; }
.signin-divider { display: flex; align-items: center; gap: 16px; margin-block: 24px; font-size: 12px; color: var(--signin-muted); }
.signin-divider::before, .signin-divider::after { content: ""; flex: 1; height: 1px; background: var(--signin-line); }
.signin-help { margin-top: 32px !important; text-align: center; font-size: 13px; color: var(--signin-muted); }
.signin-help a { color: var(--signin-ink); font-weight: 700; text-decoration: none; }
.signin-help a:hover { text-decoration: underline; text-underline-offset: 3px; }
.signin-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 12px; color: var(--signin-muted); font-variant-numeric: tabular-nums; }
.signin :focus-visible { outline: 2px solid var(--signin-ink); outline-offset: 3px; }

/* The photos. */
.signin-media { position: relative; isolation: isolate; overflow: hidden; display: grid; min-height: 0; padding: 40px; border-radius: 16px;
    color: var(--signin-photo-ink); background: var(--signin-photo-bg); }
.signin-photos { position: absolute; inset: 0; z-index: -2; }
.signin-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: saturate(.6) contrast(1.02); transition: opacity .9s cubic-bezier(.2, 0, 0, 1); }
.signin-photo.on { opacity: 1; }
.signin-wash { position: absolute; inset: 0; z-index: -1; background: var(--signin-wash); mix-blend-mode: multiply; pointer-events: none; }
.signin-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, color-mix(in srgb, var(--signin-shade) 78%, transparent) 0%,
    color-mix(in srgb, var(--signin-shade) 40%, transparent) 34%, transparent 60%); }
.signin-media-content { align-self: end; display: grid; gap: 24px; text-shadow: 0 1px 2px rgb(0 0 0 / .25), 0 4px 24px rgb(0 0 0 / .35); animation: signin-in .8s cubic-bezier(.2, 0, 0, 1) .3s both; }
.signin-slides { display: grid; padding: 0; list-style: none; }
.signin-slide { grid-area: 1 / 1; align-self: end; opacity: 0; transform: translateY(12px); transition: opacity .5s cubic-bezier(.2, 0, 0, 1), transform .6s cubic-bezier(.2, 0, 0, 1); }
.signin-slide.on { opacity: 1; transform: none; transition-delay: .2s; }
.signin-slide-title { font-size: clamp(24px, 2vw, 30px); font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.signin-slide-text { margin-top: 8px !important; max-width: 32ch; font-size: 15px; line-height: 1.5; color: color-mix(in srgb, var(--signin-photo-ink) 80%, transparent); }
.signin-media-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.signin-progress { display: flex; align-items: center; gap: 2px; }
.signin-dot { display: grid; align-items: center; height: 24px; padding: 0 3px; border: 0; background: transparent; cursor: pointer; }
.signin-bar { position: relative; display: block; overflow: hidden; width: 22px; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--signin-photo-ink) 30%, transparent); transition: width .4s cubic-bezier(.2, 0, 0, 1); }
.signin-dot:hover .signin-bar { background: color-mix(in srgb, var(--signin-photo-ink) 50%, transparent); }
.signin-dot.on .signin-bar { width: 40px; }
.signin-fill { position: absolute; inset: 0; background: var(--signin-photo-ink); transform: scaleX(0); transform-origin: left; animation: signin-fill 5s linear forwards; }
.signin-media.paused .signin-fill { animation-play-state: paused; }
.signin-dot:focus-visible, .signin-arrow:focus-visible { outline-color: var(--signin-photo-ink); }
.signin-arrows { display: flex; gap: 16px; flex: none; }
.signin-arrow { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 1px solid rgb(255 255 255 / .6); border-radius: 50%; background: transparent;
    color: var(--signin-photo-ink); cursor: pointer; transition: background-color .15s, border-color .15s; }
.signin-arrow:hover { border-color: var(--signin-photo-ink); background: color-mix(in srgb, var(--signin-photo-ink) 14%, transparent); }
.signin-arrow:active { transform: scale(.96); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes signin-fill { to { transform: scaleX(1); } }
@keyframes signin-spin { to { transform: rotate(360deg); } }
@keyframes signin-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes signin-shake { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .signin *, .signin *::before, .signin *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; } }

/* Narrower: the photo becomes a short banner above the form. */
@media (max-width: 1023px) {
    .signin { padding: 0; background: var(--signin-card); }
    .signin-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 0; min-height: 100vh; padding: 0; border-radius: 0; box-shadow: none; }
    .signin-media { order: -1; height: 200px; margin: 12px 12px 0; padding: 20px; }
    .signin-slides, .signin-arrows { display: none; }
    .signin-photo { object-position: 60% 30% !important; }
    .signin-main { padding-block: 32px; }
}
@media (max-width: 639px) {
    .signin-media { height: 160px; }
    .signin-side { padding: 16px 20px; }
    .signin-logo { width: 96px; }
    .signin-control input { font-size: 16px; }
}

/* ---------- Permission matrix ---------- */
table.matrix { width: 100%; border-collapse: collapse; }
table.matrix th, table.matrix td { padding: .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.matrix th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
table.matrix td.module { color: var(--muted); font-size: .8rem; }
table.matrix tr.sub td { background: var(--slate-50); }
table.matrix input[type=text] { font: inherit; padding: .25rem .4rem; border: 1px solid var(--slate-300); border-radius: .4rem; background: var(--surface); color: var(--ink); }
/* A caption over a group of ticks, and the ticks side by side. */
.field-label { display: block; font-size: .875rem; font-weight: 500; color: var(--slate-700); margin-bottom: .375rem; }
.ticks { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.small { font-size: .8125rem; margin: .4rem 0 0; }
/* Tabs at the top of a card: a row of names with a line under the open one. */
.tabs { display: flex; gap: 1.5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs [role=tab] { margin-bottom: -1px; padding: .25rem 0 .7rem; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs [role=tab]:hover { color: var(--ink); }
.tabs [role=tab].sel { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.tabs [role=tab]:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 4px; }
/* A permission setting: three positions in one pill, Deny, not set, Allow. The chosen one is filled. */
.tri { display: inline-flex; padding: 2px; gap: 2px; border-radius: 999px; background: var(--slate-100); border: 1px solid var(--line); vertical-align: middle; }
.tri.allow { background: var(--ok-soft); border-color: var(--ok-line); }
.tri.deny { background: var(--danger-soft); border-color: var(--danger-line); }
.tri button { display: grid; place-items: center; width: 1.75rem; height: 1.5rem; padding: 0; border: 0; border-radius: 999px; background: none; color: var(--slate-400); cursor: pointer; }
.tri button svg { width: .95rem; height: .95rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.tri button:hover { color: var(--slate-700); background: rgb(15 23 42 / .06); }
.tri button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.tri button[aria-checked=true] { color: #fff; box-shadow: 0 1px 2px rgb(16 24 40 / .2); }
.tri .tri-unset[aria-checked=true] { background: var(--surface); color: var(--slate-500); }
.tri .tri-allow[aria-checked=true] { background: var(--ok); }
.tri .tri-deny[aria-checked=true] { background: var(--danger); }
table.matrix input[type=text] { width: 100%; box-sizing: border-box; }

/* ---------- Notifications ---------- */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; padding: .5rem .75rem; border-radius: var(--radius); color: var(--slate-600); text-decoration: none; line-height: 1; }
.bell:hover { background: var(--slate-100); color: var(--slate-900); }
.bell-count { position: absolute; top: 2px; right: 2px; min-width: 16px; padding: 0 4px; border-radius: 9px; background: #e11d48; color: #fff; font-size: .68rem; font-weight: 600; line-height: 16px; text-align: center; }
ul.inbox { list-style: none; margin: 0; padding: 0; }
ul.inbox li { padding: .75rem .25rem; border-bottom: 1px solid var(--line); }
ul.inbox li:last-child { border-bottom: 0; }
ul.inbox li.unread { border-left: 3px solid var(--brand-500); padding-left: .75rem; background: var(--brand-50); }
.inbox-head { display: flex; justify-content: space-between; gap: 1rem; }
.inbox-text { white-space: pre-wrap; margin: .25rem 0; }
.preview { margin-top: 1rem; padding: .9rem; border: 1px dashed var(--slate-300); border-radius: var(--radius); background: var(--slate-50); }
.preview iframe { width: 100%; height: 260px; border: 1px solid var(--line); background: #fff; margin-top: .5rem; }

/* ---------- Database chat ---------- */
.chat { display: flex; flex-direction: column; gap: .6rem; padding-bottom: 5rem; }
.chat-question { align-self: flex-end; max-width: 70%; background: var(--brand-600); color: #fff; padding: .55rem .9rem; border-radius: 14px 14px 2px 14px; white-space: pre-wrap; }
.chat-answer { margin-bottom: 0; max-width: 100%; }
.chat-sql { background: var(--slate-50); border: 1px solid var(--line); border-radius: .5rem; padding: .6rem; white-space: pre-wrap; font-size: .85em; }
.chat-grid { overflow-x: auto; margin-top: .6rem; max-height: 60vh; overflow-y: auto; }
.chat-grid th { position: sticky; top: 0; background: var(--surface); }
.chat-foot { margin-top: .4rem; font-size: .8rem; }
.chat-input { position: sticky; bottom: 0; display: flex; gap: .5rem; padding: .8rem 0; background: var(--page); }
.chat-input input { flex: 1; }
.chat-history { list-style: none; margin: 0; padding: 0; }
.chat-history li { display: flex; gap: 1rem; align-items: baseline; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.chat-history li button:first-child { flex: 1; text-align: left; }
.prompt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.prompt-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; cursor: pointer; font: inherit; color: inherit; }
.prompt-card:hover { border-color: var(--brand-500); }
.prompt-card span { display: block; color: var(--muted); font-size: .85em; margin-top: .2rem; }
.table-ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .25rem .8rem; }

#blazor-error-ui { background: var(--warn-soft); color: var(--ink); bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ---------- Small screens: the menu slides in over the page ---------- */
@media (max-width: 1023px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 41; transform: translateX(-100%); transition: transform .2s; width: 16rem !important; }
    .shell.menu-open .sidebar { transform: none; }
    .shell.menu-open .sidebar-shade { display: block; position: fixed; inset: 0; z-index: 40; background: rgb(15 23 42 / .5); }
    .sidebar-foot { display: none; }
    .menu-toggle { display: inline-flex; }
    .who-text { display: none; }
    .topbar, .content { padding-inline: 1rem; }
}
@media (max-width: 800px) {
    .form-grid { grid-template-columns: 1fr; }
}
